/* Uploadify v3.2 Copyright (c) 2012 Reactive Apps, Ronnie Garcia Released under the MIT License */ var swfobject=function(){function A(){var a,c,d;if(!t){try{a=i.getElementsByTagName("body")[0].appendChild(Q("span")),a.parentNode.removeChild(a)}catch(b){return}for(t=!0,c=l.length,d=0;c>d;d++)l[d]()}}function B(a){t?a():l[l.length]=a}function C(b){if(typeof h.addEventListener!=a)h.addEventListener("load",b,!1);else if(typeof i.addEventListener!=a)i.addEventListener("load",b,!1);else if(typeof h.attachEvent!=a)R(h,"onload",b);else if("function"==typeof h.onload){var c=h.onload;h.onload=function(){c(),b()}}else h.onload=b}function D(){k?E():F()}function E(){var f,g,c=i.getElementsByTagName("body")[0],d=Q(b);d.setAttribute("type",e),f=c.appendChild(d),f?(g=0,function(){if(typeof f.GetVariable!=a){var b=f.GetVariable("$version");b&&(b=b.split(" ")[1].split(","),y.pv=[parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10)])}else if(10>g)return g++,setTimeout(arguments.callee,10),void 0;c.removeChild(d),f=null,F()}()):F()}function F(){var c,d,e,f,g,h,i,j,k,l,n,b=m.length;if(b>0)for(c=0;b>c;c++)if(d=m[c].id,e=m[c].callbackFn,f={success:!1,id:d},y.pv[0]>0){if(g=P(d))if(!S(m[c].swfVersion)||y.wk&&y.wk<312)if(m[c].expressInstall&&H()){for(h={},h.data=m[c].expressInstall,h.width=g.getAttribute("width")||"0",h.height=g.getAttribute("height")||"0",g.getAttribute("class")&&(h.styleclass=g.getAttribute("class")),g.getAttribute("align")&&(h.align=g.getAttribute("align")),i={},j=g.getElementsByTagName("param"),k=j.length,l=0;k>l;l++)"movie"!=j[l].getAttribute("name").toLowerCase()&&(i[j[l].getAttribute("name")]=j[l].getAttribute("value"));I(h,i,d,e)}else J(g),e&&e(f);else U(d,!0),e&&(f.success=!0,f.ref=G(d),e(f))}else U(d,!0),e&&(n=G(d),n&&typeof n.SetVariable!=a&&(f.success=!0,f.ref=n),e(f))}function G(c){var f,d=null,e=P(c);return e&&"OBJECT"==e.nodeName&&(typeof e.SetVariable!=a?d=e:(f=e.getElementsByTagName(b)[0],f&&(d=f))),d}function H(){return!u&&S("6.0.65")&&(y.win||y.mac)&&!(y.wk&&y.wk<312)}function I(b,c,d,e){var g,j,k,l;u=!0,r=e||null,s={success:!1,id:d},g=P(d),g&&("OBJECT"==g.nodeName?(p=K(g),q=null):(p=g,q=d),b.id=f,(typeof b.width==a||!/%$/.test(b.width)&&parseInt(b.width,10)<310)&&(b.width="310"),(typeof b.height==a||!/%$/.test(b.height)&&parseInt(b.height,10)<137)&&(b.height="137"),i.title=i.title.slice(0,47)+" - Flash Player Installation",j=y.ie&&y.win?"ActiveX":"PlugIn",k="MMredirectURL="+h.location.toString().replace(/&/g,"%26")+"&MMplayerType="+j+"&MMdoctitle="+i.title,typeof c.flashvars!=a?c.flashvars+="&"+k:c.flashvars=k,y.ie&&y.win&&4!=g.readyState&&(l=Q("div"),d+="SWFObjectNew",l.setAttribute("id",d),g.parentNode.insertBefore(l,g),g.style.display="none",function(){4==g.readyState?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}()),L(b,c,d))}function J(a){if(y.ie&&y.win&&4!=a.readyState){var b=Q("div");a.parentNode.insertBefore(b,a),b.parentNode.replaceChild(K(a),b),a.style.display="none",function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}else a.parentNode.replaceChild(K(a),a)}function K(a){var d,e,f,g,c=Q("div");if(y.win&&y.ie)c.innerHTML=a.innerHTML;else if(d=a.getElementsByTagName(b)[0],d&&(e=d.childNodes))for(f=e.length,g=0;f>g;g++)1==e[g].nodeType&&"PARAM"==e[g].nodeName||8==e[g].nodeType||c.appendChild(e[g].cloneNode(!0));return c}function L(c,d,f){var g,i,j,k,l,m,o,p,h=P(f);if(y.wk&&y.wk<312)return g;if(h)if(typeof c.id==a&&(c.id=f),y.ie&&y.win){i="";for(j in c)c[j]!=Object.prototype[j]&&("data"==j.toLowerCase()?d.movie=c[j]:"styleclass"==j.toLowerCase()?i+=' class="'+c[j]+'"':"classid"!=j.toLowerCase()&&(i+=" "+j+'="'+c[j]+'"'));k="";for(l in d)d[l]!=Object.prototype[l]&&(k+='');h.outerHTML='"+k+"",n[n.length]=c.id,g=P(c.id)}else{m=Q(b),m.setAttribute("type",e);for(o in c)c[o]!=Object.prototype[o]&&("styleclass"==o.toLowerCase()?m.setAttribute("class",c[o]):"classid"!=o.toLowerCase()&&m.setAttribute(o,c[o]));for(p in d)d[p]!=Object.prototype[p]&&"movie"!=p.toLowerCase()&&M(m,p,d[p]);h.parentNode.replaceChild(m,h),g=m}return g}function M(a,b,c){var d=Q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function N(a){var b=P(a);b&&"OBJECT"==b.nodeName&&(y.ie&&y.win?(b.style.display="none",function(){4==b.readyState?O(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function O(a){var c,b=P(a);if(b){for(c in b)"function"==typeof b[c]&&(b[c]=null);b.parentNode.removeChild(b)}}function P(a){var b=null;try{b=i.getElementById(a)}catch(c){}return b}function Q(a){return i.createElement(a)}function R(a,b,c){a.attachEvent(b,c),o[o.length]=[a,b,c]}function S(a){var b=y.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function T(c,d,e,f){var g,h,j;y.ie&&y.mac||(g=i.getElementsByTagName("head")[0],g&&(h=e&&"string"==typeof e?e:"screen",f&&(v=null,w=null),v&&w==h||(j=Q("style"),j.setAttribute("type","text/css"),j.setAttribute("media",h),v=g.appendChild(j),y.ie&&y.win&&typeof i.styleSheets!=a&&i.styleSheets.length>0&&(v=i.styleSheets[i.styleSheets.length-1]),w=h),y.ie&&y.win?v&&typeof v.addRule==b&&v.addRule(c,d):v&&typeof i.createTextNode!=a&&v.appendChild(i.createTextNode(c+" {"+d+"}"))))}function U(a,b){if(x){var c=b?"visible":"hidden";t&&P(a)?P(a).style.visibility=c:T("#"+a,"visibility:"+c)}}function V(b){var c=/[\\\"<>\.;]/,d=null!=c.exec(b);return d&&typeof encodeURIComponent!=a?encodeURIComponent(b):b}var p,q,r,s,v,w,a="undefined",b="object",c="Shockwave Flash",d="ShockwaveFlash.ShockwaveFlash",e="application/x-shockwave-flash",f="SWFObjectExprInst",g="onreadystatechange",h=window,i=document,j=navigator,k=!1,l=[D],m=[],n=[],o=[],t=!1,u=!1,x=!0,y=function(){var s,f=typeof i.getElementById!=a&&typeof i.getElementsByTagName!=a&&typeof i.createElement!=a,g=j.userAgent.toLowerCase(),l=j.platform.toLowerCase(),m=l?/win/.test(l):/win/.test(g),n=l?/mac/.test(l):/mac/.test(g),o=/webkit/.test(g)?parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,p=!1,q=[0,0,0],r=null;if(typeof j.plugins!=a&&typeof j.plugins[c]==b)r=j.plugins[c].description,!r||typeof j.mimeTypes!=a&&j.mimeTypes[e]&&!j.mimeTypes[e].enabledPlugin||(k=!0,p=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),q[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),q[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),q[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof h.ActiveXObject!=a)try{s=new ActiveXObject(d),s&&(r=s.GetVariable("$version"),r&&(p=!0,r=r.split(" ")[1].split(","),q=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:f,pv:q,wk:o,ie:p,win:m,mac:n}}();return function(){y.w3&&((typeof i.readyState!=a&&"complete"==i.readyState||typeof i.readyState==a&&(i.getElementsByTagName("body")[0]||i.body))&&A(),t||(typeof i.addEventListener!=a&&i.addEventListener("DOMContentLoaded",A,!1),y.ie&&y.win&&(i.attachEvent(g,function(){"complete"==i.readyState&&(i.detachEvent(g,arguments.callee),A())}),h==top&&function(){if(!t){try{i.documentElement.doScroll("left")}catch(a){return setTimeout(arguments.callee,0),void 0}A()}}()),y.wk&&function(){return t?void 0:/loaded|complete/.test(i.readyState)?(A(),void 0):(setTimeout(arguments.callee,0),void 0)}(),C(A)))}(),function(){y.ie&&y.win&&window.attachEvent("onunload",function(){var b,c,d,e,f,a=o.length;for(b=0;a>b;b++)o[b][0].detachEvent(o[b][1],o[b][2]);for(c=n.length,d=0;c>d;d++)N(n[d]);for(e in y)y[e]=null;y=null;for(f in swfobject)swfobject[f]=null;swfobject=null})}(),{registerObject:function(a,b,c,d){if(y.w3&&a&&b){var e={};e.id=a,e.swfVersion=b,e.expressInstall=c,e.callbackFn=d,m[m.length]=e,U(a,!1)}else d&&d({success:!1,id:a})},getObjectById:function(a){return y.w3?G(a):void 0},embedSWF:function(c,d,e,f,g,h,i,j,k,l){var m={success:!1,id:d};y.w3&&!(y.wk&&y.wk<312)&&c&&d&&e&&f&&g?(U(d,!1),B(function(){var n,o,p,q,r,s;if(e+="",f+="",n={},k&&typeof k===b)for(o in k)n[o]=k[o];if(n.data=c,n.width=e,n.height=f,p={},j&&typeof j===b)for(q in j)p[q]=j[q];if(i&&typeof i===b)for(r in i)typeof p.flashvars!=a?p.flashvars+="&"+r+"="+i[r]:p.flashvars=r+"="+i[r];if(S(g))s=L(n,p,d),n.id==d&&U(d,!0),m.success=!0,m.ref=s;else{if(h&&H())return n.data=h,I(n,p,d,l),void 0;U(d,!0)}l&&l(m)})):l&&l(m)},switchOffAutoHideShow:function(){x=!1},ua:y,getFlashPlayerVersion:function(){return{major:y.pv[0],minor:y.pv[1],release:y.pv[2]}},hasFlashPlayerVersion:S,createSWF:function(a,b,c){return y.w3?L(a,b,c):void 0},showExpressInstall:function(a,b,c,d){y.w3&&H()&&I(a,b,c,d)},removeSWF:function(a){y.w3&&N(a)},createCSS:function(a,b,c,d){y.w3&&T(a,b,c,d)},addDomLoadEvent:B,addLoadEvent:C,getQueryParamValue:function(a){var c,d,b=i.location.search||i.location.hash;if(b){if(/\?/.test(b)&&(b=b.split("?")[1]),null==a)return V(b);for(c=b.split("&"),d=0;d=9,j?(window["uploadify_"+g.id]=new SWFUpload(h),k=window["uploadify_"+g.id],e.data("uploadify",k),l=a("
",{id:g.id,"class":"uploadify",css:{height:g.height+"px",width:g.width+"px"}}),a("#"+k.movieName).wrap(l),l=a("#"+g.id),l.data("uploadify",k),m=a("
",{id:g.id+"-button","class":"uploadify-button "+g.buttonClass}),g.buttonImage&&m.css({"background-image":"url('"+g.buttonImage+"')","text-indent":"-9999px"}),m.html(''+g.buttonText+"").css({height:g.height+"px","line-height":g.height+"px",width:g.width+"px"}),l.append(m),a("#"+k.movieName).css({position:"absolute","z-index":1}),g.queueID||(n=a("
",{id:g.id+"-queue","class":"uploadify-queue"}),l.after(n),k.settings.queueID=g.id+"-queue",k.settings.defaultQueue=!0),k.queueData={files:{},filesSelected:0,filesQueued:0,filesReplaced:0,filesCancelled:0,filesErrored:0,uploadsSuccessful:0,uploadsErrored:0,averageSpeed:0,queueLength:0,queueSize:0,uploadSize:0,queueBytesUploaded:0,uploadQueue:[],errorMsg:"Some files were not added to the queue:"},k.original=f,k.wrapper=l,k.button=m,k.queue=n,g.onInit&&g.onInit.call(e,k)):g.onFallback&&g.onFallback.call(e)})},cancel:function(){var d=arguments;this.each(function(){var g,h,i,b=a(this),c=b.data("uploadify"),e=c.settings,f=-1;if(d[0])if("*"==d[0])g=c.queueData.queueLength,a("#"+e.queueID).find(".uploadify-queue-item").each(function(){f++,d[1]===!0?c.cancelUpload(a(this).attr("id"),!1):c.cancelUpload(a(this).attr("id")),a(this).find(".data").removeClass("data").html(" - Cancelled"),a(this).find(".uploadify-progress-bar").remove(),a(this).delay(1e3+100*f).fadeOut(500,function(){a(this).remove()})}),c.queueData.queueSize=0,c.queueData.queueLength=0,e.onClearQueue&&e.onClearQueue.call(b,g);else for(h=0;h0&&alert(this.queueData.errorMsg),e.onDialogClose&&e.onDialogClose.call(this,this.queueData),e.auto&&a("#"+e.id).uploadify("upload","*")},onSelect:function(b){var e,f,g,h,i,j,k,c=this.settings,d={};for(e in this.queueData.files)if(d=this.queueData.files[e],1!=d.uploaded&&d.name==b.name){if(f=confirm('The file named "'+b.name+'" is already in the queue.\nDo you want to replace the existing item in the queue?'),!f)return this.cancelUpload(b.id),this.queueData.filesCancelled++,!1;a("#"+d.id).remove(),this.cancelUpload(d.id),this.queueData.filesReplaced++}if(g=Math.round(b.size/1024),h="KB",g>1e3&&(g=Math.round(g/1e3),h="MB"),i=g.toString().split("."),g=i[0],i.length>1&&(g+="."+i[1].substr(0,2)),g+=h,j=b.name,j.length>25&&(j=j.substr(0,25)+"..."),itemData={fileID:b.id,instanceID:c.id,fileName:j,fileSize:g},0==c.itemTemplate&&(c.itemTemplate='
X
${fileName} (${fileSize})
'),a.inArray("onSelect",c.overrideEvents)<0){itemHTML=c.itemTemplate;for(k in itemData)itemHTML=itemHTML.replace(new RegExp("\\$\\{"+k+"\\}","g"),itemData[k]);a("#"+c.queueID).append(itemHTML)}this.queueData.queueSize+=b.size,this.queueData.files[b.id]=b,c.onSelect&&c.onSelect.apply(this,arguments)},onSelectError:function(b,c,d){var e=this.settings;if(a.inArray("onSelectError",e.overrideEvents)<0)switch(c){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:this.queueData.errorMsg+=e.queueSizeLimit>d?"\nThe number of files selected exceeds the remaining upload limit ("+d+").":"\nThe number of files selected exceeds the queue size limit ("+e.queueSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+b.name+'" exceeds the size limit ('+e.fileSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.queueData.errorMsg+='\nThe file "'+b.name+'" is empty.';break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+b.name+'" is not an accepted file type ('+e.fileTypeDesc+")."}c!=SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED&&delete this.queueData.files[b.id],e.onSelectError&&e.onSelectError.apply(this,arguments)},onQueueComplete:function(){this.settings.onQueueComplete&&this.settings.onQueueComplete.call(this,this.settings.queueData)},onUploadComplete:function(b){var c=this.settings,d=this,e=this.getStats();if(this.queueData.queueLength=e.files_queued,"*"==this.queueData.uploadQueue[0]?this.queueData.queueLength>0?this.startUpload():(this.queueData.uploadQueue=[],c.onQueueComplete&&c.onQueueComplete.call(this,this.queueData)):this.queueData.uploadQueue.length>0?this.startUpload(this.queueData.uploadQueue.shift()):(this.queueData.uploadQueue=[],c.onQueueComplete&&c.onQueueComplete.call(this,this.queueData)),a.inArray("onUploadComplete",c.overrideEvents)<0)if(c.removeCompleted)switch(b.filestatus){case SWFUpload.FILE_STATUS.COMPLETE:setTimeout(function(){a("#"+b.id)&&(d.queueData.queueSize-=b.size,d.queueData.queueLength-=1,delete d.queueData.files[b.id],a("#"+b.id).fadeOut(500,function(){a(this).remove()}))},1e3*c.removeTimeout);break;case SWFUpload.FILE_STATUS.ERROR:c.requeueErrors||setTimeout(function(){a("#"+b.id)&&(d.queueData.queueSize-=b.size,d.queueData.queueLength-=1,delete d.queueData.files[b.id],a("#"+b.id).fadeOut(500,function(){a(this).remove()}))},1e3*c.removeTimeout)}else b.uploaded=!0;c.onUploadComplete&&c.onUploadComplete.call(this,b)},onUploadError:function(b,c,d){var g,e=this.settings,f="Error";switch(c){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:f="HTTP Error ("+d+")";break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:f="Missing Upload URL";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:f="IO Error";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:f="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:alert("The upload limit has been reached ("+d+")."),f="Exceeds Upload Limit";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:f="Failed";break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:f="Validation Error";break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:f="Cancelled",this.queueData.queueSize-=b.size,this.queueData.queueLength-=1,(b.status==SWFUpload.FILE_STATUS.IN_PROGRESS||a.inArray(b.id,this.queueData.uploadQueue)>=0)&&(this.queueData.uploadSize-=b.size),e.onCancel&&e.onCancel.call(this,b),delete this.queueData.files[b.id];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:f="Stopped"}a.inArray("onUploadError",e.overrideEvents)<0&&(c!=SWFUpload.UPLOAD_ERROR.FILE_CANCELLED&&c!=SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED&&a("#"+b.id).addClass("uploadify-error"),a("#"+b.id).find(".uploadify-progress-bar").css("width","1px"),c!=SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND&&b.status!=SWFUpload.FILE_STATUS.COMPLETE&&a("#"+b.id).find(".data").html(" - "+f)),g=this.getStats(),this.queueData.uploadsErrored=g.upload_errors,e.onUploadError&&e.onUploadError.call(this,b,c,d,f)},onUploadProgress:function(b,c,d){var i,j,k,l,m,n,e=this.settings,f=new Date,g=f.getTime(),h=g-this.timer;h>500&&(this.timer=g),i=c-this.bytesLoaded,this.bytesLoaded=c,j=this.queueData.queueBytesUploaded+c,k=Math.round(100*(c/d)),l="KB/s",m=0,n=i/1024/(h/1e3),n=Math.floor(10*n)/10,this.queueData.averageSpeed=this.queueData.averageSpeed>0?Math.floor((this.queueData.averageSpeed+n)/2):Math.floor(n),n>1e3&&(m=.001*n,this.queueData.averageSpeed=Math.floor(m),l="MB/s"),a.inArray("onUploadProgress",e.overrideEvents)<0&&("percentage"==e.progressData?a("#"+b.id).find(".data").html(" - "+k+"%"):"speed"==e.progressData&&h>500&&a("#"+b.id).find(".data").html(" - "+this.queueData.averageSpeed+l),a("#"+b.id).find(".uploadify-progress-bar").css("width",k+"%")),e.onUploadProgress&&e.onUploadProgress.call(this,b,c,d,j,this.queueData.uploadSize)},onUploadStart:function(b){var c=this.settings,d=new Date;this.timer=d.getTime(),this.bytesLoaded=0,0==this.queueData.uploadQueue.length&&(this.queueData.uploadSize=b.size),c.checkExisting&&a.ajax({type:"POST",async:!1,url:c.checkExisting,data:{filename:b.name},success:function(c){if(1==c){var d=confirm('A file with the name "'+b.name+'" already exists on the server.\nWould you like to replace the existing file?');d||(this.cancelUpload(b.id),a("#"+b.id).remove(),this.queueData.uploadQueue.length>0&&this.queueData.queueLength>0&&("*"==this.queueData.uploadQueue[0]?this.startUpload():this.startUpload(this.queueData.uploadQueue.shift())))}}}),c.onUploadStart&&c.onUploadStart.call(this,b)},onUploadSuccess:function(b,c,d){var e=this.settings,f=this.getStats();this.queueData.uploadsSuccessful=f.successful_uploads,this.queueData.queueBytesUploaded+=b.size,a.inArray("onUploadSuccess",e.overrideEvents)<0&&a("#"+b.id).find(".data").html(" - Complete"),e.onUploadSuccess&&e.onUploadSuccess.call(this,b,c,d)}};a.fn.uploadify=function(c){return b[c]?b[c].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof c&&c?(a.error("The method "+c+" does not exist in $.uploadify"),void 0):b.init.apply(this,arguments)}}($);