var SWFUpload;
if(SWFUpload==undefined){
SWFUpload=function(_1){
this.initSWFUpload(_1);
};
}
SWFUpload.prototype.initSWFUpload=function(_2){
try{
this.customSettings={};
this.settings=_2;
this.eventQueue=[];
this.movieName="SWFUpload_"+SWFUpload.movieCount++;
this.movieElement=null;
SWFUpload.instances[this.movieName]=this;
this.initSettings();
this.loadFlash();
this.displayDebugInfo();
}
catch(ex){
delete SWFUpload.instances[this.movieName];
throw ex;
}
};
SWFUpload.instances={};
SWFUpload.movieCount=0;
SWFUpload.version="2.2.0 Beta 3";
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(_3,_4){
this.settings[_3]=(this.settings[_3]==undefined)?_4:this.settings[_3];
};
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",null);
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+"?swfuploadrnd="+Math.floor(Math.random()*999999999);
}
delete this.ensureDefault;
};
SWFUpload.prototype.loadFlash=function(){
if(this.settings.button_placeholder_id!==""){
this.replaceWithFlash();
}else{
this.appendFlash();
}
};
SWFUpload.prototype.appendFlash=function(){
var _5,_6;
if(document.getElementById(this.movieName)!==null){
throw "ID "+this.movieName+" is already in use. The Flash Object could not be added";
}
_5=document.getElementsByTagName("body")[0];
if(_5==undefined){
throw "Could not find the 'body' element.";
}
_6=document.createElement("div");
_6.style.width="1px";
_6.style.height="1px";
_6.style.overflow="hidden";
_5.appendChild(_6);
_6.innerHTML=this.getFlashHTML();
if(window[this.movieName]==undefined){
window[this.movieName]=this.getMovieElement();
}
};
SWFUpload.prototype.replaceWithFlash=function(){
var _7,_8;
if(document.getElementById(this.movieName)!==null){
throw "ID "+this.movieName+" is already in use. The Flash Object could not be added";
}
_7=document.getElementById(this.settings.button_placeholder_id);
if(_7==undefined){
throw "Could not find the placeholder element.";
}
_8=document.createElement("div");
_8.innerHTML=this.getFlashHTML();
_7.parentNode.replaceChild(_8.firstChild,_7);
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 _9=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(_9),"&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 _b=this.settings.post_params;
var _c=[];
if(typeof (_b)==="object"){
for(var _d in _b){
if(_b.hasOwnProperty(_d)){
_c.push(encodeURIComponent(_d.toString())+"="+encodeURIComponent(_b[_d].toString()));
}
}
}
return _c.join("&amp;");
};
SWFUpload.prototype.destroy=function(){
try{
this.cancelUpload(null,false);
var _e=null;
_e=this.getMovieElement();
if(_e){
for(var i in _e){
try{
if(typeof (_e[i])==="function"){
_e[i]=null;
}
}
catch(ex1){
}
}
try{
_e.parentNode.removeChild(_e);
}
catch(ex){
}
}
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(ex1){
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(_10,_11,_12){
if(_11==undefined){
return (this.settings[_10]=_12);
}else{
return (this.settings[_10]=_11);
}
};
SWFUpload.prototype.getSetting=function(_13){
if(this.settings[_13]!=undefined){
return this.settings[_13];
}
return "";
};
SWFUpload.prototype.callFlash=function(_14,_15){
_15=_15||[];
var _16=this.getMovieElement();
var _17,_18;
try{
_18=_16.CallFunction("<invoke name=\""+_14+"\" returntype=\"javascript\">"+__flash__argumentsToXML(_15,0)+"</invoke>");
_17=eval(_18);
}
catch(ex){
throw "Call to "+_14+" failed";
}
if(_17!=undefined&&typeof _17.post==="object"){
_17=this.unescapeFilePostParams(_17);
}
return _17;
};
SWFUpload.prototype.selectFile=function(){
this.callFlash("SelectFile");
};
SWFUpload.prototype.selectFiles=function(){
this.callFlash("SelectFiles");
};
SWFUpload.prototype.startUpload=function(_19){
this.callFlash("StartUpload",[_19]);
};
SWFUpload.prototype.cancelUpload=function(_1a,_1b){
if(_1b!==false){
_1b=true;
}
this.callFlash("CancelUpload",[_1a,_1b]);
};
SWFUpload.prototype.stopUpload=function(){
this.callFlash("StopUpload");
};
SWFUpload.prototype.getStats=function(){
return this.callFlash("GetStats");
};
SWFUpload.prototype.setStats=function(_1c){
this.callFlash("SetStats",[_1c]);
};
SWFUpload.prototype.getFile=function(_1d){
if(typeof (_1d)==="number"){
return this.callFlash("GetFileByIndex",[_1d]);
}else{
return this.callFlash("GetFile",[_1d]);
}
};
SWFUpload.prototype.addFileParam=function(_1e,_1f,_20){
return this.callFlash("AddFileParam",[_1e,_1f,_20]);
};
SWFUpload.prototype.removeFileParam=function(_21,_22){
this.callFlash("RemoveFileParam",[_21,_22]);
};
SWFUpload.prototype.setUploadURL=function(url){
this.settings.upload_url=url.toString();
this.callFlash("SetUploadURL",[url]);
};
SWFUpload.prototype.setPostParams=function(_24){
this.settings.post_params=_24;
this.callFlash("SetPostParams",[_24]);
};
SWFUpload.prototype.addPostParam=function(_25,_26){
this.settings.post_params[_25]=_26;
this.callFlash("SetPostParams",[this.settings.post_params]);
};
SWFUpload.prototype.removePostParam=function(_27){
delete this.settings.post_params[_27];
this.callFlash("SetPostParams",[this.settings.post_params]);
};
SWFUpload.prototype.setFileTypes=function(_28,_29){
this.settings.file_types=_28;
this.settings.file_types_description=_29;
this.callFlash("SetFileTypes",[_28,_29]);
};
SWFUpload.prototype.setFileSizeLimit=function(_2a){
this.settings.file_size_limit=_2a;
this.callFlash("SetFileSizeLimit",[_2a]);
};
SWFUpload.prototype.setFileUploadLimit=function(_2b){
this.settings.file_upload_limit=_2b;
this.callFlash("SetFileUploadLimit",[_2b]);
};
SWFUpload.prototype.setFileQueueLimit=function(_2c){
this.settings.file_queue_limit=_2c;
this.callFlash("SetFileQueueLimit",[_2c]);
};
SWFUpload.prototype.setFilePostName=function(_2d){
this.settings.file_post_name=_2d;
this.callFlash("SetFilePostName",[_2d]);
};
SWFUpload.prototype.setUseQueryString=function(_2e){
this.settings.use_query_string=_2e;
this.callFlash("SetUseQueryString",[_2e]);
};
SWFUpload.prototype.setRequeueOnError=function(_2f){
this.settings.requeue_on_error=_2f;
this.callFlash("SetRequeueOnError",[_2f]);
};
SWFUpload.prototype.setHTTPSuccess=function(_30){
if(typeof _30==="string"){
_30=_30.replace(" ","").split(",");
}
this.settings.http_success=_30;
this.callFlash("SetHTTPSuccess",[_30]);
};
SWFUpload.prototype.setDebugEnabled=function(_31){
this.settings.debug_enabled=_31;
this.callFlash("SetDebugEnabled",[_31]);
};
SWFUpload.prototype.setButtonImageURL=function(_32){
if(_32==undefined){
_32="";
}
this.settings.button_image_url=_32;
this.callFlash("SetButtonImageURL",[_32]);
};
SWFUpload.prototype.setButtonDimensions=function(_33,_34){
this.settings.button_width=_33;
this.settings.button_height=_34;
var _35=this.getMovieElement();
if(_35!=undefined){
_35.style.width=_33+"px";
_35.style.height=_34+"px";
}
this.callFlash("SetButtonDimensions",[_33,_34]);
};
SWFUpload.prototype.setButtonText=function(_36){
this.settings.button_text=_36;
this.callFlash("SetButtonText",[_36]);
};
SWFUpload.prototype.setButtonTextPadding=function(_37,top){
this.settings.button_text_top_padding=top;
this.settings.button_text_left_padding=_37;
this.callFlash("SetButtonTextPadding",[_37,top]);
};
SWFUpload.prototype.setButtonTextStyle=function(css){
this.settings.button_text_style=css;
this.callFlash("SetButtonTextStyle",[css]);
};
SWFUpload.prototype.setButtonDisabled=function(_3a){
this.settings.button_disabled=_3a;
this.callFlash("SetButtonDisabled",[_3a]);
};
SWFUpload.prototype.setButtonAction=function(_3b){
this.settings.button_action=_3b;
this.callFlash("SetButtonAction",[_3b]);
};
SWFUpload.prototype.setButtonCursor=function(_3c){
this.settings.button_cursor=_3c;
this.callFlash("SetButtonCursor",[_3c]);
};
SWFUpload.prototype.queueEvent=function(_3d,_3e){
if(_3e==undefined){
_3e=[];
}else{
if(!(_3e instanceof Array)){
_3e=[_3e];
}
}
var _3f=this;
if(typeof this.settings[_3d]==="function"){
this.eventQueue.push(function(){
this.settings[_3d].apply(this,_3e);
});
setTimeout(function(){
_3f.executeNextEvent();
},0);
}else{
if(this.settings[_3d]!==null){
throw "Event handler "+_3d+" is unknown or is not a function";
}
}
};
SWFUpload.prototype.executeNextEvent=function(){
var f=this.eventQueue?this.eventQueue.shift():null;
if(typeof (f)==="function"){
f.apply(this);
}
};
SWFUpload.prototype.unescapeFilePostParams=function(_41){
var reg=/[$]([0-9a-f]{4})/i;
var _43={};
var uk;
if(_41!=undefined){
for(var k in _41.post){
if(_41.post.hasOwnProperty(k)){
uk=k;
var _46;
while((_46=reg.exec(uk))!==null){
uk=uk.replace(_46[0],String.fromCharCode(parseInt("0x"+_46[1],16)));
}
_43[uk]=_41.post[k];
}
}
_41.post=_43;
}
return _41;
};
SWFUpload.prototype.flashReady=function(){
var _47=this.getMovieElement();
if(typeof (_47.CallFunction)==="unknown"){
this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
for(var key in _47){
try{
if(typeof (_47[key])==="function"){
_47[key]=null;
}
}
catch(ex){
}
}
}
this.queueEvent("swfupload_loaded_handler");
};
SWFUpload.prototype.fileDialogStart=function(){
this.queueEvent("file_dialog_start_handler");
};
SWFUpload.prototype.fileQueued=function(_49){
_49=this.unescapeFilePostParams(_49);
this.queueEvent("file_queued_handler",_49);
};
SWFUpload.prototype.fileQueueError=function(_4a,_4b,_4c){
_4a=this.unescapeFilePostParams(_4a);
this.queueEvent("file_queue_error_handler",[_4a,_4b,_4c]);
};
SWFUpload.prototype.fileDialogComplete=function(_4d,_4e){
this.queueEvent("file_dialog_complete_handler",[_4d,_4e]);
};
SWFUpload.prototype.uploadStart=function(_4f){
_4f=this.unescapeFilePostParams(_4f);
this.queueEvent("return_upload_start_handler",_4f);
};
SWFUpload.prototype.returnUploadStart=function(_50){
var _51;
if(typeof this.settings.upload_start_handler==="function"){
_50=this.unescapeFilePostParams(_50);
_51=this.settings.upload_start_handler.call(this,_50);
}else{
if(this.settings.upload_start_handler!=undefined){
throw "upload_start_handler must be a function";
}
}
if(_51===undefined){
_51=true;
}
_51=!!_51;
this.callFlash("ReturnUploadStart",[_51]);
};
SWFUpload.prototype.uploadProgress=function(_52,_53,_54){
_52=this.unescapeFilePostParams(_52);
this.queueEvent("upload_progress_handler",[_52,_53,_54]);
};
SWFUpload.prototype.uploadError=function(_55,_56,_57){
_55=this.unescapeFilePostParams(_55);
this.queueEvent("upload_error_handler",[_55,_56,_57]);
};
SWFUpload.prototype.uploadSuccess=function(_58,_59){
_58=this.unescapeFilePostParams(_58);
this.queueEvent("upload_success_handler",[_58,_59]);
};
SWFUpload.prototype.uploadComplete=function(_5a){
_5a=this.unescapeFilePostParams(_5a);
this.queueEvent("upload_complete_handler",_5a);
};
SWFUpload.prototype.debug=function(_5b){
this.queueEvent("debug_handler",_5b);
};
SWFUpload.prototype.debugMessage=function(_5c){
if(this.settings.debug){
var _5d,_5e=[];
if(typeof _5c==="object"&&typeof _5c.name==="string"&&typeof _5c.message==="string"){
for(var key in _5c){
if(_5c.hasOwnProperty(key)){
_5e.push(key+": "+_5c[key]);
}
}
_5d=_5e.join("\n")||"";
_5e=_5d.split("\n");
_5d="EXCEPTION: "+_5e.join("\nEXCEPTION: ");
SWFUpload.Console.writeLine(_5d);
}else{
SWFUpload.Console.writeLine(_5c);
}
}
};
SWFUpload.Console={};
SWFUpload.Console.writeLine=function(_60){
var _61,_62;
try{
_61=document.getElementById("SWFUpload_Console");
if(!_61){
_62=document.createElement("form");
document.getElementsByTagName("body")[0].appendChild(_62);
_61=document.createElement("textarea");
_61.id="SWFUpload_Console";
_61.style.fontFamily="monospace";
_61.setAttribute("wrap","off");
_61.wrap="off";
_61.style.overflow="auto";
_61.style.width="700px";
_61.style.height="350px";
_61.style.margin="5px";
_62.appendChild(_61);
}
_61.value+=_60+"\n";
_61.scrollTop=_61.scrollHeight-_61.clientHeight;
}
catch(ex){
alert("Exception: "+ex.name+" Message: "+ex.message);
}
};
var SWFUpload;
if(typeof (SWFUpload)==="function"){
SWFUpload.queue={};
SWFUpload.prototype.initSettings=(function(_63){
return function(){
if(typeof (_63)==="function"){
_63.call(this);
}
this.customSettings.queue_cancelled_flag=false;
this.customSettings.queue_upload_count=0;
this.settings.user_upload_complete_handler=this.settings.upload_complete_handler;
this.settings.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(_64){
this.customSettings.queue_cancelled_flag=false;
this.callFlash("StartUpload",[_64]);
};
SWFUpload.prototype.cancelQueue=function(){
this.customSettings.queue_cancelled_flag=true;
this.stopUpload();
var _65=this.getStats();
while(_65.files_queued>0){
this.cancelUpload();
_65=this.getStats();
}
};
SWFUpload.queue.uploadStartHandler=function(_66){
var _67;
if(typeof (this.customSettings.user_upload_start_handler)==="function"){
_67=this.customSettings.user_upload_start_handler.call(this,_66);
}
_67=(_67===false)?false:true;
this.customSettings.queue_cancelled_flag=!_67;
return _67;
};
SWFUpload.queue.uploadCompleteHandler=function(_68){
var _69=this.settings.user_upload_complete_handler;
var _6a;
if(_68.filestatus===SWFUpload.FILE_STATUS.COMPLETE){
this.customSettings.queue_upload_count++;
}
if(typeof (_69)==="function"){
_6a=(_69.call(this,_68)===false)?false:true;
}else{
_6a=true;
}
if(_6a){
var _6b=this.getStats();
if(_6b.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(_6c,_6d){
this.fileProgressID=_6c.id;
this.opacity=100;
this.height=0;
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 _6e=document.createElement("a");
_6e.className="progressCancel";
_6e.href="#";
_6e.style.visibility="hidden";
_6e.appendChild(document.createTextNode(" "));
var _6f=document.createElement("div");
_6f.className="progressName";
_6f.appendChild(document.createTextNode(_6c.name));
var _70=document.createElement("div");
_70.className="progressBarInProgress";
var _71=document.createElement("div");
_71.className="progressBarStatus";
_71.innerHTML="&nbsp;";
this.fileProgressElement.appendChild(_6e);
this.fileProgressElement.appendChild(_6f);
this.fileProgressElement.appendChild(_71);
this.fileProgressElement.appendChild(_70);
this.fileProgressWrapper.appendChild(this.fileProgressElement);
document.getElementById(_6d).appendChild(this.fileProgressWrapper);
}else{
this.fileProgressElement=this.fileProgressWrapper.firstChild;
}
this.height=this.fileProgressWrapper.offsetHeight;
};
FileProgress.prototype.setProgress=function(_72){
this.fileProgressElement.className="progressContainer green";
this.fileProgressElement.childNodes[3].className="progressBarInProgress";
this.fileProgressElement.childNodes[3].style.width=_72+"%";
};
FileProgress.prototype.setComplete=function(){
this.fileProgressElement.className="progressContainer blue";
this.fileProgressElement.childNodes[3].className="progressBarComplete";
this.fileProgressElement.childNodes[3].style.width="";
var _73=this;
setTimeout(function(){
_73.disappear();
},10000);
};
FileProgress.prototype.setError=function(){
this.fileProgressElement.className="progressContainer red";
this.fileProgressElement.childNodes[3].className="progressBarError";
this.fileProgressElement.childNodes[3].style.width="";
var _74=this;
setTimeout(function(){
_74.disappear();
},5000);
};
FileProgress.prototype.setCancelled=function(){
this.fileProgressElement.className="progressContainer";
this.fileProgressElement.childNodes[3].className="progressBarError";
this.fileProgressElement.childNodes[3].style.width="";
var _75=this;
setTimeout(function(){
_75.disappear();
},2000);
};
FileProgress.prototype.setStatus=function(_76){
this.fileProgressElement.childNodes[2].innerHTML=_76;
};
FileProgress.prototype.toggleCancel=function(_77,_78){
this.fileProgressElement.childNodes[0].style.visibility=_77?"visible":"hidden";
if(_78){
var _79=this.fileProgressID;
this.fileProgressElement.childNodes[0].onclick=function(){
_78.cancelUpload(_79);
return false;
};
}
};
FileProgress.prototype.disappear=function(){
var _7a=15;
var _7b=4;
var _7c=30;
if(this.opacity>0){
this.opacity-=_7a;
if(this.opacity<0){
this.opacity=0;
}
if(this.fileProgressWrapper.filters){
try{
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=this.opacity;
}
catch(e){
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-=_7b;
if(this.height<0){
this.height=0;
}
this.fileProgressWrapper.style.height=this.height+"px";
}
if(this.height>0||this.opacity>0){
var _7d=this;
setTimeout(function(){
_7d.disappear();
},_7c);
}else{
this.fileProgressWrapper.style.display="none";
}
};
function cancelQueue(_7e){
document.getElementById(_7e.customSettings.cancelButtonId).disabled=true;
_7e.stopUpload();
var _7f;
do{
_7f=_7e.getStats();
_7e.cancelUpload();
}while(_7f.files_queued!==0);
};
function fileDialogStart(){
};
function fileQueued(_80){
try{
var _81=new FileProgress(_80,this.customSettings.progressTarget);
_81.setStatus("Pending...");
_81.toggleCancel(true,this);
}
catch(ex){
this.debug(ex);
}
};
function fileQueueError(_82,_83,_84){
try{
if(_83===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){
alert("You have attempted to queue too many files.\n"+(_84===0?"You have reached the upload limit.":"You may select "+(_84>1?"up to "+_84+" files.":"one file.")));
return;
}
var _85=new FileProgress(_82,this.customSettings.progressTarget);
_85.setError();
_85.toggleCancel(false);
switch(_83){
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
_85.setStatus("File is too big.");
this.debug("Error Code: File too big, File name: "+_82.name+", File size: "+_82.size+", Message: "+_84);
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
_85.setStatus("Cannot upload Zero Byte files.");
this.debug("Error Code: Zero byte file, File name: "+_82.name+", File size: "+_82.size+", Message: "+_84);
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
_85.setStatus("Invalid File Type.");
this.debug("Error Code: Invalid File Type, File name: "+_82.name+", File size: "+_82.size+", Message: "+_84);
break;
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
alert("You have selected too many files.  "+(_84>1?"You may only add "+_84+" more files":"You cannot add any more files."));
break;
default:
if(_82!==null){
_85.setStatus("Unhandled Error");
}
this.debug("Error Code: "+_83+", File name: "+_82.name+", File size: "+_82.size+", Message: "+_84);
break;
}
}
catch(ex){
this.debug(ex);
}
};
function fileDialogComplete(_86,_87){
try{
if(this.getStats().files_queued>0){
document.getElementById(this.customSettings.cancelButtonId).disabled=false;
}
this.startUpload();
}
catch(ex){
this.debug(ex);
}
};
function uploadStart(_88){
try{
var _89=new FileProgress(_88,this.customSettings.progressTarget);
_89.setStatus("Uploading...");
_89.toggleCancel(true,this);
}
catch(ex){
}
return true;
};
function uploadProgress(_8a,_8b,_8c){
try{
var _8d=Math.ceil((_8b/_8c)*100);
var _8e=new FileProgress(_8a,this.customSettings.progressTarget);
_8e.setProgress(_8d);
_8e.setStatus("Uploading...");
}
catch(ex){
this.debug(ex);
}
};
function uploadSuccess(_8f,_90){
try{
var _91=new FileProgress(_8f,this.customSettings.progressTarget);
_91.setComplete();
_91.setStatus("Complete.");
_91.toggleCancel(false);
dspdata(_90);
}
catch(ex){
this.debug(ex);
}
};
function dspdata(_92){
document.getElementById("fimg").value=_92;
};
var number=0;
function uploadComplete(_93){
var _94=document.getElementById("fimg").value;
var _95=document.getElementById("foldimg").value;
var _96="http://www.imagesplace.net/";
var _97=document.getElementById("displaycodes");
var _98=document.createElement("div");
_97.appendChild(_98);
_98.setAttribute("id",number);
var _99=document.getElementById(number);
if(_94!=_95){
forWebsite=websiteCodes();
forForum=forumCodes();
forEmail=emailCodes();
var _9a=document.getElementById("divStatus");
_9a.innerHTML="<div id='imagecodes'><div id='box1'><textarea onclick='javascript:this.focus();this.select();'>"+forWebsite+"</textarea><br />For Websites</div><div id='box2'><textarea  onclick='javascript:this.focus();this.select();'>"+forForum+"</textarea><br />For Forums</div><div id='box3'><div id='box3'><textarea  onclick='javascript:this.focus();this.select();'>"+forEmail+"</textarea><br />For Email</div></div><p id='clear'></p>";
var _9b="<div id='thumbnailbox'><a id='thumbpic' href='gallery.php?entry=images/"+_94+"'><img src='thumbs/"+_94+"' /></a><ul><li><p>Hotlink a clickable thumbnail on websites</p><input type='text' value='&lt;a href=&quot;"+_96+"gallery.php?entry=images/"+_94+"&quot;&gt;&lt;img src=&quot;"+_96+"thumbs/"+_94+"&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;' onclick='javascript:this.focus();this.select();' /></li><li><p>Hotlink a clickable thumbnail on forums</p><input type='text' value='[url="+_96+"gallery.php?entry=images/"+_94+"][img]"+_96+"thumbs/"+_94+"[/img][/url]' onclick='javascript:this.focus();this.select();' /></li><li><p>Share with friends via email/Instant Messanger</p><input type='text' value='"+_96+"gallery.php?entry=images/"+_94+"'  onclick='javascript:this.focus();this.select();' /></li></ul><span id='filename'>"+_94+"</span></div>";
_99.innerHTML=_9b;
document.getElementById("foldimg").value=_94;
}
number++;
};
function websiteCodes(){
var _9c=document.getElementById("fimg").value;
var _9d="http://www.imagesplace.net/";
var _9e=document.getElementById("g_wcode").value;
var _9f="<a href='"+_9d+"gallery.php?entry=images/"+_9c+"'><img src='"+_9d+"thumbs/"+_9c+"' alt='' /></a>";
var _a0=_9e+_9f;
document.getElementById("g_wcode").value=_a0;
return _a0;
};
function forumCodes(){
var _a1=document.getElementById("fimg").value;
var _a2="http://www.imagesplace.net/";
var _a3=document.getElementById("g_forcode").value;
var _a4="[url="+_a2+"gallery.php?entry=images/"+_a1+"][img]"+_a2+"thumbs/"+_a1+"[/img][/url]";
var _a5=_a3+_a4;
document.getElementById("g_forcode").value=_a5;
return _a5;
};
function emailCodes(){
var _a6=document.getElementById("fimg").value;
var _a7="http://www.imagesplace.net/";
var _a8=document.getElementById("g_emcode").value;
var _a9=_a7+"gallery.php?entry=images/"+_a6;
var _aa=_a8+"\r\n"+_a9;
document.getElementById("g_emcode").value=_aa;
return _aa;
};
function queueComplete(_ab){
};
function uploadError(_ac,_ad,_ae){
try{
var _af=new FileProgress(_ac,this.customSettings.progressTarget);
_af.setError();
_af.toggleCancel(false);
switch(_ad){
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
_af.setStatus("Upload Error: "+_ae);
this.debug("Error Code: HTTP Error, File name: "+_ac.name+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
_af.setStatus("Configuration Error");
this.debug("Error Code: No backend file, File name: "+_ac.name+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
_af.setStatus("Upload Failed.");
this.debug("Error Code: Upload Failed, File name: "+_ac.name+", File size: "+_ac.size+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
_af.setStatus("Server (IO) Error");
this.debug("Error Code: IO Error, File name: "+_ac.name+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
_af.setStatus("Security Error");
this.debug("Error Code: Security Error, File name: "+_ac.name+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
_af.setStatus("Upload limit exceeded.");
this.debug("Error Code: Upload Limit Exceeded, File name: "+_ac.name+", File size: "+_ac.size+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
_af.setStatus("File not found.");
this.debug("Error Code: The file was not found, File name: "+_ac.name+", File size: "+_ac.size+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
_af.setStatus("Failed Validation.  Upload skipped.");
this.debug("Error Code: File Validation Failed, File name: "+_ac.name+", File size: "+_ac.size+", Message: "+_ae);
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
if(this.getStats().files_queued===0){
document.getElementById(this.customSettings.cancelButtonId).disabled=true;
}
_af.setStatus("Cancelled");
_af.setCancelled();
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
_af.setStatus("Stopped");
break;
default:
_af.setStatus("Unhandled Error: "+error_code);
this.debug("Error Code: "+_ad+", File name: "+_ac.name+", File size: "+_ac.size+", Message: "+_ae);
break;
}
}
catch(ex){
this.debug(ex);
}
};

