function doinput(e,a,l,t){if(typeof $("#"+a+"-form-c").html()=="undefined"){f='';$("#upload-wrapper:first").append(f)}if(e=="description"){ht='";if(typeof $("textarea[name='c_entry_"+e+"["+a+"]']").html()=="undefined"){$("#"+a+"-form-c").append(ht)}else{$("textarea[name='c_entry_"+e+"["+a+"]']").val(t)}}else if(e=="size"){ht='';if(typeof $("input[name='c_entry_"+e+"["+a+"]']").html()=="undefined"){$("#"+a+"-form-c").append(ht)}else{$("input[name='c_entry_"+e+"["+a+"]']").val(t)}}else{ht='';if(typeof $("input[name='c_entry_"+e+"["+a+"]']").html()=="undefined"){$("#"+a+"-form-c").append(ht)}else{$("input[name='c_entry_"+e+"["+a+"]']").val(t)}}}(function(v,s){var p={};function n(e){return plupload.translate(e)||e}function o(e,a){var l="fe";a.contents().each(function(e,a){a=v(a);if(!a.is(".plupload")){a.remove()}});var t="";if(v("#UFBE").val()=="1"){t=" off"}var i=v("#upload_category").parent().html();v("#upload_category").detach();var d=v("#upload-category").text();var s=d=="auto"?" no-display":"";var p='
'+i+"
";var n='
';var o=n;var r='';if(v("#UFBE").val()!="1"){r=""}var u='
'+r+o+"
";var c='
0% 
';var _='
'+c+"
";a.prepend('
'+p+u+'
'+_+'
'+'
'+'
'+'
'+'"+'
'+'
'+'
'+upload_lang["filename"]+"
"+'
Remove
'+'
'+upload_lang["status"]+"
"+'
'+upload_lang["size"]+"
"+'
 
'+"
"+'
    '+"
    "+"
    "+"
    "+''+"
    ")}v.fn.pluploadQueue=function(d){if(d){this.each(function(){var c,l,_,e;l=v(this);_=l.attr("id");if(!_){_=plupload.guid();l.attr("id",_)}e=l.html();o(_,l);d=v.extend({dragdrop:true,browse_button:_+"_browse",container:_},d);if(d.dragdrop){d.drop_element=_+"_filelist"}c=new plupload.Uploader(d);p[_]=c;function f(e){var a;var l;if(e.status==plupload.DONE){a="plupload_done";l="icon-check"}if(e.status==plupload.FAILED){a="plupload_failed";l="iconBe-info"}if(e.status==plupload.QUEUED){a="plupload_delete";l="icon-times"}if(e.status==plupload.UPLOADING){a="plupload_uploading"}var t=v("#"+e.id).attr("class",a).find("a").css("display","block");v("#"+e.id).find("i.pl_status").attr("class",l);if(e.hint){t.attr("title",e.hint)}}function t(){v("span.plupload_total_status",l).html(c.total.percent+"%");v("span.plupload_progress_bar",l).css("width",c.total.percent+"%");v("span.plupload_upload_status",l).html(s.sprintf(n("Uploaded %d/%d files"),c.total.uploaded,c.files.length));if(c.total.percent>52){v(".plupload_total_status").css("color","white")}else{v(".plupload_total_status").css("color","black")}}function a(){var o=v("ul.plupload_filelist",l).html(""),r=0,u;v.each(c.files,function(e,a){u="";if(a.status==plupload.DONE){if(a.target_name){u+=''}u+='';u+='';r++;v("#"+_+"_count").val(r)}var l=v("#upload_category").parent().html().replace(/upload_category/g,"upload_category_"+a.id).replace(/file_category_0/g,"upload_category_"+a.id).replace(/file_category_sel/g,"upload_category_"+a.id);var t=v("#upload-category").text();var i=t=="auto"?" no-display-off":"";var d='
    '+l+"
    ";var s=typeof v("input[name='c_entry_tags["+a.id+"]']").html()=="undefined"?a.name.replace(/\.[^/.]+$/,""):v("input[name='c_entry_tags["+a.id+"]']").val();var p=s.split(/\s+/);var n=p.filter(function(e){return e.length>=4});var s=n.join(" ");o.append('
  • '+'
    '+a.name+'
    '+'
    '+'
    '+a.percent+"%
    "+'
    '+plupload.formatSize(a.size)+"
    "+'
     
    '+u+"
  • "+'
  • '+'
    '+'
    '+'

    '+"
    "+d+"
    "+'
     
    '+'
    '+'
    '+'"+'
    '+"
  • ");f(a);v("#select-box-upload_category_"+a.id+":last").detach();SelectList.init(v("#upload_category_"+a.id).attr("name"));v("#upload_category_"+a.id).change(function(){doinput("category",a.id,a.name,this.value)});v("#"+a.id+".plupload_delete a").click(function(e){v("#"+a.id+"-form-c").detach();v("#"+a.id).remove();c.removeFile(a);e.preventDefault()})});v("a.plupload_start",l).toggleClass("plupload_disabled",c.files.length==c.total.uploaded+c.total.failed);o[0].scrollTop=o[0].scrollHeight;t();if(!c.files.length&&c.features.dragdrop&&c.settings.dragdrop){v("#"+_+"_filelist").append('
  • '+upload_lang["drag"].replace("##",c.settings.max_files)+"
  • ")}}function i(){delete p[_];c.destroy();l.html(e);c=l=e=null}c.bind("UploadFile",function(e,a){v("#"+a.id).addClass("plupload_current_file")});c.bind("Init",function(s,e){if(!d.unique_names&&d.rename){l.on("click","#"+_+"_filelist div.plupload_file_name span",function(e){var l=v(e.target),t,a,i,d="";t=s.getFile(l.parents("li")[0].id);i=t.name;a=/^(.+)(\.[^.]+)$/.exec(i);if(a){i=a[1];d=a[2]}l.hide().after('');l.next().val(i).focus().blur(function(){l.show().next().remove()}).keydown(function(e){var a=v(this);if(e.keyCode==13){e.preventDefault();t.name=a.val()+d;l.html(t.name);a.blur()}})})}v("a.plupload_start",l).click(function(e){if(!v(this).hasClass("plupload_disabled")){c.start()}e.preventDefault()});v("a.plupload_stop",l).click(function(e){e.preventDefault();c.stop()});v("a.plupload_start",l).addClass("plupload_disabled")});c.bind("Error",function(e,a){var l=a.file,t;if(l){t=a.message;if(a.details){t+=" ("+a.details+")"}if(a.code==plupload.FILE_SIZE_ERROR){alert(n("Error: File too large:")+" "+l.name)}if(a.code==plupload.FILE_EXTENSION_ERROR){alert(n("Error: Invalid file extension:")+" "+l.name)}l.hint=t;v("#"+l.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",t)}if(a.code===plupload.INIT_ERROR){setTimeout(function(){i()},1)}});c.bind("PostInit",function(e){if(e.settings.dragdrop&&e.features.dragdrop){v("#"+_+"_filelist").append('
  • '+upload_lang["drag"].replace("##",e.settings.max_files)+"
  • ")}});c.init();c.bind("StateChanged",function(){if(c.state===plupload.STARTED){v("li.plupload_delete a,div.plupload_buttons",l).hide();v("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",l).css("display","block");if(d.multiple_queues){}}else{a();v("a.plupload_delete",l).css("display","block");if(d.multiple_queues&&c.total.uploaded+c.total.failed==c.files.length){v(".plupload_buttons,.plupload_upload_status",l).css("display","inline");v(".plupload_start",l).addClass("plupload_disabled")}}});c.bind("FilesAdded",a);c.bind("FilesRemoved",function(){var e=v("#"+_+"_filelist").scrollTop();a();v("#"+_+"_filelist").scrollTop(e)});c.bind("FileUploaded",function(e,a){f(a)});c.bind("UploadProgress",function(e,a){v("#"+a.id+" div.plupload_file_status",l).html(a.percent+"%");f(a);t()});if(d.setup){d.setup(c)}});return this}else{return p[v(this[0]).attr("id")]}}})(jQuery,mOxie);