(function(a){a.fn.makeAsyncUploader=function(b){return this.each(function(){var d=a(this).attr("id");var f=a(this);a(this).attr("style","display: inline; border: solid 1px #7FAAFF; background-color: #C5D9FF; padding: 2px;float:left");f.append(a("<span id='spanButton"+d+"Placeholder'></span>"));f.after(a("<div id='divFileProgress"+d+"Container' style='height: 75px;float:right;width:auto;float:left;'>"));f.after(a("</div>"));f.after(a("<input type='hidden' name='"+d+"_filename' />"));f.after(a("<input type='hidden' name='"+d+"_guid' />"));var l;var e=220,j=18,h="3 MB";if(b){e=b.width||e;j=b.height||j;h=b.file_size_limit||h;}var g={flash_url:"/ScriptsGenerales/swfupload.swf",upload_url:"/ScriptsGenerales/UploadDocument.ashx",file_size_limit:h,file_types:"*.*",file_types_description:"All Files",debug:false,button_image_url:"/App_Themes/Default/Images/SmallSpyGlassWithTransperancy_17x18.png",button_placeholder_id:"spanButton"+d+"Placeholder",button_width:220,button_height:18,button_text:'<span class="button">'+GlobalJavascript.SubirArchivoSeleccionar+'<span class="buttonSmall"> ('+h+" Max)</span></span>",button_text_style:".button {font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }",button_text_top_padding:0,button_text_left_padding:18,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,button_cursor:SWFUpload.CURSOR.HAND,file_queued_handler:function(p){l.startUpload();},file_queue_error_handler:function k(u,s,r){a("input[name$="+d+"_filename]").val("");a("input[name$="+d+"_guid]").val("");a("#divFileProgress"+d+"Container").show();try{var q="";var p=new FileProgress(u,this.customSettings.upload_target);p.setError();p.toggleCancel(false);switch(s){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:p.setStatus(GlobalJavascript.SubirArchivoTamanoMaximo);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:p.setStatus(GlobalJavascript.SubirArchivoTamano0);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:p.setStatus(GlobalJavascript.SubirArchivoTipoNoPermitido);break;default:alert(r);break;}}catch(t){this.debug(t);}},upload_error_handler:function n(v,t,r){var p;a("input[name$="+d+"_filename]").val("");a("input[name$="+d+"_guid]").val("");a("#divFileProgress"+d+"Container").show();try{switch(t){case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:try{p=new FileProgress(v,this.customSettings.upload_target);p.setCancelled();p.setStatus(GlobalJavascript.SubirArchivoCancelado);p.toggleCancel(false);}catch(q){this.debug(q);}break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:try{p=new FileProgress(v,this.customSettings.upload_target);p.setCancelled();p.setStatus(GlobalJavascript.SubirArchivoDetenido);p.toggleCancel(true);}catch(u){this.debug(u);}case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:p=new FileProgress(v,this.customSettings.upload_target);p.setCancelled();p.setStatus(GlobalJavascript.SubirArchivoTamanoMaximo);p.toggleCancel(true);break;default:alert(r);break;}}catch(s){this.debug(s);}},upload_start_handler:function(){a("input[name$="+d+"_filename]").val("");a("input[name$="+d+"_guid]").val("");if(b.disableDuringUpload){a(b.disableDuringUpload).attr("disabled","disabled");}},upload_success_handler:function i(r,q){a("input[name$="+d+"_filename]").val(r.name);a("input[name$="+d+"_guid]").val(q);var p=new FileProgress(r,this.customSettings.upload_target);p.toggleCancel(false);},upload_complete_handler:function m(r){try{if(this.getStats().files_queued>0){this.startUpload();}else{var p=new FileProgress(r,this.customSettings.upload_target);p.setComplete();p.setStatus(GlobalJavascript.SubirArchivoOk);p.toggleCancel(false);a("#divFileProgress"+d+"Container").show();}}catch(q){this.debug(q);}},file_dialog_complete_handler:function c(q,p){try{if(p>0){this.startUpload();}}catch(r){this.debug(r);}},upload_progress_handler:function o(t,q){try{var r=Math.ceil((q/t.size)*100);var p=new FileProgress(t,this.customSettings.upload_target);p.setProgress(r);if(r===100){p.setStatus(GlobalJavascript.Subiendo);p.toggleCancel(false,this);}else{p.setStatus(GlobalJavascript.Subiendo);p.toggleCancel(true,this);}}catch(s){this.debug(s);}}};l=new SWFUpload(a.extend(g,b||{}));l.customSettings.upload_target="divFileProgress"+d+"Container";});};})(jQuery);function fadeIn(c,b){var a=5;var f=30;if(b<100){b+=a;if(b>100){b=100;}if(c.filters){try{c.filters.item("DXImageTransform.Microsoft.Alpha").opacity=b;}catch(d){c.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+b+")";}}else{c.style.opacity=b/100;}}if(b<100){setTimeout(function(){fadeIn(c,b);},f);}}function FileProgress(f,a){this.fileProgressID="divFileProgress";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);fadeIn(this.fileProgressWrapper,0);}else{this.fileProgressElement=this.fileProgressWrapper.firstChild;this.fileProgressElement.childNodes[1].firstChild.nodeValue=f.name;}this.height=this.fileProgressWrapper.offsetHeight;}FileProgress.prototype.setProgress=function(a){this.fileProgressElement.className="progressContainer green";this.fileProgressElement.childNodes[3].className="progressBarInProgress";this.fileProgressElement.childNodes[3].style.width=a+"%";};FileProgress.prototype.setComplete=function(){this.fileProgressElement.className="progressContainer blue";this.fileProgressElement.childNodes[3].className="progressBarComplete";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setError=function(){this.fileProgressElement.className="progressContainer red";this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setCancelled=function(){this.fileProgressElement.className="progressContainer";this.fileProgressElement.childNodes[3].className="progressBarError";this.fileProgressElement.childNodes[3].style.width="";};FileProgress.prototype.setStatus=function(a){this.fileProgressElement.childNodes[2].innerHTML=a;};FileProgress.prototype.show=function(){this.fileProgressElement.style.visibilitychil="visible";};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;};}};