function basename(d,c){var a=d.replace(/^.*[\/\\]/g,"");if(typeof(c)=="string"&&a.substr(a.length-c.length)==c){a=a.substr(0,a.length-c.length)}return a}(function(a){a.fn.filestyle=function(b){var c={width:250};if(b){a.extend(c,b)}return this.each(function(){var e=this;var f=a("<div>").css({width:c.imagewidth+"px",height:c.imageheight+"px",display:"inline",position:"absolute",overflow:"hidden"});var d=a('<input class="file">').addClass(a(e).attr("class")).css({display:"inline",width:c.width+"px"});a(e).before(d);a(e).wrap(f);a(e).css({position:"relative",height:c.imageheight+"px",width:c.width+"px",display:"inline",cursor:"pointer",opacity:"0.0"});if(a.browser.mozilla){if(/Win/.test(navigator.platform)){a(e).css("margin-left","-110px");a(e).parent().css("cursor","default")}else{if(/Linux/.test(navigator.platform)){a(e).css("margin-left","-173px");a(e).parent().css("cursor","default")}else{a(e).css("margin-left","-155px")}}}else{a(e).css("margin-left",c.imagewidth-c.width+"px")}a(e).bind("change",function(){d.val(basename(a(e).val()))})})}})(jQuery);
