/*!
* jQuery Upload File Plugin
* version: 4.0.10
* @requires jQuery v1.5 or later & form plugin
* Copyright (c) 2013 Ravishanker Kusuma
* http://hayageek.com/
*/
(function(b){if(b.fn.ajaxForm==undefined){b.getScript("php/3rdparty/jquery.form.js")}var a={};a.fileapi=b("").get(0).files!==undefined;a.formdata=window.FormData!==undefined;b.fn.uploadFile=function(h){var t=b.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:true,duplicateStrict:false,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:false,dynamicFormData:false,maxFileSize:-1,maxFileCount:-1,multiple:true,dragDrop:true,autoSubmit:true,showCancel:true,showAbort:true,showDone:false,showDelete:false,showError:true,showStatusAfterSuccess:true,showStatusAfterError:true,showFileCounter:true,fileCounterStyle:"). ",showFileSize:true,showProgress:false,nestedForms:true,showDownload:false,onLoad:function(s){},onSelect:function(s){return true},onSubmit:function(s,B){},onSuccess:function(C,B,D,s){},onError:function(D,s,C,B){},onCancel:function(B,s){},onAbort:function(B,s){},downloadCallback:false,deleteCallback:false,afterUploadAll:false,serialize:true,sequential:false,sequentialCount:2,customProgressBar:false,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"Drag & Drop Files",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:false,statusBarWidth:400,dragdropWidth:400,showPreview:false,previewHeight:"auto",previewWidth:"100%",extraHTML:false,uploadQueueOrder:"top",headers:{}},h);this.fileCounter=1;this.selectedFiles=0;var g="ajax-file-upload-"+(new Date().getTime());this.formGroup=g;this.errorLog=b("
");B.cancel.show();H.remove();B.cancel.click(function(){q.splice(q.indexOf(H),1);l(I,D);B.statusbar.remove();G.onCancel.call(I,D,B);I.selectedFiles-=D.length;e(G,I)});return false},beforeSend:function(K,J){for(var s in J.headers){K.setRequestHeader(s,J.headers[s])}B.progressDiv.show();B.cancel.hide();B.done.hide();if(G.showAbort){B.abort.show();B.abort.click(function(){l(I,D);K.abort();I.selectedFiles-=D.length;G.onAbort.call(I,D,B)})}if(!a.formdata){B.progressbar.width("5%")}else{B.progressbar.width("1%")}},uploadProgress:function(M,s,L,K){if(K>98){K=98}var J=K+"%";if(K>1){B.progressbar.width(J)}if(G.showProgress){B.progressbar.html(J);B.progressbar.css("text-align","center")}},success:function(J,s,L){B.cancel.remove();u.pop();if(G.returnType=="json"&&b.type(J)=="object"&&J.hasOwnProperty(G.customErrorKeyStr)){B.abort.hide();var K=J[G.customErrorKeyStr];G.onError.call(this,D,200,K,B);if(G.showStatusAfterError){B.progressDiv.hide();B.statusbar.append("ERROR: "+K+"")}else{B.statusbar.hide();B.statusbar.remove()}I.selectedFiles-=D.length;H.remove();return}I.responses.push(J);B.progressbar.width("100%");if(G.showProgress){B.progressbar.html("100%");B.progressbar.css("text-align","center")}B.abort.hide();G.onSuccess.call(this,D,J,L,B);if(G.showStatusAfterSuccess){if(G.showDone){B.done.show();B.done.click(function(){B.statusbar.hide("slow");B.statusbar.remove()})}else{B.done.hide()}if(G.showDelete){B.del.show();B.del.click(function(){l(I,D);B.statusbar.hide().remove();if(G.deleteCallback){G.deleteCallback.call(this,J,B)}I.selectedFiles-=D.length;e(G,I)})}else{B.del.hide()}}else{B.statusbar.hide("slow");B.statusbar.remove()}if(G.showDownload){B.download.show();B.download.click(function(){if(G.downloadCallback){G.downloadCallback(J,B)}})}H.remove()},error:function(K,s,J){B.cancel.remove();u.pop();B.abort.hide();if(K.statusText=="abort"){B.statusbar.hide("slow").remove();e(G,I)}else{G.onError.call(this,D,s,J,B);if(G.showStatusAfterError){B.progressDiv.hide();B.statusbar.append("ERROR: "+J+"")}else{B.statusbar.hide();B.statusbar.remove()}I.selectedFiles-=D.length}H.remove()}};if(G.showPreview&&F!=null){if(F.type.toLowerCase().split("/").shift()=="image"){z(F,B.preview)}}if(G.autoSubmit){H.ajaxForm(C);q.push(H);f()}else{if(G.showCancel){B.cancel.show();B.cancel.click(function(){q.splice(q.indexOf(H),1);l(I,D);H.remove();B.statusbar.remove();G.onCancel.call(I,D,B);I.selectedFiles-=D.length;e(G,I)})}H.ajaxForm(C)}}return this}}(jQuery));