1function CPassword(container=null){let _this=this;this.container=container||document;this.FormartValid=function(element){let rta=!0;let isnum=/(\d)+/;let isString=/[a-zA-Z]/;if(element.value.length<8||element.value.length>16){rta=!1}else if(element.value.match(isnum)==null){rta=!1}else if(element.value.match(isString)==null){rta=!1}else if(element.value.match(/(\W)+/)){rta=!1} 2return rta} 3this.passwordValidation=function(){let element=_this.container.querySelector("#password") 4if(_this.container.querySelector("#confirmPassword").value!=""&&element.value!=_this.container.querySelector("#confirmPassword").value){_this.ErrorPassword()}else{if(!_this.FormartValid(element)){(new CClient()).setErrorField("password","El formato de password es invalido")}else if(_this.container.querySelector("#error-password").classList.contains("show")) 5_this.DisabledErrorPassword(_this.container);}} 6this.confirmValidation=function(){let element=_this.container.querySelector("#confirmPassword") 7if(element.value!=_this.container.querySelector("#password").value){_this.ErrorPassword()}else{if(!_this.FormartValid(element)){(new CClient()).setErrorField("confirmPassword","El formato es invalido")}else if(_this.container.querySelector("#error-password").classList.contains("show")) 8_this.DisabledErrorPassword();}} 9this.setEventValidation=function(){_this.container.querySelector("#confirmPassword").addEventListener("change",function(e){_this.confirmValidation()});_this.container.querySelector("#password").addEventListener("change",function(e){_this.passwordValidation()})} 10this.ErrorPassword=function(){let pass=this.container.querySelector("#password");let confirm=_this.container.querySelector("#confirmPassword");pass.parentNode.classList.add("has-error");confirm.parentNode.classList.add("has-error");_this.container.querySelector("#error-password").classList.add("show")} 11this.DisabledErrorPassword=function(){let pass=_this.container.querySelector("#password");let confirm=_this.container.querySelector("#confirmPassword");pass.parentNode.classList.remove("has-error");confirm.parentNode.classList.remove("has-error");_this.container.querySelector("#error-password").classList.remove("show")}} 12function CClient(element=null){let _this=this;this.element=element;this.fields={};this.fieldsValidate={};_this.clearFormCliente=function(){let element=document.querySelector(_this.element)||document.querySelector("#popupClient");if(element) 13document.body.removeChild(element)} 14this.setFieldsValidate=function(fieldsValidate){_this.fieldsValidate=fieldsValidate} 15this.showRegister=function(popup=!0){BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'getFormRegister',popup:popup}})};this.showLogin=function(popup=!0){BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'getFormLogin',popup:popup}})};this.cleanFields=function(){} 16this.getFields=function(){_this.fields.name=document.getElementById("name").value;_this.fields.surname=document.getElementById("surname").value;_this.fields.phone=document.getElementById("phone").value;_this.fields.phoneMobile=document.getElementById("phoneMobile").value;_this.fields.country=document.getElementById("country")?document.getElementById("country").value:'';_this.fields.province=document.getElementById("province")?document.getElementById("province").value:'';_this.fields.city=document.getElementById("city")?document.getElementById("city").value:'';_this.fields.addressStreet=document.getElementById("addressStreet")?document.getElementById("addressStreet").value:'';_this.fields.addressNumber=document.getElementById("addressNumber")?document.getElementById("addressNumber").value:'';_this.fields.addressComplement=document.getElementById("addressComplement")?document.getElementById("addressComplement").value:'';_this.fields.addressPostalCode=document.getElementById("addressPostalCode")?document.getElementById("addressPostalCode").value:'';_this.fields.documentIdentificationNumber=document.getElementById("documentIdentificationNumber")?document.getElementById("documentIdentificationNumber").value:''};this.saveUser=function(){this.getFields();_this.fields.id=-1;_this.fields.email=document.getElementById("email").value;_this.fields.password=document.getElementById("password").value;_this.fields.confirmPassword=document.getElementById("confirmPassword").value;const Data={fields:_this.fields} 17if(PHPResponse.urlRef){Data.ref=PHPResponse.urlRef} 18if(_this.validationFields()&&document.querySelectorAll(".has-error").length==0){BL_LoadingBox({Center:!0,Text:'Creando Usuario...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'register',Data}})}} 19this.updateClient=function(){_this.getFields();if(_this.validationFields()&&document.querySelectorAll(".has-error").length==0){BL_LoadingBox({Center:!0,Text:'Actulizacion Usuario...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'update',Data:_this.fields}})}}
20this.showForgetPassword=function(popup=!0){BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'getFormForgetPassword',popup:popup}})} 21this.changePassword=function(){_this.fields.password=document.getElementById("password").value;_this.fields.confirmPassword=document.getElementById("confirmPassword").value;_this.fields.email=document.getElementById("email").value;_this.fields.code=document.getElementById("code")?document.getElementById("code").value:-1;_this.fieldsValidate=["password","confirmPassword"];if(_this.validationFields()&&document.querySelectorAll(".has-error").length==0){BL_LoadingBox({Center:!0,Text:'Cambiando Password...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'newPassword',Data:_this.fields}})}} 22this.forgetPassword=function(){_this.fields.email=document.getElementById("email").value;if(_this.fields.email==""){_this.setErrorField("email","complete el campo del email para la comprobacion")}else{BL_LoadingBox({Center:!0,Text:'Verificando el mail...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'forgetPassword',Data:_this.fields}})}} 23this.loginUser=function(){_this.fields.email=document.getElementById("email").value;_this.fields.password=document.getElementById("password").value;if(_this.validationFields()){BL_LoadingBox({Center:!0,Text:'Buscando Usuario...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'login',Data:_this.fields}})}} 24this.validationFields=function(){let rta=!0;for(let field in _this.fields){let element=document.getElementById(field) 25if(element&&element.tagName=="INPUT"){switch(element.type){case 'text':if(_this.fieldsValidate.indexOf(field)!=-1&&element.value.trim().length==0){rta=!1;_this.setErrorField(element.id,"El Campo es obligatorio")}else if(element.getAttribute("data-format")){switch(element.getAttribute("data-format")){case 'number':if(element.value.trim().match(/(\D)+/)){rta=!1;_this.setErrorField(element.id,"Formato Invalido: Solo se admiten numeros")} 26break;case 'string':if(element.value.trim().match(/[^A-Za-z ]/)){rta=!1;_this.setErrorField(element.id,"Formato Invalido: Solo se admiten letras")} 27break;case 'email':if(!element.value.trim().match(/^[^@]+@[^@]+\.[a-z]{2,6}$/i)){rta=!1;_this.setErrorField(element.id,"Formato Invalido: no se ingreso un correo valido")} 28break;case 'alphanumeric':if(element.value.trim().match(/[^a-zA-Z0-9 ,._-ñÑ]/)){rta=!1;_this.setErrorField(element.id,"Formato Invalido: no se admiten caracteres especiales")} 29break}} 30break}}} 31return rta} 32this.setErrorField=function(name,error){let element=document.getElementById(name);element.parentNode.classList.add("has-error");let tooltip=new bootstrap.Tooltip(element,{placement:'top',title:error,delay:0});tooltip.enable();tooltip.show();let removeTooltip=()=>{element.parentNode.classList.remove('has-error');tooltip.dispose() 33element.onkeypress=null;element.onchange=null} 34element.onkeypress=removeTooltip;element.onchange=removeTooltip} 35this.close=function(element){document.body.removeChild(element);document.body.classList.remove("modal-open")} 36this.onResponseSuccess=function(response){BL_HidenLoadingBox({});switch(response.Action){case 100:_this.clearFormCliente();let container=document.createElement("div");container.innerHTML=response.Data.form;container.querySelector("#save").addEventListener("click",function(e){e.preventDefault();_this.saveUser()});(new CPassword(container)).setEventValidation();container.querySelectorAll("input").forEach(function(element){element.addEventListener("keypress",function(e){if(e.keyCode==13){_this.saveUser()}}) 37window.setTimeout(function(element){element.value=""},110,element)});if(response.Data.popup){document.body.classList.add("modal-open");container.id="popupClient";container.querySelector("#r-close").addEventListener("click",function(e){e.preventDefault();_this.close(document.querySelector("#popupClient"))});window.setTimeout(function(){document.querySelector(".formRegistro").classList.add("in")},100)} 38document.body.appendChild(container);_this.fieldsValidate=response.Data.fieldsValidate;break;case 101:BL_MessageBoxCreate({Title:"Usuario Creado",Text:"Registro completado exitosamente. Por favor, compruebe su correo electrónico para finalizar el proceso de registro. Revise su bandeja de entrada, incluyendo la carpeta de spam o correo no deseado, ya que el correo de verificación puede tardar unos minutos en llegar. ",Buttons:[{Text:'Aceptar',ClassName:'btn btn-primary',CallBack:function(){if(document.querySelector("#popupClient")){_this.close(document.querySelector("#popupClient"))}else{location.href=PHPResponse.AppDomain}}}]});break;case 200:document.body.classList.add("modal-open");let login=document.createElement("div");login.innerHTML=response.Data.form;login.querySelector("#login-client").addEventListener("click",function(e){e.preventDefault();_this.loginUser()});login.querySelectorAll("input").forEach(function(element){element.addEventListener("keypress",function(e){if(e.keyCode==13){_this.loginUser()}}) 39window.setTimeout(function(element){element.value=""},110,element)});if(response.Data.popup){login.id="popupClient";login.querySelector("#r-close").addEventListener("click",function(e){e.preventDefault();_this.close(document.querySelector("#popupClient"))});window.setTimeout(function(){document.querySelector(".formLogin").classList.add("in")},100)} 40document.body.appendChild(login);_this.fieldsValidate=response.Data.fieldsValidate;break;case 201:location.reload();document.querySelector(".login").classList.remove("hidden");document.querySelector(".NoLogin").classList.add("hidden");break;case 202:BL_MessageBoxCreate({Title:"Error",Text:"El usuario o la contraseña ingresada son incorrectas",Icon:'ERROR'});break;case 203:BL_MessageBoxCreate({Title:"Mail Enviado",Text:"Hemos enviado el enlace de activación correctamente a su dirección de correo electrónico. Para completar el proceso de registro, por favor revise su bandeja de entrada y haga clic en el enlace de activación. Si no encuentra el correo electrónico en su bandeja de entrada, por favor revise su carpeta de spam o correo no deseado. ",Buttons:[{Text:'Aceptar',ClassName:'btn btn-warning',CallBack:function(){if(document.querySelector("#popupClient")){_this.close(document.querySelector("#popupClient"))}else{location.href=PHPResponse.AppDomain}}}]});break;case 205:if(typeof SDPW=="undefined"){let script=document.createElement("script");script.src=PHPResponse.AppDomain+'/js/SDPW.js';script.onload=function(){(new SDPW()).showDeviceActive()};document.head.appendChild(script)}else{(new SDPW()).showDeviceActive()} 41break;case 300:document.querySelector(".NoLogin").classList.remove("hidden");document.querySelector(".login").classList.add("hidden");location.reload();break;case 400:let forget=document.createElement("div");forget.innerHTML=response.Data.form;forget.querySelector("#forget-password").addEventListener("click",function(e){e.preventDefault();_this.forgetPassword()});forget.querySelector("#email").addEventListener("keypress",function(e){if(e.keyCode==13){_this.forgetPassword()};element.value=""});if(response.Data.popup){_this.close(document.querySelector("#popupClient"));document.body.classList.add("modal-open");forget.id="popupClient";forget.querySelector("#r-close").addEventListener("click",function(e){e.preventDefault();_this.close(document.querySelector("#popupClient"))});window.setTimeout(function(){document.querySelector(".formForget").classList.add("in")},110)} 42document.body.appendChild(forget);break;case 401:BL_MessageBoxCreate({Title:'Reestablecer Clave',Text:'Hemos enviado un correo electrónico con un enlace para restablecer su contraseña. Por favor, revise su bandeja de entrada y haga clic en el enlace proporcionado para continuar con la operación. Si no encuentra el correo electrónico en su bandeja de entrada, revise su carpeta de spam o correo no deseado, ya que a veces los correos electrónicos pueden ser filtrados por error. ¡Gracias por utilizar nuestro servicio!',Buttons:[{Text:'Aceptar',ClassName:'btn btn-primary',CallBack:function(){if(document.querySelector("#popupClient")){_this.close(document.querySelector("#popupClient"))}else{location.href=PHPResponse.AppDomain}}}]});break;case 402:BL_MessageBoxCreate({Title:'Reestablecer Clave',Text:'Su
42contraseña se ha cambiado con éxito. Ahora puede hacer clic en el botón para ir a la página principal y continuar utilizando nuestros servicios.',Buttons:[{Text:'Ir a Home',ClassName:'btn btn-primary',CallBack:function(){location.href=PHPResponse.AppDomain}},]});break;case 403:BL_MessageBoxCreate({Title:'Error',Text:response.Data.error,Icon:'ERROR'});break;case 0:BL_MessageBoxCreate({Title:"Error",Text:response.Data.Errores,Icon:"ERROR"});break;case-1:let msj="";for(let e in response.Data.Errores){msj+=response.Data.Errores[e]+"</br>";_this.setErrorField(e,response.Data.Errores[e])} 43break;case-2:if(!_this.fields.email&&!_this.fields.password){let email=_this.fields.password;_this.fields=[];_this.fields.email=email} 44BL_MessageBoxCreate({Title:'Usuario Inactivo',Text:'Lo siento, parece que está intentando acceder con un usuario inactivo. Para activar su cuenta, por favor revise el correo electrónico que recibió al momento de registrarse y siga las instrucciones para activar su cuenta. Si ha pasado el tiempo estipulado para activar su cuenta, haga clic en el botón de "Reenviar correo electrónico" para recibir un nuevo enlace de activación. Si continúa teniendo problemas, no dude en ponerse en contacto con nuestro equipo de soporte para obtener ayuda adicional.',Buttons:[{Text:'Reenviar Email',ClassName:'btn btn-primary',CallBack:function(){BL_LoadingBox({Center:!0,Text:'Enviando Email...'});BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'forwardActivationCode',Data:_this.fields}})}},{Text:'Salir',ClassName:'btn btn-warning',CallBack:function(){}}]});break;case-5:let error="";for(let e in response.Data.Errores){error+=response.Data.Errores[e]+"</br>"} 45BL_MessageBoxCreate({Title:"FORMATO INVALIDO",Text:error,Icon:'ERROR'});break}} 46this.Logout=function(){BL_AjaxRequest({Url:PHPResponse.AppDomain+'CalledClient.php',CallBack:_this.onResponseSuccess,Request:{Action:'logout',}})}};function CFade(Control){var _My;if(!this.CFadeStatus){_My=Control;_My.CFadeStatus=1 47CFade.call(_My)}else if(this.CFadeStatus==1){_My=this;_My.CFadeStatus=2;this.Fade=0;this.style.opacity=0;this.style.filter='alpha(opacity=0)';this.Interval=null;this.FadeDesde=0;this.FadeHasta=100;this.FadeTime=10;this.FadeOp=40;this.SetFadeRange=function(Desde,Hasta){this.FadeDesde=Desde;this.FadeHasta=Hasta} 48this.SetFadeTime=function(Tiem,FadeOp){this.FadeTime=Tiem;this.FadeOp=FadeOp} 49this.FadeIn=function(CallBack){window.clearInterval(_My.Interval);this.Fade=_My.FadeDesde;this.Interval=window.setInterval(function(){_My.style.display='block';_My.Fade+=_My.FadeOp;_My.style.opacity=_My.Fade/100;_My.style.filter='alpha(opacity='+_My.Fade+')';if(_My.Fade>_My.FadeHasta){_My.Fade=_My.FadeHasta;window.clearInterval(_My.Interval);if(CallBack) 50CallBack();}},this.FadeTime)} 51this.FadeOut=function(CallBack){window.clearInterval(_My.Interval);this.Fade=_My.FadeHasta;this.Interval=window.setInterval(function(){_My.Fade-=_My.FadeOp;_My.style.opacity=_My.Fade/100;_My.style.filter='alpha(opacity='+_My.Fade+')';if(_My.Fade<_My.FadeDesde){_My.style.display='none';_My.Fade=_My.FadeDesde;window.clearInterval(_My.Interval);if(CallBack) 52CallBack();}},this.FadeTime)}} 53return _My};function CToolTip(Control){var _My;if(!this.CToolTipStatus){_My=CCtrl(Control);if(_My.CToolTipStatus!=2){_My.CToolTipStatus=1;CToolTip.call(_My)}}else if(this.CToolTipStatus==1){_My=this;this.CToolTipStatus=2;this.ToolTip=document.createElement('div');this.ToolTip.Clear=document.createElement('div');this.ToolTip.Clear.className='DivClear';this.ToolTip.Text=document.createElement('p');this.ToolTip.Text.innerHTML='ToolTip.';this.ToolTip.style.position='fixed';this.ToolTip.className='CToolTip';this.ToolTip.Type='NORMAL';this.ToolTip.Icon=document.createElement('img');this.ToolTip.Icon.style.display='none';this.ToolTip.appendChild(this.ToolTip.Icon);this.ToolTip.appendChild(this.ToolTip.Text);this.ToolTip.appendChild(this.ToolTip.Clear);this.ToolTip.style.zIndex=10000;this.ToolTip.TimeOut=null;document.body.appendChild(this.ToolTip);CFade(this.ToolTip);this.ToolTip.SetFadeTime(2,10);this.SetToolTipType=function(Type){this.ToolTip.Type=Type} 54this.onmouseover=function(){this.ToolTip.Type=this.getAttribute('tooltiptype');if(this.ToolTip.Type&&this.ToolTip.Type!=''){this.ToolTip.Text.innerHTML=this.getAttribute('tooltiptext');switch(this.ToolTip.Type){case 'CRITICAL':this.ToolTip.style.backgroundColor='#FFCCAA';this.ToolTip.style.border='1px solid #FF3334';this.ToolTip.Icon.style.display='block';this.ToolTip.Icon.src='img/icons/Critical.png';break;case 'WARNING':this.ToolTip.style.backgroundColor='#FFFFAA';this.ToolTip.style.border='1px solid #FFAD33';this.ToolTip.Icon.style.display='block';this.ToolTip.Icon.src='img/icons/Warning.png';break;case 'INFO':this.ToolTip.style.backgroundColor='#9FDAEE';this.ToolTip.style.border='1px solid #2BB0D7';this.ToolTip.Icon.style.display='block';this.ToolTip.Icon.src='img/icons/Info.png';break;case 'HELP':this.ToolTip.style.backgroundColor='#9FDAEE';this.ToolTip.style.border='1px solid #2BB0D7';this.ToolTip.Icon.style.display='block';this.ToolTip.Icon.src='img/icons/Help.png';break;default:this.ToolTip.style.backgroundColor='#FFFFAA';this.ToolTip.style.border='1px solid #FFAD33';this.ToolTip.Icon.style.display='none';this.ToolTip.Icon.src=''} 55this.ToolTip.TimeOut=window.setTimeout(function(){var Poss=getAbsoluteElementPosition(_My);_My.ToolTip.style.top=Poss.bottom-10+"px";_My.ToolTip.style.left=Poss.right-10+"px";_My.ToolTip.FadeIn()},500)}} 56this.onmouseout=function(){window.clearTimeout(this.ToolTip.TimeOut);this.ToolTip.FadeOut()}} 57return _My};var STATUS_ERROR=-1;var STATUS_OK=0;var STATUS_STOP=1;var STATUS_WARNING=2;function BL_AjaxInit(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();return xmlHttp}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");return xmlHttp}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");return xmlHttp}catch(e){alert("Tu navegador no soporta AJAX!");return!1}}}} 58function BL_AjaxRequest(Request){try{var BL_Ajax=BL_AjaxInit();if(Request.Url) 59BL_Ajax.open("POST",Request.Url,!0);else BL_Ajax.open("POST",PathLlamado,!0);BL_Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");BL_Ajax.onreadystatechange=function(){if(BL_Ajax.readyState===4){try 60{if(BL_Ajax.status===200){var nResponseStart=BL_Ajax.responseText.search("<BL_AjaxResponse>");var nResponseEnd=BL_Ajax.responseText.search("</BL_AjaxResponse>");if(nResponseStart!==-1&&nResponseEnd!==-1){var strAjaxResponse=BL_Ajax.responseText.substring(nResponseStart+17,nResponseEnd);if(Request.Parent){Request.CallBack.call(Request.Parent,JSON.parse(strAjaxResponse))}else{Request.CallBack(JSON.parse(strAjaxResponse))}}else{Request.CallBack({Error:1,msg:'No tuvo respuesta de la peticion.',Status:STATUS_ERROR,Message:'No tuvo respuesta de la peticion.'})}}else if(BL_Ajax.status==400){Request.CallBack({Error:1,msg:'No encontro la pagina de solicitud.',Status:STATUS_ERROR,Message:'No tuvo respuesta de la peticion.'})}else if(BL_Ajax.status!=0){Request.CallBack({Error:1,msg:'No tuvo respuesta de la peticion.',Status:STATUS_ERROR,Message:'No tuvo respuesta de la peticion.'})}}catch(e){console.error(e);Request.CallBack({Error:1,msg:'Error no controlado. '+e,Status:STATUS_ERROR,Message:'Error no controlado. '+e})}}} 61var Datos="Ajax=1&Request="+encodeURIComponent(JSON.stringify(Request.Request));BL_Ajax.send(Datos)}catch(e){console.error(e);Request.CallBack({Error:1,msg:'Error no controlado. '+e,Status:STATUS_ERROR,Message:'Error no controlado. '+e})}};HTMLElement=typeof HTMLElement!=="undefined"?HTMLElement:Element;function BL_extend(m,e){var e=e||this;for(var x in m) 62e[x]=m[x];return e} 63HTMLElement.prototype.BL_extend=HTMLElement.prototype.BL_Extend=BL_Extend=BL_extend;function BL_ManagerMessage(){this.DMSG=[]} 64BL_ManagerMessage.prototype.AssingDispatch=function(Objeto){Objeto.SetManagerMessage(this);this.DMSG.push(Objeto)} 65BL_ManagerMessage.prototype.DispatchMessage=function(ID_MSG){for(var i=0;i<this.DMSG.length;i++){this.DMSG[i].SendMessage(ID_MSG)}} 66function BL_DispatchMessage(){this.FUNCION=[];this.MNGMSG=null} 67BL_DispatchMessage.prototype.SendMessage=function(ID_MSG){for(var i=0;i<this.FUNCION.length;i++){if(this.FUNCION[i].ID==ID_MSG) 68this[this.FUNCION[i].CallBack]();}} 69BL_DispatchMessage.prototype.Call=function(ID_MSG,CallBack){var bEsta=!1;for(var i=0;i<this.FUNCION.length;i++){if(this.FUNCION[i].ID==ID_MSG){this.FUNCION[i].CallBack=CallBack;bEsta=!0;break}} 70if(!bEsta) 71this.FUNCION.push({ID:ID_MSG,CallBack:CallBack})} 72BL_DispatchMessage.prototype.SetManagerMessage=function(Manager){this.MNGMSG=Manager} 73BL_DispatchMessage.prototype.DispatchMessage=function(ID_MSG){this.MNGMSG.DispatchMessage(ID_MSG)} 74String.prototype.RemplaceAll=function(busca,reemplaza){var text=this;while(text.toString().indexOf(busca)!=-1) 75text=text.toString().replace(busca,reemplaza);return text} 76HTMLElement.prototype.AddEventList=function(eventType,handler){var _this=this;if(this.addEventListener) 77this.addEventListener(eventType,handler,!1);else if(this.attachEvent) 78this.attachEvent('on'+eventType,function(){handler.call(_this)})} 79HTMLDocument.prototype.AddEventList=function(eventType,handler){var _this=this;if(this.addEventListener) 80this.addEventListener(eventType,handler,!1);else if(this.attachEvent) 81this.attachEvent('on'+eventType,function(){handler.call(_this)})} 82HTMLElement.prototype.BL_RemoveClass=function(c){this.className=this.className.replace(new RegExp('(^|\\s)'+c+'(\\s|$)','g'),' ');this.className=this.className.replace(new RegExp('(\\s\\s)','g'),' ')} 83HTMLElement.prototype.BL_AddClass=function(c){this.BL_RemoveClass(c);this.className+=' '+c} 84HTMLElement.prototype.BL_HasClass=function(ClassName){Ex=new RegExp('(^|\\s)'+ClassName+'(\\s|$)','g');return Ex.test(this.className)} 85HTMLElement.prototype.BL_Hidden=function(f){(f)?this.BL_AddClass('COculto'):this.BL_RemoveClass('COculto')} 86HTMLElement.prototype.BL_Enabled=function(bEnable){if(bEnable===!0){this.disabled=!1}else if(bEnable===!1){this.disabled=!0} 87return!this.disabled};HTMLElement.prototype.BL_CreateTab=function(){this.Items=[];var myob=this;this.PosicionSalvada=null;this.ItemSalvado;this.PosicionFinal=this.nDesplazamientos=this.maxDesplazamiento=0;this.tabsWidth=this.tabsLeft=this.tabsTop=this.tabsHeight=0;this.UpdateTabs=function(){var i,j,li;var _My=this;var arrNodes=[];var posLeft,posRight;arrNodes=this.getElementsByTagName('*');for(var n=0;n<arrNodes.length;n++){switch(arrNodes[n].getAttribute('data-tabs')){case 'TABS':this.ulTabs=arrN
87odes[n];break;case 'CONTROLS':this.Slider=arrNodes[n];this.Slider.preloaded=!0;break;default:break}} 88if(typeof this.ulTabs!=='object'){for(i=0;i<this.childNodes.length;i++){if(this.childNodes[i].tagName=="UL"){this.ulTabs=this.childNodes[i]}}} 89this.ulTabs.style.whiteSpace='nowrap';this.ulTabs.style.overflow='hidden';this.ulTabs.CtrlTab=this;li=this.ulTabs.getElementsByTagName("li");this.Items.length=0;for(j=0;j<li.length;j++){li[j].CtrlTab=this;li[j].ItemID=j;li[j].style.position='relative';li[j].style.display='inline-block';if(!li[j].style.left) 90li[j].style.left='0px';if(this.ulTabs.offsetLeft<(li[0].offsetLeft-parseInt(li[0].style.left))){posLeft=li[j].offsetLeft-this.ulTabs.offsetLeft;posRight=(li[j].offsetLeft-this.ulTabs.offsetLeft)+li[j].offsetWidth}else{posLeft=li[j].offsetLeft;posRight=li[j].offsetLeft+li[j].offsetWidth} 91this.Items.push({t:li[j],p:document.getElementById(li[j].getAttribute("ref")),l:!1,f:document.getElementById(li[j].getAttribute("ref")).parentNode,Tipo:li[j].getAttribute("data-tabs-type"),Codigo:li[j].getAttribute("data-tabs-code"),totalSize:0,Left:posLeft,Right:posRight});li[j].onclick=function(){this.CtrlTab.SelectItem(this.ItemID)};document.getElementById(li[j].getAttribute("ref")).BL_AddClass("CTabChild");if(!li[j].getAttribute("noload")) 92document.getElementById(li[j].getAttribute("ref")).parentNode.removeChild(document.getElementById(li[j].getAttribute("ref")));} 93if(this.Items.length>1){this.margenLi=((this.Items[1].Left-this.Items[0].Right)/2)}else{this.margenLi=0} 94if(typeof(this.Slider)!=='object'){this.Slider=document.createElement('div');this.Slider.CtrlTab=this;this.Slider.setAttribute('data-tabs','CONTROLS');this.Slider.preloaded=!1} 95if(typeof this.Slider.Left=='undefined'){this.Slider.Left=document.createElement('button');this.Slider.Left.CtrlTab=this;this.Slider.Left.BL_AddClass('tabs-controls-btnleft');this.Slider.Left.innerHTML='<<';this.Slider.Right=document.createElement('button');this.Slider.Right.CtrlTab=this;this.Slider.Right.BL_AddClass('tabs-controls-btnright');this.Slider.Right.innerHTML='>>';this.Slider.Left.setAttribute('title','ver pesta�as');this.Slider.Left.onclick=function(){this.CtrlTab.SlideLeft()};this.Slider.Right.setAttribute('title','ver pesta�as');this.Slider.Right.onclick=function(){this.CtrlTab.SlideRight()};this.Slider.appendChild(this.Slider.Left);this.Slider.appendChild(this.Slider.Right)} 96if(!(this.Slider.preloaded)){this.Slider.style.position='absolute';this.Slider.style.zIndex='10';this.Slider.style.display='block';this.ulTabs.parentNode.insertBefore(this.Slider,this.ulTabs);this.ulTabs.Poss=getAbsoluteElementPosition(this.ulTabs);this.Slider.style.top=this.ulTabs.Poss.bottom-(this.Slider.offsetHeight/2)+"px";this.Slider.style.left=this.ulTabs.Poss.right-(this.Slider.offsetWidth*0.7)+"px";this.Slider.style.display='none';var oldResize=window.onresize;window.onresize=function(){_My.ulTabs.Poss=getAbsoluteElementPosition(_My.ulTabs);_My.Slider.style.top=_My.ulTabs.Poss.bottom-(_My.Slider.offsetHeight/2)+"px";_My.Slider.style.left=_My.ulTabs.Poss.right-(_My.Slider.offsetWidth*0.7)+"px";if(typeof oldResize==='function'){oldResize()}}} 97this.paddingUl=0;this.paddingUl=((((this.PosicionSalvada)?-this.PosicionSalvada:0)+this.Items[0].Left)-this.margenLi);for(i=0;i<this.Items.length;i++){this.Items[i].totalSize=this.Items[i].t.offsetWidth+this.margenLi} 98this.maxDesplazamiento=(this.Items[this.Items.length-1].Right+this.margenLi+this.paddingUl)-this.ulTabs.offsetWidth;if(this.maxDesplazamiento<=0){this.Slider.style.display='none'}else{this.Slider.style.display='block'} 99this.Slider.Left.Active=function(){this.disabled=!1;this.style.visibility="visible";this.onclick=function(){this.CtrlTab.SlideLeft()}};this.Slider.Right.Active=function(){this.disabled=!1;this.style.visibility="visible";this.onclick=function(){this.CtrlTab.SlideRight()}};this.Slider.Left.Inactive=function(){this.disabled=!0;this.style.visibility="hidden";this.onclick=function(){}};this.Slider.Right.Inactive=function(){this.disabled=!0;this.style.visibility="hidden";this.onclick=function(){}}};this.InitTabs=function(){this.PosicionFinal=this.tabsWidth=this.nDesplazamientos=this.maxDesplazamiento=0;this.UpdateTabs();if(this.PosicionSalvada){for(var i=0;i<this.Items.length;i++){this.Items[i].t.style.left=(this.PosicionSalvada)+'px'} 100delete this.PosicionSalvada} 101if(this.ItemSalvado){this.SelectItem(this.ItemSalvado)}else{this.SelectItem(0)} 102this.SlideState()};this.SelectItem=function(ii,cod){for(var g=0;g<this.Items.length;g++){this.Items[g].p.BL_Hidden(!0);this.Items[g].t.BL_RemoveClass('CSelected');if(typeof ii==='string'){if(this.Items[g].Tipo==ii){if(typeof cod==='string'||typeof cod==='number'){if(this.Items[g].Codigo==cod){ii=g}}else{ii=g}}}}
103if(!(typeof ii==='number')){ii=0} 104if(this.Items[ii].l==!1){this.Items[ii].f.appendChild(this.Items[ii].p);this.Items[ii].l=!0} 105this.Items[ii].t.BL_AddClass('CSelected');this.Items[ii].p.BL_Hidden(!1)};this.AddItem=function(objTab){if(typeof objTab.Ref==='string'&&objTab){var liTab,divContainer;liTab=document.createElement('li');divContainer=document.createElement('div');liTab.innerHTML=objTab.Name;liTab.setAttribute('ref','idTab-'+objTab.Ref);if(!objTab.noload){liTab.setAttribute('noload','1')}else{liTab.setAttribute('noload','')} 106if(objTab.Title){liTab.setAttribute('title',objTab.Title)} 107if(typeof objTab.Class==='string'){liTab.BL_AddClass(objTab.Class)} 108liTab.style.position='relative';liTab.style.display='inline-block';liTab.CtrlTab=this;if((typeof objTab.Tipo=='string')||(typeof objTab.Tipo=='number')){liTab.setAttribute('data-tabs-type',objTab.Tipo)} 109if((typeof objTab.Codigo=='string')||(typeof objTab.Codigo=='number')){liTab.setAttribute('data-tabs-code',objTab.Codigo)} 110this.ulTabs.appendChild(liTab.cloneNode(!0));if((typeof objTab.Content=='string')||(typeof objTab.Content=='number')){divContainer.innerHTML=objTab.Content}else if(typeof objTab.Content=='object'){divContainer.appendChild(objTab.Content.cloneNode(!0))} 111divContainer.setAttribute('id','idTab-'+objTab.Ref);divContainer.BL_AddClass("CTabChild");divContainer.BL_AddClass("COculto");this.appendChild(divContainer.cloneNode(!0));if(this.Items[0]){this.Items[0].t.style.left=(this.Items[0].t.style.left)?this.Items[0].t.style.left:'0px'} 112this.PosicionSalvada=parseInt(this.Items[0].t.style.left,10);for(var g=0;g<this.Items.length;g++){if(this.Items[g].t.className.indexOf('CSelected')!==-1) 113this.ItemSalvado=g} 114this.InitTabs();return(this.Items.length-1)}};this.RemoveItem=function(ii){if(!isNaN(ii)){this.Items[ii].t.parentNode.removeChild(this.Items[ii].t);this.Items[ii].p.parentNode.removeChild(this.Items[ii].p);this.Items.splice(ii,1);for(var g=0;g<this.Items.length;g++){this.Items[g].t.ItemID=g}}else if((typeof ii)==('string')){if(ii.indexOf('idTab-')===-1){ii='idTab-'+ii} 115for(var g=0;g<this.Items.length;g++){if(this.Items[g].t.getAttribute('ref')==ii){this.Items[g].t.parentNode.removeChild(this.Items[g].t);this.Items[g].p.parentNode.removeChild(this.Items[g].p);this.Items.splice(g,1);for(var h=0;h<this.Items.length;h++){this.Items[h].t.ItemID=h}}}} 116if(!this.Items[0].t.style.left){this.Items[0].t.style.left='0px'} 117this.PosicionSalvada=parseInt(this.Items[0].t.style.left,10);for(var g=0;g<this.Items.length;g++){if(this.Items[g].t.className.indexOf('CSelected')!==-1) 118this.ItemSalvado=g} 119this.InitTabs()};this.SlideRight=function(){if((!this.idInterval)){var distancia=0,Dir,Posicion;if(!this.Items[0].t.style.left) 120this.Items[0].t.style.left='0px';Posicion=parseInt(this.Items[0].t.style.left,10);for(var i=0;i<this.Items.length;i++){distancia=(this.Items[i].Right+this.margenLi-this.ulTabs.offsetWidth);if(distancia>0){distancia+=this.paddingUl;distancia=(i===(this.Items.length-1))?(this.maxDesplazamiento+Posicion):distancia;break}} 121this.PosicionFinal=Posicion-distancia;Dir=-1;this.nDesplazamientos++;this.idInterval=window.setInterval(function(){myob.SlideHorizontal(Dir)},10)}};this.SlideLeft=function(){if((!this.idInterval)){var distancia=0,Dir,Posicion;if(!this.Items[0].t.style.left) 122this.Items[0].t.style.left='0px';Posicion=parseInt(this.Items[0].t.style.left,10);for(var i=0;i<this.Items.length;i++){distancia=(this.Items[i].Right+this.margenLi+this.paddingUl);if(distancia>0){distancia=this.Items[i].totalSize-(this.Items[i].Right);distancia+=this.paddingUl;distancia=(i===0)?Math.abs(Posicion):distancia;break}} 123this.PosicionFinal=Posicion+distancia;Dir=1;this.nDesplazamientos--;this.idInterval=window.setInterval(function(){myob.SlideHorizontal(Dir)},10)}};this.SlideHorizontal=function(nDireccion){try{this.PosicionFinal=Math.ceil(this.PosicionFinal);var Posicion=parseInt(this.Items[0].t.style.left,10);var nVelocidad;nVelocidad=Math.ceil(Math.sqrt(Math.abs(this.PosicionFinal-Posicion)));if(nVelocidad<0) 124nVelocidad=nVelocidad*-1;if(nVelocidad===0) 125nVelocidad=1;if(this.PosicionFinal!=Posicion){Posicion+=(nDireccion*nVelocidad);if(nDireccion<0){if(Posicion<(-this.maxDesplazamiento)){Posicion=this.PosicionFinal=(-this.maxDesplazamiento);this.nDesplazamientos=(this.Items.length-1)}else if(Posicion<this.PosicionFinal){Posicion=this.PosicionFinal}}else{if(Posicion>0){Posicion=this.PosicionFinal=0;this.nDesplazamientos=0}else if(Posicion>this.PosicionFinal){Posicion=this.PosicionFinal}} 126for(var i=0;i<this.Items.length;i++){this.Items[i].t.style.left=(Posicion)+'px';if(this.ulTabs.offsetLeft<(this.Items[0].t.offsetLeft-parseInt(this.Items[0].t.style.left))){this.Items[i].Left=this.Items[i].t.offsetLeft-this.ulTabs.offsetLeft;this.Items[i].Right=(this.Items[i].t.offsetLeft-this.ulTabs.offsetLeft)+this.Items[i].t.offsetWidth}else{this.Items[i].Left=this.Items[i].t.offsetLeft;this.Items[i].Right=this.Items[i].t.offsetLeft+this.Items[i].t.offsetWidth}}}else{window.clearInterval(this.idInterval);delete this.idInterval;this.SlideState()}}catch(e){alert(e)}};this.SlideState=function(){if(!this.Items[0].t.style.left)
127this.Items[0].t.style.left='0px';if(parseInt(this.Items[0].t.style.left,10)>=0){this.Slider.Left.Inactive();this.Slider.Right.Active()}else if(parseInt(this.Items[0].t.style.left,10)<=(-this.maxDesplazamiento)){this.Slider.Right.Inactive();this.Slider.Left.Active()}else{this.Slider.Left.Active();this.Slider.Right.Active()}};this.InitTabs()};HTMLElement.prototype.BL_Enabled=function(bEnable){if(bEnable===!0){this.disabled=!1}else if(bEnable===!1){this.disabled=!0} 128return!this.disabled};function CCtrl(Control){var _My;if(!this.CCtrlStatus){if(typeof(Control)==="string"){if(!(_My=document.getElementById(Control))){_My=document.createElement('div');_My.id=Control||''}}else if(Control) 129_My=Control;else _My=document.createElement('div');if(!_My.CCtrlStatus) 130_My.CCtrlStatus=1;CCtrl.call(_My,Control)}else if(this.CCtrlStatus===1){_My=this;_My.CCtrlStatus=2;if(this.getAttribute("validacion")==='ENTERO'){this.onkeypress=function(event){return BL_ToolTipValidation(BL_VNumeric,event,this,'Solo se permite ingresar valores numericos.')} 131this.onchange=function(event){return BL_ToolTipValidation(BL_VNumeric,event,this,'Solo se permite ingresar valores numericos.')}} 132this.setClass=function(ClassName){this.className=ClassName} 133this.AddClass=function(ClassName){this.BL_AddClass(ClassName)} 134this.RemoveClass=function(ClassName){this.BL_RemoveClass(ClassName)} 135this.HasClass=function(ClassName){Ex=new RegExp('(^|\\s)'+ClassName+'(\\s|$)','g');return Ex.test(this.className)} 136this.setText=function(Text){this.innerHTML=Text} 137this.AddClick=function(Function){if(document.addEventListener){this.addEventListener('click',Function,!1)}else{this.attachEvent('onclick',Function)}}} 138return _My} 139function CField(){var _My;if(!this.CFieldStatus){_My=CCtrl();_My.CFieldStatus=1;CField.call(_My)}else{_My=this;_My.CFieldStatus=2;this.setClass('CField');this.Index=0;this.ParentRow=null} 140return _My} 141function CRow(Control){var _My;if(!this.CRowStatus){_My=CCtrl(Control);_My.CRowStatus=1;CRow.call(_My,Control)}else if(this.CRowStatus==1){_My=this;this.CRowStatus=2;this.Fields=new Array();this.setClass('CRow');this.ParentList=null;this.Index=0;this.Fields.Clear=function(){var Dato;while((Dato=this.pop())){_My.removeChild(Dato);delete Dato}} 142this.Fields.Remove=function(Index){this.removeChild(this[Index]);this.splice(Index,1);for(var i=0;i<this.length;i++){this[i].Index=i}} 143this.Fields.Add=function(Parameters){var _New=CField();_My.appendChild(_New);_New.ParentRow=_My;_New.Index=this.length;if(Parameters.Text){_New.setText(Parameters.Text)}else if(Parameters.Control){_New.appendChild(Parameters.Control)} 144if(Parameters.Class!==undefined) 145_New.BL_AddClass(Parameters.Class);if(Parameters.Title!==undefined) 146_New.title=Parameters.Title;this.push(_New);return _New.Index}} 147return _My} 148function CListView(idControl){var _My;if(!this.CListViewStatus){_My=CCtrl(idControl);if(!_My.CListViewStatus){_My.CListViewStatus=1;CListView.call(_My,idControl)}}else if(this.CListViewStatus==1){_My=this;this.CListViewStatus=2;this.setClass('CListView');this.Rows=new Array();this.Body=document.createElement('div');this.Body.BL_AddClass('CBody');this.Caption={IDs:null,Controls:new Array(),Text:'',Default:''};this.Header=CRow(idControl+'_Head');this.Header.setClass('CHead');this.Header.ParentList=this;this.Foot=CRow(idControl+'_Foot');this.Foot.setClass('CFoot');this.Foot.ParentList=this;this.Pages=new Array();this.Pages.Selected=1;this.Pages.Size=11;this.Pages.CtrlClone=new Array();this.Pages.Ctrl=new Array();if((this.getAttribute('pageid'))=='none'){}else if((this.getAttribute('pageid'))){this.Pages.CtrlClone=this.getAttribute('pageid').split(';');for(var i=0;i<this.Pages.CtrlClone.length;i++){this.Pages.Ctrl.push(CRow(document.getElementById(this.Pages.CtrlClone[i])));this.Pages.Ctrl[i].BL_AddClass('CPage')}}else{this.Pages.Ctrl.push(CRow(idControl+'_Page'));this.Pages.Ctrl[0].setClass('CPage');this.appendChild(this.Pages.Ctrl[0])} 149this.appendChild(this.Header);this.appendChild(this.Body);this.appendChild(this.Foot);if((this.getAttribute('captionid'))){this.Caption.Text=this.getAttribute('captiontext');this.Caption.Default=this.getAttribute('captiondefault');this.Caption.IDs=this.getAttribute('captionid').split(';');for(var i=0;i<this.Caption.IDs.length;i++){this.Caption.Controls.push(document.getElementById(this.Caption.IDs[i]));this.Caption.Controls[i].innerHTML=this.Caption.Default}} 150if((this.Pages.Count=parseInt(this.getAttribute('pagecount'),10))===null){this.Pages.Count=3} 151if(!(this.Pages.Size=parseInt(this.getAttribute('rowsize'),10))){this.Pages.Size=10;this.Pages.Count=10} 152this.Caption.innerHTML=this.Caption.Default;this.Pages.Select=function(Sel){var Cantidad=0;this.Selected=Sel;this.Referen();for(var i=0;i<_My.Rows.length;i++){if(_My.Rows[i].Oculto===!0){_My.Rows[i].style.display='none';continue} 153_My.Rows[i].RemoveClass('ImPar');_My.Rows[i].RemoveClass('Par');Cantidad++;if(Cantidad%2) 154_My.Rows[i].BL_AddClass('ImPar');else _My.Rows[i].BL_AddClass('Par');if(i>=((this.Selected-1)*this.Size)&&i<(this.Selected*this.Size)) 155_My.Rows[i].style.display='';else _My.Rows[i].style.display='none'}} 156this.Pages.Next=function(){} 157this.Pages.Preview=function(){} 158this.Pages.Referen=function(){var Paginas=parseInt(_My.Rows.length/this.Size,10);var Index,Boton;if(_My.Rows.length%this.Size) 159Paginas++;for(var Clo=0;Clo<this.Ctrl.length;Clo++){this.Ctrl[Clo].innerHTML='';if(Paginas>0){Boton=document.createElement('button');Boton.innerHTML='<<';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=1){Boton.Page=1;Boton.onclick=function(){_My.Pages.Select(this.Page)} 160Boton.disabled=!1}else Boton.disabled=!0;Boton=document.createElement('button');Boton.innerHTML='<';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=1){Boton.Page=_My.Pages.Selected-1;Boton.onclick=function(){_My.Pages.Select(this.Page)} 161Boton.disabled=!1}else Boton.disabled=!0;for(var i=1;i<=Paginas;i++){var Mostrar=!1;if((this.Selected-this.Count)<=0&&i<=(this.Selected+this.Count+(this.Count+1-this.Selected))) 162Mostrar=!0;if((this.Selected-this.Count)<=i&&i<=(this.Selected+this.Count)) 163Mostrar=!0;if((this.Selected+this.Count)>=Paginas&&i>=(this.Selected-this.Count-((this.Selected+this.Count)-Paginas))) 164Mostrar=!0;if(Mostrar){Boton=document.createElement('button');Boton.innerHTML=i;this.Ctrl[Clo].appendChild(Boton);if(this.Selected==i){Boton.BL_AddClass('CSelected')}else{Boton.Page=i;Boton.onclick=function(){_My.Pages.Select(this.Page)}}}} 165Boton=document.createElement('button');Boton.innerHTML='>';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=Paginas){Boton.Page=_My.Pages.Selected+1;Boton.onclick=function(){_My.Pages.Select(this.Page)} 166Boton.disabled=!1}else Boton.disabled=!0;Boton=document.createElement('button');Boton.innerHTML='>>';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=Paginas){Boton.Page=Paginas;Boton.onclick=function(){_My.Pages.Select(this.Page)} 167Boton.disabled=!1}else Boton.disabled=!0}} 168if(_My.Caption.Controls.length){var Caption=_My.Caption.Text;Caption=Caption.replace('[INDEX]',this.Selected);Caption=Caption.replace('[PAGES]',Paginas);Caption=Caption.replace('[ROWS]',(_My.Rows.length));for(var i=0;i<_My.Caption.Controls.length;i++){_My.Caption.Controls[i].innerHTML=Caption}}} 169this.Pages.Refresh=function(){this.Select(this.Selected)} 170this.Rows.Clear=function(){var Dato;while((Dato=this.pop())){_My.Body.removeChild(Dato);delete Dato}} 171this.Rows.Remove=function(Index){var Hijo=this[Index];_My.Body.removeChild(Hijo);this.splice(Index,1);for(var i=0;i<this.length;i++){this[i].Index=i}} 172this.Rows.Add=function(Parameters){var _New=CRow();_New.Fields.Add(Parameters);_My.Body.appendChild(_New);_New.ParentList=_My;_New.Index=this.length;this.push(_New);_My.Pages.Refresh();return _New.Index}} 173return _My} 174function CSubItem(){var _My;if(!this.CSubItemStatus){_My=CCtrl();_My.CSubItemStatus=1;CSubItem.call(_My)}else{_My=this;_My.CSubItemStatus=2;this.type='CSubItem';this.setClass('CSubItem');this.Init=function(){}} 175return _My} 176function CItem(){var _My;if(!this.CItemStatus){_My=CCtrl();_My.CItemStatus=1;CItem.call(_My)}else if(this.CItemStatus==1){_My=this;this.CItemStatus=2;this._EOC=CCtrl();this._EOC.style.clear='both';this.appendChild(this._EOC);this.SubItems=new Array();this.type='CItem';this.setClass('CItem');this.Init=function(){} 177this.Remove=function(Index){this.removeChild(this.SubItems[Index]);this.SubItems.splice(Index,1);for(var i=0;i<this.SubItems.length;i++){this.SubItems[i].Index=i}} 178this.SubItems.Add=function(Parameters){var _New=CSubItem();_New.style.cssFloat='left';_New.style.styleFloat='left';_My.insertBefore(_New,_My._EOC);_New.Parent=_My;_New.Index=this.length;_New.setText(Parameters.Text);this.push(_New);return _New.Index} 179this.CItemStatus=2} 180return _My} 181function CHeader(idControl){var _My;if(!this.CHeaderStatus){_My=CItem(idControl);_My.CHeaderStatus=1;CHeader.call(_My)}else if(this.CHeaderStatus==1){} 182return _My} 183function CBody(idControl){var _My;if(!this.CBodyStatus){_My=CListView(idControl);_My.CBodyStatus=1;CBody.call(_My)}
183else if(this.CBodyStatus==1){this.Pages=[];this.Items.Add=function(Parameters){var _New=CItem();_New.SubItems.Add(Parameters);_My.appendChild(_New);_New.Parent=_My;_New.Index=this.length;if(_New.Index%2) 184_New.AddClass('ImPar');else _New.AddClass('Par');this.push(_New);return _New.Index}} 185return _My} 186function CGridView(idControl){var _My;if(!this.CGridViewStatus){_My=CCtrl(idControl);_My.CGridViewStatus=1;CGridView.call(_My,idControl)}else if(this.CGridViewStatus==1){var _CtrlGrid=CCtrl(idControl+'_Grid');var _CtrlPage=CCtrl(idControl+'_Pages');_CtrlPage.setClass('CPage');_CtrlGrid.setClass('CGrid');_My=this;this.type='CGridView';this.Header=CHeader(idControl+'_Header');this.Body=CBody(idControl+'_Body');this.Header.setClass('CHeader');this.Body.setClass('CBody');this.appendChild(_CtrlPage);this.appendChild(_CtrlGrid);_CtrlPage.appendChild(this.Body.Page);_CtrlGrid.appendChild(this.Header);_CtrlGrid.appendChild(this.Body);this.Init=function(){}} 187return _My} 188function CTreeView(idControl){var _My;if(!this.CTreeViewStatus){_My=CRow(idControl);if(!_My.CTreeViewStatus){_My.CTreeViewStatus=1;CTreeView.call(_My,idControl)}}else if(this.CTreeViewStatus==1){_My=this;this.CTreeViewStatus=2;this.TreeIndex=0;this.TreeParent=null;this.TreeObject=this;this.setClass('CTreeView');this.ChildrenIndex=-1;this.SelectedItem=null;this.Mostrar=function(Object){if(typeof Object.HasClass!='undefined'){if(Object.HasClass('CChecked')){Object.RemoveClass('CChecked');if(Object.ChildrenIndex>-1) 189_My.Fields[Object.ChildrenIndex].RemoveClass('Selected');}else{Object.AddClass('CChecked');if(Object.ChildrenIndex>-1) 190_My.Fields[Object.ChildrenIndex].AddClass('Selected');}}} 191this.AddChildren=function(Texto,Childs){Index=this.Fields.Add({Text:'<span>'+Texto+'</span>'});this.Fields[Index].style.cssFloat='';this.Fields[Index].style.styleFloat='';this.Fields[Index].AddClass('CIndex'+this.TreeIndex);if(Childs){this.Fields[Index].onclick=function(){_My.Mostrar(this)} 192this.Fields[Index].AddClass('CFather');this.Fields[Index].ChildrenIndex=this.Fields.Add({Text:''});CTreeView(this.Fields[this.Fields[Index].ChildrenIndex]);this.Fields[this.Fields[Index].ChildrenIndex].AddClass('CIndex'+this.TreeIndex);this.Fields[this.Fields[Index].ChildrenIndex].TreeObject=this.TreeObject;this.Fields[this.Fields[Index].ChildrenIndex].TreeParent=this;this.Fields[this.Fields[Index].ChildrenIndex].TreeIndex=this.TreeIndex+1;this.Fields[this.Fields[Index].ChildrenIndex].style.cssFloat='';this.Fields[this.Fields[Index].ChildrenIndex].style.styleFloat='';return this.Fields[Index].ChildrenIndex}else{this.Fields[Index].AddClass('CChildren');this.Fields[Index].TreeParent=this} 193return Index} 194this.SelectItem=function(IdObjeto){var Objeto=document.getElementById(IdObjeto);if(_My.TreeObject.SelectedItem) 195_My.TreeObject.SelectedItem.RemoveClass('CChecked');_My.TreeObject.SelectedItem=Objeto;_My.TreeObject.SelectedItem.AddClass('CChecked');while((Objeto=Objeto.TreeParent)){if(!Objeto.HasClass('CChecked')){_My.Mostrar(Object)}}}} 196return _My} 197function CSlideView(idControl){var _My;if(!this.CSlideViewStatus){_My=CListView(idControl);if(!_My.CSlideViewStatus){_My.CSlideViewStatus=1;CSlideView.call(_My,idControl)}}else if(this.CSlideViewStatus==1){_My=this;this.Pages.Ctrl[0].RemoveClass('CPage');this.Pages.Ctrl[0].AddClass('CPagePoint');this.Pages.Show=function(Item){this.Selected=Item;if(_My.idInterval) 198window.clearInterval(_My.idInterval) 199_My.idInterval=!1;_My.Deslizar(Item)} 200if(!(this.Pages.PageChar=this.getAttribute('pagechar'))) 201this.Pages.PageChar='•';this.Pages.SelectItem=function(Sel){for(var i=0;i<_My.Rows.length;i++){_My.Rows[i].RemoveClass('Selected');_My.Pages.Ctrl[0].Fields[i].RemoveClass('Selected');if((i+1)==Sel){_My.Pages.Ctrl[0].Fields[i].AddClass('Selected');_My.Rows[i].AddClass('Selected')}}} 202this.Pages.Select=function(Sel){this.ItemSelected=Sel;this.Referen();for(var i=0;i<_My.Rows.length;i++){_My.Rows[i].RemoveClass('Selected');if((i+1)==this.ItemSelected) 203_My.Rows[i].AddClass('Selected');}} 204this.Pages.Referen=function(){var Paginas=parseInt(_My.Rows.length/this.Size,10);var Index;if(_My.Rows.length%this.Size) 205Paginas++;for(var Clo=0;Clo<this.Ctrl.length;Clo++){this.Ctrl[Clo].Fields.Clear();if(Paginas>0){for(var i=1;i<=_My.Rows.length;i++){Index=this.Ctrl[Clo].Fields.Add({Text:this.PageChar});if(this.ItemSelected==(i)) 206this.Ctrl[Clo].Fields[Index].AddClass('Selected');this.Ctrl[Clo].Fields[Index].style.cursor='pointer';this.Ctrl[Clo].Fields[Index].Item=i;this.Ctrl[Clo].Fields[Index].onclick=function(){_My.Pages.Show(this.Item)} 207this.Ctrl[Clo].Fields[Index].onmouseover=function(){_My.Pages.SelectItem(this.Item)}}}} 208if(_My.Caption.Controls.length){var Caption=_My.Caption.Text;Caption=Caption.replace('[INDEX]',this.Selected);Caption=Caption.replace('[PAGES]',Paginas);Caption=Caption.replace('[ROWS]',(_My.Rows.length));for(var i=0;i<_My.Caption.Controls.length;i++){_My.Caption.Controls[i].innerHTML=Caption}}} 209_My.Deslizar=function(Item){try{var AltoLista=_My.offsetHeight;var AnchoLista=_My.offsetWidth;var AltoVentana=_My.parentNode.offsetHeight;var AnchoVentana=_My.parentNode.offsetWidth;var Posicion,PosicionFinal;var nMilisegundos=10;if(AltoLista>AnchoLista){if(AltoLista>AltoVentana){Posicion=_My.offsetTop;Destino=_My.Rows[Item-1].offsetTop;if(Posicion>(-_My.Rows[Item-1].offsetTop)){Dir=-1}else if(Posicion<(-_My.Rows[Item-1].offsetTop)){Dir=1}else{Dir=0} 210if(!_My.style.top) 211_My.style.top=_My.offsetTop+'px';PosicionFinal=-_My.Rows[Item-1].offsetTop;_My.idInterval=window.setInterval(function(){_My.SlideVertical(PosicionFinal,Dir)},nMilisegundos)}}else{if(AnchoLista>AnchoVentana){Posicion=_My.offsetLeft;Destino=_My.Rows[Item-1].offsetLeft;if(Posicion>(-_My.Rows[Item-1].offsetLeft)){Dir=-1}else if(Posicion<(-_My.Rows[Item-1].offsetLeft)){Dir=1}else{Dir=0} 212if(!_My.style.left) 213_My.style.left=_My.clientLeft+'px';PosicionFinal=-_My.Rows[Item-1].offsetLeft;_My.idInterval=window.setInterval(function(){_My.SlideHorizontal(PosicionFinal,Dir)},nMilisegundos)}}}catch(e){}} 214_My.SlideHorizontal=function(Distancia,nDireccion){try{var nDestino=Distancia;var Posicion=parseInt(_My.style.left,10);var nVelocidad;nVelocidad=parseInt(((_My.offsetHeight)*0.1),10);if(nVelocidad<0) 215nVelocidad=nVelocidad*-1;if(nVelocidad==0) 216nVelocidad=1;if(Posicion!=nDestino){Posicion+=(nDireccion*nVelocidad);if(nDireccion<0){if(Posicion<nDestino){Posicion=nDestino}}else{if(Posicion>nDestino){Posicion=nDestino}} 217_My.style.left=(Posicion)+'px'}else{window.clearInterval(_My.idInterval);delete _My.idInterval}}catch(e){alert(e)}} 218_My.SlideVertical=function(Distancia,nDireccion){try{var nDestino=Distancia;var Posicion=parseInt(_My.style.top,10);var nVelocidad;nVelocidad=parseInt(((_My.offsetWidth)*0.1),10);if(nVelocidad<0) 219nVelocidad=nVelocidad*-1;if(nVelocidad==0) 220nVelocidad=1;if(Posicion!=nDestino){Posicion+=(nDireccion*nVelocidad);if(nDireccion<0){if(Posicion<nDestino){Posicion=nDestino}}else{if(Posicion>nDestino){Posicion=nDestino}} 221_My.style.top=Posicion+'px'}else{window.clearInterval(_My.idInterval);delete _My.idInterval}}catch(e){alert(e)}}} 222return _My};function GetZiseWindow(){var Tamanyo=[0,0];if(typeof window.innerWidth!='undefined'){Tamanyo=[window.innerWidth,window.innerHeight]}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){Tamanyo=[document.documentElement.clientWidth,document.documentElement.clientHeight]}else{Tamanyo=[document.getElementsByTagName('body')[0].clientWidth,document.getElementsByTagName('body')[0].clientHeight]} 223return Tamanyo} 224function OpenWindow(){if(!arguments[1]) 225arguments[1]=800;if(!arguments[2]) 226arguments[2]=600;window.open(arguments[0],'','width='+arguments[1]+', height='+arguments[2]+', top=0, left=0, dependent:yes, directories=no, location=no, menubar=no, personalbar = no, status=no, toolbar=no, scrollbars=yes, resizable=no')}
227function Redirect(href){BL_LoadingBox({Center:!0,Text:'Redireccionando...'});window.location=href} 228function utf8_decode(str_data){var tmp_arr=[],i=0,ac=0,c1=0,c2=0,c3=0;str_data+='';while(i<str_data.length){c1=str_data.charCodeAt(i);if(c1<128){tmp_arr[ac++]=String.fromCharCode(c1);i++}else if(c1>191&&c1<224){c2=str_data.charCodeAt(i+1);tmp_arr[ac++]=String.fromCharCode(((c1&31)<<6)|(c2&63));i+=2}else{c2=str_data.charCodeAt(i+1);c3=str_data.charCodeAt(i+2);tmp_arr[ac++]=String.fromCharCode(((c1&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}} 229return tmp_arr.join('')} 230String.prototype.unescapeHtml=function(){var temp=document.createElement("div");temp.innerHTML=this;var result=temp.childNodes[0].nodeValue;temp.removeChild(temp.firstChild);return result} 231Date.prototype.addDays=function(dias){var fecha1=new Date(2011,1,20);var fecha2=new Date(2011,1,21);var diferencia=fecha2.getTime()-fecha1.getTime();var luego=new Date();luego.setTime(this.getTime()+(dias*diferencia));return luego} 232String.prototype.LTrim=function(){return this.replace(/^\s+/,"")} 233String.prototype.RTrim=function(){return this.replace(/\s+$/,"")} 234String.prototype.Trim=function(){return this.RTrim(this.LTrim(this))} 235function StopEvent(e){if(e.preventDefault) 236e.preventDefault();else e.returnValue=!1;if(e.stopPropagation) 237e.stopPropagation();else e.cancelBubble=!0} 238function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft} 239return[scrOfX,scrOfY]} 240document.moz=document.getElementById&&!document.all;document.estoyArrastrando=!1;document.dobj;document.CursorX=0;document.CursorY=0;document.onmousedown=function(e){var fobj=this.moz?e.target:event.srcElement;while(fobj.tagName.toLowerCase()!="html"&&!fobj.BL_HasClass("objMovible")){fobj=this.moz?fobj.parentNode:fobj.parentElement} 241if(fobj.BL_HasClass("objMovible")){this.estoyArrastrando=!0;this.dobj=fobj;this.CursorX=(this.moz?e.clientX:event.clientX)+getScrollXY()[0];this.CursorY=(this.moz?e.clientY:event.clientY)+getScrollXY()[1];return!1}} 242document.onmousemove=function(e){if(this.estoyArrastrando){var newLeft=(this.moz?e.clientX:event.clientX)+getScrollXY()[0];var newTop=(this.moz?e.clientY:event.clientY)+getScrollXY()[1];if(typeof this.dobj.OnUpdatePosition=='function'){this.dobj.OnUpdatePosition(newLeft-this.CursorX,newTop-this.CursorY)}else{this.dobj.style.left=(this.dobj.offsetLeft+(newLeft-this.CursorX))+'px';this.dobj.style.top=(this.dobj.offsetTop+(newTop-this.CursorY))+'px';if(typeof this.dobj.PositionUpdate=='function') 243this.dobj.PositionUpdate();} 244this.CursorX=newLeft;this.CursorY=newTop;return!1}} 245document.onmouseup=function(e){this.estoyArrastrando=!1} 246function getAbsoluteElementPosition(element){if(typeof element=="string") 247element=document.getElementById(element) 248if(!element) 249return{top:0,left:0,bottom:0,right:0};var y=0;var x=0;var h=element.offsetHeight;var w=element.offsetWidth;while(element.offsetParent){x+=element.offsetLeft;y+=element.offsetTop;element=element.offsetParent} 250return{top:y,left:x,bottom:y+h,right:x+w}} 251HTMLDocument=typeof HTMLDocument!=="undefined"?HTMLDocument:Document;HTMLDocument.prototype.AddStyleSheet=function(StyleSheet){var css,head,sheets,loaded=!1;head=document.getElementsByTagName('head')[0];sheets=head.getElementsByTagName('link');if(typeof StyleSheet=='string'){for(var i=0;i<sheets.length;i++){if(sheets[i].getAttribute('href')==StyleSheet){loaded=!0}} 252if(!loaded){css=document.createElement('link');css.setAttribute('rel','stylesheet');css.setAttribute('href',StyleSheet);css.setAttribute('type','text/css');head.appendChild(css.cloneNode(!0))}}else if(typeof StyleSheet=='object'){if(StyleSheet.tagName.toUpperCase()=='LINK'){for(var i=0;i<sheets.length;i++){if(sheets[i].getAttribute('href')==StyleSheet.getAttribute('href')){loaded=!0}} 253if(!loaded){head.appendChild(StyleSheet)}}}};HTMLDocument.prototype.RemoveStyleSheet=function(StyleSheet){var head,sheets;head=document.getElementsByTagName('head')[0];sheets=head.getElementsByTagName('link');if(typeof StyleSheet=='string'){for(var i=0;
253i<sheets.length;i++){if(sheets[i].getAttribute('href')==StyleSheet){sheets[i].parentNode.removeChild(sheets[i])}}}else if(typeof StyleSheet=='object'){if(StyleSheet.tagName.toUpperCase()=='LINK'){for(var i=0;i<sheets.length;i++){if(sheets[i].getAttribute('href')==StyleSheet.getAttribute('href')){sheets[i].parentNode.removeChild(sheets[i])}}}}};HTMLDocument.prototype.AddJS=function(JS){var css,head,scripts,loaded=!1;head=document.getElementsByTagName('head')[0];scripts=head.getElementsByTagName('script');if(typeof JS=='string'){for(var i=0;i<scripts.length;i++){if(scripts[i].getAttribute('src')==JS){loaded=!0}} 254if(!loaded){css=document.createElement('script');css.setAttribute('src',JS);css.setAttribute('type','text/javascript');head.appendChild(css.cloneNode(!0))}}else if(typeof JS=='object'){if(JS.tagName.toUpperCase()=='SCRIPT'){for(var i=0;i<scripts.length;i++){if(scripts[i].getAttribute('src')==JS.getAttribute('src')){loaded=!0}} 255if(!loaded){head.appendChild(JS)}}}};HTMLDocument.prototype.RemoveJS=function(JS){var head,scripts;head=document.getElementsByTagName('head')[0];scripts=head.getElementsByTagName('script');if(typeof JS=='string'){for(var i=0;i<scripts.length;i++){if(scripts[i].getAttribute('src')==JS){scripts[i].parentNode.removeChild(scripts[i])}}}else if(typeof JS=='object'){if(JS.tagName.toUpperCase()=='SCRIPT'){for(var i=0;i<scripts.length;i++){if(scripts[i].getAttribute('src')==JS.getAttribute('src')){scripts[i].parentNode.removeChild(scripts[i])}}}}};function BL_GetObject(idControl,Text){var _Control;if((_Control=document.getElementById(idControl))){if(Text) 256_Control.innerHTML=Text} 257return _Control};function TamVentana(){var Tamanyo=[0,0];if(typeof window.innerWidth!='undefined'){Tamanyo=[window.innerWidth,window.innerHeight]}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){Tamanyo=[document.documentElement.clientWidth,document.documentElement.clientHeight]}else{Tamanyo=[document.getElementsByTagName('body')[0].clientWidth,document.getElementsByTagName('body')[0].clientHeight]} 258return Tamanyo} 259function CreateButton(Texto,href){var Boton=document.createElement('a');Boton.setAttribute('href',href);Boton.setAttribute('class','ctlButton');Boton.innerHTML=Texto;return Boton.cloneNode(!0)} 260var CountMessage=0;var CountLoad=0;var CountWindow=0;var ZINDEX=1030;function CDialogBox(){var _My;if(!this.CDialogBoxStatus){if(typeof Control=="string") 261_My=document.getElementById(Control) 262else _My=Control;if(_My.CDialogBoxStatus!=2){_My.CDialogBoxStatus=1;CDialogBox.call(_My)}}else if(this.CDialogBoxStatus==1){_My=this;this.CDialogBoxStatus=2} 263return _My} 264DialogBox=function(){this.Message=function(){this.Count=0;this.show=function(Parameters){}} 265this.Window=function(){this.show=function(Title,Contex){}} 266this.Loading=function(){this.show=function(Text){}}} 267function BL_MessageBoxCreate(Parameters){var IdMessagebox='';var Aceptar=!0;var Messagebox=document.createElement('div');
267var Background=document.createElement('div');var Dialog=document.createElement('div');var Titulo=document.createElement('div');var Text=document.createElement('div');var Icon=document.createElement('div');var Botones=document.createElement('div');var Button;Dialog.appendChild(Titulo);Dialog.appendChild(Icon);Dialog.appendChild(Text);Dialog.appendChild(Botones);Messagebox.appendChild(Background);Messagebox.appendChild(Dialog);Messagebox.setAttribute('class','BL_MessageBox');Background.setAttribute('class','BL_MessageBox_Background');Dialog.setAttribute('class','BL_MessageBox_Dialog');Titulo.setAttribute('class','BL_MessageBox_Title');Icon.setAttribute('class','BL_MessageBox_Icon');Text.setAttribute('class','BL_MessageBox_Text');Botones.setAttribute('class','BL_MessageBox_Butons');Titulo.innerHTML=Parameters.Title;Text.innerHTML=Parameters.Text;switch(Parameters.Icon){case 'Error':Icon.setAttribute('class','BL_MessageBox_Icon_Error');break} 268CountMessage++;IdMessagebox='Messagebox'+CountMessage;Messagebox.setAttribute('id',IdMessagebox);Messagebox.style.position="fixed";Messagebox.style.top='0';Messagebox.style.left='0';Messagebox.style.width='100%';Messagebox.style.height='100%';CFade(Dialog);CFade(Background);Background.SetFadeRange(0,10);Background.SetFadeTime(10,20);if(Parameters.Buttons){for(var b=0;b<Parameters.Buttons.length;b++){Button=document.createElement('button');Button.innerHTML=Parameters.Buttons[b].Text;Button.className=Parameters.Buttons[b].ClassName;Button.CallBack=Parameters.Buttons[b].CallBack;Button.onclick=function(){if(this.CallBack()!==!1){Dialog.FadeOut(function(){BL_MessageBoxDestroy({MessageBox:IdMessagebox})}());Background.FadeOut()}} 269Botones.appendChild(Button)}}else{Botones.btnAcept=document.createElement('button');Botones.appendChild(Botones.btnAcept);Botones.btnAcept.innerHTML='Aceptar';if(Parameters.CallBackAccept){Botones.btnAcept.onclick=function(){Dialog.FadeOut(function(Callback){BL_MessageBoxDestroy({MessageBox:IdMessagebox});Callback()}(Parameters.CallBackAccept));Background.FadeOut()} 270Aceptar=!1} 271if(Aceptar){Botones.btnAcept.onclick=function(){Dialog.FadeOut(function(){BL_MessageBoxDestroy({MessageBox:IdMessagebox})});Background.FadeOut()}}} 272document.getElementsByTagName('body')[0].appendChild(Messagebox);Dialog.style.top=((Messagebox.offsetHeight/2)-Dialog.offsetHeight/2)+'px';Dialog.style.left=((Messagebox.offsetWidth/2)-Dialog.offsetWidth/2)+'px';Dialog.FadeIn();Background.FadeIn();return IdMessagebox} 273function BL_MessageBoxDestroy(Parameters){var Padre,Hijo;if(Parameters.MessageBox){Padre=document.getElementsByTagName('body')[0];Hijo=document.getElementById(Parameters.MessageBox);Padre.removeChild(Hijo);delete(Hijo)}} 274function BL_LoadingBox(Parameters){var Loading=document.createElement('div');
274var Background=document.createElement('div');var Dialog=document.createElement('div');var Text=document.createElement('div');var Icon=document.createElement('div');var Padre;BL_HidenLoadingBox({Dialog:Parameters.Elemento});Loading.appendChild(Background);Dialog.appendChild(Text);Dialog.appendChild(Icon);Loading.appendChild(Dialog);Loading.setAttribute('class','BL_LoadingBox');Background.setAttribute('class','BL_LoadingBox_Background');Dialog.setAttribute('class','BL_LoadingBox_Dialog');Text.setAttribute('class','BL_LoadingBox_Text');Icon.setAttribute('class','BL_LoadingBox_Icon');CFade(Dialog);CFade(Background);Background.SetFadeRange(0,10);Background.SetFadeTime(10,20);Text.innerHTML=Parameters.Text;if(Parameters.Icon) 275Icon.innerHTML=Parameters.Icon;else Icon.innerHTML='<img src="img/Loading.gif" title="Cargando" alt="Cargando" />';if(Parameters.Element){Padre=Parameters.Element;if(!Padre) 276return null;if(!Padre.style.position) 277Padre.style.position="relative";Loading.setAttribute('id',Parameters.WinId+'_Loading');Loading.style.position="absolute";Loading.style.top=0;Loading.style.left=0;Loading.style.width="100%";Loading.style.height="100%";Padre.appendChild(Loading)}else if(Parameters.Elemento){Padre=document.getElementById(Parameters.Elemento);if(!Padre) 278return null;if(!Padre.style.position) 279Padre.style.position="relative";Loading.setAttribute('id',Parameters.Elemento+'_Loading');Loading.style.position="absolute";Loading.style.top=0;Loading.style.left=0;Loading.style.width="100%";Loading.style.height="100%";Padre.appendChild(Loading)}else{Padre=document.getElementsByTagName('body')[0];Loading.setAttribute('id',(Parameters.WinId)?Parameters.WinId+'_Loading':'body_Loading');Loading.style.position="fixed";Loading.style.top='0';Loading.style.left='0';Loading.style.width="100%";Loading.style.height="100%";Padre.appendChild(Loading)} 280Loading.Removes=function(){CountLoad++;this.id=this.id+CountLoad;Dialog.FadeOut(function(){if(Loading.parentNode!=null) 281Loading.parentNode.removeChild(Loading);});Background.FadeOut()} 282Dialog.FadeIn();Background.FadeIn();if(Parameters.Center==!0) 283Dialog.style.top=((Loading.offsetHeight/2)-Dialog.offsetHeight/2)+'px';else Dialog.style.top=0;Dialog.style.left=((Loading.offsetWidth/2)-Dialog.offsetWidth/2)+'px';if(Parameters.Elemento) 284return Parameters.Elemento;else return null} 285function BL_HidenLoadingBox(Parameters){var Hijo;Parameters.Dialog=Parameters.WinId;if(Parameters.Dialog) 286Hijo=document.getElementById(Parameters.Dialog+'_Loading');else Hijo=document.getElementById('body_Loading');if(Hijo) 287Hijo.Removes();} 288function BL_WindowBox_KillFocus(){var nn=document.querySelectorAll(".CActiveWindow");for(var i=0;i<nn.length;i++){nn[i].BL_RemoveClass("CActiveWindow")}} 289function BL_WindowBoxCreate(Parameters){if(Parameters.Id){var objet=document.getElementById(Parameters.Id);if(objet){objet.WindowFocus();objet.CtrlDialog.CtrlContent.BL_AddClass("contentFade");objet.CtrlDialog.BL_RemoveClass("CSelectWindow");objet.CtrlDialog.offsetWidth=objet.CtrlDialog.offsetWidth;objet.CtrlDialog.BL_AddClass("CSelectWindow");return Parameters.Id}} 290var IdWindowbox='';var Windowbox=document.createElement('div');
290var Background=document.createElement('div');var Dialog=document.createElement('div');var Title=document.createElement('div');var TitleText=document.createElement('span');var Content=document.createElement('div');var Icon=document.createElement('a');var Sizeing=document.createElement('div');var TitleBar=document.createElement('div');var ActionBar=document.createElement('div');CFade(Dialog);CFade(Background);Background.SetFadeRange(0,10);Background.SetFadeTime(10,20);Title.ondblclick=function(){Content.BL_AddClass("contentFade");if(Content.BL_HasClass("fadeAnim")){Content.BL_RemoveClass("fadeAnim");Sizeing.style.display='block'}else{Content.BL_AddClass("fadeAnim");Sizeing.style.display='none'}} 291Dialog.style.minWidth="200px";document.getElementsByTagName('body')[0].appendChild(Windowbox);Dialog.appendChild(Title);Dialog.appendChild(ActionBar);Dialog.appendChild(Icon);Dialog.appendChild(Content);if(Parameters.Resize!==undefined&&Parameters.Resize==!0){Sizeing.style.width="20px";Sizeing.style.height="20px";Sizeing.style.position="absolute";Sizeing.style.right=0;Sizeing.style.bottom=0;Sizeing.style.backgroundImage='url(img/resize.png)';Sizeing.style.cursor="nw-resize";Sizeing.setAttribute('class','objMovible');Dialog.appendChild(Sizeing);Content.style.boxSizing='border-box';Sizeing.PositionUpdate=function(){var left,top;Content.BL_RemoveClass("contentFade");left=Sizeing.offsetLeft;top=Sizeing.offsetTop;Sizeing.style.left='auto';Sizeing.style.top='auto';Sizeing.style.right=0;Sizeing.style.bottom=0;left=left-Sizeing.offsetLeft;top=top-Sizeing.offsetTop;Content.style.width=(Content.offsetWidth+left)+'px';Content.style.height=(Content.offsetHeight+top)+'px';if(Content.offsetWidth<250){Content.style.width="250px"} 292if(Content.offsetHeight<250){Content.style.height="250px"} 293Windowbox.WindowFocus()}} 294if(Parameters.Modal==undefined||Parameters.Modal==!0){Windowbox.style.width='100%';Windowbox.style.height='100%';Windowbox.appendChild(Background)} 295Windowbox.setAttribute("data-windowbox-modal","1");Windowbox.appendChild(Dialog);Windowbox.CtrlBackground=Background;Windowbox.CtrlDialog=Dialog;Windowbox.style.zIndex=ZINDEX++;Dialog.CtrlTitle=Title;Dialog.CtrlIcon=Icon;Dialog.CtrlContent=Content;Dialog.onclick=function(event){if(document.windowFocus==!1){document.windowFocus=!0;Windowbox.WindowFocus()}};Dialog.style.boxSizing="border-box";Title.OnUpdatePosition=function(offsetX,offsetY){Dialog.style.left=(Dialog.offsetLeft+offsetX)+'px';Dialog.style.top=(Dialog.offsetTop+offsetY)+'px';Windowbox.WindowFocus()};Windowbox.setAttribute('class','BL_WindowBox');Background.setAttribute('class','BL_WindowBox_Background');Dialog.setAttribute('class','BL_WindowBox_Dialog');Title.setAttribute('class','BL_WindowBox_Title objMovible');Icon.setAttribute('class','BL_WindowBox_Icon');Content.setAttribute('class','BL_WindowBox_Content contentFade');TitleBar.setAttribute('class','BL_WindowBox_TitleBar');ActionBar.setAttribute('class','BL_WindowBox_ActionBar');TitleText.innerHTML=Parameters.Title;Title.appendChild(TitleText);Title.appendChild(TitleBar);if(!Parameters.TitleBar){Parameters.TitleBar=[{Text:'<i class="zmdi zmdi-close"></i>',ClassName:'btn-close',CallBack:function(){return!0}}]} 296if(Parameters.TitleBar){for(var b=0;b<Parameters.TitleBar.length;b++){var Button=document.createElement('button');Button.innerHTML=Parameters.TitleBar[b].Text;Button.className=Parameters.TitleBar[b].ClassName;Button.CallBack=Parameters.TitleBar[b].CallBack;Button.onclick=function(){if(this.CallBack()!==!1){Dialog.FadeOut(function(){Windowbox.Close()}());Background.FadeOut()}};TitleBar.appendChild(Button)}} 297if(Parameters.ActionBar){for(var b=0;b<Parameters.ActionBar.length;b++){var Button=document.createElement('button');Button.innerHTML=Parameters.ActionBar[b].Text;Button.className=Parameters.ActionBar[b].ClassName;Button.CallBack=Parameters.ActionBar[b].CallBack;Button.onclick=function(){if(this.CallBack()!==!1){Dialog.FadeOut(function(){Windowbox.Close()}());Background.FadeOut()}};ActionBar.appendChild(Button)}} 298if(Parameters.Element) 299Content.appendChild(Parameters.Element);else Content.innerHTML=Parameters.Content;if(Parameters.WinId){IdWindowbox=Parameters.WinId}else if(Parameters.Id){IdWindowbox=Parameters.Id}else{CountWindow++;IdWindowbox='Windowbox'+CountWindow} 300Windowbox.setAttribute('id',IdWindowbox);Content.style.maxWidth=(GetZiseWindow()[0]-50)+"px";Content.style.maxHeight=(GetZiseWindow()[1]-100)+"px";Icon.href='javascript:';Icon.onclick=function(){Dialog.FadeOut(function(){BL_WindowDestroy({Windowbox:IdWindowbox})});
300Background.FadeOut()};Windowbox.SetShowChange=function(change){if(change===!0) 301TitleText.innerHTML=TitleText.innerHTML.replace("Editor Web ","Editor Web* ");else TitleText.innerHTML=TitleText.innerHTML.replace("Editor Web* ","Editor Web ")} 302Windowbox.SetDimension=function(w,h){Content.style.height=h;Content.style.width=w};Windowbox.SetOnlyRead=function(onlyRead,type){if(onlyRead){switch(type){case CModelType.type.html:case CModelType.type.richText:case CModelType.type.textHTML:if(Content.querySelector('div.note-editable')) 303Content.querySelector('div.note-editable').setAttribute('contenteditable','false');if(Content.querySelector('div.note-editor.note-frame')) 304Content.querySelector('div.note-editor.note-frame').style.paddingBottom=0;if(Content.querySelector('.cancel-update')) 305Content.querySelector('.cancel-update').classList.add('hidden');break;case CModelType.type.dinamico:case CModelType.type.image:var img=Content.querySelector('#over-div-nocrop');img.className=('show');case CModelType.type.text:case CModelType.type.audio:case CModelType.type.video:case CModelType.type.poll:let text=Content.querySelectorAll('input , textarea');for(let i=0;i<text.length;i++){text[i].setAttribute('readonly','true')} 306let multiselect=Content.querySelectorAll('.multiselect');for(let i=0;i<multiselect.length;i++){multiselect[i].setAttribute('disabled','true')} 307let options=Content.querySelectorAll('[data-form="option-multiple"]');for(let i=0;i<options.length;i++){options[i].setAttribute('disabled','true')} 308break;default:break}}};Windowbox.WindowUpdate=function(){var y=((this.parentNode.offsetHeight/2)-this.CtrlDialog.offsetHeight/2);var x=((this.parentNode.offsetWidth/2)-this.CtrlDialog.offsetWidth/2);if(y<0){y=50} 309if(x<0){x=50} 310this.CtrlDialog.style.top=y+'px';this.CtrlDialog.style.left=x+'px'};Windowbox.WindowFocus=function(){BL_WindowBox_KillFocus();this.CtrlDialog.BL_AddClass("CActiveWindow");if(this.style.zIndex==undefined||parseInt(this.style.zIndex)!=ZINDEX){ZINDEX++;this.style.zIndex=ZINDEX}} 311Windowbox.OnClose=function(){if(Parameters.onClose){Parameters.onClose()}};Dialog.FadeIn();Background.FadeIn();Windowbox.WindowUpdate();Windowbox.WindowFocus();document.windowFocus=!0;Windowbox.Close=function(){BL_WindowDestroy({Windowbox:IdWindowbox})};return IdWindowbox} 312function BL_PopupCreate(Parameters){var IdWindowbox='';var Windowbox=document.createElement('div');
312var Background=document.createElement('div');var Dialog=document.createElement('div');var Content=document.createElement('div');var btnClose=document.createElement('div');ZINDEX=1300;CFade(Dialog);CFade(Background);Background.SetFadeRange(0,10);Background.SetFadeTime(10,20);Dialog.style.minWidth="200px";document.getElementsByTagName('body')[0].appendChild(Windowbox);Dialog.appendChild(Content);Windowbox.style.width='100%';Windowbox.style.height='100%';Windowbox.appendChild(Background);Windowbox.setAttribute("data-windowbox-popup","1");Windowbox.appendChild(Dialog);Windowbox.appendChild(btnClose);Windowbox.CtrlBackground=Background;Windowbox.CtrlDialog=Dialog;Windowbox.style.zIndex=ZINDEX++;Dialog.CtrlContent=Content;Dialog.onclick=function(event){if(document.windowFocus==!1){document.windowFocus=!0;Windowbox.WindowFocus()}};Dialog.style.boxSizing="border-box";Windowbox.setAttribute('class','BL_PopupBox');Background.setAttribute('class','BL_PopupBox_Background');Dialog.setAttribute('class','BL_PopupBox_Dialog');Content.setAttribute('class','BL_PopupBox_Content contentFade');btnClose.setAttribute('class',"BL_PopupBox_Close");if(!Parameters.btnClose){Parameters.btnClose=[{Text:'',ClassName:'btn-close',CallBack:function(){return!0}}]} 313if(Parameters.btnClose){for(var b=0;b<Parameters.btnClose.length;b++){var Button=document.createElement('button');Button.innerHTML=Parameters.btnClose[b].Text;Button.className=Parameters.btnClose[b].ClassName;Button.CallBack=Parameters.btnClose[b].CallBack;Button.onclick=function(){if(this.CallBack()!==!1){Dialog.FadeOut(function(){document.getElementsByTagName("body")[0].classList.remove("modal-open");Windowbox.Close()}());Background.FadeOut()}};btnClose.appendChild(Button)}} 314if(Parameters.Element) 315Content.appendChild(Parameters.Element);else Content.innerHTML=Parameters.Content;if(Parameters.WinId){IdWindowbox=Parameters.WinId}else if(Parameters.Id){IdWindowbox=Parameters.Id}else{CountWindow++;IdWindowbox='Windowbox'+CountWindow} 316Windowbox.setAttribute('id',IdWindowbox);Content.style.maxWidth=(GetZiseWindow()[0]-50)+"px";Content.style.maxHeight=(GetZiseWindow()[1]-100)+"px";Windowbox.SetDimension=function(w,h){Content.style.height=h;Content.style.width=w};Windowbox.WindowUpdate=function(){var y=((this.parentNode.offsetHeight/2)-this.CtrlDialog.offsetHeight/2);var x=((this.parentNode.offsetWidth/2)-this.CtrlDialog.offsetWidth/2);if(y<0){y=50} 317if(x<0){x=50} 318this.CtrlDialog.style.top=y+'px';this.CtrlDialog.style.left=x+'px'};Windowbox.WindowFocus=function(){BL_WindowBox_KillFocus();this.CtrlDialog.BL_AddClass("CActiveWindow");if(this.style.zIndex==undefined||parseInt(this.style.zIndex)!=ZINDEX){ZINDEX++;this.style.zIndex=ZINDEX}} 319Windowbox.OnClose=function(){if(Parameters.onClose){Parameters.onClose()}};Dialog.FadeIn();Background.FadeIn();Windowbox.WindowUpdate();Windowbox.WindowFocus();document.getElementsByTagName("body")[0].classList.add("modal-open");let img=Dialog.querySelectorAll("img")||[];for(let i=0;i<img.length;i++){img[i].onload=function(){Windowbox.WindowUpdate()}} 320document.windowFocus=!0;Windowbox.Close=function(){BL_WindowDestroy({Windowbox:IdWindowbox})};return IdWindowbox} 321function BL_WindowDestroy(Parameters){var Padre,Hijo;if(Parameters.Windowbox){Padre=document.getElementsByTagName('body')[0];Hijo=document.getElementById(Parameters.Windowbox);if(Hijo!==null){Hijo.OnClose();Padre.removeChild(Hijo);delete(Hijo)}}} 322function BL_ToolTipCreate(Parameters){var IdToolTip='';var ToolTip=document.createElement('div');var Content=document.createElement('div');var Icon=document.createElement('a');ToolTip.appendChild(Icon);ToolTip.appendChild(Content);ToolTip.setAttribute('class','BL_ToolTip');Icon.setAttribute('class','BL_ToolTip_Icon');Content.setAttribute('class','BL_ToolTip_Content');if(Parameters.Element) 323Content.innerHTML=Parameters.Element.innerHTML;else Content.innerHTML=Parameters.Content;if(Parameters.ToolTipID){IdToolTip=Parameters.ToolTipID}else{CountToolTip++;IdToolTip='ToolTip'+CountToolTip} 324BL_ToolTipDestroy({ToolTipID:IdToolTip});ToolTip.setAttribute('id',IdToolTip);Icon.setAttribute('href',"javascript:BL_ToolTipDestroy({ToolTipID: '"+IdToolTip+"'});");if(Parameters.TimeOut) 325window.setTimeout("BL_ToolTipDestroy({ToolTipID: '"+IdToolTip+"'})",Parameters.TimeOut);var Objeto=document.getElementById(Parameters.Field);if(Objeto){var Padre,Top=0,Left=0;Padre=Objeto;do{Top+=Padre.offsetTop;Left+=Padre.offsetLeft}while((Padre=Padre.offsetParent)) 326document.getElementsByTagName('body')[0].appendChild(ToolTip);Left+=Objeto.offsetWidth;Top+=Objeto.offsetHeight;if((Left+ToolTip.offsetWidth)>TamVentana()[0]){Left=Left-ToolTip.offsetWidth-Objeto.offsetWidth+20} 327ToolTip.style.top=(Top-10)+'px';ToolTip.style.left=(Left-10)+'px'} 328return IdToolTip} 329function BL_ToolTipDestroy(Parameters){var Padre,Hijo;if(Parameters.ToolTipID){if((Hijo=document.getElementById(Parameters.ToolTipID))){Padre=Hijo.parentNode;Padre.removeChild(Hijo);delete(Hijo)}}}
330document.windowFocus=!1;document.onclick=function(){if(document.windowFocus==!1){BL_WindowBox_KillFocus()};document.windowFocus=!1};function CFactoryAds(id,ContainerAds,quantity=1,lazy=!0){const Basic=1;const PopUp=2;const Fixed=3;const movilMaxWidth=768;const Multiple=4;const _DESKTOP_=1;const _MOVIL_=2;let _this=this 331let screen=_DESKTOP_;this.id=id;this.containerAds=ContainerAds;this.quantity=quantity;this.lazy=lazy;this.development=(PHPResponse.development);this.ads;this.Instance=function(){if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<movilMaxWidth){screen=_MOVIL_} 332BL_AjaxRequest({Url:(PHPResponse.AppDomain?PHPResponse.AppDomain:PHPResponse.System.PathOrigin)+'CalledAdvertising.php',CallBack:this.Response,Request:{Action:'GetAds',Data:{id:this.id,containerAds:this.containerAds,quantity:this.quantity,screen:screen,section:PHPResponse.Section?PHPResponse.Section:PHPResponse.Rubro,lazy:this.lazy}}})} 333this.Create=function(data){let ad=null;switch(parseInt(data.type)){case Basic:ad=new CAdBasic(data);break;case PopUp:ad=new CAdPopUp(data);break;case Fixed:ad=new CAdFixed(data);break;case Multiple:data.containers.forEach(data=>Object.keys(data.ads).length?_this.InitAds(data):new CFactoryAds(data.id,_this.containerAds));break} 334return ad} 335this.Response=function(Response){if(Response.Status==STATUS_ERROR){console.error(Response.Message);return} 336switch(Response.Action){case 1:_this.InitAds(Response.Data.ad);break}} 337this.InitAds=function(data){try{_this.ads=_this.Create(data);if(_this.ads==null){if(data.type!=Multiple){console.error("No se pudo crear el tipo de publiciad("+Response.Data.type+")");console.error(Response.Data.type+"tipo no existente")} 338return} 339_this.ads.setMedia(screen);_this.ads.create(_this.development)}catch(e){console.error(e)}} 340this.Instance()} 341function LoadAdvertising(){let containers=document.querySelectorAll("[data-type='adContainer']");const quantityContainerForType={} 342containers.forEach((container)=>{if(!quantityContainerForType[container.getAttribute("data-adContainer")]){quantityContainerForType[container.getAttribute("data-adContainer")]=[]} 343quantityContainerForType[container.getAttribute("data-adContainer")].push(container.getAttribute("data-element"))});for(let i in quantityContainerForType){new CFactoryAds(quantityContainerForType[i].length==1?quantityContainerForType[i][0]:quantityContainerForType[i],i,quantityContainerForType[i].length)}} 344function CAdvertising(data){const _DESKTOP_=1;const _MOVIL_=2;const CLICK=1;const PRINT=2;let _this=this;this.data=data;this.container={};this.executeScript=function(script){if(!script.src){let f=new Function(script.textContent);f()}} 345this.init=function(){this.container=document.getElementById(this.data.id);this.container.innerHTML=this.data.html;if(this.data.ads[-1]){this.container.querySelectorAll("script").forEach(_this.executeScript)} 346this.container.querySelectorAll('[data-type="3"] iframe').forEach((iframe)=>{iframe.onload=()=>{let doc=iframe.contentDocument;let style=document.createElement('style');style.innerHTML='body{margin:0;padding:0;overflow:hidden;}';doc.head.append(style)}})} 347this.addClick=function(elements){for(let i=0;i<elements.length;i++){elements[i].addEventListener("click",function clickAd(){let code=_this.getCodeAd(this);_this.AddDispatched(_this.data.ads[code],CLICK,(_this.data.containerClick?!1:!0));this.removeEventListener('click',clickAd,!1)})}} 348this.setMedia=function(media){this.data.media=media} 349this.getCodeAd=function(element){let css=element.classList;let code=0;for(let i=0;i<css.length;i++){if(css[i].indexOf("Ad-")!=-1){let list=css[i].split("-");code=list.length==3?list[1]:"-"+list[2]}} 350return code} 351this.addPrint=function(elements){let container=document.getElementById(this.data.id);let topAD=container.offsetTop;while(1){if(container.offsetParent){container=container.offsetParent;topAD+=container.offsetTop}else{break}} 352let printDispatched=function(){let posScreen=window.scrollY+container.clientHeight;if(posScreen>topAD&&posScreen<(topAD+container.clientHeight)){for(let i=0;i<elements.length;i++){if(elements.length==1||elements[i].classList.contains("active")){let code=_this.getCodeAd(elements[i]);if(!_this.data.ads[code].print){_this.addScriptPrint(_this.data.ads[code]);
352_this.AddDispatched(_this.data.ads[code],PRINT,(_this.data.containerPrint?!1:!0));_this.data.ads[code].print=!0;_this.data.containerPrint=!0} 353return}}}} 354window.addEventListener('scroll',printDispatched);if(elements.length>1) 355document.getElementById('carousel-'+this.data.id).addEventListener('slid.bs.carousel',printDispatched);printDispatched()} 356this.addScriptPrint=function(ad){if(ad.scriptPrint!=null){let container=document.getElementById(this.data.id);let div=document.createElement("div");div.innerHTML=ad.scriptPrint;container.append(div);div.querySelectorAll("script").forEach(_this.executeScript)}} 357this.createCarousel=function(){let carousel=document.getElementById('carousel-'+this.data.id) 358carousel.querySelector(".item").classList.add("active");if(_this.data.media==_DESKTOP_){carousel.querySelector(".carousel-inner").style.minHeight=_this.data.dimensions.desktop.height+"px"}else{carousel.querySelector(".carousel-inner").style.minHeight=_this.data.dimensions.movil.height+"px"} 359let carouselControl=new bootstrap.Carousel(carousel,{interval:(this.data.carousel.interval*1000),ride:"carousel"});if(carousel.querySelector("video")){let videos=carousel.querySelectorAll(".carousel-item:not(.active) video");for(let i=0;i<videos.lenght;i++){videos[i].pause()} 360carousel.addEventListener('slide.bs.carousel',function(){if(this.querySelector(".active video")){this.querySelector(".active video").pause()}});carousel.addEventListener('slid.bs.carousel',function(){if(this.querySelector(".active video")){this.querySelector(".active video").play()}})} 361carouselControl.cycle()} 362this.AddDispatched=function(ad,event,eventContainer){let data={codeAd:ad.codeAd,codeRemoto:ad.remote,version:ad.version,section:this.data.section,media:this.data.media} 363data.idContainer=this.data.idContainer;data.addContainer=!0;data.origin=ad.origin;BL_AjaxRequest({Url:(PHPResponse.AppDomain?PHPResponse.AppDomain:PHPResponse.System.PathOrigin)+'calledAdvertising.php',CallBack:_this.OnResponse,Parent:this,Request:{Action:event==CLICK?"setClick":"setPrint",Data:data}})} 364this.OnResponse=function(Response){if(Response.Status==STATUS_ERROR){console.error("PUBLICIDAD: ERROR "+Response.Message);return} 365switch(Response.Action){case 1:break}} 366this.show=function(){}} 367function CAdBasic(ad){let _this=this;let container 368CAdvertising.call(this,ad);this.create=function(development){this.init();if(!development) 369this.createEvent();} 370this.createEvent=function(){let container=document.getElementById(this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()} 371this.addClick(items);this.addPrint(items)}} 372function CAdPopUp(ad){let _this=this;CAdvertising.call(this,ad);this.create=function(development){let dateLast=window.sessionStorage.getItem("popup-"+this.data.id);if(!dateLast||(dateLast&&Math.floor((new Date()-new Date(dateLast))/1000)>PHPResponse.intervalPopUp)||development){window.sessionStorage.setItem("popup-"+this.data.id,new Date())}else{return} 373if(this.data.notData){return} 374this.init();this.container.querySelector(".pr-close").addEventListener("click",_this.close);if(!development){this.createEvent();this.show()}} 375this.createEvent=function(){let container=document.getElementById("p-"+_this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()} 376this.addClick(items);this.addPrint(items)} 377this.close=function(){let container=document.getElementById("p-"+_this.data.id);document.querySelector("body").classList.remove("modal-open");container.classList.add("hide");container.remove()} 378this.show=function(){let container=document.getElementById("p-"+this.data.id);if(container.querySelector(".pr-content article").innerHTML==""){this.close()}else{document.querySelector("body").classList.add("modal-open");container.classList.remove("hide")}}} 379function CAdFixed(ad){let _this=this;CAdvertising.call(this,ad);this.create=function(development){this.init();if(!development){this.createEvent();let fixed=this.container.querySelector(".Ad-fixed");fixed.querySelector("span").addEventListener("click",function(e){e.preventDefault();fixed.close=!0;
379fixed.classList.remove("show")}) 380window.addEventListener("scroll",function(){if(window.scrollY>150&&!fixed.close){fixed.classList.add("show")}else{fixed.classList.remove("show")}})}} 381this.setPosition=function(pos){let container=document.getElementById("fixed-"+this.data.id);container.classList.add(pos)} 382this.createEvent=function(){let container=document.getElementById("fixed-"+this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()} 383this.addClick(items);this.addPrint(items)}};document.addEventListener("DOMContentLoaded",function(){affix();CreateLazyLoad();SDCookie();if(document.querySelector('.go-up')){window.addEventListener("scroll",function(){if(window.scrollY>150) 384document.querySelector('.go-up').classList.add("active");else document.querySelector('.go-up').classList.remove("active")});document.querySelector('.go-up').onclick=function(){window.scrollTo(0,0)}} 385document.querySelectorAll('.lomasleido').forEach(function(el){el.parentNode.classList.remove('col-1');el.parentNode.classList.remove('col-2');el.parentNode.classList.remove('col-3');el.parentNode.classList.remove('col-4');el.parentNode.classList.remove('col-5');el.parentNode.classList.remove('col-6');el.parentNode.classList.remove('col-7');el.parentNode.classList.remove('col-8');el.parentNode.classList.remove('col-9');el.parentNode.classList.remove('col-10');el.parentNode.classList.remove('col-11');el.parentNode.classList.remove('col-12');if(!el.parentNode.classList.contains('mas-popular')) 386el.parentNode.classList.add('parent-mas-popular');});if(document.querySelector('[id*="content-"][data-type="4"]')){importJs(PHPResponse.AppDomain+"js/admin/poll.js").then(()=>{VerificarSiCargarPolls()})} 387if(document.getElementById("lastest")){lastest()} 388if(typeof CPublicidad!="undefined"&&(typeof CWinApp=="undefined"||!(CWinApp()instanceof CPageAdm))){let advertising=new CPublicidad();advertising.get()} 389if(document.querySelector(".swiper")){slider()} 390LoadAdvertising();ServiceWork()});function affix(){window.addEventListener('scroll',function(event){var scrollValue=window.scrollY;document.querySelectorAll('[data-spy="affix"]').forEach(function(el){let offset=el.getAttribute('data-offset-top');if(scrollValue>offset){if(el.classList.contains('affix')){return} 391let event=new Event('affix.bs.affix');el.dispatchEvent(event);el.classList.add('affix');event=new Event('affixed.bs.affix');el.dispatchEvent(event)}else{el.classList.remove('affix');let event=new Event('affixed-top.bs.affix');el.dispatchEvent(event)}})})} 392function ServiceWork(){var sw;let install=()=>{if(sw instanceof CAppSW){return} 393if(!('PushManager' in window)){console.log("el dispositivo no soporta notificaciones push");document.removeEventListener("click",install);return} 394if(!('serviceWorker' in navigator)){console.log("el navegador no soporta ServiceWoker");document.removeEventListener("click",install) 395return} 396sw=new CAppSW();sw.setUPPush()} 397document.addEventListener("click",install);document.addEventListener("scroll",()=>{if(sw instanceof CAppSW){return} 398if(!('PushManager' in window)){console.log("el dispositivo no soporta notificaciones push");return} 399if(!('serviceWorker' in navigator)){console.log("el navegador no soporta ServiceWoker");return} 400sw=new CAppSW();sw.setUPPush()})} 401function CreateLazyLoad(){if('loading' in HTMLImageElement.prototype){return} 402importJs("https://unpkg.com/[email protected]/dist/jquery.min.js").then(()=>{importJs(PHPResponse.AppDomain+'Core/plugin/lazy/jquery.lazyload.min.js').then(()=>{$("img.lazy").lazyload({failure_limit:10})})})} 403function Registrar(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.showRegister()})} 404function Ingresar(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.showLogin()})} 405function Salir(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.Logout()})} 406function lastest(){let btnArrows=document.querySelectorAll('[data-form="lastest-arrow"]');btnArrows.forEach((el)=>{console.log(el);el.onclick=function(){let idLastest="";let parent=this.parentNode;while(idLastest==""){if(parent.getAttribute("data-idLastest")){idLastest=parent.getAttribute("data-idLastest")}else{parent=parent.parentNode}} 407if(this.classList.contains("disable")){return} 408if(!PHPResponse.ContentsExist){PHPResponse.ContentsExist=[]} 409if(!PHPResponse.ContentsExist[idLastest]){let ContentsExist=[0];if(!Array.isArray(PHPResponse.ContentsExist)){ContentsExist=ContentsExist.concat(PHPResponse.ContentsExist)} 410PHPResponse.ContentsExist[idLastest]=ContentsExist} 411if(PHPResponse.ContentsExist[idLastest].length==1&&PHPResponse.ContentsExist[idLastest][0]==0){parent.querySelectorAll("[id*='singleElement-']").forEach(function(el){PHPResponse.ContentsExist[idLastest].push(el.getAttribute("id").split("-")[2])})} 412if(this.getAttribute("data-lastest")=="left"&&PHPResponse.ContentsExist[idLastest].length>(parent.getAttribute("data-quantity")*2)){PHPResponse.ContentsExist[idLastest].splice(PHPResponse.ContentsExist[idLastest].length-(parent.getAttribute("data-quantity")*2),PHPResponse.ContentsExist[idLastest].length)} 413parent.querySelector(".lastest-loading").classList.add("show");let data={"action":"Lastest","ContentsExist":PHPResponse.ContentsExist[idLastest],"idLastest":idLastest,"quantity":parent.getAttribute("data-quantity"),"section":parent.getAttribute("data-section")};fetch(PHPResponse.AppDomain+"/CalledConsultasExternas.php",{method:"POST",body:JSON.stringify(data),}).then(response=>response.json()).then(response=>{let container=document.querySelector("[data-idLastest='"+data.idLastest+"']");container.querySelector(".lastest-loading").classList.remove("show");if(response.nota!=""){container.querySelector('[data-lastest="right"]').classList.remove("disable");let content=container.querySelector(".lastest-content");content.innerHTML=response.nota;content.querySelectorAll('img').forEach(function(e){e.setAttribute("src",e.getAttribute("data-original"))});PHPResponse.ContentsExist[idLastest]=response.contenidos;if(response.contenidos.length>(container.getAttribute("data-quantity")*2)) 414container.querySelector('[data-lastest="left"]').classList.remove("disable");else container.querySelector('[data-lastest="left"]').classList.add("disable")}else{container.querySelector('[data-lastest="right"]').classList.add("disable")}}).catch(e=>{document.querySelector(".lastest-loading").classList.remove("show");console.warn(e)})}})} 415function slider(){importCss("https://unpkg.com/swiper/swiper-bundle.min.css");importJs("https://unpkg.com/swiper/swiper-bundle.min.js").then(()=>{const indicator={1:'bullets',2:'fraction'};document.querySelectorAll(".swiper").forEach(el=>{if(el.getAttribute('data-quantity')==0){return} 416let param={loop:!0,speed:400,breakpoints:{1200:{slidesPerView:el.getAttribute("data-amountDisplay"),}}} 417if(el.getAttribute("data-amountDisplayMD")){param.breakpoints={768:{slidesPerView:el.getAttribute("data-amountDisplayMD")},...param.breakpoints}} 418if(el.getAttribute("data-amountDisplaySM")){param.breakpoints={480:{slidesPerView:el.getAttribute("data-amountDisplaySM")},...param.breakpoints}} 419if(el.getAttribute("data-spaceBetween")){param.spaceBetween=Number.parseInt(el.getAttribute("data-spaceBetween"))} 420if(el.getAttribute("data-typeIndicator")!=0){param.pagination={el:".swiper-pagination",dynamicBullets:!0,type:indicator[Number.parseInt(el.getAttribute("data-typeIndicator"))]}} 421if(el.getAttribute("data-typeArrow")!=0){param.navigation={nextEl:`.swiper-button-next ${el.getAttribute("data-typeArrow") == 2 ? 'arrow-custom' : ''}`,prevEl:`.swiper-button-prev ${el.getAttribute("data-typeArrow") == 2 ? 'arrow-custom' : ''}`,}} 422if(param.speed!=0){param.autoplay={delay:Number.parseInt(el.getAttribute("data-speed"))+(Math.floor(Math.random()*51)+100)}} 423swiper=new Swiper("#"+el.id,param)})})} 424function copyClipboard(text){copy=document.createElement('input');copy.value=text;document.body.appendChild(copy);copy.select();document.execCommand('copy');document.body.removeChild(copy);let divToast=document.createElement("div");divToast.innerHTML=`<div class="toast position-fixed bottom-0 end-0 text-white bg-primary border-0" role="alert" aria-live="assertive" aria-atomic="true"> 425 <div class="d-flex"> 426 <div class="toast-body"> 427 Enlace copiado: ${text} 428 </div> 429 <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button> 430 </div> 431 </div>`;document.querySelector("body").appendChild(divToast);let myToast=divToast.querySelector('.toast');let toast=bootstrap.Toast.getOrCreateInstance(myToast);myToast.addEventListener("hidden.bs.toast",function(){document.querySelector("body").removeChild(this.parentNode)}) 432toast.show();console.log("copy")} 433async function importJs(url){return new Promise((resolve)=>{let fileLoaded=document.querySelectorAll("script");for(let i=0;i<fileLoaded.length;i++){if(fileLoaded[i].src==url){if((fileLoaded[i].loaded!==undefined&&fileLoaded[i].loaded==!0)){resolve()}else{fileLoaded[i].addEventListener("load",()=>resolve())} 434return}} 435let script=document.createElement("script");script.src=url;script.loaded="false";script.setAttribute("async",!0);script.onload=()=>{script.loaded=!0;resolve()};document.head.appendChild(script)})} 436function importCss(url){let fileLoaded=document.querySelectorAll("link");for(let i=0;i<fileLoaded.length;i++){if(fileLoaded[i].href==url) 437return} 438let link=document.createElement('link');link.rel='preload stylesheet';link.type='text/css';link.as='style';link.href=url;document.head.appendChild(link)};function CAppSW(){const urlSW=PHPResponse.AppDomain+"js/SW.js";const appkey=PHPResponse.AppVAPID;var _this=this;let notification;this.RegisterServiceWorker=function(){if(!navigator.serviceWorker.controller){return navigator.serviceWorker.register(urlSW,{scope:'./'}).then(function(registration){console.log('Service worker registro completado.');console.log("Service Woker"+registration);console.log("scope is: "+registration.scope);return registration}).catch(function(err){console.log('no se pudo completar el registro
438service worker.',err);console.log()})}else{return navigator.serviceWorker.getRegistration()}} 439this.setUPPush=function(){notification=new CPushNotification(urlSW,appkey);return Promise.all([this.RegisterServiceWorker(),notification.GetPermissionNotification()]).then(function(result){const register=result[0];const permissionNotification=result[1];if(!register){return} 440if(permissionNotification=='denied'){console.warn("notificaciones bloqueadas");return}else if(permissionNotification!=='granted'){notification.askPermission().then(function(result){if(result=='granted'){register.pushManager.getSubscription().then(function(subscription){if(!subscription){notification.subscribeUserPush()}})}})}else{register.pushManager.getSubscription().then(function(subscription){if(!subscription){notification.subscribeUserPush()}else{notification.ExistsSuscribeUser(subscription)}})}})} 441this.unsubscribe=function(){(new CPushNotification()).unsubscribeUser()}} 442function CPushNotification(url,Key){const urlSW=url;const appkey=Key;var Sections=[];var _this=this;this.SetSections=function(s){Sections=s;console.log(Sections)} 443this.getSWRegistration=function(){return navigator.serviceWorker.getRegistration()};this.urlBase64ToUint8Array=function(base64String){const padding='='.repeat((4-base64String.length%4)%4);const base64=(base64String+padding).replace(/\-/g,'+').replace(/_/g,'/');const rawData=window.atob(base64);const outputArray=new Uint8Array(rawData.length);for(let i=0;i<rawData.length;++i){outputArray[i]=rawData.charCodeAt(i)} 444return outputArray} 445this.GetPermissionNotification=function(){if(navigator.permissions){return navigator.permissions.query({name:'notifications'}).then((result)=>{return result.state})} 446return new Promise(function(resolve){resolve(Notification.requestPermission)})} 447this.askPermission=function(){return new Promise(function(resolve,reject){const resultPermission=Notification.requestPermission(function(result){resolve(result)});if(resultPermission){resultPermission.then(resolve,reject)}}).then(function(result){if(!(result==='granted')){console.log('Sea bloqueado las notificaciones.');return} 448return result})} 449this.subscribeUserPush=function(){const subscribeOptions={userVisibleOnly:!0,applicationServerKey:_this.urlBase64ToUint8Array(appkey)};this.getSWRegistration().then(function(register){register.pushManager.subscribe(subscribeOptions).then(function(pushSubscription){console.log(pushSubscription.toJSON());console.log('Received PushSubscription: ',JSON.stringify(pushSubscription));return pushSubscription}).then(_this.SaveSubscripcion)})} 450this.SelectionSections=function(){var modal=new WindowsSelectSection(_this);modal.show()} 451this.SaveSubscripcion=function(subscription){const key=subscription.getKey('p256dh');const token=subscription.getKey('auth');BL_AjaxRequest({Url:PHPResponse.AppDomain+'calledPushNotification.php',CallBack:_this.OnResponse,Parent:this,Request:{endpoint:subscription.endpoint,key:key?btoa(String.fromCharCode.apply(null,new Uint8Array(subscription.getKey('p256dh')))):null,token:token?btoa(String.fromCharCode.apply(null,new Uint8Array(subscription.getKey('auth')))):null,sections:Sections,action:'suscribir'}})} 452this.OnResponse=function(response){switch(response.Action){case-1:this.unsubscribeUser();console.log("no se pudo subscribir");break;case 110:console.log("se subscribio correctamente");break;case 120:_this.subscribeUserPush();break}} 453this.unsubscribeUser=function(){return this.getSWRegistration().then(function(regitration){regitration.pushManager.getSubscription().then(function(subs){return subs.unsubscribe()})})} 454this.ExistsSuscribeUser=function(suscribeUser){BL_AjaxRequest({Url:PHPResponse.AppDomain+'calledPushNotification.php',CallBack:_this.OnResponse,Parent:this,Request:{endpoint:suscribeUser.endpoint,action:'existsSubscribeUser'}})}};'use strict';self.addEventListener("install",function(event){});self.addEventListener('push',function(event){console.log(JSON.parse(event.data.text()));const notificationObject=JSON.parse(event.data.text());const title=notificationObject.title;const options={body:notificationObject.msg,icon:notificationObject.icon,badge:notificationObject.badge,data:{url:notificationObject.url},image:notificationObject.image};self.notificationURL=notificationObject.url;event.waitUntil(self.registration.showNotification(title,options))});self.addEventListener('notificationclick',function(event){console.log('[Service Worker] Notification click Received.');event.notification.close();
454event.waitUntil(clients.openWindow(event.notification.data.url))});self.addEventListener("fetch",function(event){});function SDCookie(){function useCookie(){let data={action:"hasCookie"};fetch(PHPResponse.AppDomain+"CalledCookies.php",{method:"POST",body:JSON.stringify(data),headers:{'Content-Type':'application/json'}}).then((result)=>result.text()).then((t)=>{if(t==1){crearActualizarCookie(!0)}else{crearLayerConfirmacionCookie()}}).catch(function(e){console.error("Se produjo un error al intentar crear la cookie.")})} 455function crearLayerConfirmacionCookie(){var t=document.createElement("div");t.classList.add("bannerCookie");var a=document.createElement("div");a.classList.add("col-sm-8");var e=document.createElement("p");e.classList.add("texto-bannerCookie"),e.innerText=PHPResponse.Cookie.Message;var i=document.createElement("div");i.classList.add("botonera-bannerCookie","col-sm-4");var i=document.createElement("div");i.classList.add("botonera-bannerCookie","col-sm-4");var b=document.createElement("div");b.classList.add("background-bannerCookie");if(PHPResponse.Cookie.Buttons.ok){o=document.createElement("button");o.classList.add("btn","btn-primary"),o.innerText=PHPResponse.Cookie.Buttons.ok,o.addEventListener("click",function(){crearActualizarCookie(!0),document.querySelector("body").removeChild(t),document.querySelector("body").removeChild(b),document.querySelector("body").classList.remove("modal-cookie")}),i.appendChild(o)} 456if(PHPResponse.Cookie.Buttons.cancel){var r=document.createElement("button");r.classList.add("btn","btn-warning"),r.innerText=PHPResponse.Cookie.Buttons.cancel,r.addEventListener("click",function(){crearActualizarCookie(!1),document.querySelector("body").removeChild(t)}),i.appendChild(r)} 457a.appendChild(e),t.appendChild(a),t.appendChild(i),document.querySelector("body").appendChild(t),document.querySelector("body").appendChild(b),document.querySelector("body").classList.add("modal-cookie");if(PHPResponse.Cookie.Automatic){crearActualizarCookie(!0)}} 458function crearActualizarCookie(t){var a={action:"crearActualizarCookie",confirmacion:t};fetch(PHPResponse.AppDomain+"CalledCookies.php",{method:"POST",body:JSON.stringify(a),headers:{'Content-Type':'application/json'}})} 459useCookie()}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.