var W3CDOM = (document.createElement && document.getElementsByTagName);

$(document).ready( function() {
$('input[type=file]').each(function(){
  
  var uploadbuttonlabeltext = $(this).attr('title'); //get title attribut for languagesettings
  if(uploadbuttonlabeltext == ''){
    var uploadbuttonlabeltext = 'Browse...';
  }
  
  var uploadbutton = '<input type="button" class="button" value="'+uploadbuttonlabeltext+'" />';
   $(this).wrap('<div class="fileinputs"></div>');
    $(this).addClass('file').css('opacity', 0); //set to invisible
    $(this).parent().append($('<div class="fakefile" />').append($('<input type="text" class="fake" />').attr('id',$(this).attr('id')+'__fake')).append(uploadbutton));
 
    $(this).bind('change', function() {
      $('#'+$(this).attr('id')+'__fake').val($(this).val());;
    });
    $(this).bind('mouseout', function() {
      $('#'+$(this).attr('id')+'__fake').val($(this).val());;
    });
  });

} )

