/*eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.Y.X=6(f){7 2={3:W};b(f){$.V(2,f)};U o.T(6(){7 1=o;7 l=$("<S>").5({"3":2.h+"4","k":2.j+"4","n":"R("+2.Q+") 0 0 P-O","n-e":"N","d":"c","e":"M","L":"K"});7 8=$(\'<J m="I">\').H($(1).G("m")).5({"d":"c","3":2.3+"4"});$(1).F(8);$(1).E(l);$(1).5({"e":"D","k":2.j+"4","3":2.3+"4","d":"c","C":"B","A":"0.0"});b($.z.y){b(/x/.w(v.u)){$(1).5("a-9","-t")}i{$(1).5("a-9","-s")}}i{$(1).5("a-9",2.h-2.3+"4")};$(1).r("q",6(){8.g($(1).g())})})}})(p);',61,61,'|self|settings|width|px|css|function|var|filename|left|margin|if|inline|display|position|options|val|imagewidth|else|imageheight|height|wrapper|class|background|this|jQuery|change|bind|168px|142px|platform|navigator|test|Win|mozilla|browser|opacity|pointer|cursor|relative|wrap|before|attr|addClass|file|input|hidden|overflow|absolute|right|repeat|no|image|url|div|each|return|extend|250|filestyle|fn'.split('|'),0,{}))*/


(function ($) {
    $.fn.filestyle = function (options) {
        var settings = {
            width: 250
        };
        if (options) {
            $.extend(settings, options)
        };
        return this.each(function () {
            var self = this;
            var wrapper = $("<div>").css({
                "width": settings.imagewidth + "px",
                "height": settings.imageheight + "px",
                "background": "url(" + settings.image + ") 0 0 no-repeat",
                "background-position": "right",
                "display": "inline",
                "position": "absolute",
                "overflow": "hidden",
				"left": settings.left + "px"
            });
            var filename = $('<input class="file">').addClass($(self).attr("class")).css({
                "display": "inline",
                "width": settings.width + "px"
            });
            $(self).before(filename);
            $(self).wrap(wrapper);
            $(self).css({
                "position": "relative",
                "height": settings.imageheight + "px",
                "width": settings.width + "px",
                "display": "inline",
                "cursor": "pointer",
                "opacity": "0.0"
            });
            if ($.browser.mozilla) {
                if (/Win/.test(navigator.platform)) {
                    $(self).css("margin-left", "-142px")
                } else {
                    $(self).css("margin-left", "-168px")
                }
            } else {
                $(self).css("margin-left", settings.imagewidth - settings.width + "px")
            };
            $(self).bind("change", function () {
                filename.val($(self).val())
            })
        })
    }
})(jQuery);
