var swfobject=function(){function v(){var i,r,n;if(!c){try{i=t.getElementsByTagName("body")[0].appendChild(h("span"));i.parentNode.removeChild(i)}catch(u){return}for(c=!0,r=w.length,n=0;n0)for(r=0;r0){if(t=u(f),t)if(!g(s[r].swfVersion)||n.wk&&n.wk<312)if(s[r].expressInstall&&ut()){h={};h.data=s[r].expressInstall;h.width=t.getAttribute("width")||"0";h.height=t.getAttribute("height")||"0";t.getAttribute("class")&&(h.styleclass=t.getAttribute("class"));t.getAttribute("align")&&(h.align=t.getAttribute("align"));var p={},a=t.getElementsByTagName("param"),w=a.length;for(c=0;c');y.outerHTML='"+k+"<\/object>";b[b.length]=t.id;v=u(t.id)}else{c=h(f);c.setAttribute("type",p);for(s in t)t[s]!=Object.prototype[s]&&(s.toLowerCase()=="styleclass"?c.setAttribute("class",t[s]):s.toLowerCase()!="classid"&&c.setAttribute(s,t[s]));for(l in r)r[l]!=Object.prototype[l]&&l.toLowerCase()!="movie"&&ii(c,l,r[l]);y.parentNode.replaceChild(c,y);v=c}return v}function ii(n,t,i){var r=h("param");r.setAttribute("name",t);r.setAttribute("value",i);n.appendChild(r)}function wt(t){var i=u(t);i&&i.nodeName=="OBJECT"&&(n.ie&&n.win?(i.style.display="none",function(){i.readyState==4?ri(t):setTimeout(arguments.callee,10)}()):i.parentNode.removeChild(i))}function ri(n){var t=u(n),i;if(t){for(i in t)typeof t[i]=="function"&&(t[i]=null);t.parentNode.removeChild(t)}}function u(n){var i=null;try{i=t.getElementById(n)}catch(r){}return i}function h(n){return t.createElement(n)}function ui(n,t,i){n.attachEvent(t,i);a[a.length]=[n,t,i]}function g(t){var r=n.pv,i=t.split(".");return i[0]=parseInt(i[0],10),i[1]=parseInt(i[1],10)||0,i[2]=parseInt(i[2],10)||0,r[0]>i[0]||r[0]==i[0]&&r[1]>i[1]||r[0]==i[0]&&r[1]==i[1]&&r[2]>=i[2]?!0:!1}function bt(r,u,o,s){var a,c,l;n.ie&&n.mac||(a=t.getElementsByTagName("head")[0],a)&&(c=o&&typeof o=="string"?o:"screen",s&&(e=null,tt=null),e&&tt==c||(l=h("style"),l.setAttribute("type","text/css"),l.setAttribute("media",c),e=a.appendChild(l),n.ie&&n.win&&typeof t.styleSheets!=i&&t.styleSheets.length>0&&(e=t.styleSheets[t.styleSheets.length-1]),tt=c),n.ie&&n.win?e&&typeof e.addRule==f&&e.addRule(r,u):e&&typeof t.createTextNode!=i&&e.appendChild(t.createTextNode(r+" {"+u+"}")))}function l(n,t){if(vt){var i=t?"visible":"hidden";c&&u(n)?u(n).style.visibility=i:bt("#"+n,"visibility:"+i)}}function kt(n){var t=/[\\\"<>\.;]/.exec(n)!=null;return t&&typeof encodeURIComponent!=i?encodeURIComponent(n):n}var i="undefined",f="object",st="Shockwave Flash",dt="ShockwaveFlash.ShockwaveFlash",p="application/x-shockwave-flash",ht="SWFObjectExprInst",ct="onreadystatechange",r=window,t=document,o=navigator,lt=!1,w=[gt],s=[],b=[],a=[],y,k,nt,at,c=!1,d=!1,e,tt,vt=!0,n=function(){var l=typeof t.getElementById!=i&&typeof t.getElementsByTagName!=i&&typeof t.createElement!=i,e=o.userAgent.toLowerCase(),s=o.platform.toLowerCase(),a=s?/win/.test(s):/win/.test(e),v=s?/mac/.test(s):/mac/.test(e),y=/webkit/.test(e)?parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,h=!+"\v1",u=[0,0,0],n=null,c;if(typeof o.plugins!=i&&typeof o.plugins[st]==f)n=o.plugins[st].description,!n||typeof o.mimeTypes!=i&&o.mimeTypes[p]&&!o.mimeTypes[p].enabledPlugin||(lt=!0,h=!1,n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),u[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10),u[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10),u[2]=/[a-zA-Z]/.test(n)?parseInt(n.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof r.ActiveXObject!=i)try{c=new ActiveXObject(dt);c&&(n=c.GetVariable("$version"),n&&(h=!0,n=n.split(" ")[1].split(","),u=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]))}catch(w){}return{w3:l,pv:u,wk:y,ie:h,win:a,mac:v}}(),fi=function(){n.w3&&((typeof t.readyState!=i&&t.readyState=="complete"||typeof t.readyState==i&&(t.getElementsByTagName("body")[0]||t.body))&&v(),c||(typeof t.addEventListener!=i&&t.addEventListener("DOMContentLoaded",v,!1),n.ie&&n.win&&(t.attachEvent(ct,function(){t.readyState=="complete"&&(t.detachEvent(ct,arguments.callee),v())}),r==top&&function(){if(!c){try{t.documentElement.doScroll("left")}catch(n){setTimeout(arguments.callee,0);return}v()}}()),n.wk&&function(){if(!c){if(!/loaded|complete/.test(t.readyState)){setTimeout(arguments.callee,0);return}v()}}(),pt(v)))}(),ei=function(){n.ie&&n.win&&window.attachEvent("onunload",function(){for(var r,i,u,f,e=a.length,t=0;t','','','','','','',"<\/object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var n=this.buildParamString(),t=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&uploadURL=",encodeURIComponent(this.settings.upload_url),"&useQueryString=",encodeURIComponent(this.settings.use_query_string),"&requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&httpSuccess=",encodeURIComponent(t),"&assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&params=",encodeURIComponent(n),"&filePostName=",encodeURIComponent(this.settings.file_post_name),"&fileTypes=",encodeURIComponent(this.settings.file_types),"&fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&buttonWidth=",encodeURIComponent(this.settings.button_width),"&buttonHeight=",encodeURIComponent(this.settings.button_height),"&buttonText=",encodeURIComponent(this.settings.button_text),"&buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&buttonAction=",encodeURIComponent(this.settings.button_action),"&buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined&&(this.movieElement=document.getElementById(this.movieName)),this.movieElement===null)throw"Could not find Flash element";return this.movieElement};SWFUpload.prototype.buildParamString=function(){var n=this.settings.post_params,i=[],t;if(typeof n=="object")for(t in n)n.hasOwnProperty(t)&&i.push(encodeURIComponent(t.toString())+"="+encodeURIComponent(n[t].toString()));return i.join("&")};SWFUpload.prototype.destroy=function(){var n,t;try{if(this.cancelUpload(null,!1),n=null,n=this.getMovieElement(),n&&typeof n.CallFunction=="unknown"){for(t in n)try{typeof n[t]=="function"&&(n[t]=null)}catch(i){}try{n.parentNode.removeChild(n)}catch(r){}}return window[this.movieName]=null,SWFUpload.instances[this.movieName]=null,delete SWFUpload.instances[this.movieName],this.movieElement=null,this.settings=null,this.customSettings=null,this.eventQueue=null,this.movieName=null,!0}catch(u){return!1}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url: ",this.settings.upload_url,"\n","\t","flash_url: ",this.settings.flash_url,"\n","\t","use_query_string: ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error: ",this.settings.requeue_on_error.toString(),"\n","\t","http_success: ",this.settings.http_success.join(", "),"\n","\t","assume_success_timeout: ",this.settings.assume_success_timeout,"\n","\t","file_post_name: ",this.settings.file_post_name,"\n","\t","post_params: ",this.settings.post_params.toString(),"\n","\t","file_types: ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit: ",this.settings.file_size_limit,"\n","\t","file_upload_limit: ",this.settings.file_upload_limit,"\n","\t","file_queue_limit: ",this.settings.file_queue_limit,"\n","\t","debug: ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching: ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id: ",this.settings.button_placeholder_id.toString(),"\n","\t","button_placeholder: ",this.settings.button_placeholder?"Set":"Not Set","\n","\t","button_image_url: ",this.settings.button_image_url.toString(),"\n","\t","button_width: ",this.settings.button_width.toString(),"\n","\t","button_height: ",this.settings.button_height.toString(),"\n","\t","button_text: ",this.settings.button_text.toString(),"\n","\t","button_text_style: ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding: ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action: ",this.settings.button_action.toString(),"\n","\t","button_disabled: ",this.settings.button_disabled.toString(),"\n","\t","custom_settings: ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned: ",(typeof this.settings.swfupload_loaded_handler=="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler=="function").toString(),"\n","\t","file_queued_handler assigned: ",(typeof this.settings.file_queued_handler=="function").toString(),"\n","\t","file_queue_error_handler assigned: ",(typeof this.settings.file_queue_error_handler=="function").toString(),"\n","\t","upload_start_handler assigned: ",(typeof this.settings.upload_start_handler=="function").toString(),"\n","\t","upload_progress_handler assigned: ",(typeof this.settings.upload_progress_handler=="function").toString(),"\n","\t","upload_error_handler assigned: ",(typeof this.settings.upload_error_handler=="function").toString(),"\n","\t","upload_success_handler assigned: ",(typeof this.settings.upload_success_handler=="function").toString(),"\n","\t","upload_complete_handler assigned: ",(typeof this.settings.upload_complete_handler=="function").toString(),"\n","\t","debug_handler assigned: ",(typeof this.settings.debug_handler=="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(n,t,i){return this.settings[n]=t==undefined?i:t};SWFUpload.prototype.getSetting=function(n){return this.settings[n]!=undefined?this.settings[n]:""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement(),returnValue,returnString;try{returnString=movieElement.CallFunction(''+__flash__argumentsToXML(argumentArray,0)+"<\/invoke>");returnValue=evals(returnString)}catch(ex){throw"Call to "+functionName+" failed";}return returnValue!=undefined&&typeof returnValue.post=="object"&&(returnValue=this.unescapeFilePostParams(returnValue)),returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(n){this.callFlash("StartUpload",[n])};SWFUpload.prototype.cancelUpload=function(n,t){t!==!1&&(t=!0);this.callFlash("CancelUpload",[n,t])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(n){this.callFlash("SetStats",[n])};SWFUpload.prototype.getFile=function(n){return typeof n=="number"?this.callFlash("GetFileByIndex",[n]):this.callFlash("GetFile",[n])};SWFUpload.prototype.addFileParam=function(n,t,i){return this.callFlash("AddFileParam",[n,t,i])};SWFUpload.prototype.removeFileParam=function(n,t){this.callFlash("RemoveFileParam",[n,t])};SWFUpload.prototype.setUploadURL=function(n){this.settings.upload_url=n.toString();this.callFlash("SetUploadURL",[n])};SWFUpload.prototype.setPostParams=function(n){this.settings.post_params=n;this.callFlash("SetPostParams",[n])};SWFUpload.prototype.addPostParam=function(n,t){this.settings.post_params[n]=t;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(n){delete this.settings.post_params[n];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(n,t){this.settings.file_types=n;this.settings.file_types_description=t;this.callFlash("SetFileTypes",[n,t])};SWFUpload.prototype.setFileSizeLimit=function(n){this.settings.file_size_limit=n;this.callFlash("SetFileSizeLimit",[n])};SWFUpload.prototype.setFileUploadLimit=function(n){this.settings.file_upload_limit=n;this.callFlash("SetFileUploadLimit",[n])};SWFUpload.prototype.setFileQueueLimit=function(n){this.settings.file_queue_limit=n;this.callFlash("SetFileQueueLimit",[n])};SWFUpload.prototype.setFilePostName=function(n){this.settings.file_post_name=n;this.callFlash("SetFilePostName",[n])};SWFUpload.prototype.setUseQueryString=function(n){this.settings.use_query_string=n;this.callFlash("SetUseQueryString",[n])};SWFUpload.prototype.setRequeueOnError=function(n){this.settings.requeue_on_error=n;this.callFlash("SetRequeueOnError",[n])};SWFUpload.prototype.setHTTPSuccess=function(n){typeof n=="string"&&(n=n.replace(" ","").split(","));this.settings.http_success=n;this.callFlash("SetHTTPSuccess",[n])};SWFUpload.prototype.setAssumeSuccessTimeout=function(n){this.settings.assume_success_timeout=n;this.callFlash("SetAssumeSuccessTimeout",[n])};SWFUpload.prototype.setDebugEnabled=function(n){this.settings.debug_enabled=n;this.callFlash("SetDebugEnabled",[n])};SWFUpload.prototype.setButtonImageURL=function(n){n==undefined&&(n="");this.settings.button_image_url=n;this.callFlash("SetButtonImageURL",[n])};SWFUpload.prototype.setButtonDimensions=function(n,t){this.settings.button_width=n;this.settings.button_height=t;var i=this.getMovieElement();i!=undefined&&(i.style.width=n+"px",i.style.height=t+"px");this.callFlash("SetButtonDimensions",[n,t])};SWFUpload.prototype.setButtonText=function(n){this.settings.button_text=n;this.callFlash("SetButtonText",[n])};SWFUpload.prototype.setButtonTextPadding=function(n,t){this.settings.button_text_top_padding=t;this.settings.button_text_left_padding=n;this.callFlash("SetButtonTextPadding",[n,t])};SWFUpload.prototype.setButtonTextStyle=function(n){this.settings.button_text_style=n;this.callFlash("SetButtonTextStyle",[n])};SWFUpload.prototype.setButtonDisabled=function(n){this.settings.button_disabled=n;this.callFlash("SetButtonDisabled",[n])};SWFUpload.prototype.setButtonAction=function(n){this.settings.button_action=n;this.callFlash("SetButtonAction",[n])};SWFUpload.prototype.setButtonCursor=function(n){this.settings.button_cursor=n;this.callFlash("SetButtonCursor",[n])};SWFUpload.prototype.queueEvent=function(n,t){t==undefined?t=[]:t instanceof Array||(t=[t]);var i=this;if(typeof this.settings[n]=="function")this.eventQueue.push(function(){this.settings[n].apply(this,t)}),setTimeout(function(){i.executeNextEvent()},0);else if(this.settings[n]!==null)throw"Event handler "+n+" is unknown or is not a function";};SWFUpload.prototype.executeNextEvent=function(){var n=this.eventQueue?this.eventQueue.shift():null;typeof n=="function"&&n.apply(this)};SWFUpload.prototype.unescapeFilePostParams=function(n){var u={},t,i,r;if(n!=undefined){for(i in n.post)if(n.post.hasOwnProperty(i)){for(t=i;(r=/[$]([0-9a-f]{4})/i.exec(t))!==null;)t=t.replace(r[0],String.fromCharCode(parseInt("0x"+r[1],16)));u[t]=n.post[i]}n.post=u}return n};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(n){return!1}};SWFUpload.prototype.flashReady=function(){var n=this.getMovieElement();if(!n){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(n);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(n){try{if(this.movieElement&&typeof n.CallFunction=="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var t in n)try{typeof n[t]=="function"&&(n[t]=null)}catch(i){}}}catch(r){}window.__flash__removeCallback=function(n,t){try{n&&(n[t]=null)}catch(i){}}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(n){n=this.unescapeFilePostParams(n);this.queueEvent("file_queued_handler",n)};SWFUpload.prototype.fileQueueError=function(n,t,i){n=this.unescapeFilePostParams(n);this.queueEvent("file_queue_error_handler",[n,t,i])};SWFUpload.prototype.fileDialogComplete=function(n,t,i){this.queueEvent("file_dialog_complete_handler",[n,t,i])};SWFUpload.prototype.uploadStart=function(n){n=this.unescapeFilePostParams(n);this.queueEvent("return_upload_start_handler",n)};SWFUpload.prototype.returnUploadStart=function(n){var t;if(typeof this.settings.upload_start_handler=="function")n=this.unescapeFilePostParams(n),t=this.settings.upload_start_handler.call(this,n);else if(this.settings.upload_start_handler!=undefined)throw"upload_start_handler must be a function";t===undefined&&(t=!0);t=!!t;this.callFlash("ReturnUploadStart",[t])};SWFUpload.prototype.uploadProgress=function(n,t,i){n=this.unescapeFilePostParams(n);this.queueEvent("upload_progress_handler",[n,t,i])};SWFUpload.prototype.uploadError=function(n,t,i){n=this.unescapeFilePostParams(n);this.queueEvent("upload_error_handler",[n,t,i])};SWFUpload.prototype.uploadSuccess=function(n,t,i){n=this.unescapeFilePostParams(n);this.queueEvent("upload_success_handler",[n,t,i])};SWFUpload.prototype.uploadComplete=function(n){n=this.unescapeFilePostParams(n);this.queueEvent("upload_complete_handler",n)};SWFUpload.prototype.debug=function(n){this.queueEvent("debug_handler",n)};SWFUpload.prototype.debugMessage=function(n){var i,t,r;if(this.settings.debug)if(t=[],typeof n=="object"&&typeof n.name=="string"&&typeof n.message=="string"){for(r in n)n.hasOwnProperty(r)&&t.push(r+": "+n[r]);i=t.join("\n")||"";t=i.split("\n");i="EXCEPTION: "+t.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(i)}else SWFUpload.Console.writeLine(n)};SWFUpload.Console={};SWFUpload.Console.writeLine=function(n){var t,i;try{t=document.getElementById("SWFUpload_Console");t||(i=document.createElement("form"),document.getElementsByTagName("body")[0].appendChild(i),t=document.createElement("textarea"),t.id="SWFUpload_Console",t.style.fontFamily="monospace",t.setAttribute("wrap","off"),t.wrap="off",t.style.overflow="auto",t.style.width="700px",t.style.height="350px",t.style.margin="5px",i.appendChild(t));t.value+=n+"\n";t.scrollTop=t.scrollHeight-t.clientHeight}catch(r){alert("Exception: "+r.name+" Message: "+r.message)}},function(n){var i={init:function(i,r){return this.each(function(){var o=n(this),v=o.clone(),u=n.extend({id:o.attr("id"),swf:"uploadify.swf",uploader:"uploadify.php",auto:!0,buttonClass:"",buttonCursor:"hand",buttonImage:null,buttonText:"SELECT FILES",checkExisting:!1,debug:!1,fileObjName:"Filedata",fileSizeLimit:0,fileTypeDesc:"All Files",fileTypeExts:"*.*",height:30,itemTemplate:!1,method:"post",multi:!0,formData:{},preventCaching:!0,progressData:"percentage",queueID:!1,queueSizeLimit:999,removeCompleted:!0,removeTimeout:3,requeueErrors:!1,successTimeout:30,uploadLimit:0,width:120,overrideEvents:[]},i),s={assume_success_timeout:u.successTimeout,button_placeholder_id:u.id,button_width:u.width,button_height:u.height,button_text:null,button_text_style:null,button_text_top_padding:0,button_text_left_padding:0,button_action:u.multi?SWFUpload.BUTTON_ACTION.SELECT_FILES:SWFUpload.BUTTON_ACTION.SELECT_FILE,button_disabled:!1,button_cursor:u.buttonCursor=="arrow"?SWFUpload.CURSOR.ARROW:SWFUpload.CURSOR.HAND,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,debug:u.debug,requeue_on_error:u.requeueErrors,file_post_name:u.fileObjName,file_size_limit:u.fileSizeLimit,file_types:u.fileTypeExts,file_types_description:u.fileTypeDesc,file_queue_limit:u.queueSizeLimit,file_upload_limit:u.uploadLimit,flash_url:u.swf,prevent_swf_caching:u.preventCaching,post_params:u.formData,upload_url:u.uploader,use_query_string:u.method=="get",file_dialog_complete_handler:t.onDialogClose,file_dialog_start_handler:t.onDialogOpen,file_queued_handler:t.onSelect,file_queue_error_handler:t.onSelectError,swfupload_loaded_handler:u.onSWFReady,upload_complete_handler:t.onUploadComplete,upload_error_handler:t.onUploadError,upload_progress_handler:t.onUploadProgress,upload_start_handler:t.onUploadStart,upload_success_handler:t.onUploadSuccess},l,a,f,e,h,c;r&&(s=n.extend(s,r));s=n.extend(s,u);l=swfobject.getFlashPlayerVersion();a=l.major>=9;a?(window["uploadify_"+u.id]=new SWFUpload(s),f=window["uploadify_"+u.id],o.data("uploadify",f),e=n("
",{id:u.id,"class":"uploadify",css:{height:u.height+"px",width:u.width+"px"}}),n("#"+f.movieName).wrap(e),e=n("#"+u.id),e.data("uploadify",f),h=n("
",{id:u.id+"-button","class":"uploadify-button "+u.buttonClass}),u.buttonImage&&h.css({"background-image":"url('"+u.buttonImage+"')","text-indent":"-9999px"}),h.html(''+u.buttonText+"<\/span>").css({height:u.height+"px","line-height":u.height+"px",width:u.width+"px"}),e.append(h),n("#"+f.movieName).css({position:"absolute","z-index":1}),u.queueID||(c=n("
",{id:u.id+"-queue","class":"uploadify-queue"}),e.after(c),f.settings.queueID=u.id+"-queue",f.settings.defaultQueue=!0),f.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:"},f.original=v,f.wrapper=e,f.button=h,f.queue=c,u.onInit&&u.onInit.call(o,f)):u.onFallback&&u.onFallback.call(o)})},cancel:function(){var t=arguments;this.each(function(){var f=n(this),i=f.data("uploadify"),u=i.settings,e=-1,o,r,s;if(t[0])if(t[0]=="*")o=i.queueData.queueLength,n("#"+u.queueID).find(".uploadify-queue-item").each(function(){e++;t[1]===!0?i.cancelUpload(n(this).attr("id"),!1):i.cancelUpload(n(this).attr("id"));n(this).find(".data").removeClass("data").html(" - Cancelled");n(this).find(".uploadify-progress-bar").remove();n(this).delay(1e3+100*e).fadeOut(500,function(){n(this).remove()})}),i.queueData.queueSize=0,i.queueData.queueLength=0,u.onClearQueue&&u.onClearQueue.call(f,o);else for(r=0;r0&&alert(this.queueData.errorMsg);u.onDialogClose&&u.onDialogClose.call(this,this.queueData);u.auto&&n("#"+u.id).uploadify("upload","*")},onSelect:function(t){var r=this.settings,u={},h,c,i,o,e,f,s;for(h in this.queueData.files)if(u=this.queueData.files[h],u.uploaded!=!0&&u.name==t.name)if(c=confirm('The file named "'+t.name+'" is already in the queue.\nDo you want to replace the existing item in the queue?'),c)n("#"+u.id).remove(),this.cancelUpload(u.id),this.queueData.filesReplaced++;else return this.cancelUpload(t.id),this.queueData.filesCancelled++,!1;if(i=Math.round(t.size/1024),o="KB",i>1e3&&(i=Math.round(i/1e3),o="MB"),e=i.toString().split("."),i=e[0],e.length>1&&(i+="."+e[1].substr(0,2)),i+=o,f=t.name,f.length>25&&(f=f.substr(0,25)+"..."),itemData={fileID:t.id,instanceID:r.id,fileName:f,fileSize:i},r.itemTemplate==!1&&(r.itemTemplate='
\t\t\t\t\t
\t\t\t\t\t\tX<\/a>\t\t\t\t\t<\/div>\t\t\t\t\t${fileName} (${fileSize})<\/span><\/span>\t\t\t\t\t
\t\t\t\t\t\t
<\/div>\t\t\t\t\t<\/div>\t\t\t\t<\/div>'),n.inArray("onSelect",r.overrideEvents)<0){itemHTML=r.itemTemplate;for(s in itemData)itemHTML=itemHTML.replace(new RegExp("\\$\\{"+s+"\\}","g"),itemData[s]);n("#"+r.queueID).append(itemHTML)}this.queueData.queueSize+=t.size;this.queueData.files[t.id]=t;r.onSelect&&r.onSelect.apply(this,arguments)},onSelectError:function(t,i,r){var u=this.settings;if(n.inArray("onSelectError",u.overrideEvents)<0)switch(i){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:this.queueData.errorMsg+=u.queueSizeLimit>r?"\nThe number of files selected exceeds the remaining upload limit ("+r+").":"\nThe number of files selected exceeds the queue size limit ("+u.queueSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+t.name+'" exceeds the size limit ('+u.fileSizeLimit+").";break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.queueData.errorMsg+='\nThe file "'+t.name+'" is empty.';break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.queueData.errorMsg+='\nThe file "'+t.name+'" is not an accepted file type ('+u.fileTypeDesc+")."}i!=SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED&&delete this.queueData.files[t.id];u.onSelectError&&u.onSelectError.apply(this,arguments)},onQueueComplete:function(){this.settings.onQueueComplete&&this.settings.onQueueComplete.call(this,this.settings.queueData)},onUploadComplete:function(t){var i=this.settings,r=this,u=this.getStats();if(this.queueData.queueLength=u.files_queued,this.queueData.uploadQueue[0]=="*"?this.queueData.queueLength>0?this.startUpload():(this.queueData.uploadQueue=[],i.onQueueComplete&&i.onQueueComplete.call(this,this.queueData)):this.queueData.uploadQueue.length>0?this.startUpload(this.queueData.uploadQueue.shift()):(this.queueData.uploadQueue=[],i.onQueueComplete&&i.onQueueComplete.call(this,this.queueData)),n.inArray("onUploadComplete",i.overrideEvents)<0)if(i.removeCompleted)switch(t.filestatus){case SWFUpload.FILE_STATUS.COMPLETE:setTimeout(function(){n("#"+t.id)&&(r.queueData.queueSize-=t.size,r.queueData.queueLength-=1,delete r.queueData.files[t.id],n("#"+t.id).fadeOut(500,function(){n(this).remove()}))},i.removeTimeout*1e3);break;case SWFUpload.FILE_STATUS.ERROR:i.requeueErrors||setTimeout(function(){n("#"+t.id)&&(r.queueData.queueSize-=t.size,r.queueData.queueLength-=1,delete r.queueData.files[t.id],n("#"+t.id).fadeOut(500,function(){n(this).remove()}))},i.removeTimeout*1e3)}else t.uploaded=!0;i.onUploadComplete&&i.onUploadComplete.call(this,t)},onUploadError:function(t,i,r){var f=this.settings,u="Error",e;switch(i){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:u="HTTP Error ("+r+")";break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:u="Missing Upload URL";break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:u="IO Error";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:u="Security Error";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:alert("The upload limit has been reached ("+r+").");u="Exceeds Upload Limit";break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:u="Failed";break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:u="Validation Error";break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:u="Cancelled";this.queueData.queueSize-=t.size;this.queueData.queueLength-=1;(t.status==SWFUpload.FILE_STATUS.IN_PROGRESS||n.inArray(t.id,this.queueData.uploadQueue)>=0)&&(this.queueData.uploadSize-=t.size);f.onCancel&&f.onCancel.call(this,t);delete this.queueData.files[t.id];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:u="Stopped"}n.inArray("onUploadError",f.overrideEvents)<0&&(i!=SWFUpload.UPLOAD_ERROR.FILE_CANCELLED&&i!=SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED&&n("#"+t.id).addClass("uploadify-error"),n("#"+t.id).find(".uploadify-progress-bar").css("width","1px"),i!=SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND&&t.status!=SWFUpload.FILE_STATUS.COMPLETE&&n("#"+t.id).find(".data").html(" - "+u));e=this.getStats();this.queueData.uploadsErrored=e.upload_errors;f.onUploadError&&f.onUploadError.call(this,t,i,r,u)},onUploadProgress:function(t,i,r){var f=this.settings,a=new Date,o=a.getTime(),e=o-this.timer,s;e>500&&(this.timer=o);s=i-this.bytesLoaded;this.bytesLoaded=i;var v=this.queueData.queueBytesUploaded+i,h=Math.round(i/r*100),c="KB/s",l=0,u=s/1024/(e/1e3);u=Math.floor(u*10)/10;this.queueData.averageSpeed=this.queueData.averageSpeed>0?Math.floor((this.queueData.averageSpeed+u)/2):Math.floor(u);u>1e3&&(l=u*.001,this.queueData.averageSpeed=Math.floor(l),c="MB/s");n.inArray("onUploadProgress",f.overrideEvents)<0&&(f.progressData=="percentage"?n("#"+t.id).find(".data").html(" - "+h+"%"):f.progressData=="speed"&&e>500&&n("#"+t.id).find(".data").html(" - "+this.queueData.averageSpeed+c),n("#"+t.id).find(".uploadify-progress-bar").css("width",h+"%"));f.onUploadProgress&&f.onUploadProgress.call(this,t,i,r,v,this.queueData.uploadSize)},onUploadStart:function(t){var i=this.settings,r=new Date;this.timer=r.getTime();this.bytesLoaded=0;this.queueData.uploadQueue.length==0&&(this.queueData.uploadSize=t.size);i.checkExisting&&n.ajax({type:"POST",async:!1,url:i.checkExisting,data:{filename:t.name},success:function(i){if(i==1){var r=confirm('A file with the name "'+t.name+'" already exists on the server.\nWould you like to replace the existing file?');r||(this.cancelUpload(t.id),n("#"+t.id).remove(),this.queueData.uploadQueue.length>0&&this.queueData.queueLength>0&&(this.queueData.uploadQueue[0]=="*"?this.startUpload():this.startUpload(this.queueData.uploadQueue.shift())))}}});i.onUploadStart&&i.onUploadStart.call(this,t)},onUploadSuccess:function(t,i,r){var u=this.settings,f=this.getStats();this.queueData.uploadsSuccessful=f.successful_uploads;this.queueData.queueBytesUploaded+=t.size;n.inArray("onUploadSuccess",u.overrideEvents)<0&&n("#"+t.id).find(".data").html(" - Complete");u.onUploadSuccess&&u.onUploadSuccess.call(this,t,i,r)}};n.fn.uploadify=function(t){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t!="object"&&t)n.error("The method "+t+" does not exist in $.uploadify");else return i.init.apply(this,arguments)}}($)