var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(A){this.initSWFUpload(A);};}SWFUpload.prototype.initSWFUpload=function(B){try{this.customSettings={};this.settings=B;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo();}catch(A){delete SWFUpload.instances[this.movieName];throw A;}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Beta 5 2008-01-29";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(B,A){this.settings[B]=(this.settings[B]==undefined)?A:this.settings[B];};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime();}delete this.ensureDefault;};SWFUpload.prototype.loadFlash=function(){var A,B;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added";}A=document.getElementById(this.settings.button_placeholder_id);if(A==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id;}B=document.createElement("div");B.innerHTML=this.getFlashHTML();A.parentNode.replaceChild(B.firstChild,A);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement();}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("");};SWFUpload.prototype.getFlashVars=function(){var B=this.buildParamString();var A=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(A),"&amp;params=",encodeURIComponent(B),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("");};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName);}if(this.movieElement===null){throw"Could not find Flash element";}return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var C=this.settings.post_params;var B=[];if(typeof (C)==="object"){for(var A in C){if(C.hasOwnProperty(A)){B.push(encodeURIComponent(A.toString())+"="+encodeURIComponent(C[A].toString()));}}}return B.join("&amp;");};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var A=null;A=this.getMovieElement();if(A&&typeof (A.CallFunction)==="unknown"){for(var C in A){try{if(typeof (A[C])==="function"){A[C]=null;}}catch(E){}}try{A.parentNode.removeChild(A);}catch(B){}}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;return true;}catch(D){return false;}};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","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_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(B,C,A){if(C==undefined){return(this.settings[B]=A);}else{return(this.settings[B]=C);}};SWFUpload.prototype.getSetting=function(A){if(this.settings[A]!=undefined){return this.settings[A];}return"";};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString);}catch(ex){throw"Call to "+functionName+" failed";}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue);}return returnValue;};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile");};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles");};SWFUpload.prototype.startUpload=function(A){this.callFlash("StartUpload",[A]);};SWFUpload.prototype.cancelUpload=function(A,B){if(B!==false){B=true;}this.callFlash("CancelUpload",[A,B]);};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload");};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats");};SWFUpload.prototype.setStats=function(A){this.callFlash("SetStats",[A]);};SWFUpload.prototype.getFile=function(A){if(typeof (A)==="number"){return this.callFlash("GetFileByIndex",[A]);}else{return this.callFlash("GetFile",[A]);}};SWFUpload.prototype.addFileParam=function(A,B,C){return this.callFlash("AddFileParam",[A,B,C]);};SWFUpload.prototype.removeFileParam=function(A,B){this.callFlash("RemoveFileParam",[A,B]);};SWFUpload.prototype.setUploadURL=function(A){this.settings.upload_url=A.toString();this.callFlash("SetUploadURL",[A]);};SWFUpload.prototype.setPostParams=function(A){this.settings.post_params=A;this.callFlash("SetPostParams",[A]);};SWFUpload.prototype.addPostParam=function(A,B){this.settings.post_params[A]=B;this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.removePostParam=function(A){delete this.settings.post_params[A];this.callFlash("SetPostParams",[this.settings.post_params]);};SWFUpload.prototype.setFileTypes=function(A,B){this.settings.file_types=A;this.settings.file_types_description=B;this.callFlash("SetFileTypes",[A,B]);};SWFUpload.prototype.setFileSizeLimit=function(A){this.settings.file_size_limit=A;this.callFlash("SetFileSizeLimit",[A]);};SWFUpload.prototype.setFileUploadLimit=function(A){this.settings.file_upload_limit=A;this.callFlash("SetFileUploadLimit",[A]);};SWFUpload.prototype.setFileQueueLimit=function(A){this.settings.file_queue_limit=A;this.callFlash("SetFileQueueLimit",[A]);};SWFUpload.prototype.setFilePostName=function(A){this.settings.file_post_name=A;this.callFlash("SetFilePostName",[A]);};SWFUpload.prototype.setUseQueryString=function(A){this.settings.use_query_string=A;this.callFlash("SetUseQueryString",[A]);};SWFUpload.prototype.setRequeueOnError=function(A){this.settings.requeue_on_error=A;this.callFlash("SetRequeueOnError",[A]);};SWFUpload.prototype.setHTTPSuccess=function(A){if(typeof A==="string"){A=A.replace(" ","").split(",");}this.settings.http_success=A;this.callFlash("SetHTTPSuccess",[A]);};SWFUpload.prototype.setDebugEnabled=function(A){this.settings.debug_enabled=A;this.callFlash("SetDebugEnabled",[A]);};SWFUpload.prototype.setButtonImageURL=function(A){if(A==undefined){A="";}this.settings.button_image_url=A;this.callFlash("SetButtonImageURL",[A]);};SWFUpload.prototype.setButtonDimensions=function(C,A){this.settings.button_width=C;this.settings.button_height=A;var B=this.getMovieElement();if(B!=undefined){B.style.width=C+"px";B.style.height=A+"px";}this.callFlash("SetButtonDimensions",[C,A]);};SWFUpload.prototype.setButtonText=function(A){this.settings.button_text=A;this.callFlash("SetButtonText",[A]);};SWFUpload.prototype.setButtonTextPadding=function(B,A){this.settings.button_text_top_padding=A;this.settings.button_text_left_padding=B;this.callFlash("SetButtonTextPadding",[B,A]);};SWFUpload.prototype.setButtonTextStyle=function(A){this.settings.button_text_style=A;this.callFlash("SetButtonTextStyle",[A]);};SWFUpload.prototype.setButtonDisabled=function(A){this.settings.button_disabled=A;this.callFlash("SetButtonDisabled",[A]);};SWFUpload.prototype.setButtonAction=function(A){this.settings.button_action=A;this.callFlash("SetButtonAction",[A]);};SWFUpload.prototype.setButtonCursor=function(A){this.settings.button_cursor=A;this.callFlash("SetButtonCursor",[A]);};SWFUpload.prototype.queueEvent=function(B,C){if(C==undefined){C=[];}else{if(!(C instanceof Array)){C=[C];}}var A=this;if(typeof this.settings[B]==="function"){this.eventQueue.push(function(){this.settings[B].apply(this,C);});setTimeout(function(){A.executeNextEvent();},0);}else{if(this.settings[B]!==null){throw"Event handler "+B+" is unknown or is not a function";}}};SWFUpload.prototype.executeNextEvent=function(){var A=this.eventQueue?this.eventQueue.shift():null;if(typeof (A)==="function"){A.apply(this);}};SWFUpload.prototype.unescapeFilePostParams=function(C){var E=/[$]([0-9a-f]{4})/i;var F={};var D;if(C!=undefined){for(var A in C.post){if(C.post.hasOwnProperty(A)){D=A;var B;while((B=E.exec(D))!==null){D=D.replace(B[0],String.fromCharCode(parseInt("0x"+B[1],16)));}F[D]=C.post[A];}}C.post=F;}return C;};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface");}catch(A){return false;}};SWFUpload.prototype.flashReady=function(){var A=this.getMovieElement();if(!A){this.debug("Flash called back ready but the flash movie can't be found.");return ;}this.cleanUp(A);this.queueEvent("swfupload_loaded_handler");};SWFUpload.prototype.cleanUp=function(A){try{if(this.movieElement&&typeof (A.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var C in A){try{if(typeof (A[C])==="function"){A[C]=null;}}catch(B){}}}}catch(D){}window["__flash__removeCallback"]=function(E,F){try{if(E){E[F]=null;}}catch(G){}};};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler");};SWFUpload.prototype.fileQueued=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("file_queued_handler",A);};SWFUpload.prototype.fileQueueError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("file_queue_error_handler",[A,C,B]);};SWFUpload.prototype.fileDialogComplete=function(A,B){this.queueEvent("file_dialog_complete_handler",[A,B]);};SWFUpload.prototype.uploadStart=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("return_upload_start_handler",A);};SWFUpload.prototype.returnUploadStart=function(A){var B;if(typeof this.settings.upload_start_handler==="function"){A=this.unescapeFilePostParams(A);B=this.settings.upload_start_handler.call(this,A);}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function";}}if(B===undefined){B=true;}B=!!B;this.callFlash("ReturnUploadStart",[B]);};SWFUpload.prototype.uploadProgress=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_progress_handler",[A,C,B]);};SWFUpload.prototype.uploadError=function(A,C,B){A=this.unescapeFilePostParams(A);this.queueEvent("upload_error_handler",[A,C,B]);};SWFUpload.prototype.uploadSuccess=function(B,A){B=this.unescapeFilePostParams(B);this.queueEvent("upload_success_handler",[B,A]);};SWFUpload.prototype.uploadComplete=function(A){A=this.unescapeFilePostParams(A);this.queueEvent("upload_complete_handler",A);};SWFUpload.prototype.debug=function(A){this.queueEvent("debug_handler",A);};SWFUpload.prototype.debugMessage=function(C){if(this.settings.debug){var A,D=[];if(typeof C==="object"&&typeof C.name==="string"&&typeof C.message==="string"){for(var B in C){if(C.hasOwnProperty(B)){D.push(B+": "+C[B]);}}A=D.join("\n")||"";D=A.split("\n");A="EXCEPTION: "+D.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(A);}else{SWFUpload.Console.writeLine(C);}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(D){var B,A;try{B=document.getElementById("SWFUpload_Console");if(!B){A=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(A);B=document.createElement("textarea");B.id="SWFUpload_Console";B.style.fontFamily="monospace";B.setAttribute("wrap","off");B.wrap="off";B.style.overflow="auto";B.style.width="700px";B.style.height="350px";B.style.margin="5px";A.appendChild(B);}B.value+=D+"\n";B.scrollTop=B.scrollHeight-B.clientHeight;}catch(C){alert("Exception: "+C.name+" Message: "+C.message);}};function sizeUnit(A){if(A>1024&&A<1024*1024){return formatFloat(A/1024,2)+"KB";}else{if(A>1024*1024&&A<1024*1024*1024){return formatFloat(A/1024/1024,2)+"MB";}else{if(A>1024*1024*1024){return formatFloat(A/1024/1024,2)+"GB";}else{return A+"B";}}}}var SWFUpload;if(typeof (SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.queue.uploadfiles=[];SWFUpload.prototype.initSettings=(function(A){return function(){if(typeof (A)==="function"){A.call(this);}this.customSettings.queue_cancelled_flag=false;this.customSettings.queue_upload_count=0;this.customSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.customSettings.user_upload_start_handler=this.settings.upload_start_handler;this.settings.upload_complete_handler=SWFUpload.queue.uploadCompleteHandler;this.settings.upload_start_handler=SWFUpload.queue.uploadStartHandler;this.settings.queue_complete_handler=this.settings.queue_complete_handler||null;};})(SWFUpload.prototype.initSettings);SWFUpload.prototype.startUpload=function(A){this.customSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[A]);};SWFUpload.prototype.cancelQueue=function(){this.customSettings.queue_cancelled_flag=true;this.stopUpload();var A=this.getStats();while(A.files_queued>0){this.cancelUpload();A=this.getStats();}};SWFUpload.queue.uploadStartHandler=function(A){var B;if(typeof (this.customSettings.user_upload_start_handler)==="function"){B=this.customSettings.user_upload_start_handler.call(this,A);}B=(B===false)?false:true;this.customSettings.queue_cancelled_flag=!B;return B;};SWFUpload.queue.uploadCompleteHandler=function(B){var C=this.customSettings.user_upload_complete_handler;var D;if(B.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.customSettings.queue_upload_count++;}if(typeof (C)==="function"){D=(C.call(this,B)===false)?false:true;}else{if(B.filestatus===SWFUpload.FILE_STATUS.QUEUED){D=false;}else{D=true;}}if(D){var A=this.getStats();if(A.files_queued>0&&this.customSettings.queue_cancelled_flag===false){this.startUpload();}else{if(this.customSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.customSettings.queue_upload_count]);this.customSettings.queue_upload_count=0;}else{this.customSettings.queue_cancelled_flag=false;this.customSettings.queue_upload_count=0;}}}};}function FileProgress(C,A){this.fileProgressID=C.id;this.fileProgressWrapper=document.getElementById(this.fileProgressID);if(!this.fileProgressWrapper){this.fileProgressWrapper=document.createElement("div");this.fileProgressWrapper.className="progressWrapper";this.fileProgressWrapper.id=this.fileProgressID;this.fileProgressElement=document.createElement("div");this.fileProgressElement.className="progressContainer";var F=document.createElement("div");F.className="progressIcon";F.title="取消";F.appendChild(document.createTextNode(" "));var B=document.createElement("div");B.className="progressName";B.appendChild(document.createTextNode(C.name));var E=document.createElement("div");E.className="progressBarInProgress";var D=document.createElement("div");D.appendChild(document.createTextNode(sizeUnit(C.size)));D.className="progressBarStatus";this.fileProgressElement.appendChild(F);this.fileProgressElement.appendChild(B);this.fileProgressElement.appendChild(D);this.fileProgressElement.appendChild(E);this.fileProgressWrapper.appendChild(this.fileProgressElement);document.getElementById(A).appendChild(this.fileProgressWrapper);}else{this.fileProgressElement=this.fileProgressWrapper.firstChild;this.reset();}this.height=this.fileProgressWrapper.offsetHeight;this.setTimer(null);}FileProgress.prototype.setTimer=function(A){this.fileProgressElement["FP_TIMER"]=A;};FileProgress.prototype.getTimer=function(A){return this.fileProgressElement["FP_TIMER"]||null;};FileProgress.prototype.reset=function(){this.fileProgressElement.className="progressContainer";this.fileProgressElement.childNodes[0].title="取消";this.fileProgressElement.childNodes[2].className="progressBarStatus";this.fileProgressElement.childNodes[3].className="progressBarInProgress";this.fileProgressElement.childNodes[3].style.width="0%";this.appear();};FileProgress.prototype.setProgress=function(A){this.fileProgressElement.className="progressContainer uploadinprogress";this.fileProgressElement.childNodes[3].className="progressBarInProgress";this.fileProgressElement.childNodes[3].style.width=A+"%";this.appear();};FileProgress.prototype.setComplete=function(){this.fileProgressElement.className="progressContainer uploadcomplete";this.fileProgressElement.childNodes[0].title="完成";this.fileProgressElement.childNodes[0].onclick=function(){};this.fileProgressElement.childNodes[3].className="progressBarComplete";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setError=function(){this.fileProgressElement.className="progressContainer uploaderr";this.fileProgressElement.childNodes[0].title="失败";this.fileProgressElement.childNodes[0].onclick=function(){};this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setCancelled=function(){this.fileProgressElement.className="progressContainer uploaderr";this.fileProgressElement.childNodes[0].title="已取消";this.fileProgressElement.childNodes[0].onclick=function(){};this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setStatus=function(A){this.fileProgressElement.childNodes[2].innerHTML=A;};FileProgress.prototype.toggleCancel=function(B,C){this.fileProgressElement.className="progressContainer";if(C){var A=this.fileProgressID;this.fileProgressElement.childNodes[0].onclick=function(){C.cancelUpload(A);return false;};}};FileProgress.prototype.appear=function(){};FileProgress.prototype.disappear=function(){var E=15;var C=4;var B=30;if(this.opacity>0){this.opacity-=E;if(this.opacity<0){this.opacity=0;}if(this.fileProgressWrapper.filters){try{this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=this.opacity;}catch(D){this.fileProgressWrapper.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+this.opacity+")";}}else{this.fileProgressWrapper.style.opacity=this.opacity/100;}}if(this.height>0){this.height-=C;if(this.height<0){this.height=0;}this.fileProgressWrapper.style.height=this.height+"px";}if(this.height>0||this.opacity>0){var A=this;this.setTimer(setTimeout(function(){A.disappear();},B));}else{this.fileProgressWrapper.style.display="none";this.setTimer(null);}};FileProgress.prototype.remove=function(){this.fileProgressWrapper.style.display="none";};var swfupld_dic={pending:"排队中...",toomany:"您选择的文件过多!",reachedlmt:"已经达到限制数量!",ymsel:"每次最多同时选择n张图片",toobig:"文件大小不能超过10Mb!",zsize:"不能上传零字节文件!",invalid:"文件扩展名不正确!",unhandled:"未知错误!",uploading:"上传中...",complete:"上传完毕!",uperror:"上传失败!",upfailed:"上传失败!",IOerr:"IO错误!",securerr:"安全错误!",uplimit:"超出上传限制个数!",valfailed:"文件校验失败，上传取消!",canceled:"上传取消!",stoped:"上传停止!",uploaded:"个文件上传成功!",btn_cancel:"取消",btn_sure:"确定",processing:"处理中,请稍候..."};function fileQueued(C){try{var A=new FileProgress(C,this.customSettings.progressTarget);this.customSettings.progressInstanceArray.push(A);A.toggleCancel(true,this);}catch(B){this.debug(B);}}function fileQueueError(C,E,D){try{if(E===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert((D=="0"?swfupld_dic.reachedlmt:swfupld_dic.ymsel.replace("n",D)));return ;}var A=new FileProgress(C,this.customSettings.progressTarget);A.setError();switch(E){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:A.setStatus(swfupld_dic.toobig);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:A.setStatus(swfupld_dic.zsize);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:A.setStatus(swfupld_dic.invalid);break;default:if(C!==null){A.setStatus(swfupld_dic.unhandled);}break;}YAHOO.chatr.container.wait.show();}catch(B){this.debug(B);}}function fileDialogStart(){YUD.get(this.customSettings.progressTarget).innerHTML="";}function fileDialogComplete(B,D){SWFUpload.queue.uploadfiles=[];try{if(D>0){var A=document.getElementById("divStatus");A.innerHTML="正在上传中，请等待";YAHOO.chatr.container.wait.show();}this.startUpload();}catch(C){this.debug(C);}}function uploadStart(C){try{var A=new FileProgress(C,this.customSettings.progressTarget);A.toggleCancel(true,this);}catch(B){}return true;}function uploadProgress(C,F,E){try{var D=Math.ceil((F/E)*100);var A=new FileProgress(C,this.customSettings.progressTarget);A.setProgress(D);document.getElementById(this.customSettings.cancelButtonId).innerHTML=swfupld_dic.btn_cancel;if(D==100){}}catch(B){this.debug(B);}}function uploadSuccess(D,B){try{var A=new FileProgress(D,this.customSettings.progressTarget);A.setComplete();document.getElementById(this.customSettings.cancelButtonId).innerHTML=swfupld_dic.btn_sure;SWFUpload.queue.uploadfiles.push(B.trim());}catch(C){this.debug(C);}}function uploadError(C,E,D){try{var A=new FileProgress(C,this.customSettings.progressTarget);A.setError();document.getElementById(this.customSettings.cancelButtonId).innerHTML=swfupld_dic.btn_sure;switch(E){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:A.setStatus(swfupld_dic.uperror);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:A.setStatus(swfupld_dic.upfailed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:A.setStatus(swfupld_dic.IOerr);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:A.setStatus(swfupld_dic.securerr);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:A.setStatus(swfupld_dic.uplimit);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:A.setStatus(swfupld_dic.valfailed);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){}A.setStatus(swfupld_dic.canceled);A.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:A.setStatus(swfupld_dic.stoped);break;default:A.setStatus(swfupld_dic.unhandled+E);break;}}catch(B){this.debug(B);}}function uploadComplete(A){if(this.getStats().files_queued===0){this.customSettings.upSuccProc(SWFUpload.queue.uploadfiles);document.getElementById(this.customSettings.cancelButtonId).innerHTML=swfupld_dic.btn_sure;}}function queueComplete(B){var A=document.getElementById("divStatus");A.innerHTML=B+swfupld_dic.uploaded;}var right_type=[".gif",".jpg",".jpeg",".png",".tiff",".tif"];var checkImgType=function(B){var E=right_type.length;var G=B.toLowerCase();var C=G.length;var A=G.substring(C-4,C);var F=G.substring(C-5,C);var D=false;for(i=0;i<E;i++){if((A==right_type[i])||(F==right_type[i])){D=true;break;}else{D=false;}}if(D){return true;}else{alert("只支持: "+right_type.join("; ")+"格式！");return false;}};if(!YAHOO.chatr.iniSwfUploader){YAHOO.chatr.iniSwfUploader={};}YAHOO.chatr.iniSwfUploader=function(K,O,N,B,A,L){YAHOO.chatr.container.wait.setHeader('<div id="divStatus" class="ctmsgtitle">正在上传请等待</div>');var S='<fieldset class="uploadprogressCon" id="fsUploadProgress"></fieldset><div class="cancelUpbtn"><button id="btnCancel" type="cannel" class="default-btn-s2">取消</button></div>';YAHOO.chatr.container.wait.setBody("<div id='loadpbar' class='loadingpanel'>"+S+"</div>");YAHOO.chatr.container.wait.render(document.body);var E=this;var I=ismaxthon();E.hasProductInstall=swfobject.hasFlashPlayerVersion("9.0.45")&&!I;E.upSuccProc=K;O=O?O:0;N=N?N:"*.*";A=A?A:null;isdebug=L?true:false;var P=B.width?B.width:"100%";var H=B.height?B.height:"21";var C=B.id?B.id:"swfupbtn";var M=B.text?B.text:"";var F=B.style?B.style:"";var D=B.pl?B.pl:0;var R=B.pt?B.pt:0;var J=B.image?B.image:null;var Q=B.cursor?SWFUpload.CURSOR.HAND:SWFUpload.CURSOR.ARROW;var G=SWFUpload.BUTTON_ACTION.SELECT_FILES;if(parseInt(O,10)===1){G=SWFUpload.BUTTON_ACTION.SELECT_FILE;}if(E.hasProductInstall){this.settings={flash_url:"http://r.chatr.com.cn/images/swf/swfupload.swf",upload_url:"http://www.chetang.com/interface/upload/image_flash.php",post_params:A,file_size_limit:"10 MB",file_types:N,file_types_description:"Files",file_upload_limit:0,file_queue_limit:O,custom_settings:{progressTarget:"fsUploadProgress",cancelButtonId:"btnCancel",progressInstanceArray:[],upSuccProc:E.upSuccProc},debug:isdebug,button_width:P,button_height:H,button_placeholder_id:C,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,button_text:M,button_action:G,button_text_style:F,button_cursor:Q,button_image_url:J,button_text_left_padding:D,button_text_top_padding:R,file_queued_handler:fileQueued,file_queue_error_handler:fileQueueError,file_dialog_start_handler:fileDialogStart,file_dialog_complete_handler:fileDialogComplete,upload_start_handler:uploadStart,upload_progress_handler:uploadProgress,upload_error_handler:uploadError,upload_success_handler:uploadSuccess,upload_complete_handler:uploadComplete,queue_complete_handler:queueComplete};E.swfu=new SWFUpload(E.settings);}E.chkQuota=function(){return true;};E.browse=function(V){YUE.preventDefault(V);if(E.chkQuota()){var U="";if(A){U="?";for(key in A){if(A.hasOwnProperty(key)){U=[U,key,"=",A[key]+"&"].join("");}}}var T=encodeURI(["http://www.chetang.com/interface/fileup.php",U].join(""));YAHOO.chatr.container.wait.setHeader('<div class="ctmsgtitle">上传相片 <span id="upload_divStatus" class="upload_divStatus"></span></div>');YAHOO.chatr.container.wait.setBody('<div id="noflashupload" class=""><form id="noflashupform" method="post" action="" enctype="multipart/form-data"><input type="hidden" name="actionvalue" value="upload" /><input id="Filedata" type="file" name="Filedata" /><p class="hue">支持的图片格式：*.jpg，*.jpeg，*.gif，*.png</p></form><div id="fileuploading" style="visibility:hidden;"><img align="absmiddle" src="http://r.chatr.com.cn/images/spinner_grey.gif"> 相片上传中请稍候</div></div>');YAHOO.chatr.container.wait.setFooter('<div class="ctmsgbtn"><button id="uploadsurebtn" class="sure-btn-s2 mr5">上传</button><button id="uploadcancelbtn" class="default-btn-s2">取消</button></div>');YAHOO.chatr.container.wait.render(document.body);YAHOO.chatr.container.wait.show();YUE.addListener("uploadcancelbtn","click",function(W){E.cancelall();});YUE.addListener("uploadsurebtn","click",function(W){var X={upload:function(Z){YUD.setStyle("fileuploading","visibility","hidden");var Y=YAHOO.lang.JSON.parse(Z.responseText);E.upSuccProc([Y.message]);YAHOO.chatr.container.wait.hide();}};if(checkImgType(YUD.get("Filedata").value)){YUC.setForm("noflashupform",true);YUD.setStyle("fileuploading","visibility","visible");cObj=YUC.asyncRequest("POST","http://www.chetang.com/interface/upload/image_file.php",X,U);}});}else{alert("您的上传空间已经超额！");}};E.cancelall=function(){if(E.hasProductInstall){E.swfu.cancelQueue();}YAHOO.chatr.container.wait.hide();};YUE.addListener("btnCancel","click",E.cancelall);};