/* UploadiFive 1.2.3 Copyright (c) 2012 Reactive Apps, Ronnie Garcia Released under the UploadiFive Standard License */ (function(d){var o={init:function(t){return this.i(function(){var s=d(this);s.data("uploadifive",{t:{},o:0,l:0,u:{count:0,selected:0,s:0,p:0,v:0,h:0},m:{g:0,_:0,F:0,p:0,count:0}});var p=s.data("uploadifive");var c=p.D=d.extend({I:true,T:false,L:"Select Files",C:false,N:true,M:false,q:"Filedata",O:0,U:false,k:{},height:30,X:false,method:"post",R:true,B:[],S:false,A:0,P:false,j:0,H:0,V:0,Y:"uploadifive.php",width:100},t);var r;if(c.U){r=c.U.split("|")}if(isNaN(c.O)){var e=parseInt(c.O)*1.024;if(c.O.indexOf("KB")>-1){c.O=e*1e3}else if(c.O.indexOf("MB")>-1){c.O=e*1e6}else if(c.O.indexOf("GB")>-1){c.O=e*1e9}}else{c.O=c.O*1024}p.Z=d('').G({"font-size":c.height+"px",opacity:0,position:"absolute",right:"-3px",top:"-3px","z-index":999});p.K=function(){var e=p.Z.clone();var t=e.name="input"+p.o++;if(c.R){e.W("multiple",true)}if(c.U){e.W("accept",c.U)}e.bind("change",function(){p.u.selected=0;p.u.s=0;p.u.p=0;p.u.v=0;var e=this.files.length;p.u.selected=e;if(p.u.count+e>c.A&&c.A!==0){if(d.$("onError",c.B)<0){alert("The maximum number of queue items has been reached ("+c.A+"). Please select fewer files.")}if(typeof c.J==="function"){c.J.call(s,"QUEUE_LIMIT_EXCEEDED")}}else{for(var i=0;ic.A&&c.A!==0){if(d.$("onError",c.B)<0){alert("The maximum number of queue items has been reached ("+c.A+"). Please select fewer files.")}if(typeof c.J==="function"){c.J.call(s,"QUEUE_LIMIT_EXCEEDED")}}else{for(var n=0;n'+'X'+'
'+'
'+'
'+"
"+"")}else{p.ae=d(c.X)}p.ee=function(e){if(d.$("onAddQueueItem",c.B)<0){p.le(e);e.ae=p.ae.clone();e.ae.W("id",c.id+"-file-"+p.l++);e.ae.find(".close").bind("click",function(){o.cancel.call(s,e);return false});var i=e.name;if(i.length>c.H&&c.H!==0){i=i.substring(0,c.H)+"..."}e.ae.find(".filename").ue(i);e.ae.data("file",e);p.se.append(e.ae)}if(typeof c.pe==="function"){c.pe.call(s,e)}if(e.size>c.O&&c.O!==0){p.error("FILE_SIZE_LIMIT_EXCEEDED",e)}else{p.u.v++;p.u.count++}};p.ce=function(e,i,t){if(!t)t=0;var f=i?0:500;if(e.ae){if(e.ae.find(".fileinfo").ue()!=" - Completed"){e.ae.find(".fileinfo").ue(" - Cancelled")}e.ae.find(".progress-bar").width(0);e.ae.ve(t).de(f,function(){d(this).remove()});delete e.ae;p.u.count--}};p.he=function(){var e=0;for(var i in p.t){input=p.t[i];limit=input.files.length;for(var t=0;t'+c.L+"");if(c.T)p.button.Me(c.T);p.button.G({height:c.height,"line-height":c.height+"px",overflow:"hidden",position:"relative","text-align":"center",width:c.width});s.Re(p.button).Xe(p.button).hide();p.K.call(s);if(!c.S){c.S=c.id+"-queue";p.se=d('
');p.button.Be(p.se)}else{p.se=d("#"+c.S)}if(c.N){var i=c.M?d(c.M):p.se.get(0);i.addEventListener("dragleave",function(e){e.preventDefault();e.stopPropagation()},false);i.addEventListener("dragenter",function(e){e.preventDefault();e.stopPropagation()},false);i.addEventListener("dragover",function(e){e.preventDefault();e.stopPropagation()},false);i.addEventListener("drop",p.ne,false)}if(!XMLHttpRequest.prototype.sendAsBinary){XMLHttpRequest.prototype.sendAsBinary=function(e){function byteValue(e){return e.charCodeAt(0)&255}var i=Array.prototype.map.call(e,byteValue);var t=new Uint8Array(i);this.send(t.buffer)}}if(typeof c.Se==="function"){c.Se.call(s)}}else{if(typeof c.Ae==="function"){c.Ae.call(s)}return false}})},debug:function(){return this.i(function(){console.log(d(this).data("uploadifive"))})},Pe:function(){this.i(function(){var e=d(this),t=e.data("uploadifive"),f=t.D;for(var n in t.t){input=t.t[n];limit=input.files.length;for(i=0;i=t.j&&t.j!==0||i.m.g>=t.V&&t.V!==0||i.m.count>=t.V&&t.V!==0){return false}if(t.C){_file.Ze=true;skipFile=i.Ee(_file);_file.Ze=false;if(!skipFile){i.De(_file,true)}}else{i.De(_file,true)}});if(d("#"+t.S).find(".uploadifive-queue-item").Ye(".error, .complete").size()===0){i.Ue()}}else{if(i.m.g===0){if(d.$("onError",t.B)<0){if(i.he()>0&&t.V!==0){alert("The maximum upload limit has been reached.")}}if(typeof t.J==="function"){t.J.call(e,"UPLOAD_LIMIT_EXCEEDED",i.he())}}}}})},Ge:function(){this.i(function(){var e=d(this),i=e.data("uploadifive"),t=i.D;o.Pe.call(e);if(!t.S)d("#"+t.S).remove();e.Ke("input").remove();e.show().insertBefore(i.button);i.button.remove();if(typeof t.We==="function"){t.We.call(e)}})}};d.Je.$e=function(e){if(o[e]){return o[e].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof e==="object"||!e){return o.init.apply(this,arguments)}else{d.error("The method "+e+" does not exist in $.uploadify")}}})(jQuery);