var Uploader=new Class({initialize:function(A,B){this.file=$(A);this.filename=A;this.url=B.url;this.data=B.data;this.response=B.response;this.type=B.type;this.fileSizeMax=104857600;this.setUploader(this.file)},setUploader:function(B){var A=B.get("id");var C=this.filename;this.fancy=new Swiff.Uploader({fieldName:C,path:"/js/fancyupload/Swiff.Uploader.swf",url:this.url,data:this.data,verbose:true,queued:false,multiple:true,target:A,instantStart:true,typeFilter:this.type,fileSizeMax:this.fileSizeMax,appendCookieData:true,onSelectSuccess:function(D){loading();if(Browser.Platform.linux){window.alert("Warning: Due to a misbehaviour of Adobe Flash Player on Linux,\nthe browser will probably freeze during the upload process.\nSince you are prepared now, the upload will start right away ...")}this.setEnabled(false);if(!$(this.options.fieldName+"-process")){new Element("span",{id:this.options.fieldName+"-process"}).set("text",D[0].name).inject(this.options.target,"after")}},onSelectFail:function(D){msg(sprintf(lng.error_upload_size,D[0].name,upload_max_filesize/1024/1024),"error")},onQueue:function(){if(!this.uploading){return}var D=Swiff.Uploader.formatUnit(this.size,"b");var E=sprintf(lng.l_uploading,this.percentLoaded+"%",D);$(this.options.fieldName+"-process").set("html",E)},onFileComplete:this.responseDefault.bind(this),onComplete:function(){loading();this.setEnabled(true)}})},responseDefault:function(A){var B=JSON.decode(A.response.text);if(B.error!=undefined){msg(B.error,"error")}else{this.response(B.file)}}});
