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 e={start:this.initialTab,click:Function.createDelegate(this,this.set_translationMode)};$("#tabsModo ul").idTabs(e);var d=true;if($.browser.msie&&$.browser.version=="6.0"){d=false;}$("#uploadDocument").makeAsyncUploader({file_size_limit:this.sizeLimit,file_types:this.fileTypes,upload_success_handler:Type.createDelegate(this,this.uploadSuccess),showProgress:d,file_dialog_complete_handler:Type.createDelegate(this,this.uploadDialogComplete),allowDragDrop:true});var f="\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("[^"+f+"]","gi");this.regUANC2=new RegExp("^[^"+f+"<#]","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=false;$().maxlength();},modalAddShown:function(){if(!this.isVisible){$find("modalTransInsert").add_shown(Type.createDelegate(this,this.initialiceTiny));}this.isVisible=true;},btnRetrocedeClick:function(){this.doStep(0);},serviceChanged:function(d){var e=d.attr("id").substring(2);this.changeRate(e);},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(){if(this.validateDeadLine()){this.calculateTotalPrice();}else{$("#chkProfReading").attr("checked",false);}},chkDeadLineClick:function(){if(this.validateDeadLine()){this.calculateTotalPrice();}else{$("#chkDeadLine").attr("checked",false);}},validateDeadLine:function(){if($("#chkDeadLine").is(":checked")&&$("#chkProfReading").is(":checked")){this.showError("No es posible seleccionar conjuntamente revisión y plazo urgente.");return false;}return true;},uploadSuccess:function(d,e){if(e.isOk){this.calculateFileRates();}else{this.editorClearScreen();}},calculateFileRates:function(){var e=$("input[name$=uploadDocument_guid]").val();var f=$("input[name$=uploadDocument_filename]").val();if(e!=null&&e!=""&&f!=null&&f!=""){try{this.service.GetRateByDataFile(e,f,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),this.idServiceSelected,Type.createDelegate(this,this.bindTarifaFileUploadMode),Type.createDelegate(this,this.onCallbackError),null);}catch(d){this.showError(d.message);this.editorClearScreen();}}else{this.showError(GlobalJavascript.SubirArchivoNoSeleccionado);this.editorClearScreen();}},uploadDialogComplete:function(d,e){if(d>0){this.editorBlockScreen(GlobalJavascript.SubiendoArchivo);}},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 e=$("input[name$=uploadDocument_guid]").val();var f=$("input[name$=uploadDocument_filename]").val();if(e!=null&&e!=""&&f!=null&&f!=""){try{this.service.GetNextStepDataFileUploadMode(e,f,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),this.idServiceSelected,Type.createDelegate(this,this.bindTareaTraduccionData),Type.createDelegate(this,this.onCallbackError),null);}catch(d){MasterClientesShowMessage(d.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 d=this.numMaxCaracteres;var g=this.get_Texto();var e=g.length;if(e<=d){try{this.service.GetNextStepData(g,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(f){MasterClientesShowMessage(f.message,-1);this.editorClearScreen();}}else{this.showError(GlobalJavascript.CaracteresNumeroMaximo+" "+d+"."+GlobalJavascript.CaracteresNumeroActual+":"+e);this.editorClearScreen();}},doSendTask:function(){if(this.validate()){this.editorBlockScreen(GlobalJavascript.Validando);var g=null;var f=null;var e=false;if($get("txtEmail")!=null){g=$get("txtEmail").value;}var d=$("#chkProfReading").is(":checked");var l=$("#chkDeadLine").is(":checked");var h=$get(this.idComboCategories).value;if(h<0){h=null;}if($get("sPayment")!=null&&$get("sPayment").value==0){e=true;}if(this.translationMode==0){this.service.InsertTareaTraduccionByText(this.get_Texto(),this.get_Observaciones(),this.idServiceSelected,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),g,e,h,d,l,Type.createDelegate(this,this.responseSendTask),Type.createDelegate(this,this.onCallbackError),null);}else{var j=$("input[name$=uploadDocument_guid]").val();var k=$("input[name$=uploadDocument_filename]").val();this.service.InsertTareaTraduccionByFile(j,k,this.get_IDIdiomaOrigen(),this.get_IDIdiomaDestino(),g,e,this.idServiceSelected,h,d,l,this.get_Observaciones(),Type.createDelegate(this,this.responseSendTask),Type.createDelegate(this,this.onCallbackError),null);}if(this.esEditorEstadoAlta()){pageTracker._trackPageview("/finAltaSimplificada.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 d=$get("btnAvanza");var e=$get("btnRetrocede");var f=$get("btnFinalizar");var g=$get("step1");var h=$get("step2");g.style.display="inline";h.style.display="none";e.style.display="none";d.style.display="inline";f.style.display="none";g.style.visibility="visible";h.style.visibility="hidden";this.applyDesignBySelectedService();},applyDesignBySelectedService:function(){},setSecondStepVisible:function(){var d=$get("btnAvanza");var e=$get("btnRetrocede");var f=$get("btnFinalizar");var g=$get("step1");var h=$get("step2");g.style.display="none";h.style.display="inline";e.style.display="inline";d.style.display="none";f.style.display="inline";g.style.visibility="hidden";h.style.visibility="visible";},updateTotalPrice:function(h,g,e,d){var f=h*g;f=Math.round((f*(1+d/100))*100)/100;$get("lTotalPrice").innerHTML=f+e;$get("lPWord").innerHTML=Math.round(g*1000)/1000+e;},bindTareaTraduccionData:function(d){this.editorClearScreen();if(!d.isOK){this.showError(d.message);}else{this.setSecondStepVisible();this.tarea=d;$get("liDest").innerHTML=d.idiomaDestinoLiteral;this.calculateTotalPrice();$get("prtIva").innerHTML=d.porcentajeIva;$get("lOrigin").innerHTML=d.idiomaOrigenLiteral;$get("lnWords").innerHTML=d.numeroPalabras;var f=null;if(this.get_translationMode()==0){var j=50;if(j<d.textoOrigen.length){j=d.textoOrigen.length;}f=d.textoOrigen.substring(0,j)+".......";}else{f=$("input[name$=uploadDocument_filename]").val();}$get("infoNombreArchivo").innerHTML=f;var h=$get("l11");if(d.numeroPalabras==d.numeroPalabrasMinimo){h.style.display="inline";h.innerHTML=this.format(h.innerHTML,d.numeroPalabrasMinimo);}else{h.style.display="none";}var g=this.loadCategories();var e=null;if(d.esPermiteProofReading){e=this.getPriceProofReading();}if(e==null){$("#dvRevision").hide();d.esPermiteProofReading=false;}else{$("#dvRevision").show();$get("sPriceProf").innerHTML=e+d.simboloMoneda;}if(d.limitePlazoUrgente!=null){$("#dvPLazoUrgente").show();$get("sPlazo").innerHTML=d.limitePlazoUrgente;}else{$("#dvPLazoUrgente").hide();}if(d.mostrarPanelPagos){$get("pnPayment").style.display="block";}else{$get("pnPayment").style.display="none";}if($get("l10")!=null){$get("l10").innerHTML=d.saldoUsuarioConMoneda;}}if(d.fechaEntregaEstimada!=null){$get("sFEntrega").innerHTML=d.fechaEntregaEstimada.getDate()+"/"+(d.fechaEntregaEstimada.getMonth()+1)+" "+d.fechaEntregaEstimada.getHours()+":00";}else{$get("sFEntrega").innerHTML="---------";}if(d.limitePlazoUrgente!=null){this.toggleElement("dvOpcionesPLazo","dvSinOpcionesPLazo");}else{this.toggleElement("dvSinOpcionesPLazo","dvOpcionesPLazo");}if(d.esPermiteProofReading||g){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();$("#txObservaciones").val("");$("#divFileProgressuploadDocumentContainer").hide();$("input[name$=uploadDocument_filename]").val("");$("input[name$=uploadDocument_guid]").val("");$("#chkProfReading").attr("checked",false);$("#chkDeadLine").attr("checked",false);this.isVisible=false;this.currentWordCount=0;},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 f=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 d=g.indexOf("*/",0);g=g.substring(d+2,g.length);}e=this.countWordsByFormat(g+" ");f=this.getPriceByLangAndService(controlSource.value,controlDest.value,this.idServiceSelected);this.updatePrice(e,Math.round((e*f)*100)/100);this.currentWordCount=e;}else{if(this.translationMode==1&&this.isRecalByLang){this.calculateFileRates();}else{if(this.translationMode==1&&this.currentWordCount>0){f=this.getPriceByLangAndService(controlSource.value,controlDest.value,this.idServiceSelected);this.updatePrice(this.currentWordCount,Math.round((this.currentWordCount*f)*100)/100);}}}},getPriceByLangAndService:function(f,d,e){var g=0;var h=this.getServiceRate(e);for(a=0;a<h.languages.length;a++){if(f==h.languages[a].idSourceLanguage&&d==h.languages[a].idDestLanguage){g=h.languages[a].price;break;}}return g;},countWordsByFormat:function(d){word_count=0;word_count=this.countWords(d);return word_count;},countWords:function(f){f=f.replace(new RegExp('<[^>]* class="mceNonEditable">[^<]*<[^>]*>',"g")," ");f=f.replace(/nbsp+/gi," ");f=f.replace("&lt;"," ");f=f.replace("&gt;"," ");f=f.replace(/[/][*][^*/]*[*][/]+/i," ");f=f.replace(new RegExp("[0-9]+[.|,][0-9]+","g"),"numero");f=f.replace(new RegExp("[0-9]+[/][0-9]+[/][0-9]+","g"),"fecha");f=f.replace(/&[A-Za-z]*;+/gi,"");f=f.replace(/<p>|<li>|<br [/]>|<br[/]>+/gi," ");f=this.deleteHTML(f);f=f.replace(/quot+/gi,"");f=f.replace(/[\u2028\u2029\u000d\u000a]/gi," ");var e=this.leftTrimString(f);var d=e.replace(this.regUANC," ");var g=d.split(/\s+/);var h=g.length;if(g[g.length-1]==""){h=h-1;}if(f.length<2){h=0;}return h;},leftTrimString:function(d){return d.replace(this.regUANC2,"");},deleteHTML:function(d){return d.replace(/<[^>]*>+/gi,"");},assignRates:function(f){this.rates=f;this.loadServices(this.rates);var e=this.idServiceProfesionalTranslation;for(a=0;a<f.services.length;a++){if(f.services[a].isParticularService){e=f.services[a].idService;break;}}this.changeRate(e);if(this.rates.settings!=null&&this.rates.settings.lastIdSourceLanguage!=null&&this.rates.settings.lastIdSourceLanguage!=0){var d=this.getServiceRate(this.idServiceSelected);for(a=0;a<d.languages.length;a++){if(d.languages[a].idSourceLanguage==this.rates.settings.lastIdSourceLanguage&&d.languages[a].idDestLanguage==this.rates.settings.lastIdTargetLanguage){this.set_IDIdiomaOrigen(this.rates.settings.lastIdSourceLanguage);this.reloadComboDestinyLanguages();this.set_IDIdiomaDestino(this.rates.settings.lastIdTargetLanguage);}}}},loadServices:function(e){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<e.services.length;a++){if(jQuery.inArray(e.services[a].idType,this.idTypesEnabledToShow)>-1){var d=this.getComboElement(e.services[a].name,e.services[a].description);this.selectRates.addItem(d,e.services[a].idService);}}},getComboElement:function(f,e){var d='<span class="thistext headerRate">'+f+'</span><p  class="descriptionRate"><span>'+e+"</span></p>";return d;},changeRate:function(d){if(this.rates!=null&&this.idServiceSelected!=d){this.idServiceSelected=d;this.loadSourceCombo();var e=this.getServiceRate(d);if(e.idType==this.idTypeServiceProofReadingFull){$(".detalles #column_right").hide();}else{$(".detalles #column_right").show();}if(this.selectRates.getValue()!=d){this.selectRates.changeOption(d);}}},validateChangeRate:function(e){var d=true;var f=this.getServiceRate(e);if(!f.allowFiles&&this.get_translationMode()==1){d=false;}if(!d&&this.isVisible){alert("Esta tarifa no esta disponible para documentos");}return d;},loadCategories:function(){var d=false;idSourceLang=$get(this.idComboSourceLanguage).value;idDestinyLang=$get(this.idComboDestLanguage).value;control=$get(this.idComboCategories);control.options.length=0;var e=this.getCurrentRate();control.options[0]=new Option(GlobalJavascript.Seleccionar+".....",-1);for(c=0;c<e.categories.length;c++){if(e.categories[c].idType==this.idTypeContentCategory&&!this.existValue(control.options,e.categories[c].name)){var f=e.categories[c].name+" +"+e.categories[c].price+this.tarea.simboloMoneda;control.options[control.options.length]=new Option(f,e.categories[c].id);}}var g=this.getCategoryPrice(this.idCategoryDeadLine);if(g==null){$("#dvPLazoUrgente").hide();}else{$("#dvPLazoUrgente").show();$get("sPlazoUr").innerHTML=g+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 e=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 f=d.languages[a].nameSourceLanguage;if(d.idType==this.idTypeServiceProofReadingFull){f=f+" / "+d.languages[a].price;}control.options[control.options.length]=new Option(f,d.languages[a].idSourceLanguage);}}if(e!=""){this.set_IDIdiomaOrigen(e);}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 d=0;var e=$get(this.idComboCategories).value;if(e!="-1"){d+=this.getCategoryPrice(e);}if($("#chkDeadLine").is(":checked")){d+=this.getCategoryPrice(this.idCategoryDeadLine);}if($("#chkProfReading").is(":checked")){d+=this.getPriceProofReading();}this.updateTotalPrice(this.tarea.numeroPalabras,this.tarea.precioPorPalabra+d,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 d=null;var f=this.getCurrentRate();for(a=0;a<f.categories.length;a++){if(f.categories[a].id==e){d=f.categories[a].price;break;}}return d;},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(d,e){for(b=0;b<d.length;b++){if(d[b].value==e){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();}
