/*
 jquery.swfui.js v1.0.0 (requires jQuery v1.4+)
*/
jQuery&&function(h,j){var o={color:1,"font-family":1,"font-size":1,"font-style":1,"font-weight":1,"letter-spacing":1,"margin-left":1,"margin-right":1,"text-align:":1,"text-decoration":1,"text-indent":1},p=function(a){var b={},e,c;typeof a==="string"&&(a=a.replace(/(^\{|\}$)/g,"").split(";"));for(e in a)a[e]&&(c=h.trim(e.replace(/([A-Z])/g,"-$1").toLowerCase()),o[c]&&(b[c]=h.trim(a[e])));return b},q=function(a){var b=[],e;for(e in a)b.push(e+":"+a[e]);return".swfui{"+b.join(";")+";}"},r=function(a,
b){return a.replace(/\{(\w*)\}/g,function(a,c){return c?(b||{})[c]||"":"swfui"})},k=function(a){return(a=a.id?h.swfui.suIndex[a.id]:0)?SWFUpload.instances[a]||0:0},s=function(a){var b,e,c="",d="",g=!1,f=0;if(a){try{try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{e.AllowScriptAccess="always"}catch(h){b="6.0.0"}}catch(k){}b=b||(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}catch(l){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)b=
(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description}catch(D){}}if(b){b=b.replace(/\D+/g,".").replace(/(^\.+|\.+$)/g,"").split(".");for(a=a.split(".");!g&&f<3;f++)if(c=parseInt(b[f]||0,10),d=parseInt(a[f]||0,10),d>c)break;else g=c>d;g=g||f>2;c=b.join(".");d=a.join(".")}}!g&&j.console&&j.console.log&&j.console.log("jQuery.swfui : "+(c?"Flash version ("+c+") too low (vs. "+d+")":"Flash not found"));return g},t=function(a){return(a=SWFUpload.instances[a])?a.customSettings.elemID:
""},n=function(a,b){h(a).delay(b).animate({opacity:0},500).slideUp(function(){h(this).remove()})},u=function(a,b,e){var c=this.customSettings,d=c.queue,c=c.options;this.getStats();d.numErrored=a-b;d.numSelected=a;d.numAdded=b-d.numCancelled;d.numQueued=e;c.skipDefault.onDialogClose||d.numErrored>0&&j.alert(d.error);c.onDialogClose&&c.onDialogClose.call(this,d);c.auto&&h("#"+c.id).swfuiUpload("*")},v=function(){var a=this.customSettings,b=a.queue,a=a.options;b.error="Some files were not added to the queue:";
b.numReplaced=0;b.numCancelled=0;a.onDialogOpen&&a.onDialogOpen.call(this)},w=function(a){var b=this.customSettings,e=b.queue,c=b.options,d,g;if(!c.skipDefault.onSelect){for(g in e.files)if(d=e.files[g],d.name===a.name){if(j.confirm('The file named "'+a.name+'" is already in the queue.\nDo you want to replace the existing item in the queue?'))e.numReplaced++,h("#"+b.elemID).swfuiCancel(d.id);else return e.numCancelled++,this.cancelUpload(a.id),!1;break}d=a.size/1024;d=d>1024?(d/1024).toFixed(2)+"MB":
d.toFixed(1)+"KB";g=a.name;g.length>25&&(g=g.substr(0,25)+"...");d=h(r(h.swfui.item,{id:a.id,name:g,size:d,type:a.type.replace(/^\./,"")}));h("a.swfuiCancel",d).click(function(){var a=h(this).closest(".swfuiItem").attr("id")||"";h("#"+t(a.replace(/_\d+$/,""))).swfuiCancel(a);return!1}).each(function(){c.cancelImage&&h('<img src="'+c.cancelImage+'" alt="" />').appendTo(this)});h("#"+b.queueID).append(d);e.queueSize+=a.size}e.files[a.id]=a;c.onSelect&&c.onSelect.call(this,a)},x=function(a,b,e){var c=
this.settings,d=this.customSettings,g=d.options,d=d.queue,f=SWFUpload.QUEUE_ERROR;g.skipDefault.onSelectError||(b===f.QUEUE_LIMIT_EXCEEDED&&(d.error+="\nThe number of files selected exceeds the ",d.error+=c.file_queue_limit>e?"remaining upload quota ("+e+").":"select limit ("+c.file_queue_limit+")."),b===f.FILE_EXCEEDS_SIZE_LIMIT&&(d.error+='\nThe file "'+a.name+'" exceeds the size limit ('+c.file_size_limit+")."),b===f.ZERO_BYTE_FILE&&(d.error+='\nThe file "'+a.name+'" is empty.'),b===f.INVALID_FILE_TYPE&&
(d.error+='\nThe file "'+a.name+'" is not an accepted file type ('+c.file_types_description+")."));g.onSelectError&&g.onSelectError.call(this,a,b,e)},y=function(a){var b=this.getStats(),e=this.customSettings,c=e.queue,d=e.options,g=SWFUpload.FILE_STATUS,f=!1;c.uploadAll?(f=!b.files_queued)||this.startUpload():(f=!c.uploadQueue.length)||this.startUpload(c.uploadQueue.shift());d.skipDefault.onUploadComplete||d.removeCompleted&&(a.filestatus===g.COMPLETE||a.filestatus===g.ERROR&&!d.requeueErrors)&&j.setTimeout(function(){h("#"+
e.elemID).swfuiCancel(a.id)},d.removeTimeout*1E3);d.onUploadComplete&&d.onUploadComplete.call(this,a,c);f&&d.onQueueComplete&&d.onQueueComplete.call(this)},z=function(a,b,e){var c=this.customSettings,d=c.queue,c=c.options,g="Error",f=SWFUpload,i=f.UPLOAD_ERROR,f=f.FILE_STATUS;b!==i.FILE_CANCELLED&&b!==i.UPLOAD_STOPPED&&h("#"+a.id).addClass("swfuiError");h("#"+a.id+" .swfuiBar").css({right:"100%"});if(b===i.HTTP_ERROR)g="HTTP Error ("+e+")";else if(b===i.MISSING_UPLOAD_URL)g="Missing Upload URL";else if(b===
i.IO_ERROR)g="IO Error";else if(b===i.SECURITY_ERROR)g="Security Error";else if(b===i.UPLOAD_LIMIT_EXCEEDED)j.alert("The upload limit has been reached ("+e+")."),g="Exceeds Upload Limit";else if(b===i.UPLOAD_FAILED)g="Failed";else if(b===i.FILE_VALIDATION_FAILED)g="Validation Error";else if(b===i.FILE_CANCELLED){g="Cancelled";d.queueSize-=a.size;if(a.filestatus===f.IN_PROGRESS||h.inArray(a.id,d.uploadQueue)>=0)d.uploadSize-=a.size;delete d.files[a.id]}else b===i.UPLOAD_STOPPED&&(g="Stopped");b!==
i.SPECIFIED_FILE_ID_NOT_FOUND&&a.filestatus!==f.COMPLETE&&h("#"+a.id+" .swfuiData").html("- "+g);c.onUploadError&&c.onUploadError.call(this,a,b,e,g,d)},A=function(a,b,e){var c=this.customSettings,d=c.queue,c=c.options,g=(new Date).getTime(),f=Math.round(b*100/e),i=(b-d.bCount)*1E3/1024/(g-d.timer),j=d.uploadSpeed*d.pCount+i,l=f<100?"":" wait...";if(a)d.timer=g,d.bCount=b,d.uploadSpeed=j/++d.pCount,c.skipDefault.onUploadProgress||(g=h("#"+a.id+" .swfuiData"),c.progressData==="percentage"?g.html("- "+
f+"%"+l):c.progressData==="speed"&&g.html("- "+(i>1024?(i/1024).toFixed(2)+"MB/s":i.toFixed(1)+"KB/s")+l),h("#"+a.id+" .swfuiBar").css({right:100-f+"%"})),c.onUploadProgress&&c.onUploadProgress.call(this,a,b,e,d,i)},B=function(a){var b=this,e=b.customSettings,c=e.queue,e=e.options;h("#"+a.id+" .swfuiPostData input").each(function(){var a=h(this);b.addPostParam(a.attr("name"),a.val())});b.getStats();c.timer=(new Date).getTime();c.bCount=0;e.onUploadStart&&e.onUploadStart.call(b,a)},C=function(a,b,
e){var c=this.customSettings,d=c.options,g=h("#"+a.id).addClass("swfuiCompleted");c.queue.uploadedBytes+=a.size;h(".swfuiData",g).html("- Complete");h(".swfuiBar",g).css({right:0});d.onUploadSuccess&&d.onUploadSuccess.call(this,a,b,e)};h.swfui={version:"1.0.0",suIndex:{},suCount:0,item:'<div id="{id}" class="{}Item"><div class="{}Progress"><div class="{}Bar"><\!-- Progress Bar --\></div><div class="{}Text {}Type-{type}"><div class="{}PostData"><label>w:<input type="text" value="" name="media_dim_width" size="3" /></label><label>h:<input type="text" value="" name="media_dim_height" size="3" /></label></div><span class="{}Name">{name}</span> ({size}) <span class="{}Data"></span></div></div><div class="{}Error"></div><a class="{}Cancel" href="#"></a></div>'};
h.extend(h.fn,{swfui:function(a,b){if(SWFUpload&&s("9.0.28"))a=a||{},a.buttonStyle=p(a.buttonStyle||{}),this.not(".SWFUI").each(function(){var e,c=!1,d=!1,g=h(this).val("").each(function(){d=!!this.disabled;this.disabled=!0;this.id?e=this.id:(this.id=e="SWFUI_"+ ++h.swfui.suCount,c=!0)}).hide().addClass("SWFUI"),f=h.extend(!0,{id:e,swf:"swfupload.swf",uploader:g.closest("form").attr("action")||"",auto:!1,buttonHand:!0,buttonHeight:30,buttonImage:"sprite.button.gif",buttonText:"Select File"+(a.multi?
"s":"")+"...",buttonStyle:{color:"#FFFFFF","text-align":"center","font-family":"Arial,Verdana,Geneva,sans-serif","font-size":14},buttonPadTop:4,buttonPadLeft:0,buttonWidth:120,buttonWmode:"window",cancelImage:"cancel.png",debug:!1,disabled:d,fileObjName:g.attr("name")||"FileData",maxSize:0,selectDesc:"All Files (*.*)",selectExts:"*.*",method:"post",multi:!1,queueID:"",removeCompleted:!0,removeTimeout:3,requeueErrors:!0,postData:{},preventCaching:!0,progressData:"percentage",successTimeout:30,limit:99,
skipDefault:{},onDialogOpen:null,onDialogClose:null,onQueueComplete:null,onSelectError:null,onSelect:null,onSWFReady:null,onUploadComplete:null,onUploadError:null,onUploadProgress:null,onUploadSuccess:null,onUploadStart:null},a),i="SWFUIbutton_"+e,j="SWFUIwrap_"+e,l=f.queueID?h("#"+f.queueID):[],k=l.length?f.queueID:"SWFUIqueue_"+e,n=!l.length,m=h.extend({assume_success_timeout:f.successTimeout,button_placeholder_id:i,button_image_url:f.buttonImage,button_width:f.buttonWidth,button_height:f.buttonHeight,
button_text:'<span class="swfui">'+f.buttonText+"</span>",button_text_style:q(f.buttonStyle),button_text_top_padding:f.buttonPadTop,button_text_left_padding:f.buttonPadLeft,button_action:f.multi?SWFUpload.BUTTON_ACTION.SELECT_FILES:SWFUpload.BUTTON_ACTION.SELECT_FILE,button_disabled:f.disabled,button_cursor:f.buttonHand?SWFUpload.CURSOR.HAND:SWFUpload.CURSOR.ARROW,button_window_mode:f.buttonWmode,debug:f.debug,requeue_on_error:f.requeueErrors,file_post_name:f.fileObjName,file_size_limit:f.maxSize,
file_types:f.selectExts,file_types_description:f.selectDesc,file_queue_limit:f.limit,file_upload_limit:f.limit,flash_url:f.swf,prevent_swf_caching:f.preventCaching,post_params:f.postData,upload_url:f.uploader,use_query_string:f.method==="get",file_dialog_complete_handler:u,file_dialog_start_handler:v,file_queued_handler:w,file_queue_error_handler:x,swfupload_loaded_handler:f.onSWFReady,upload_complete_handler:y,upload_error_handler:z,upload_progress_handler:A,upload_start_handler:B,upload_success_handler:C},
b||{}),i=h("<div />",{id:j,"class":"swfui"}).css({position:"relative",width:f.buttonWidth,height:f.buttonHeight}).append(h("<div />",{id:i})).insertAfter(g),m=new SWFUpload(m);!m.movieName||!SWFUpload.instances[m.movieName]?(g.removeClass("SWFUI").each(function(){this.disabled=d;if(c)this.id=""}).show(),i.remove()):(h.swfui.suIndex[e]=m.movieName,n&&(l=h("<div />",{id:k}).insertAfter(i)),l.addClass("swfuiQueue"),h.extend(!0,m.customSettings,{options:f,elemID:e,wrapperID:j,queueID:k,removeQueue:n,
removeID:c,leaveDisabled:d,queue:{files:{},numSelected:0,numAdded:0,numReplaced:0,numCancelled:0,numErrored:0,numQueued:0,error:"",queueSize:0,uploadSpeed:0,uploadSize:0,uploadedBytes:0,uploadQueue:[],uploadAll:0,timer:0,bCount:0,pCount:0}}))});return this},swfuiCancel:function(a){this.filter(".SWFUI").each(function(){var b=k(this),e=0,c,d;if(b)if(c=b.customSettings,d=c.queue,!a||a==="*")h("#"+c.queueID+" .swfuiItem").each(function(){b.cancelUpload(this.id);n(this,100*e++)}),d.queueSize=0,d.files=
[];else for(typeof a==="string"&&(a=[a]);e<a.length;e++)b.cancelUpload(a[e]),d.files[a[e]]&&(d.queueSize-=d.files[a[e]].size,delete d.files[a[e]]),n("#"+a[e],100*e)});return this},swfuiDestroy:function(){this.filter(".SWFUI").each(function(){var a=k(this),b,e,c,d,g;if(a){delete h.swfui.suIndex[this.id];b=a.customSettings;e=h("#"+b.wrapperID);c=h("#"+b.queueID);d=b.removeQueue;g=b.removeID;b=b.leaveDisabled;a.destroy();d?c.remove():(h(".swfuiItem",c).remove(),c.removeClass("swfuiQueue"));e.remove();
if(g)this.id="";this.disabled=b;h(this).removeClass("SWFUI").show()}});return this},swfuiDisable:function(a){this.filter(".SWFUI").each(function(){var b=k(this);b&&b.setButtonDisabled(a)});return this},swfuiStop:function(){this.filter(".SWFUI").each(function(){var a=k(this);a&&a.stopUpload()});return this},swfuiUpload:function(a){this.filter(".SWFUI").each(function(){var b=k(this),e,c,d=0;if(b&&(e=b.getStats(),c=b.customSettings.queue,e.files_queued))if(c.uploadSpeed=0,c.uploadSize=0,c.uploadedBytes=
0,c.uploadQueue=[],c.uploadAll=!a||a==="*"||a===!0,c.pCount=0,c.uploadAll)c.uploadSize=c.queueSize,b.startUpload();else{for(typeof a==="string"&&(a=[a]);d<a.length;d++)if(e=c.files[a[d]])c.uploadSize+=e.size,c.uploadQueue.push(e.id);b.startUpload(c.uploadQueue.shift())}});return this}})}(jQuery,window);
