var VIGET = VIGET || {};

VIGET.fileInputs = function() {
  var $this = $(this),
      $val = $this.val(),
      valArray = $val.split('\\'),
      newVal = valArray[valArray.length-1],
      $fakeFile = $this.siblings('.choosenfile');
  if(newVal !== '') {
    if($fakeFile.length === 0) {
      $button.after('' + newVal + '');
    } else {
      $fakeFile.text(newVal);
    }
  }
};

$(document).ready(function() {
  $('.filechoose input[type=file]')
  .bind('change focus click', VIGET.fileInputs);
});
