Type.registerNamespace("Babelic");Babelic.NuevaTraduccionCliente=function(d){Babelic.NuevaTraduccionCliente.initializeBase(this,[d]);};Babelic.NuevaTraduccionCliente.prototype={esEditorEstadoAlta:function(){return $get("txtEmail")!=null;},get_idCoin:function(){return this.idCoin;},set_idCoin:function(d){this.idCoin=d;},get_idComboSourceLanguage:function(){return this.idComboSourceLanguage;},set_idComboSourceLanguage:function(d){this.idComboSourceLanguage=d;},get_idComboDestLanguage:function(){return this.idComboDestLanguage;},set_idComboDestLanguage:function(d){this.idComboDestLanguage=d;},get_idComboCategories:function(){return this.idComboCategories;},set_idComboCategories:function(d){this.idComboCategories=d;},get_idtextArea:function(){return this.idtextArea;},set_idtextArea:function(d){this.idtextArea=d;},get_idNumberWords:function(){return this.idNumberWords;},set_idNumberWords:function(d){this.idNumberWords=d;},get_idPrice:function(){return this.idPrice;},set_idPrice:function(d){this.idPrice=d;},get_nameFunctionFinish:function(){return this.nameFunctionFinish;},set_nameFunctionFinish:function(d){this.nameFunctionFinish=d;},get_IDIdiomaOrigen:function(){return $get(this.idComboSourceLanguage).value;},set_IDIdiomaOrigen:function(d){$("#"+this.idComboSourceLanguage).val(d);},set_IDIdiomaDestino:function(d){$("#"+this.idComboDestLanguage).val(d);},get_IDIdiomaDestino:function(){return $get(this.idComboDestLanguage).value;},get_Importe:function(){return $get(this.idPrice).firstChild.data;},get_CantPalabras:function(){return $get(this.idNumberWords).firstChild.data;},get_Texto:function(){return tinyMCE.get(this.idtextArea).getContent();},set_Texto:function(d){tinyMCE.get(this.idtextArea).setContent(d);},get_numMaxCaracteres:function(){return this.numMaxCaracteres;},set_numMaxCaracteres:function(d){this.numMaxCaracteres=d;},get_sizeLimit:function(){return this.sizeLimit;},set_sizeLimit:function(d){this.sizeLimit=d;},get_fileTypes:function(){return this.fileTypes;},set_fileTypes:function(d){this.fileTypes=d;},get_translationMode:function(){return this.translationMode;},get_initialTab:function(){return this.initialTab;},set_initialTab:function(d){this.initialTab=d;},get_idCategoryDeadLine:function(){return this.idCategoryDeadLine;},set_idCategoryDeadLine:function(d){this.idCategoryDeadLine=d;},get_idServiceProofReadingAdded:function(){return this.idServiceProofReadingAdded;},set_idServiceProofReadingAdded:function(d){this.idServiceProofReadingAdded=d;},get_idTypeServiceProofReadingFull:function(){return this.idTypeServiceProofReadingFull;},set_idTypeServiceProofReadingFull:function(d){this.idTypeServiceProofReadingFull=d;},get_idServiceBasicTranslation:function(){return this.idServiceBasicTranslation;},set_idServiceBasicTranslation:function(d){this.idServiceBasicTranslation=d;},get_idServiceProfesionalTranslation:function(){return this.idServiceProfesionalTranslation;},set_idServiceProfesionalTranslation:function(d){this.idServiceProfesionalTranslation=d;},get_idTypesEnabledToShow:function(){return this.idTypesEnabledToShow;},set_idTypesEnabledToShow:function(d){this.idTypesEnabledToShow=d;},get_isLoggedMode:function(){return this.isLoggedMode;},set_isLoggedMode:function(d){this.isLoggedMode=d;},get_idTypeCustomerService:function(){return this.idTypeCustomerService;},set_idTypeCustomerService:function(d){this.idTypeCustomerService=d;},get_idTypeContentCategory:function(){return this.idTypeContentCategory;},set_idTypeContentCategory:function(d){this.idTypeContentCategory=d;},initialize:function(){Babelic.NuevaTraduccionCliente.callBaseMethod(this,"initialize");this.service=new TralimaWebServices.TralimaEditorService();if(!this.isLoggedMode){$get("l9").style.display="none";$get("l10").style.display="none";}$addHandler($get(this.idComboSourceLanguage),"change",Function.createDelegate(this,this.comboSourceLanguageChanged));$addHandler($get(this.idComboDestLanguage),"change",Function.createDelegate(this,this.calculate));$addHandler($get(this.idComboCategories),"change",Function.createDelegate(this,this.categoriesChanged));$addHandler($get("btnCancelar"),"click",Function.createDelegate(this,this.closeAndCleanEditorEditor));$addHandler($get("btnRetrocede"),"click",Function.createDelegate(this,this.btnRetrocedeClick));$addHandler($get("btnAvanza"),"click",Function.createDelegate(this,this.btnAvanzaClick));$addHandler($get("btnFinalizar"),"click",Function.createDelegate(this,this.doSendTask));$addHandler($get("aClose"),"click",Function.createDelegate(this,this.closeAndCleanEditorEditor));$addHandler($get("chkProfReading"),"click",Function.createDelegate(this,this.chkProfReadingClick));$addHandler($get("chkDeadLine"),"click",Function.createDelegate(this,this.chkDeadLineClick));var d={start:this.initialTab,click:Function.createDelegate(this,this.set_translationMode)};$("#tabsModo ul").idTabs(d);$("#uploadDocument").makeAsyncUploader({file_size_limit:this.sizeLimit,file_types:this.fileTypes,upload_success_handler:Type.createDelegate(this,this.uploadSuccess),file_dialog_complete_handler:Type.createDelegate(this,this.uploadDialogComplete)});var e="\u0030-\u0039\u0041-\u005a\u0061-\u007a\u00aa\u00b2\u00b3\u00b5\u00b9\u00ba\u00bc-\u00be\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ee\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03f5\u03f7-\u0481\u048a-\u0513\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0640-\u064a\u0660-\u0669\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u076d\u0780-\u07a5\u07b1\u07c0-\u07ea\u07f4\u07f5\u07fa\u0904-\u0939\u093d\u0950\u0958-\u0961\u0966-\u096f\u097b-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09e6-\u09f1\u09f4-\u09f9\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a66-\u0a6f\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0ae6-\u0aef\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b66-\u0b6f\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0be6-\u0bf2\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60\u0c61\u0c66-\u0c6f\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0ce6-\u0cef\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60\u0d61\u0d66-\u0d6f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0ed0-\u0ed9\u0edc\u0edd\u0f00\u0f20-\u0f33\u0f40-\u0f47\u0f49-\u0f6a\u0f88-\u0f8b\u1000-\u1021\u1023-\u1027\u1029\u102a\u1040-\u1049\u1050-\u1055\u10a0-\u10c5\u10d0-\u10fa\u10fc\u1100-\u1159\u115f-\u11a2\u11a8-\u11f9\u1200-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1369-\u137c\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u17e0-\u17e9\u17f0-\u17f9\u1810-\u1819\u1820-\u1877\u1880-\u18a8\u1900-\u191c\u1946-\u196d\u1970-\u1974\u1980-\u19a9\u19c1-\u19c7\u19d0-\u19d9\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b50-\u1b59\u1d00-\u1dbf\u1e00-\u1e9b\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2070\u2071\u2074-\u2079\u207f-\u2089\u2090-\u2094\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2153-\u2184\u2460-\u249b\u24ea-\u24ff\u2776-\u2793\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2c6c\u2c74-\u2c77\u2c80-\u2ce4\u2cfd\u2d00-\u2d25\u2d30-\u2d65\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312c\u3131-\u318e\u3192-\u3195\u31a0-\u31b7\u31f0-\u31ff\u3220-\u3229\u3251-\u325f\u3280-\u3289\u32b1-\u32bf\u3400-\u4db5\u4e00-\u9fbb\ua000-\ua48c\ua717-\ua71a\ua800\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\uac00-\ud7a3\uf900-\ufa2d\ufa30-\ufa6a\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";this.regUANC=new RegExp("[^"+e+"]","gi");this.regUANC2=new RegExp("^[^"+e+"<#]","gi");this.isRecalByLang=false;this.currentWordCount=0;this.currentStep=0;this.service.GetLanguageRates(this.idCoin,Type.createDelegate(this,this.assignRates),this.errorFromRatesCal,null);Sys.Application.add_load(Type.createDelegate(this,this.modalAddShown));this.calculateDelegate=Type.createDelegate(this,this.calculate);this.isVisible=true;$().maxlength();},modalAddShown:function(){$find("modalTransInsert").add_shown(Type.createDelegate(this,this.initialiceTiny));this.isVisible=true;},btnRetrocedeClick:function(){this.doStep(0);},serviceChanged:function(e){var d=e.attr("id").substring(2);this.changeRate(d);},getServiceRate:function(d){for(b=0;b<this.rates.services.length;b++){if(this.rates.services[b].idService==d){return this.rates.services[b];}}return null;},set_translationMode:function(d){switch(d){case"#tabModoTexto":this.translationMode=0;break;case"#tabModoArchivo":this.translationMode=1;if(!this.validateChangeRate(this.idServiceSelected)){this.changeRate(this.idServiceProfesionalTranslation);}break;}return true;},btnAvanzaClick:function(){this.doStep(1);},get_Observaciones:function(){return $("#txObservaciones").val();},initialiceTiny:function(){if((tinyMCE.getInstanceById(this.idtextArea)==null||tinyMCE.getInstanceById(this.idtextArea)=="undefined")){tinyMCE.init({mode:"textareas",theme:"tralima",skin:"o2k7",plugins:"safari,inlinepopups,paste,noneditable",editor_selector:"mceEditor",theme_tralima_buttons1:"bold,italic,underline,link,unlink,forecolor,backcolor,bullist,numlist,outdent,indent,undo,redo,hr,charmap,code,pasteword",theme_tralima_buttons2:"",theme_tralima_buttons3:"",theme_tralima_toolbar_location:"top",force_br_newlines:true,force_p_newlines:false,forced_root_block:"",convert_newlines_to_brs:true,handle_event_callback:Type.createDelegate(this,this.handleTinyEvents),onchange_callback:Type.createDelegate(this,this.onChangeText),translate_mode:true,language:"es"});}if(this.esEditorEstadoAlta()){pageTracker._trackPageview("/editorAltaSimplificadapaso1.html");}},validate:function(){if($get("txtEmail")!=null&&$get("txtEmail").value==""){this.showError(GlobalJavascript.cadena);}else{if($get("txtEmailConfirm")!=null&&$get("txtEmailConfirm").value==""){this.showError(GlobalJavascript.cadena1);}else{if($get("txtEmail")!=null&&$get("txtEmail").value!=$get("txtEmailConfirm").value){this.showError(GlobalJavascript.cadena2);}else{return true;}}}return false;},doStep:function doStep(d){if(d==1){switch(this.get_translationMode()){case 0:this.doFirstStepKeywordsMode();break;case 1:this.doFirstStepFileUploadMode();break;}}else{if(d==0){this.setFirstStepVisible();}}this.currentStep=d;},chkProfReadingClick:function(){this.calculateTotalPrice();},chkDeadLineClick:function(){this.calculateTotalPrice();},uploadSuccess:function(e,d){this.resetTinyEntries();$("input[name$=uploadDocument_filename]").val(e.name);$("input[name$=uploadDocument_guid]").val(d);this.calculateFileRates();},calculateFileRates:function(){var d=$("input[name$=uploadDocument_guid]").val();var e=$("input[name$=uploadDocument_filename]").val();if(d!=null&&d!=""&&e!=null&&e!=""){try{this.service.GetRateByDataFile(d,e,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),this.idServiceSelected,Type.createDelegate(this,this.bindTarifaFileUploadMode),Type.createDelegate(this,this.onCallbackError),null);}catch(f){this.showError(f.message);this.editorClearScreen();}}else{this.showError(GlobalJavascript.SubirArchivoNoSeleccionado);this.editorClearScreen();}},uploadDialogComplete:function(e,d){try{if(d>0){this.editorBlockScreen(GlobalJavascript.SubiendoArchivo);startUpload();}}catch(f){}},bindTarifaFileUploadMode:function(d){this.editorClearScreen();if(!d.isOK){this.showError(d.message);}else{this.currentWordCount=d.wordCount;this.updatePrice(d.wordCount,d.amount);this.isRecalByLang=d.esRecalPorCambIdiomas;}},updatePrice:function(d,e){$get(this.idNumberWords).firstChild.data=d;$get(this.idPrice).firstChild.data=e;if(e>0){highlight("traduc_precio",3000);}},doFirstStepFileUploadMode:function(){this.editorBlockScreen(GlobalJavascript.Validando);var d=$("input[name$=uploadDocument_guid]").val();var e=$("input[name$=uploadDocument_filename]").val();if(d!=null&&d!=""&&e!=null&&e!=""){try{this.service.GetNextStepDataFileUploadMode(d,e,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),this.idServiceSelected,Type.createDelegate(this,this.bindTareaTraduccionData),Type.createDelegate(this,this.onCallbackError),null);}catch(f){MasterClientesShowMessage(f.message,-1);this.editorClearScreen();}}else{this.showError(GlobalJavascript.SubirArchivoNoSeleccionado);this.editorClearScreen();}},doFirstStepKeywordsMode:function(){if(parseFloat(this.get_Importe())<=0){this.calculate();}if(parseFloat(this.get_Importe())<=0){this.showError(GlobalJavascript.ImporteMinimoRequerido);return;}this.editorBlockScreen(GlobalJavascript.Validando);var f=this.numMaxCaracteres;var d=this.get_Texto();var e=d.length;if(e<=f){try{this.service.GetNextStepData(d,this.idServiceSelected,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),this.get_Importe(),this.get_CantPalabras(),Type.createDelegate(this,this.bindTareaTraduccionData),Type.createDelegate(this,this.onCallbackError),null);}catch(g){MasterClientesShowMessage(g.message,-1);this.editorClearScreen();}}else{this.showError(GlobalJavascript.CaracteresNumeroMaximo+" "+f+"."+GlobalJavascript.CaracteresNumeroActual+":"+e);this.editorClearScreen();}},doSendTask:function(){if(this.validate()){this.editorBlockScreen(GlobalJavascript.Validando);var h=null;var e=null;var g=false;if($get("txtEmail")!=null){h=$get("txtEmail").value;}var k=$("#chkProfReading").is(":checked");var l=$("#chkDeadLine").is(":checked");var d=$get(this.idComboCategories).value;if(d<0){d=null;}if($get("sPayment")!=null&&$get("sPayment").value==0){g=true;}if(this.translationMode==0){this.service.InsertTareaTraduccionByText(this.get_Texto(),this.get_Observaciones(),this.idServiceSelected,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),h,g,d,k,l,Type.createDelegate(this,this.responseSendTask),Type.createDelegate(this,this.onCallbackError),null);}else{var j=$("input[name$=uploadDocument_guid]").val();var f=$("input[name$=uploadDocument_filename]").val();this.service.InsertTareaTraduccionByFile(j,f,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),h,g,this.idServiceSelected,d,k,l,this.get_Observaciones(),Type.createDelegate(this,this.responseSendTask),Type.createDelegate(this,this.onCallbackError),null);}if(this.esEditorEstadoAlta()){pageTracker._trackPageview("/editorAltaSimplificadapaso2.html");}}},showError:function(d){alert(d);},resetTinyEntries:function(){if(tinyMCE.get(this.idtextArea)!=undefined){this.set_Texto("");}},resetFileEntries:function(){var d=$("input[name$=uploadDocument_filename]").val();this.isRecalByLang=false;if(d!=null&&d!=""){$("input[name$=uploadDocument_filename]").val("");$("input[name$=uploadDocument_guid]").val("");$("#divFileProgressuploadDocumentContainer").hide();}},redirectPaypal:function(d){$find("modalTransInsert").hide();$.blockUI({message:"<h1>"+GlobalJavascript.RedireccionPaypal+"</h1>"});location.href=d;},responseSendTask:function(d){if(d==null){this.closeAndCleanEditorEditor();return;}else{if(d.message!=null&&d.isOK){MasterClientesShowMessage(d.message,-1);}else{if(d.message!=null&&!d.isOK){this.showError(d.message);}else{if(d.urlRedirection!=null){this.redirectPaypal(d.urlRedirection);}else{this.closeAndCleanEditorEditor();}}}}if(d.isOK&&d.urlRedirection==null){this.closeAndCleanEditorEditor();if(this.nameFunctionFinish!=null&&this.nameFunctionFinish!=""){Function.parse(this.nameFunctionFinish,null).call(this);}}if(d.urlRedirection==null){this.editorClearScreen();}},editorBlockScreen:function(d){$(".detalles").block({message:"<h1>"+d+"</h1>",css:{textAlign:"center"}});},editorClearScreen:function(){$(".detalles").unblock();},onCallbackError:function(d){this.showError(GlobalJavascript.ErrorMasTarde);this.editorClearScreen();},setFirstStepVisible:function(){var e=$get("btnAvanza");var f=$get("btnRetrocede");var h=$get("btnFinalizar");var g=$get("step1");var d=$get("step2");g.style.display="inline";d.style.display="none";f.style.display="none";e.style.display="inline";h.style.display="none";g.style.visibility="visible";d.style.visibility="hidden";this.applyDesignBySelectedService();},applyDesignBySelectedService:function(){},setSecondStepVisible:function(){var e=$get("btnAvanza");var f=$get("btnRetrocede");var h=$get("btnFinalizar");var g=$get("step1");var d=$get("step2");g.style.display="none";d.style.display="inline";f.style.display="inline";e.style.display="none";h.style.display="inline";g.style.visibility="hidden";d.style.visibility="visible";},updateTotalPrice:function(f,d,e,g){var h=f*d;h=Math.round((h*(1+g/100))*100)/100;$get("lTotalPrice").innerHTML=h+e;$get("lPWord").innerHTML=Math.round(d*1000)/1000+e;},bindTareaTraduccionData:function(h){this.editorClearScreen();if(!h.isOK){this.showError(h.message);}else{this.setSecondStepVisible();this.tarea=h;$get("liDest").innerHTML=h.idiomaDestinoLiteral;this.calculateTotalPrice();$get("prtIva").innerHTML=h.porcentajeIva;$get("lOrigin").innerHTML=h.idiomaOrigenLiteral;$get("lnWords").innerHTML=h.numeroPalabras;var d=null;if(this.get_translationMode()==0){var e=50;if(e<h.textoOrigen.length){e=h.textoOrigen.length;}d=h.textoOrigen.substring(0,e)+".......";}else{d=$("input[name$=uploadDocument_filename]").val();}$get("infoNombreArchivo").innerHTML=d;var g=$get("l11");if(h.numeroPalabras==h.numeroPalabrasMinimo){g.style.display="inline";g.innerHTML=this.format(g.innerHTML,h.numeroPalabrasMinimo);}else{g.style.display="none";}var j=this.loadCategories();var f=null;if(h.esPermiteProofReading){f=this.getPriceProofReading();}if(f==null){$("#dvRevision").hide();}else{$("#dvRevision").show();$get("sPriceProf").innerHTML=f+h.simboloMoneda;}if(h.limitePlazoUrgente!=null){$("#dvPLazoUrgente").show();$get("sPlazo").innerHTML=h.limitePlazoUrgente;}else{$("#dvPLazoUrgente").hide();}if(h.mostrarPanelPagos){$get("pnPayment").style.display="block";}else{$get("pnPayment").style.display="none";}if($get("l10")!=null){$get("l10").innerHTML=h.saldoUsuarioConMoneda;}}if(h.fechaEntregaEstimada!=null){$get("sFEntrega").innerHTML=h.fechaEntregaEstimada.getDate()+"/"+(h.fechaEntregaEstimada.getMonth()+1)+" "+h.fechaEntregaEstimada.getHours()+":00";}else{$get("sFEntrega").innerHTML="---------";}if(h.limitePlazoUrgente!=null){this.toggleElement("dvOpcionesPLazo","dvSinOpcionesPLazo");}else{this.toggleElement("dvSinOpcionesPLazo","dvOpcionesPLazo");}if(h.esPermiteProofReading||j){this.toggleElement("dvOpcionesTraduccion","dvSinOpcionesTraduccion");}else{this.toggleElement("dvSinOpcionesTraduccion","dvOpcionesTraduccion");}},toggleElement:function(e,d){$get(e).style.display="block";$get(d).style.display="none";},closeAndCleanEditorEditor:function(){$get("step1").style.display="inline";$get("step2").style.display="none";$get("step1").style.visibility="visible";$get("step2").style.visibility="hidden";$get("btnAvanza").style.display="inline";$get("btnRetrocede").style.display="none";$get("btnFinalizar").style.display="none";this.set_Texto("");this.updatePrice(0,0);$(".detalles").unblock();$find("modalTransInsert").hide();$("#divFileProgressuploadDocumentContainer").hide();$("input[name$=uploadDocument_filename]").val("");$("input[name$=uploadDocument_guid]").val("");$("#chkProfReading").attr("checked",false);$("#chkDeadLine").attr("checked",false);this.isVisible=false;},validateBrowser:function(){resp=true;if(jQuery.browser.msie){resp=false;}return resp;},format:function(d){for(i=1;i<arguments.length;i++){d=d.replace("{"+(i-1)+"}",arguments[i]);}return d;},handleTinyEvents:function(d){if(d.type=="blur"){tinyMCE.triggerSave();}if(d.type=="keyup"&&d.keyCode!=38&&d.keyCode!=39&&d.keyCode!=37&&d.keyCode!=40){this.onChangeText();}},onChangeText:function(){if(this.timer!=null){clearTimeout(this.timer);}this.timer=setTimeout(this.calculateDelegate,1000);},calculate:function(){var g;var e=0;var d=0;controlSource=$get(this.idComboSourceLanguage);controlDest=$get(this.idComboDestLanguage);g="";if(tinyMCE.get(this.idtextArea)!=null){g=tinyMCE.get(this.idtextArea).getContent();}if(g==null||g==""){g=$get(this.idtextArea).value;}if(g!=null&&g!=""){this.resetFileEntries();if(g!=null&&g.substring(0,2)=="/*"&&g.indexOf("*/",0)!=-1){var f=g.indexOf("*/",0);g=g.substring(f+2,g.length);}e=this.countWordsByFormat(g+" ");d=this.getPriceByLangAndService(controlSource.value,controlDest.value,this.idServiceSelected);this.updatePrice(e,Math.round((e*d)*100)/100);this.currentWordCount=e;}else{if(this.translationMode==1&&this.isRecalByLang){this.calculateFileRates();}else{if(this.translationMode==1&&this.currentWordCount>0){d=this.getPriceByLangAndService(controlSource.value,controlDest.value,this.idServiceSelected);this.updatePrice(this.currentWordCount,Math.round((this.currentWordCount*d)*100)/100);}}}},getPriceByLangAndService:function(h,g,e){var f=0;var d=this.getServiceRate(e);for(a=0;a<d.languages.length;a++){if(h==d.languages[a].idSourceLanguage&&g==d.languages[a].idDestLanguage){f=d.languages[a].price;break;}}return f;},countWordsByFormat:function(d){word_count=0;word_count=this.countWords(d);return word_count;},countWords:function(g){g=g.replace(new RegExp('<[^>]* class="mceNonEditable">[^<]*<[^>]*>',"g")," ");g=g.replace(/nbsp+/gi," ");g=g.replace("&lt;"," ");g=g.replace("&gt;"," ");g=g.replace(/[/][*][^*/]*[*][/]+/i," ");g=g.replace(new RegExp("[0-9]+[.|,][0-9]+","g"),"numero");g=g.replace(new RegExp("[0-9]+[/][0-9]+[/][0-9]+","g"),"fecha");g=g.replace(/&[A-Za-z]*;+/gi,"");g=g.replace(/<p>|<li>|<br [/]>|<br[/]>+/gi," ");g=this.deleteHTML(g);g=g.replace(/quot+/gi,"");g=g.replace(/[\u2028\u2029\u000d\u000a]/gi," ");var h=this.leftTrimString(g);var e=h.replace(this.regUANC," ");var d=e.split(/\s+/);var f=d.length;if(d[d.length-1]==""){f=f-1;}if(g.length<2){f=0;}return f;},leftTrimString:function(d){return d.replace(this.regUANC2,"");},deleteHTML:function(d){return d.replace(/<[^>]*>+/gi,"");},assignRates:function(e){this.rates=e;this.loadServices(this.rates);var d=this.idServiceProfesionalTranslation;for(a=0;a<e.services.length;a++){if(e.services[a].isParticularService){d=e.services[a].idService;break;}}this.changeRate(d);},loadServices:function(d){this.selectRates=$("#dvTarifas").finalselect({id:"dvSelectTarifas",optionChangingCallback:Type.createDelegate(this,this.validateChangeRate),optionChangedCallback:Type.createDelegate(this,this.changeRate),zIndex:1000,viewWidth:"260px",viewHeight:"150px",selectImage:"/App_Themes/Default/Images/ComboSelectImage.png"});for(a=0;a<d.services.length;a++){if(jQuery.inArray(d.services[a].idType,this.idTypesEnabledToShow)>-1){var e=this.getComboElement(d.services[a].name,d.services[a].description);this.selectRates.addItem(e,d.services[a].idService);}}},getComboElement:function(d,e){var f='<span class="thistext headerRate">'+d+'</span><p  class="descriptionRate"><span>'+e+"</span></p>";return f;},changeRate:function(e){if(this.rates!=null&&this.idServiceSelected!=e){this.idServiceSelected=e;this.loadSourceCombo();var d=this.getServiceRate(e);if(d.idType==this.idTypeServiceProofReadingFull){$(".detalles #column_right").hide();}else{$(".detalles #column_right").show();}if(this.selectRates.getValue()!=e){this.selectRates.changeOption(e);}}},validateChangeRate:function(e){var f=true;var d=this.getServiceRate(e);if(!d.allowFiles&&this.get_translationMode()==1){f=false;}if(!f&&this.isVisible){alert("Esta tarifa no esta disponible para documentos");}return f;},loadCategories:function(){var d=false;idSourceLang=$get(this.idComboSourceLanguage).value;idDestinyLang=$get(this.idComboDestLanguage).value;control=$get(this.idComboCategories);control.options.length=0;var g=this.getCurrentRate();control.options[0]=new Option(GlobalJavascript.Seleccionar+".....",-1);for(c=0;c<g.categories.length;c++){if(g.categories[c].idType==this.idTypeContentCategory&&!this.existValue(control.options,g.categories[c].name)){var f=g.categories[c].name+" +"+g.categories[c].price+this.tarea.simboloMoneda;control.options[control.options.length]=new Option(f,g.categories[c].id);}}var e=this.getCategoryPrice(this.idCategoryDeadLine);if(e==null){$("#dvPLazoUrgente").hide();}else{$("#dvPLazoUrgente").show();$get("sPlazoUr").innerHTML=e+this.tarea.simboloMoneda;}if(control.options.length>1){$("#dvCategorias").show();d=true;}else{$("#dvCategorias").hide();}return d;},loadSourceCombo:function(){if(this.rates!=null){control=$get(this.idComboSourceLanguage);var f=this.get_IDIdiomaOrigen();control.options.length=0;var d=this.getServiceRate(this.idServiceSelected);for(a=0;a<d.languages.length;a++){if(!this.existValue(control.options,d.languages[a].idSourceLanguage)){var e=d.languages[a].nameSourceLanguage;if(d.idType==this.idTypeServiceProofReadingFull){e=e+" / "+d.languages[a].price;}control.options[control.options.length]=new Option(e,d.languages[a].idSourceLanguage);}}if(f!=""){this.set_IDIdiomaOrigen(f);}this.comboSourceLanguageChanged();}},calculateByTypeText:function(){if(this.translationMode==1&&this.isRecalByLang){this.calculateFileRates();}else{this.calculate();}},comboSourceLanguageChanged:function(){this.reloadComboDestinyLanguages();this.calculateByTypeText();},categoriesChanged:function(){this.calculateTotalPrice();},calculateTotalPrice:function(){var e=0;var d=$get(this.idComboCategories).value;if(d!="-1"){e+=this.getCategoryPrice(d);}if($("#chkDeadLine").is(":checked")){e+=this.getCategoryPrice(this.idCategoryDeadLine);}if($("#chkProfReading").is(":checked")){e+=this.getPriceProofReading();}this.updateTotalPrice(this.tarea.numeroPalabras,this.tarea.precioPorPalabra+e,this.tarea.simboloMoneda,this.tarea.porcentajeIva);},getPriceProofReading:function(){var e=null;idSource=$get(this.idComboSourceLanguage).value;idDestiny=$get(this.idComboDestLanguage).value;var d=this.getServiceRate(this.idServiceProofReadingAdded);for(a=0;a<d.languages.length;a++){if(d.languages[a].idSourceLanguage==idSource&&d.languages[a].idDestLanguage==idDestiny){e=d.languages[a].price;break;}}return e;},getCategoryPrice:function(e){var f=null;var d=this.getCurrentRate();for(a=0;a<d.categories.length;a++){if(d.categories[a].id==e){f=d.categories[a].price;break;}}return f;},reloadComboDestinyLanguages:function(){controlSource=$get(this.idComboSourceLanguage);controlDest=$get(this.idComboDestLanguage);controlDest.options.length=0;if(this.rates!=null){var e=this.get_IDIdiomaDestino();var d=this.getServiceRate(this.idServiceSelected);for(a=0;a<d.languages.length;a++){if(d.languages[a].idSourceLanguage==controlSource.value){var f=d.languages[a].price;controlDest.options[controlDest.options.length]=new Option(d.languages[a].nameDestLanguage+" / "+f,d.languages[a].idDestLanguage);}}if(e!=""){this.set_IDIdiomaDestino(e);}}},getCurrentRate:function(){var e=null;idSource=$get(this.idComboSourceLanguage).value;idDestiny=$get(this.idComboDestLanguage).value;var d=this.getServiceRate(this.idServiceSelected);for(a=0;a<d.languages.length;a++){if(d.languages[a].idSourceLanguage==idSource&&d.languages[a].idDestLanguage==idDestiny){e=d.languages[a];break;}}return e;},existValue:function(e,d){for(b=0;b<e.length;b++){if(e[b].value==d){return true;}}return false;},errorFromRatesCall:function(d){this.showError(GlobalJavascript.ErrorOperacion);},dispose:function(){Babelic.NuevaTraduccionCliente.callBaseMethod(this,"dispose");}};Babelic.NuevaTraduccionCliente.registerClass("Babelic.NuevaTraduccionCliente",Sys.UI.Control);if(typeof(Sys)!=="undefined"){Sys.Application.notifyScriptLoaded();}