$(function(){var d=$(".comments .add-comment");var c=d.find(".comment-text");var e=d.find(".button");bindAddCommentElEvents(d);var b=$(".comments .reply-comment");var a=b.find(".comment-text");bindAddCommentElEvents(b);e.click(function(){if(c.val()!=""&&c.val()!=c.attr("title")){$.ajax({type:"POST",url:commentsSettings.addCommentUrl,dataType:"html",data:{targetContentUUID:commentsSettings.targetContentUUID,text:c.val(),pageSize:commentsSettings.pageSize,reverseSort:commentsSettings.reverseSort},beforeSend:function(){d.children().attr("disabled","disabled")},success:function(f){hideReply();$(".comments .comments-list").html(f);c.val("");c.blur();d.children().removeAttr("disabled")},error:function(g,f,h){alert(f)}})}})});function bindAddCommentElEvents(b){var a=b.find(".comment-text");var c=b.find(".button");a.val(a.attr("title"));a.focus(function(){if($(this).val()===$(this).attr("title")){$(this).val("");$(this).animate({height:"70px"},500);c.fadeIn(500);$(this).toggleClass("active")}}).blur(function(){if($(this).val()===""&&$(this).hasClass("active")){$(this).val($(this).attr("title"));$(this).animate({height:"30px"},500);c.fadeOut(500);$(this).toggleClass("active")}})}function showComments(a){$.ajax({type:"POST",url:commentsSettings.commentsListUrl,dataType:"html",data:{targetContentUUID:commentsSettings.targetContentUUID,pageIndex:a,pageSize:commentsSettings.pageSize,reverseSort:commentsSettings.reverseSort},success:function(b){$(".comments .comments-list").html(b)},error:function(c,b,d){alert(b)}})}function replyComment(a,d,c){var b=$(".comments .reply-comment");$(d).append(b);var e=b.find(".comment-text");var f=b.find(".button");f.unbind("click").click(function(){if(e.val()!=""){$.ajax({type:"POST",url:commentsSettings.replyCommentUrl,dataType:"html",data:{targetContentUUID:commentsSettings.targetContentUUID,commentUUID:a,text:e.val(),pageSize:commentsSettings.pageSize,pageIndex:c,reverseSort:commentsSettings.reverseSort},beforeSend:function(){b.children().attr("disabled","disabled")},success:function(g){e.val("");hideReply();$(".comments .comments-list").html(g)},error:function(h,g,i){alert(g)}})}});b.children().removeAttr("disabled");b.show()}function editComment(b,e,d,k){d.find(".actions").hide();var g=$(d).find(".text");$("#button-more-"+e).remove();var f=$("#preview-"+e).html();var a=$("#rest-"+e).html();var h=null;if(f!=null&&a!=null){h=(f+a)}else{h=g.html()}h=h.replace(commentsSettings.wbr,"").replace(commentsSettings.brRegex,"\n").replace(commentsSettings.brRegexIE,"\n");var j=$("<div class='text-edit'><textarea class='edit' cols='20' rows='7'></textarea><input type='button' class='button' value='Done' /></div>");var i=j.find(".button");var c=j.find(".edit");c.val(h);i.click(function(){if(jQuery.trim(c.val())!=""){$.ajax({type:"POST",url:commentsSettings.editCommentUrl,dataType:"json",data:{commentTargetContentUUID:b,commentUUID:e,text:jQuery.trim(c.val()),pageSize:commentsSettings.pageSize,pageIndex:k},success:function(l){j.remove();g.html(l);g.show();d.find(".actions").show()},error:function(m,l,n){alert(l)}})}else{showNotification("Comment cannot be empty!")}});c.width(g.width());g.hide();g.before(j)}function flagComment(a,b,c){$.ajax({type:"POST",url:commentsSettings.flagCommentUrl,dataType:"html",data:{commentTargetContentUUID:a,commentUUID:b},success:function(d){c.html("Flagged");c.addClass("active")},error:function(e,d,f){alert(d)}})}function deleteComment(a,b,c){$.ajax({type:"POST",url:commentsSettings.deleteCommentUrl,dataType:"html",data:{targetContentUUID:commentsSettings.targetContentUUID,commentTargetContentUUID:a,commentUUID:b,pageSize:commentsSettings.pageSize,pageIndex:c,reverseSort:commentsSettings.reverseSort},success:function(d){$(".comments .comments-list").html(d)},error:function(e,d,f){alert(d)}})}function hideReply(){var a=$(".comments .comments-list .reply-comment");if(a.length>0){var b=a.find(".comment-text");b.blur();a.hide();a.children().removeAttr("disabled");$(".comments .body").append(a)}};
function FileProgress(f,a){this.fileProgressID=f.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 c=document.createElement("a");c.className="progressCancel";c.href="#";c.style.visibility="hidden";c.appendChild(document.createTextNode(" "));var d=document.createElement("div");d.className="progressName";d.appendChild(document.createTextNode(f.name));var b=document.createElement("div");b.className="progressBarInProgress";var e=document.createElement("div");e.className="progressBarStatus";e.innerHTML="&nbsp;";this.fileProgressElement.appendChild(c);this.fileProgressElement.appendChild(d);this.fileProgressElement.appendChild(e);this.fileProgressElement.appendChild(b);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[2].innerHTML="&nbsp;";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 green";this.fileProgressElement.childNodes[3].className="progressBarInProgress";this.fileProgressElement.childNodes[3].style.width=a+"%";this.fileProgressElement.innerHtml="&nbsp;";this.appear()};FileProgress.prototype.setComplete=function(){this.fileProgressElement.className="progressContainer blue";this.fileProgressElement.childNodes[3].className="progressBarComplete";this.fileProgressElement.childNodes[3].style.width="";var a=this;this.setTimer(setTimeout(function(){a.disappear()},10000))};FileProgress.prototype.setError=function(){this.fileProgressElement.className="progressContainer red";this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";var a=this;this.setTimer(setTimeout(function(){a.disappear()},5000))};FileProgress.prototype.setCancelled=function(){this.fileProgressElement.className="progressContainer";this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";var a=this;this.setTimer(setTimeout(function(){a.disappear()},2000))};FileProgress.prototype.setStatus=function(a){this.fileProgressElement.childNodes[2].innerHTML=a};FileProgress.prototype.toggleCancel=function(b,c){this.fileProgressElement.childNodes[0].style.visibility=b?"visible":"hidden";if(c){var a=this.fileProgressID;this.fileProgressElement.childNodes[0].onclick=function(){c.cancelUpload(a);return false}}};FileProgress.prototype.appear=function(){if(this.getTimer()!==null){clearTimeout(this.getTimer());this.setTimer(null)}if(this.fileProgressWrapper.filters){try{this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity=100}catch(a){this.fileProgressWrapper.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=100)"}}else{this.fileProgressWrapper.style.opacity=1}this.fileProgressWrapper.style.height="";this.height=this.fileProgressWrapper.offsetHeight;this.opacity=100;this.fileProgressWrapper.style.display=""};FileProgress.prototype.disappear=function(){var b=15;var c=4;var f=30;if(this.opacity>0){this.opacity-=b;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()},f))}else{this.fileProgressWrapper.style.display="none";this.setTimer(null)}};
var trackFiles=[];var trackFilesCount=0;var trackSentURL=false;var forceDone=false;var forceFile=null;var master=null;var MacMinSizeUpload=150000;var MacDelay=10000;function fileQueued(c){try{$("#txtFileName").val(c.name);$(".txtFileName").val(c.name);var a=new FileProgress(c,this.customSettings.progressTarget);a.toggleCancel(true,this)}catch(b){this.debug(b)}}function fileQueueError(e,c,b){try{if(c===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert("You have attempted to queue too many files.\n"+(b===0?"You have reached the upload limit.":"You may select "+(b>1?"up to "+b+" files.":"one file.")));return}var a=new FileProgress(e,this.customSettings.progressTarget);a.setError();a.toggleCancel(false);switch(c){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:a.setStatus("File is too big.");this.debug("Error Code: File too big, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:a.setStatus("Cannot upload Zero Byte files.");this.debug("Error Code: Zero byte file, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:a.setStatus("Invalid File Type.");this.debug("Error Code: Invalid File Type, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;default:if(e!==null){a.setStatus("Unhandled Error")}this.debug("Error Code: "+c+", File name: "+e.name+", File size: "+e.size+", Message: "+b);break}}catch(d){this.debug(d)}}function fileDialogComplete(b,a){try{if(b>0){document.getElementById(this.customSettings.cancelButtonId).disabled=false}}catch(c){this.debug(c)}}var startDate;function uploadStart(c){try{startDate=new Date();var a=new FileProgress(c,this.customSettings.progressTarget);a.setStatus("Uploading ...");a.setStatus("");a.toggleCancel(true,this);trackFiles[trackFilesCount++]=c.name;updateDisplay.call(this,c)}catch(b){}return true}function readablizeBytes(c){var a=["bytes","kb","MB","GB","TB","PB"];if(c==0){return(c+" "+a[c])}var b=Math.floor(Math.log(c)/Math.log(1024));return(c/Math.pow(1024,Math.floor(b))).toFixed(2)+" "+a[b]}function getUploadSpeed(a){return readablizeBytes(a/(new Date()-startDate)*1000)+"/sec"}function getTimeRemaining(a,c){var b=(c-a)/(new Date()-startDate);if(b>60){return Math.floor(b/60)+" minutes"}else{return Math.floor(b)+" seconds"}}function uploadProgress(g,b,e){try{var d=Math.ceil((b/e)*100);var a=new FileProgress(g,this.customSettings.progressTarget);var c=document.getElementById("loadanim");if(c!=null){c.style.display="block"}a.setProgress(d);a.setStatus(readablizeBytes(b)+" of "+readablizeBytes(e)+"  ("+getUploadSpeed(b)+") --- "+getTimeRemaining(b,e)+" remaining ");updateDisplay.call(this,g)}catch(f){this.debug(f)}}function uploadSuccess(d,b){try{var a=new FileProgress(d,this.customSettings.progressTarget);a.setComplete();a.setStatus("Complete.");a.toggleCancel(false)}catch(c){this.debug(c)}}function uploadError(e,c,b){try{var a=new FileProgress(e,this.customSettings.progressTarget);a.setError();a.toggleCancel(false);switch(c){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:a.setStatus("Upload Error: "+b);this.debug("Error Code: HTTP Error, File name: "+e.name+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:a.setStatus("Upload Failed.");this.debug("Error Code: Upload Failed, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:a.setStatus("Server (IO) Error");this.debug("Error Code: IO Error, File name: "+e.name+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:a.setStatus("Security Error");this.debug("Error Code: Security Error, File name: "+e.name+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:a.setStatus("Upload limit exceeded.");this.debug("Error Code: Upload Limit Exceeded, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:a.setStatus("Failed Validation.  Upload skipped.");this.debug("Error Code: File Validation Failed, File name: "+e.name+", File size: "+e.size+", Message: "+b);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:if(this.getStats().files_queued===0){document.getElementById(this.customSettings.cancelButtonId).disabled=true}a.setStatus("Cancelled");a.setCancelled();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:a.setStatus("Stopped");break;default:a.setStatus("Unhandled Error: "+c);this.debug("Error Code: "+c+", File name: "+e.name+", File size: "+e.size+", Message: "+b);break}}catch(d){this.debug(d)}}function uploadComplete(a){AddVideo(a)}function queueComplete(a){var b=document.getElementById("divStatus");b.innerHTML=a+" file"+(a===1?"":"s")+" uploaded."}function updateDisplay(a){if(isMacUser){if(a==null&&forceDone){master.cancelUpload(forceFile.id,false);pauseProcess(500);master.uploadSuccess(forceFile,null);master.uploadComplete(forceFile);forceDone=false;return}if(a.size<MacMinSizeUpload&&!forceDone){master=this;if(!forceDone){forceFile=a;setTimeout("updateDisplay("+null+")",MacDelay);forceDone=true}}}}function pauseProcess(c){var a=new Date();var b=null;do{b=new Date()}while(b-a<c)};
$.fn.extend({gallery:function(a){$.extend(a,{pageSize:8,galleryEl:$(this)});var b=new Gallery(a)}});function Gallery(d){var i=this;var l=d.pageSize;var j=d.images;var h=Math.floor(j.length/l)+1;var c=0;var e=d.galleryEl;var k=true;e.append($("<div></div>").addClass("images").css({position:"relative"})).append($("<div></div>").addClass("image-title")).append($("<div></div>").addClass("thumbs"));var f=$("<div><a class='prev-page' href='#'><img class='image' src='Template/root/BinaryResource/Theme/Default/Images/gallery_prev.png'/></a> |&nbsp;<span class='page'></span>&nbsp;| <a class='next-page' href='#'><img class='image' src='Template/root/BinaryResource/Theme/Default/Images/gallery_next.png'/></a></div>").addClass("paging");f.find(".prev-page").click(function(){if(c==0){c=h-1}else{c--}g();return false});f.find(".next-page").click(function(){if(c==(h-1)){c=0}else{c++}g();return false});e.append(f);var g=function(){var p=c*l;var m=p+l;if(m>j.length){m=j.length}e.find(".images img").not(":visible").remove();e.find(".thumbs .thumb").remove();for(var o=p;o<m;o++){var q=b(j[o]);var n=a(j[o],q);if(k&&(o==0)){n.trigger("setactive");k=false}}e.find(".paging .page").html("Page: "+(c+1)+" of "+h);e.find(".images img:first").show()};var a=function(o,m){var p=$("<img />");var n=$("<div></div>").addClass("thumb").append(p).click(function(){n.trigger("setactive")});n.bind("lightup",function(){n.find("img").fadeTo("fast",1)});n.bind("lightdown",function(){n.not(".active").find("img").fadeTo("fast",0.5)});n.bind("setactive",function(){e.find(".thumbs .thumb.active").removeClass("active").trigger("lightdown");n.addClass("active");e.find(".image-title").html(o.Title);e.find(".images .full-image:visible").hide();m.show()});n.mouseenter(function(){n.trigger("lightup")});n.mouseleave(function(){n.trigger("lightdown")});e.find(".thumbs").append(n);p.load(function(){n.css({background:"none"});n.find("img").css({opacity:0,visibility:"visible"});n.is(".active")?n.trigger("lightup"):n.trigger("lightdown")});p.attr("src",o.ThumbnailUrl);return n};var b=function(o){var n=$("<img />");var m=$("<div></div>").addClass("full-image").css({display:"none"}).append(n);e.find(".images").append(m);n.attr("src",o.ImageUrl);n.load(function(){m.css({background:"none"})});return m};g()};
if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.prototype.initSettings=function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.refreshCookies(false)}}(SWFUpload.prototype.initSettings);SWFUpload.prototype.refreshCookies=function(b){if(b===undefined){b=true}b=!!b;var k=this.settings.post_params;var a,h=document.cookie.split(";"),j=h.length,f,e,g,d;for(a=0;a<j;a++){f=h[a];while(f.charAt(0)===" "){f=f.substring(1,f.length)}e=f.indexOf("=");if(e>0){g=f.substring(0,e);d=f.substring(e+1);k[g]=d}}if(b){this.setPostParams(k)}}};
var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.queue={};SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.queueSettings={};this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0;this.queueSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.queueSettings.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.queueSettings.queue_cancelled_flag=false;this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelQueue=function(){this.queueSettings.queue_cancelled_flag=true;this.stopUpload();var a=this.getStats();while(a.files_queued>0){this.cancelUpload();a=this.getStats()}};SWFUpload.queue.uploadStartHandler=function(b){var a;if(typeof(this.queueSettings.user_upload_start_handler)==="function"){a=this.queueSettings.user_upload_start_handler.call(this,b)}a=(a===false)?false:true;this.queueSettings.queue_cancelled_flag=!a;return a};SWFUpload.queue.uploadCompleteHandler=function(d){var a=this.queueSettings.user_upload_complete_handler;var b;if(d.filestatus===SWFUpload.FILE_STATUS.COMPLETE){this.queueSettings.queue_upload_count++}if(typeof(a)==="function"){b=(a.call(this,d)===false)?false:true}else{if(d.filestatus===SWFUpload.FILE_STATUS.QUEUED){b=false}else{b=true}}if(b){var c=this.getStats();if(c.files_queued>0&&this.queueSettings.queue_cancelled_flag===false){this.startUpload()}else{if(this.queueSettings.queue_cancelled_flag===false){this.queueEvent("queue_complete_handler",[this.queueSettings.queue_upload_count]);this.queueSettings.queue_upload_count=0}else{this.queueSettings.queue_cancelled_flag=false;this.queueSettings.queue_upload_count=0}}}}};
var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.speed={};SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.ensureDefault=function(c,b){this.settings[c]=(this.settings[c]==undefined)?b:this.settings[c]};this.fileSpeedStats={};this.speedSettings={};this.ensureDefault("moving_average_history_size","10");this.speedSettings.user_file_queued_handler=this.settings.file_queued_handler;this.speedSettings.user_file_queue_error_handler=this.settings.file_queue_error_handler;this.speedSettings.user_upload_start_handler=this.settings.upload_start_handler;this.speedSettings.user_upload_error_handler=this.settings.upload_error_handler;this.speedSettings.user_upload_progress_handler=this.settings.upload_progress_handler;this.speedSettings.user_upload_success_handler=this.settings.upload_success_handler;this.speedSettings.user_upload_complete_handler=this.settings.upload_complete_handler;this.settings.file_queued_handler=SWFUpload.speed.fileQueuedHandler;this.settings.file_queue_error_handler=SWFUpload.speed.fileQueueErrorHandler;this.settings.upload_start_handler=SWFUpload.speed.uploadStartHandler;this.settings.upload_error_handler=SWFUpload.speed.uploadErrorHandler;this.settings.upload_progress_handler=SWFUpload.speed.uploadProgressHandler;this.settings.upload_success_handler=SWFUpload.speed.uploadSuccessHandler;this.settings.upload_complete_handler=SWFUpload.speed.uploadCompleteHandler;delete this.ensureDefault}})(SWFUpload.prototype.initSettings);SWFUpload.speed.fileQueuedHandler=function(a){if(typeof this.speedSettings.user_file_queued_handler==="function"){a=SWFUpload.speed.extendFile(a);return this.speedSettings.user_file_queued_handler.call(this,a)}};SWFUpload.speed.fileQueueErrorHandler=function(c,b,a){if(typeof this.speedSettings.user_file_queue_error_handler==="function"){c=SWFUpload.speed.extendFile(c);return this.speedSettings.user_file_queue_error_handler.call(this,c,b,a)}};SWFUpload.speed.uploadStartHandler=function(a){if(typeof this.speedSettings.user_upload_start_handler==="function"){a=SWFUpload.speed.extendFile(a,this.fileSpeedStats);return this.speedSettings.user_upload_start_handler.call(this,a)}};SWFUpload.speed.uploadErrorHandler=function(c,b,a){c=SWFUpload.speed.extendFile(c,this.fileSpeedStats);SWFUpload.speed.removeTracking(c,this.fileSpeedStats);if(typeof this.speedSettings.user_upload_error_handler==="function"){return this.speedSettings.user_upload_error_handler.call(this,c,b,a)}};SWFUpload.speed.uploadProgressHandler=function(c,a,b){this.updateTracking(c,a);c=SWFUpload.speed.extendFile(c,this.fileSpeedStats);if(typeof this.speedSettings.user_upload_progress_handler==="function"){return this.speedSettings.user_upload_progress_handler.call(this,c,a,b)}};SWFUpload.speed.uploadSuccessHandler=function(b,a){if(typeof this.speedSettings.user_upload_success_handler==="function"){b=SWFUpload.speed.extendFile(b,this.fileSpeedStats);return this.speedSettings.user_upload_success_handler.call(this,b,a)}};SWFUpload.speed.uploadCompleteHandler=function(a){a=SWFUpload.speed.extendFile(a,this.fileSpeedStats);SWFUpload.speed.removeTracking(a,this.fileSpeedStats);if(typeof this.speedSettings.user_upload_complete_handler==="function"){return this.speedSettings.user_upload_complete_handler.call(this,a)}};SWFUpload.speed.extendFile=function(c,a){var b;if(a){b=a[c.id]}if(b){c.currentSpeed=b.currentSpeed;c.averageSpeed=b.averageSpeed;c.movingAverageSpeed=b.movingAverageSpeed;c.timeRemaining=b.timeRemaining;c.timeElapsed=b.timeElapsed;c.percentUploaded=b.percentUploaded;c.sizeUploaded=b.bytesUploaded}else{c.currentSpeed=0;c.averageSpeed=0;c.movingAverageSpeed=0;c.timeRemaining=0;c.timeElapsed=0;c.percentUploaded=0;c.sizeUploaded=0}return c};SWFUpload.prototype.updateTracking=function(d,f){var e=this.fileSpeedStats[d.id];if(!e){this.fileSpeedStats[d.id]=e={}}f=f||e.bytesUploaded||0;if(f<0){f=0}if(f>d.size){f=d.size}var g=(new Date()).getTime();if(!e.startTime){e.startTime=(new Date()).getTime();e.lastTime=e.startTime;e.currentSpeed=0;e.averageSpeed=0;e.movingAverageSpeed=0;e.movingAverageHistory=[];e.timeRemaining=0;e.timeElapsed=0;e.percentUploaded=f/d.size;e.bytesUploaded=f}else{if(e.startTime>g){this.debug("When backwards in time")}else{var a=(new Date()).getTime();var c=e.lastTime;var h=a-c;var b=f-e.bytesUploaded;if(b===0||h===0){return e}e.lastTime=a;e.bytesUploaded=f;e.currentSpeed=(b*8)/(h/1000);e.averageSpeed=(e.bytesUploaded*8)/((a-e.startTime)/1000);e.movingAverageHistory.push(e.currentSpeed);if(e.movingAverageHistory.length>this.settings.moving_average_history_size){e.movingAverageHistory.shift()}e.movingAverageSpeed=SWFUpload.speed.calculateMovingAverage(e.movingAverageHistory);e.timeRemaining=(d.size-e.bytesUploaded)*8/e.movingAverageSpeed;e.timeElapsed=(a-e.startTime)/1000;e.percentUploaded=(e.bytesUploaded/d.size*100)}}return e};SWFUpload.speed.removeTracking=function(c,a){try{a[c.id]=null;delete a[c.id]}catch(b){}};SWFUpload.speed.formatUnits=function(j,c,e,d){var a,b,f,k;if(j===0){return"0 "+e[e.length-1]}if(d){b=j;k=e.length>=c.length?e[c.length-1]:"";for(a=0;a<c.length;a++){if(j>=c[a]){b=(j/c[a]).toFixed(2);k=e.length>=a?" "+e[a]:"";break}}return b+k}else{var h=[];var g=j;for(a=0;a<c.length;a++){f=c[a];k=e.length>a?" "+e[a]:"";b=g/f;if(a<c.length-1){b=Math.floor(b)}else{b=b.toFixed(2)}if(b>0){g=g%f;h.push(b+k)}}return h.join(" ")}};SWFUpload.speed.formatBPS=function(c){var a=[1073741824,1048576,1024,1],b=["Gbps","Mbps","Kbps","bps"];return SWFUpload.speed.formatUnits(c,a,b,true)};SWFUpload.speed.formatTime=function(c){var a=[86400,3600,60,1],b=["d","h","m","s"];return SWFUpload.speed.formatUnits(c,a,b,false)};SWFUpload.speed.formatBytes=function(b){var a=[1073741824,1048576,1024,1],c=["GB","MB","KB","bytes"];return SWFUpload.speed.formatUnits(b,a,c,true)};SWFUpload.speed.formatPercent=function(a){return a.toFixed(2)+" %"};SWFUpload.speed.calculateMovingAverage=function(g){var j=[],k,c=0,m=0,d=0,l=0,e=0;var a;var f=0,h=0;k=g.length;if(k>=8){for(a=0;a<k;a++){j[a]=g[a];c+=j[a]}m=c/k;for(a=0;a<k;a++){d+=Math.pow((j[a]-m),2)}l=d/k;e=Math.sqrt(l);for(a=0;a<k;a++){j[a]=(j[a]-m)/e}var b=2;for(a=0;a<k;a++){if(j[a]<=b&&j[a]>=-b){h++;f+=g[a]}}}else{h=k;for(a=0;a<k;a++){f+=g[a]}}return f/h}};
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);
/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/
return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return}f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:></script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return}if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return}}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return}var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return}var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return}AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.onload=function(){};swfobject.addDomLoadEvent(function(){if(typeof(SWFUpload.onload)==="function"){SWFUpload.onload.call(window)}});SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.ensureDefault=function(c,b){this.settings[c]=(this.settings[c]==undefined)?b:this.settings[c]};this.ensureDefault("minimum_flash_version","9.0.28");this.ensureDefault("swfupload_pre_load_handler",null);this.ensureDefault("swfupload_load_failed_handler",null);delete this.ensureDefault}})(SWFUpload.prototype.initSettings);SWFUpload.prototype.loadFlash=function(a){return function(){var b=swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);if(b){this.queueEvent("swfupload_pre_load_handler");if(typeof(a)==="function"){a.call(this)}}else{this.queueEvent("swfupload_load_failed_handler")}}}(SWFUpload.prototype.loadFlash);SWFUpload.prototype.displayDebugInfo=function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.debug(["SWFUpload.SWFObject Plugin settings:","\n","\t","minimum_flash_version:                      ",this.settings.minimum_flash_version,"\n","\t","swfupload_pre_load_handler assigned:     ",(typeof(this.settings.swfupload_pre_load_handler)==="function").toString(),"\n","\t","swfupload_load_failed_handler assigned:     ",(typeof(this.settings.swfupload_load_failed_handler)==="function").toString(),"\n",].join(""))}}(SWFUpload.prototype.displayDebugInfo)};
var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(a){try{this.customSettings={};this.settings=a;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(b){delete SWFUpload.instances[this.movieName];throw b}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";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.completeURL=function(b){if(typeof(b)!=="string"||b.match(/^https?:\/\//i)||b.match(/^\//)){return b}var a=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var c=window.location.pathname.lastIndexOf("/");if(c<=0){path="/"}else{path=window.location.pathname.substr(0,c)+"/"}return path+b};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("preserve_relative_urls",false);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("assume_success_timeout",0);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_placeholder",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+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var b,a;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}b=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(b==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}a=document.createElement("div");a.innerHTML=this.getFlashHTML();b.parentNode.replaceChild(a.firstChild,b);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 a=this.buildParamString();var b=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(b),"&amp;assumeSuccessTimeout=",encodeURIComponent(this.settings.assume_success_timeout),"&amp;params=",encodeURIComponent(a),"&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 a in b){if(b.hasOwnProperty(a)){c.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(b[a].toString()))}}}return c.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var b=null;b=this.getMovieElement();if(b&&typeof(b.CallFunction)==="unknown"){for(var c in b){try{if(typeof(b[c])==="function"){b[c]=null}}catch(e){}}try{b.parentNode.removeChild(b)}catch(d){}}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(a){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","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(a,c,b){if(c==undefined){return(this.settings[a]=b)}else{return(this.settings[a]=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(b,a){this.settings.file_types=b;this.settings.file_types_description=a;this.callFlash("SetFileTypes",[b,a])};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.setAssumeSuccessTimeout=function(a){this.settings.assume_success_timeout=a;this.callFlash("SetAssumeSuccessTimeout",[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(b,a){this.settings.button_width=b;this.settings.button_height=a;var c=this.getMovieElement();if(c!=undefined){c.style.width=b+"px";c.style.height=a+"px"}this.callFlash("SetButtonDimensions",[b,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(a,b){if(b==undefined){b=[]}else{if(!(b instanceof Array)){b=[b]}}var c=this;if(typeof this.settings[a]==="function"){this.eventQueue.push(function(){this.settings[a].apply(this,b)});setTimeout(function(){c.executeNextEvent()},0)}else{if(this.settings[a]!==null){throw"Event handler "+a+" 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(f){var b=/[$]([0-9a-f]{4})/i;var e={};var a;if(f!=undefined){for(var d in f.post){if(f.post.hasOwnProperty(d)){a=d;var c;while((c=b.exec(a))!==null){a=a.replace(c[0],String.fromCharCode(parseInt("0x"+c[1],16)))}e[a]=f.post[d]}}f.post=e}return f};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(b){try{if(this.movieElement&&typeof(b.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var a in b){try{if(typeof(b[a])==="function"){b[a]=null}}catch(d){}}}}catch(c){}window.__flash__removeCallback=function(g,e){try{if(g){g[e]=null}}catch(f){}}};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(c,b,a){c=this.unescapeFilePostParams(c);this.queueEvent("file_queue_error_handler",[c,b,a])};SWFUpload.prototype.fileDialogComplete=function(b,a,c){this.queueEvent("file_dialog_complete_handler",[b,a,c])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(b){var a;if(typeof this.settings.upload_start_handler==="function"){b=this.unescapeFilePostParams(b);a=this.settings.upload_start_handler.call(this,b)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(a===undefined){a=true}a=!!a;this.callFlash("ReturnUploadStart",[a])};SWFUpload.prototype.uploadProgress=function(c,a,b){c=this.unescapeFilePostParams(c);this.queueEvent("upload_progress_handler",[c,a,b])};SWFUpload.prototype.uploadError=function(c,b,a){c=this.unescapeFilePostParams(c);this.queueEvent("upload_error_handler",[c,b,a])};SWFUpload.prototype.uploadSuccess=function(c,a,b){c=this.unescapeFilePostParams(c);this.queueEvent("upload_success_handler",[c,a,b])};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(b){var c,a;try{c=document.getElementById("SWFUpload_Console");if(!c){a=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(a);c=document.createElement("textarea");c.id="SWFUpload_Console";c.style.fontFamily="monospace";c.setAttribute("wrap","off");c.wrap="off";c.style.overflow="auto";c.style.width="700px";c.style.height="350px";c.style.margin="5px";a.appendChild(c)}c.value+=b+"\n";c.scrollTop=c.scrollHeight-c.clientHeight}catch(d){alert("Exception: "+d.name+" Message: "+d.message)}};


