function initUploader(){var a=this;var b={flash_url:FILE_UPLOADER_SETTINGS.flash_path,flash9_url:FILE_UPLOADER_SETTINGS.flash_path_9,upload_url:FILE_UPLOADER_SETTINGS.uploader_path+"?PHPSESSIONID="+FILE_UPLOADER_SETTINGS.session_id+(FILE_UPLOADER_SETTINGS.x!=""?"&x="+FILE_UPLOADER_SETTINGS.x:""),file_size_limit:"25 MB",file_types:FILE_UPLOADER_SETTINGS.allow_extensions,file_types_description:words.file_uploader_file_description,file_upload_limit:0,file_queue_limit:1,custom_settings:{},post_params:{uf:FILE_UPLOADER_SETTINGS.uniq_id},debug:false,button_image_url:FILE_UPLOADER_SETTINGS.button_image_url,button_placeholder_id:"uploaderPlaceholder",button_width:FILE_UPLOADER_SETTINGS.button_width,button_height:FILE_UPLOADER_SETTINGS.button_height,button_text:"",button_text_left_padding:0,button_text_top_padding:0,button_window_mode:SWFUpload.WINDOW_MODE.WINDOW,button_cursor:SWFUpload.CURSOR.HAND,swfupload_loaded_handler:swfUploadLoaded,file_queued_handler:fileQueued,file_queue_error_handler:fileQueueError,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,minimum_flash_version:"9.0.28",swfupload_preload_handler:swfUploadPreLoad,swfupload_load_failed_handler:swfUploadLoadFailed};window.swfu=new SWFUpload(b)}function isUploaderAlreadyLoaded(){return $("[name=is_ajax_file_uploader]").length>0}function fileUploaderSetMethod(a){if(tplv=="f2"){changeActiveMethod()}else{if(tplv=="f6"){if(a){$("#"+FILE_UPLOADER_SETTINGS.custom_file_block_id).show()}}else{if(tplv=="f9"){setTimeout("$('[name=method]:checked').trigger('click');",100)}else{$("[name=method]:checked").trigger("click")}}}}function fileUploaderSetEnable(a){window.swfu.setButtonDisabled(!a)}function swfUploadPreLoad(){var a=this;var b=function(){$("#fileLoading").show();var c=function(){$("#fileLoading").hide();$("#fileLongLoading").show();$("#ajaxFileUploaderContainer").remove();fileUploaderSetMethod(true)};this.customSettings.loadingTimeout=setTimeout(function(){c.call(a)},15*1000)};this.customSettings.loadingTimeout=setTimeout(function(){b.call(a)},1*1000)}function swfUploadLoaded(){var a=this;clearTimeout(this.customSettings.loadingTimeout);$("#fileLoading").hide();$("#fileLongLoading").hide();$("#ajaxFileUploaderContainer").addClass("loaded");$("#uploaderPlaceholderContainer").removeClass("no-uploader-image");$("#"+FILE_UPLOADER_SETTINGS.custom_file_block_id).hide();if(!isUploaderAlreadyLoaded()){$("textarea[name=paper2]").after('<input type="hidden" name="is_ajax_file_uploader" value="1" />');fileUploaderSetMethod(false)}}function swfUploadLoadFailed(){clearTimeout(this.customSettings.loadingTimeout);$("#ajaxFileUploaderContainer").remove();fileUploaderSetMethod(true)}function fileQueued(b){try{fileUploaderSetEnable(false);if($("#ajaxFileTextarea").val()!=""){if($("#ajaxFileTextarea").is(":visible")&&!confirm(words.file_uploader_text_will_overwrite)){return false}$("#ajaxFileTextarea").val("")}$("#ajaxFileTextarea").hide();$("#"+FILE_UPLOADER_SETTINGS.container).addClass("progress").html("	<p>		<span><strong>"+words.file_uploader_uploading_progress+'</strong></span>	</p>	<div class="load"><b class="percent"></b><img src="'+FILE_UPLOADER_SETTINGS.image_loading+'"/></div>	<a href="#" class="up-action">'+words.file_uploader_cancel+"</a>");$("#"+FILE_UPLOADER_SETTINGS.container+" .up-action").click(function(){swfu.cancelUpload(b.id);return false}).show()}catch(a){alert(a)}}function uploadProgress(c,f,e){try{var d=Math.ceil((f/e)*100);var a=d+"%";$("#"+FILE_UPLOADER_SETTINGS.container+" b.percent").html(a);$("#"+FILE_UPLOADER_SETTINGS.container+" p span").css("width",a);if(f==e){$("#"+FILE_UPLOADER_SETTINGS.container+" .up-action").hide()}}catch(b){this.debug(b)}}function uploadErrorMsg(b,a){$("#"+FILE_UPLOADER_SETTINGS.container).html("<p> &nbsp; "+words.file_uploader_not_uploaded_file+"</p>");if(a){alert(words.file_uploader_error.replace("%text%",b))}}function fileQueueError(b,d,c){try{fileUploaderSetEnable(true);if(d===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(c===0?"You have reached the upload limit.":"You may select "+(c>1?"up to "+c+" files.":"one file.")));return}switch(d){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:uploadErrorMsg("File is too big.",true);this.debug("Error Code: File too big, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:uploadErrorMsg("Cannot upload Zero Byte files.",true);this.debug("Error Code: Zero byte file, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:uploadErrorMsg("Invalid File Type.",true);this.debug("Error Code: Invalid File Type, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;default:if(b!==null){uploadErrorMsg("Unhandled Error",true)}this.debug("Error Code: "+d+", File name: "+b.name+", File size: "+b.size+", Message: "+c);break}}catch(a){this.debug(a)}}function fileDialogComplete(a,c){try{this.startUpload()}catch(b){this.debug(b)}}function uploadStart(a){return true}function uploadGetContent(a){$("input[name=uf]").val(FILE_UPLOADER_SETTINGS.uniq_id);if(FILE_UPLOADER_SETTINGS.is_adeptol){$("#"+FILE_UPLOADER_SETTINGS.container).removeClass("progress").html("<p><span>"+words.file_uploader_uploaded_success.replace("%file%"," <strong>&nbsp;"+a.name+"</strong> ")+"</span></p>");fileUploaderSetEnable(true)}else{$.ajax({type:"POST",url:FILE_UPLOADER_SETTINGS.uploader_path,cache:false,data:{action:"get_content",uf:FILE_UPLOADER_SETTINGS.uniq_id},dataType:"html",error:function(b,d,c){alert("HTTP Status:"+d);fileUploaderSetEnable(true)},success:function(b,c){$("#"+FILE_UPLOADER_SETTINGS.container).removeClass("progress").html("<p><span>"+words.file_uploader_uploaded_success.replace("%file%"," <strong>&nbsp;"+a.name+"</strong> ")+"</span></p>");$("#ajaxFileTextarea").val(b).show().focus();fileUploaderSetEnable(true)}})}}function uploadSuccess(c,a){try{if(a=="1"||a==""){$("#"+FILE_UPLOADER_SETTINGS.container+" p span").html(words.file_uploader_load_content.replace("%file%","<strong>"+c.name+"</strong>&nbsp;"));$("#"+FILE_UPLOADER_SETTINGS.container+" b.percent").html("");if($.browser.msie==true&&a==""){$.ajax({type:"POST",url:FILE_UPLOADER_SETTINGS.uploader_path,cache:false,data:{action:"get_error",uf:FILE_UPLOADER_SETTINGS.uniq_id},dataType:"text",error:function(d,f,e){fileUploaderSetEnable(true);alert("HTTP status:"+f)},success:function(d,e){if(d!="1"){fileUploaderSetEnable(true);alert("Data:"+d)}else{uploadGetContent(c)}}})}else{uploadGetContent(c)}}else{uploadErrorMsg(a,true);fileUploaderSetEnable(true)}}catch(b){this.debug(b)}}function uploadError(b,d,c){fileUploaderSetEnable(true);try{switch(d){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:uploadErrorMsg("Upload Error: "+c,true);this.debug("Error Code: HTTP Error, File name: "+b.name+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:uploadErrorMsg("Upload Failed.",true);this.debug("Error Code: Upload Failed, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:uploadErrorMsg("Server (IO) Error",true);this.debug("Error Code: IO Error, File name: "+b.name+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:uploadErrorMsg("Security Error",true);this.debug("Error Code: Security Error, File name: "+b.name+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:uploadErrorMsg("Upload limit exceeded.",true);this.debug("Error Code: Upload Limit Exceeded, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:uploadErrorMsg("Failed Validation.  Upload skipped.",true);this.debug("Error Code: File Validation Failed, File name: "+b.name+", File size: "+b.size+", Message: "+c);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){}uploadErrorMsg(words.file_uploader_cancelled,false);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:uploadErrorMsg("Stopped",true);break;default:uploadErrorMsg("Unhandled Error: "+d,true);this.debug("Error Code: "+d+", File name: "+b.name+", File size: "+b.size+", Message: "+c);break}}catch(a){this.debug(a)}}function uploadComplete(a){if(this.getStats().files_queued===0){}}function queueComplete(a){};