function CFade(Control){var _My;if(!this.CFadeStatus){_My=Control;_My.CFadeStatus=1
CFade.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}
this.SetFadeTime=function(Tiem,FadeOp){this.FadeTime=Tiem;this.FadeOp=FadeOp}
this.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)
CallBack();}},this.FadeTime)}
this.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)
CallBack();}},this.FadeTime)}}
return _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}
this.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=''}
this.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)}}
this.onmouseout=function(){window.clearTimeout(this.ToolTip.TimeOut);this.ToolTip.FadeOut()}}
return _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}}}}
function BL_AjaxRequest(Request){try{var BL_Ajax=BL_AjaxInit();if(Request.Url)
BL_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
{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})}}}
var 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)
e[x]=m[x];return e}
HTMLElement.prototype.BL_extend=HTMLElement.prototype.BL_Extend=BL_Extend=BL_extend;function BL_ManagerMessage(){this.DMSG=[]}
BL_ManagerMessage.prototype.AssingDispatch=function(Objeto){Objeto.SetManagerMessage(this);this.DMSG.push(Objeto)}
BL_ManagerMessage.prototype.DispatchMessage=function(ID_MSG){for(var i=0;i<this.DMSG.length;i++){this.DMSG[i].SendMessage(ID_MSG)}}
function BL_DispatchMessage(){this.FUNCION=[];this.MNGMSG=null}
BL_DispatchMessage.prototype.SendMessage=function(ID_MSG){for(var i=0;i<this.FUNCION.length;i++){if(this.FUNCION[i].ID==ID_MSG)
this[this.FUNCION[i].CallBack]();}}
BL_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}}
if(!bEsta)
this.FUNCION.push({ID:ID_MSG,CallBack:CallBack})}
BL_DispatchMessage.prototype.SetManagerMessage=function(Manager){this.MNGMSG=Manager}
BL_DispatchMessage.prototype.DispatchMessage=function(ID_MSG){this.MNGMSG.DispatchMessage(ID_MSG)}
String.prototype.RemplaceAll=function(busca,reemplaza){var text=this;while(text.toString().indexOf(busca)!=-1)
text=text.toString().replace(busca,reemplaza);return text}
HTMLElement.prototype.AddEventList=function(eventType,handler){var _this=this;if(this.addEventListener)
this.addEventListener(eventType,handler,!1);else if(this.attachEvent)
this.attachEvent('on'+eventType,function(){handler.call(_this)})}
HTMLDocument.prototype.AddEventList=function(eventType,handler){var _this=this;if(this.addEventListener)
this.addEventListener(eventType,handler,!1);else if(this.attachEvent)
this.attachEvent('on'+eventType,function(){handler.call(_this)})}
HTMLElement.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'),' ')}
HTMLElement.prototype.BL_AddClass=function(c){this.BL_RemoveClass(c);this.className+=' '+c}
HTMLElement.prototype.BL_HasClass=function(ClassName){Ex=new RegExp('(^|\\s)'+ClassName+'(\\s|$)','g');return Ex.test(this.className)}
HTMLElement.prototype.BL_Hidden=function(f){(f)?this.BL_AddClass('COculto'):this.BL_RemoveClass('COculto')}
HTMLElement.prototype.BL_Enabled=function(bEnable){if(bEnable===!0){this.disabled=!1}else if(bEnable===!1){this.disabled=!0}
return!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=arrNodes[n];break;case 'CONTROLS':this.Slider=arrNodes[n];this.Slider.preloaded=!0;break;default:break}}
if(typeof this.ulTabs!=='object'){for(i=0;i<this.childNodes.length;i++){if(this.childNodes[i].tagName=="UL"){this.ulTabs=this.childNodes[i]}}}
this.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)
li[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}
this.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"))
document.getElementById(li[j].getAttribute("ref")).parentNode.removeChild(document.getElementById(li[j].getAttribute("ref")));}
if(this.Items.length>1){this.margenLi=((this.Items[1].Left-this.Items[0].Right)/2)}else{this.margenLi=0}
if(typeof(this.Slider)!=='object'){this.Slider=document.createElement('div');this.Slider.CtrlTab=this;this.Slider.setAttribute('data-tabs','CONTROLS');this.Slider.preloaded=!1}
if(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)}
if(!(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()}}}
this.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}
this.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'}
this.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'}
delete this.PosicionSalvada}
if(this.ItemSalvado){this.SelectItem(this.ItemSalvado)}else{this.SelectItem(0)}
this.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}}}}
if(!(typeof ii==='number')){ii=0}
if(this.Items[ii].l==!1){this.Items[ii].f.appendChild(this.Items[ii].p);this.Items[ii].l=!0}
this.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','')}
if(objTab.Title){liTab.setAttribute('title',objTab.Title)}
if(typeof objTab.Class==='string'){liTab.BL_AddClass(objTab.Class)}
liTab.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)}
if((typeof objTab.Codigo=='string')||(typeof objTab.Codigo=='number')){liTab.setAttribute('data-tabs-code',objTab.Codigo)}
this.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))}
divContainer.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'}
this.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)
this.ItemSalvado=g}
this.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}
for(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}}}}
if(!this.Items[0].t.style.left){this.Items[0].t.style.left='0px'}
this.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)
this.ItemSalvado=g}
this.InitTabs()};this.SlideRight=function(){if((!this.idInterval)){var distancia=0,Dir,Posicion;if(!this.Items[0].t.style.left)
this.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}}
this.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)
this.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}}
this.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)
nVelocidad=nVelocidad*-1;if(nVelocidad===0)
nVelocidad=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}}
for(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)
this.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}
return!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)
_My=Control;else _My=document.createElement('div');if(!_My.CCtrlStatus)
_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.')}
this.onchange=function(event){return BL_ToolTipValidation(BL_VNumeric,event,this,'Solo se permite ingresar valores numericos.')}}
this.setClass=function(ClassName){this.className=ClassName}
this.AddClass=function(ClassName){this.BL_AddClass(ClassName)}
this.RemoveClass=function(ClassName){this.BL_RemoveClass(ClassName)}
this.HasClass=function(ClassName){Ex=new RegExp('(^|\\s)'+ClassName+'(\\s|$)','g');return Ex.test(this.className)}
this.setText=function(Text){this.innerHTML=Text}
this.AddClick=function(Function){if(document.addEventListener){this.addEventListener('click',Function,!1)}else{this.attachEvent('onclick',Function)}}}
return _My}
function 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}
return _My}
function 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}}
this.Fields.Remove=function(Index){this.removeChild(this[Index]);this.splice(Index,1);for(var i=0;i<this.length;i++){this[i].Index=i}}
this.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)}
if(Parameters.Class!==undefined)
_New.BL_AddClass(Parameters.Class);if(Parameters.Title!==undefined)
_New.title=Parameters.Title;this.push(_New);return _New.Index}}
return _My}
function 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])}
this.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}}
if((this.Pages.Count=parseInt(this.getAttribute('pagecount'),10))===null){this.Pages.Count=3}
if(!(this.Pages.Size=parseInt(this.getAttribute('rowsize'),10))){this.Pages.Size=10;this.Pages.Count=10}
this.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}
_My.Rows[i].RemoveClass('ImPar');_My.Rows[i].RemoveClass('Par');Cantidad++;if(Cantidad%2)
_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))
_My.Rows[i].style.display='';else _My.Rows[i].style.display='none'}}
this.Pages.Next=function(){}
this.Pages.Preview=function(){}
this.Pages.Referen=function(){var Paginas=parseInt(_My.Rows.length/this.Size,10);var Index,Boton;if(_My.Rows.length%this.Size)
Paginas++;for(var Clo=0;Clo<this.Ctrl.length;Clo++){this.Ctrl[Clo].innerHTML='';if(Paginas>0){Boton=document.createElement('button');Boton.innerHTML='&lt;&lt;';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=1){Boton.Page=1;Boton.onclick=function(){_My.Pages.Select(this.Page)}
Boton.disabled=!1}else Boton.disabled=!0;Boton=document.createElement('button');Boton.innerHTML='&lt;';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=1){Boton.Page=_My.Pages.Selected-1;Boton.onclick=function(){_My.Pages.Select(this.Page)}
Boton.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)))
Mostrar=!0;if((this.Selected-this.Count)<=i&&i<=(this.Selected+this.Count))
Mostrar=!0;if((this.Selected+this.Count)>=Paginas&&i>=(this.Selected-this.Count-((this.Selected+this.Count)-Paginas)))
Mostrar=!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)}}}}
Boton=document.createElement('button');Boton.innerHTML='&gt;';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=Paginas){Boton.Page=_My.Pages.Selected+1;Boton.onclick=function(){_My.Pages.Select(this.Page)}
Boton.disabled=!1}else Boton.disabled=!0;Boton=document.createElement('button');Boton.innerHTML='&gt;&gt;';this.Ctrl[Clo].appendChild(Boton);if(this.Selected!=Paginas){Boton.Page=Paginas;Boton.onclick=function(){_My.Pages.Select(this.Page)}
Boton.disabled=!1}else Boton.disabled=!0}}
if(_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}}}
this.Pages.Refresh=function(){this.Select(this.Selected)}
this.Rows.Clear=function(){var Dato;while((Dato=this.pop())){_My.Body.removeChild(Dato);delete Dato}}
this.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}}
this.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}}
return _My}
function 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(){}}
return _My}
function 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(){}
this.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}}
this.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}
this.CItemStatus=2}
return _My}
function CHeader(idControl){var _My;if(!this.CHeaderStatus){_My=CItem(idControl);_My.CHeaderStatus=1;CHeader.call(_My)}else if(this.CHeaderStatus==1){}
return _My}
function CBody(idControl){var _My;if(!this.CBodyStatus){_My=CListView(idControl);_My.CBodyStatus=1;CBody.call(_My)}else 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)
_New.AddClass('ImPar');else _New.AddClass('Par');this.push(_New);return _New.Index}}
return _My}
function 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(){}}
return _My}
function 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)
_My.Fields[Object.ChildrenIndex].RemoveClass('Selected');}else{Object.AddClass('CChecked');if(Object.ChildrenIndex>-1)
_My.Fields[Object.ChildrenIndex].AddClass('Selected');}}}
this.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)}
this.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}
return Index}
this.SelectItem=function(IdObjeto){var Objeto=document.getElementById(IdObjeto);if(_My.TreeObject.SelectedItem)
_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)}}}}
return _My}
function 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)
window.clearInterval(_My.idInterval)
_My.idInterval=!1;_My.Deslizar(Item)}
if(!(this.Pages.PageChar=this.getAttribute('pagechar')))
this.Pages.PageChar='&bull;';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')}}}
this.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)
_My.Rows[i].AddClass('Selected');}}
this.Pages.Referen=function(){var Paginas=parseInt(_My.Rows.length/this.Size,10);var Index;if(_My.Rows.length%this.Size)
Paginas++;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))
this.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)}
this.Ctrl[Clo].Fields[Index].onmouseover=function(){_My.Pages.SelectItem(this.Item)}}}}
if(_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}}}
_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}
if(!_My.style.top)
_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}
if(!_My.style.left)
_My.style.left=_My.clientLeft+'px';PosicionFinal=-_My.Rows[Item-1].offsetLeft;_My.idInterval=window.setInterval(function(){_My.SlideHorizontal(PosicionFinal,Dir)},nMilisegundos)}}}catch(e){}}
_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)
nVelocidad=nVelocidad*-1;if(nVelocidad==0)
nVelocidad=1;if(Posicion!=nDestino){Posicion+=(nDireccion*nVelocidad);if(nDireccion<0){if(Posicion<nDestino){Posicion=nDestino}}else{if(Posicion>nDestino){Posicion=nDestino}}
_My.style.left=(Posicion)+'px'}else{window.clearInterval(_My.idInterval);delete _My.idInterval}}catch(e){alert(e)}}
_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)
nVelocidad=nVelocidad*-1;if(nVelocidad==0)
nVelocidad=1;if(Posicion!=nDestino){Posicion+=(nDireccion*nVelocidad);if(nDireccion<0){if(Posicion<nDestino){Posicion=nDestino}}else{if(Posicion>nDestino){Posicion=nDestino}}
_My.style.top=Posicion+'px'}else{window.clearInterval(_My.idInterval);delete _My.idInterval}}catch(e){alert(e)}}}
return _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]}
return Tamanyo}
function OpenWindow(){if(!arguments[1])
arguments[1]=800;if(!arguments[2])
arguments[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')}
function Redirect(href){BL_LoadingBox({Center:!0,Text:'Redireccionando...'});window.location=href}
function 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}}
return tmp_arr.join('')}
String.prototype.unescapeHtml=function(){var temp=document.createElement("div");temp.innerHTML=this;var result=temp.childNodes[0].nodeValue;temp.removeChild(temp.firstChild);return result}
Date.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}
String.prototype.LTrim=function(){return this.replace(/^\s+/,"")}
String.prototype.RTrim=function(){return this.replace(/\s+$/,"")}
String.prototype.Trim=function(){return this.RTrim(this.LTrim(this))}
function StopEvent(e){if(e.preventDefault)
e.preventDefault();else e.returnValue=!1;if(e.stopPropagation)
e.stopPropagation();else e.cancelBubble=!0}
function 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}
return[scrOfX,scrOfY]}
document.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}
if(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}}
document.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')
this.dobj.PositionUpdate();}
this.CursorX=newLeft;this.CursorY=newTop;return!1}}
document.onmouseup=function(e){this.estoyArrastrando=!1}
function getAbsoluteElementPosition(element){if(typeof element=="string")
element=document.getElementById(element)
if(!element)
return{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}
return{top:y,left:x,bottom:y+h,right:x+w}}
HTMLDocument=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}}
if(!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}}
if(!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;i<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}}
if(!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}}
if(!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)
_Control.innerHTML=Text}
return _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]}
return Tamanyo}
function CreateButton(Texto,href){var Boton=document.createElement('a');Boton.setAttribute('href',href);Boton.setAttribute('class','ctlButton');Boton.innerHTML=Texto;return Boton.cloneNode(!0)}
var CountMessage=0;var CountLoad=0;var CountWindow=0;var ZINDEX=1030;function CDialogBox(){var _My;if(!this.CDialogBoxStatus){if(typeof Control=="string")
_My=document.getElementById(Control)
else _My=Control;if(_My.CDialogBoxStatus!=2){_My.CDialogBoxStatus=1;CDialogBox.call(_My)}}else if(this.CDialogBoxStatus==1){_My=this;this.CDialogBoxStatus=2}
return _My}
DialogBox=function(){this.Message=function(){this.Count=0;this.show=function(Parameters){}}
this.Window=function(){this.show=function(Title,Contex){}}
this.Loading=function(){this.show=function(Text){}}}
function BL_MessageBoxCreate(Parameters){var IdMessagebox='';var Aceptar=!0;var Messagebox=document.createElement('div');var 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}
CountMessage++;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()}}
Botones.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()}
Aceptar=!1}
if(Aceptar){Botones.btnAcept.onclick=function(){Dialog.FadeOut(function(){BL_MessageBoxDestroy({MessageBox:IdMessagebox})});Background.FadeOut()}}}
document.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}
function BL_MessageBoxDestroy(Parameters){var Padre,Hijo;if(Parameters.MessageBox){Padre=document.getElementsByTagName('body')[0];Hijo=document.getElementById(Parameters.MessageBox);Padre.removeChild(Hijo);delete(Hijo)}}
function BL_LoadingBox(Parameters){var Loading=document.createElement('div');var 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)
Icon.innerHTML=Parameters.Icon;else Icon.innerHTML='<img src="img/Loading.gif" title="Cargando" alt="Cargando" />';if(Parameters.Element){Padre=Parameters.Element;if(!Padre)
return null;if(!Padre.style.position)
Padre.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)
return null;if(!Padre.style.position)
Padre.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)}
Loading.Removes=function(){CountLoad++;this.id=this.id+CountLoad;Dialog.FadeOut(function(){if(Loading.parentNode!=null)
Loading.parentNode.removeChild(Loading);});Background.FadeOut()}
Dialog.FadeIn();Background.FadeIn();if(Parameters.Center==!0)
Dialog.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)
return Parameters.Elemento;else return null}
function BL_HidenLoadingBox(Parameters){var Hijo;Parameters.Dialog=Parameters.WinId;if(Parameters.Dialog)
Hijo=document.getElementById(Parameters.Dialog+'_Loading');else Hijo=document.getElementById('body_Loading');if(Hijo)
Hijo.Removes();}
function BL_WindowBox_KillFocus(){var nn=document.querySelectorAll(".CActiveWindow");for(var i=0;i<nn.length;i++){nn[i].BL_RemoveClass("CActiveWindow")}}
function 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}}
var IdWindowbox='';var Windowbox=document.createElement('div');var 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'}}
Dialog.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"}
if(Content.offsetHeight<250){Content.style.height="250px"}
Windowbox.WindowFocus()}}
if(Parameters.Modal==undefined||Parameters.Modal==!0){Windowbox.style.width='100%';Windowbox.style.height='100%';Windowbox.appendChild(Background)}
Windowbox.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}}]}
if(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)}}
if(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)}}
if(Parameters.Element)
Content.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}
Windowbox.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})});Background.FadeOut()};Windowbox.SetShowChange=function(change){if(change===!0)
TitleText.innerHTML=TitleText.innerHTML.replace("Editor Web ","Editor Web* ");else TitleText.innerHTML=TitleText.innerHTML.replace("Editor Web* ","Editor Web ")}
Windowbox.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'))
Content.querySelector('div.note-editable').setAttribute('contenteditable','false');if(Content.querySelector('div.note-editor.note-frame'))
Content.querySelector('div.note-editor.note-frame').style.paddingBottom=0;if(Content.querySelector('.cancel-update'))
Content.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')}
let multiselect=Content.querySelectorAll('.multiselect');for(let i=0;i<multiselect.length;i++){multiselect[i].setAttribute('disabled','true')}
let options=Content.querySelectorAll('[data-form="option-multiple"]');for(let i=0;i<options.length;i++){options[i].setAttribute('disabled','true')}
break;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}
if(x<0){x=50}
this.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}}
Windowbox.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}
function BL_PopupCreate(Parameters){var IdWindowbox='';var Windowbox=document.createElement('div');var 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}}]}
if(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)}}
if(Parameters.Element)
Content.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}
Windowbox.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}
if(x<0){x=50}
this.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}}
Windowbox.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()}}
document.windowFocus=!0;Windowbox.Close=function(){BL_WindowDestroy({Windowbox:IdWindowbox})};return IdWindowbox}
function 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)}}}
function 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)
Content.innerHTML=Parameters.Element.innerHTML;else Content.innerHTML=Parameters.Content;if(Parameters.ToolTipID){IdToolTip=Parameters.ToolTipID}else{CountToolTip++;IdToolTip='ToolTip'+CountToolTip}
BL_ToolTipDestroy({ToolTipID:IdToolTip});ToolTip.setAttribute('id',IdToolTip);Icon.setAttribute('href',"javascript:BL_ToolTipDestroy({ToolTipID: '"+IdToolTip+"'});");if(Parameters.TimeOut)
window.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))
document.getElementsByTagName('body')[0].appendChild(ToolTip);Left+=Objeto.offsetWidth;Top+=Objeto.offsetHeight;if((Left+ToolTip.offsetWidth)>TamVentana()[0]){Left=Left-ToolTip.offsetWidth-Objeto.offsetWidth+20}
ToolTip.style.top=(Top-10)+'px';ToolTip.style.left=(Left-10)+'px'}
return IdToolTip}
function BL_ToolTipDestroy(Parameters){var Padre,Hijo;if(Parameters.ToolTipID){if((Hijo=document.getElementById(Parameters.ToolTipID))){Padre=Hijo.parentNode;Padre.removeChild(Hijo);delete(Hijo)}}}
document.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
let 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_}
BL_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}}})}
this.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}
return ad}
this.Response=function(Response){if(Response.Status==STATUS_ERROR){console.error(Response.Message);return}
switch(Response.Action){case 1:_this.InitAds(Response.Data.ad);break}}
this.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")}
return}
_this.ads.setMedia(screen);_this.ads.create(_this.development)}catch(e){console.error(e)}}
this.Instance()}
function LoadAdvertising(){let containers=document.querySelectorAll("[data-type='adContainer']");const quantityContainerForType={}
containers.forEach((container)=>{if(!quantityContainerForType[container.getAttribute("data-adContainer")]){quantityContainerForType[container.getAttribute("data-adContainer")]=[]}
quantityContainerForType[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)}}
function 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()}}
this.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)}
this.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)}})}
this.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)})}}
this.setMedia=function(media){this.data.media=media}
this.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]}}
return code}
this.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}}
let 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]);_this.AddDispatched(_this.data.ads[code],PRINT,(_this.data.containerPrint?!1:!0));_this.data.ads[code].print=!0;_this.data.containerPrint=!0}
return}}}}
window.addEventListener('scroll',printDispatched);if(elements.length>1)
document.getElementById('carousel-'+this.data.id).addEventListener('slid.bs.carousel',printDispatched);printDispatched()}
this.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)}}
this.createCarousel=function(){let carousel=document.getElementById('carousel-'+this.data.id)
carousel.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"}
let 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()}
carousel.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()}})}
carouselControl.cycle()}
this.AddDispatched=function(ad,event,eventContainer){let data={codeAd:ad.codeAd,codeRemoto:ad.remote,version:ad.version,section:this.data.section,media:this.data.media}
data.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}})}
this.OnResponse=function(Response){if(Response.Status==STATUS_ERROR){console.error("PUBLICIDAD: ERROR "+Response.Message);return}
switch(Response.Action){case 1:break}}
this.show=function(){}}
function CAdBasic(ad){let _this=this;let container
CAdvertising.call(this,ad);this.create=function(development){this.init();if(!development)
this.createEvent();}
this.createEvent=function(){let container=document.getElementById(this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()}
this.addClick(items);this.addPrint(items)}}
function 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}
this.init();this.container.querySelector(".pr-close").addEventListener("click",_this.close);if(!development){this.createEvent();this.show()}}
this.createEvent=function(){let container=document.getElementById("p-"+_this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()}
this.addClick(items);this.addPrint(items)}
this.close=function(){let container=document.getElementById("p-"+_this.data.id);document.querySelector("body").classList.remove("modal-open");container.classList.add("hide");container.remove()}
this.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")}}}
function 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;fixed.classList.remove("show")})
window.addEventListener("scroll",function(){if(window.scrollY>150&&!fixed.close){fixed.classList.add("show")}else{fixed.classList.remove("show")}})}}
this.setPosition=function(pos){let container=document.getElementById("fixed-"+this.data.id);container.classList.add(pos)}
this.createEvent=function(){let container=document.getElementById("fixed-"+this.data.id);let items=container.querySelectorAll(".item");if(items.length>1){this.createCarousel()}
this.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)
document.querySelector('.go-up').classList.add("active");else document.querySelector('.go-up').classList.remove("active")});document.querySelector('.go-up').onclick=function(){window.scrollTo(0,0)}}
document.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'))
el.parentNode.classList.add('parent-mas-popular');});if(document.querySelector('[id*="content-"][data-type="4"]')){importJs(PHPResponse.AppDomain+"js/admin/poll.js").then(()=>{VerificarSiCargarPolls()})}
if(document.getElementById("lastest")){lastest()}
if(typeof CPublicidad!="undefined"&&(typeof CWinApp=="undefined"||!(CWinApp()instanceof CPageAdm))){let advertising=new CPublicidad();advertising.get()}
if(document.querySelector(".swiper")){slider()}
LoadAdvertising();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}
let 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)}})})}
function ServiceWork(){var sw;let install=()=>{if(sw instanceof CAppSW){return}
if(!('PushManager' in window)){console.log("el dispositivo no soporta notificaciones push");document.removeEventListener("click",install);return}
if(!('serviceWorker' in navigator)){console.log("el navegador no soporta ServiceWoker");document.removeEventListener("click",install)
return}
sw=new CAppSW();sw.setUPPush()}
document.addEventListener("click",install);document.addEventListener("scroll",()=>{if(sw instanceof CAppSW){return}
if(!('PushManager' in window)){console.log("el dispositivo no soporta notificaciones push");return}
if(!('serviceWorker' in navigator)){console.log("el navegador no soporta ServiceWoker");return}
sw=new CAppSW();sw.setUPPush()})}
function CreateLazyLoad(){if('loading' in HTMLImageElement.prototype){return}
importJs("https://unpkg.com/jquery@1.11.1/dist/jquery.min.js").then(()=>{importJs(PHPResponse.AppDomain+'Core/plugin/lazy/jquery.lazyload.min.js').then(()=>{$("img.lazy").lazyload({failure_limit:10})})})}
function Registrar(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.showRegister()})}
function Ingresar(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.showLogin()})}
function Salir(){importJs(PHPResponse.AppDomain+'/js/Cliente.js').then(()=>{let user=new CClient();user.Logout()})}
function 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}}
if(this.classList.contains("disable")){return}
if(!PHPResponse.ContentsExist){PHPResponse.ContentsExist=[]}
if(!PHPResponse.ContentsExist[idLastest]){let ContentsExist=[0];if(!Array.isArray(PHPResponse.ContentsExist)){ContentsExist=ContentsExist.concat(PHPResponse.ContentsExist)}
PHPResponse.ContentsExist[idLastest]=ContentsExist}
if(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])})}
if(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)}
parent.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))
container.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)})}})}
function 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}
let param={loop:!0,speed:400,breakpoints:{1200:{slidesPerView:el.getAttribute("data-amountDisplay"),}}}
if(el.getAttribute("data-amountDisplayMD")){param.breakpoints={768:{slidesPerView:el.getAttribute("data-amountDisplayMD")},...param.breakpoints}}
if(el.getAttribute("data-amountDisplaySM")){param.breakpoints={480:{slidesPerView:el.getAttribute("data-amountDisplaySM")},...param.breakpoints}}
if(el.getAttribute("data-spaceBetween")){param.spaceBetween=Number.parseInt(el.getAttribute("data-spaceBetween"))}
if(el.getAttribute("data-typeIndicator")!=0){param.pagination={el:".swiper-pagination",dynamicBullets:!0,type:indicator[Number.parseInt(el.getAttribute("data-typeIndicator"))]}}
if(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' : ''}`,}}
if(param.speed!=0){param.autoplay={delay:Number.parseInt(el.getAttribute("data-speed"))+(Math.floor(Math.random()*51)+100)}}
swiper=new Swiper("#"+el.id,param)})})}
function 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">
                        <div class="d-flex">
                          <div class="toast-body">
                            Enlace copiado: ${text}
                          </div>
                          <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
                        </div>
                      </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)})
toast.show();console.log("copy")}
async 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())}
return}}
let script=document.createElement("script");script.src=url;script.loaded="false";script.setAttribute("async",!0);script.onload=()=>{script.loaded=!0;resolve()};document.head.appendChild(script)})}
function importCss(url){let fileLoaded=document.querySelectorAll("link");for(let i=0;i<fileLoaded.length;i++){if(fileLoaded[i].href==url)
return}
let 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 service worker.',err);console.log()})}else{return navigator.serviceWorker.getRegistration()}}
this.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}
if(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)}})}})}
this.unsubscribe=function(){(new CPushNotification()).unsubscribeUser()}}
function CPushNotification(url,Key){const urlSW=url;const appkey=Key;var Sections=[];var _this=this;this.SetSections=function(s){Sections=s;console.log(Sections)}
this.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)}
return outputArray}
this.GetPermissionNotification=function(){if(navigator.permissions){return navigator.permissions.query({name:'notifications'}).then((result)=>{return result.state})}
return new Promise(function(resolve){resolve(Notification.requestPermission)})}
this.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}
return result})}
this.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)})}
this.SelectionSections=function(){var modal=new WindowsSelectSection(_this);modal.show()}
this.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'}})}
this.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}}
this.unsubscribeUser=function(){return this.getSWRegistration().then(function(regitration){regitration.pushManager.getSubscription().then(function(subs){return subs.unsubscribe()})})}
this.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();event.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.")})}
function 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)}
if(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)}
a.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)}}
function crearActualizarCookie(t){var a={action:"crearActualizarCookie",confirmacion:t};fetch(PHPResponse.AppDomain+"CalledCookies.php",{method:"POST",body:JSON.stringify(a),headers:{'Content-Type':'application/json'}})}
useCookie()};function getLatestMoment(){let data={action:"Lastest",ContentsExist:[0],quantity:5,section:-1,view:776,};fetch(PHPResponse.AppDomain+"/CalledConsultasExternas.php",{method:"POST",body:JSON.stringify(data),}).then((response)=>response.json()).then((data)=>{const container=document.getElementById("ultimosMomento");if(data.nota!=""){let notas=document.createElement("div");notas.className="notas";notas.innerHTML=data.nota;notas.querySelectorAll("article").forEach((article,key)=>{if(key==0){article.classList.add("active")}article.classList.remove("col-sm-6")});container.appendChild(notas)}}).catch((response)=>console.warn(response))}function getClima(){fetch(PHPResponse.AppDomain+"/CalledWidgets.php",{method:"POST",body:JSON.stringify({action:"getClima",}),}).then((response)=>response.json()).then((data)=>{if(data){let container=document.getElementById("clima");let icon=document.createElement("div");let iconImg=document.createElement("img");let info=document.createElement("div");let infoCity=document.createElement("p");let infoTemp=document.createElement("p");icon.classList.add("icon");info.classList.add("info");iconImg.src=data.icon;icon.appendChild(iconImg);infoCity.innerText=data.labelCity;infoTemp.innerText=data.temp+"°"+data.unit;info.appendChild(infoCity);info.appendChild(infoTemp);container.innerHTML="";container.appendChild(icon);container.appendChild(info)}}).catch((error)=>console.warn(error))}function refreshPage(min){setTimeout(function(){location.reload()},min*60*1000)}function mostPopularCategoriesShow(){let mostPopularCategorys=document.getElementById("mostPopularCategorys");if(!mostPopularCategorys){return}var catJson=JSON.parse(mostPopularCategorys.innerText);mostPopularCategorys.innerText="";mostPopularCategorys.style.display="inline-block";for(k in catJson){if(k<3){let a=document.createElement("a");a.href=PHPResponse.AppDomain+"/categorias.php?r=1&c="+catJson[k].id;a.className="text-font font-300 dark-grey-color";a.innerText=catJson[k].nombre;mostPopularCategorys.appendChild(a)}}}getLatestMoment();getClima();refreshPage(20);mostPopularCategoriesShow();let paywall={};document.addEventListener("DOMContentLoaded",function(){setFuncGalery();RenderPoll();ReplaceThirdContent();ReplaceIframeNoteInText();NoteNavigation();IframeHeightFitFContent();Paywall()});function setFuncGalery(){if(typeof importJS=='undefined'){setTimeout(setFuncGalery,200);return}
let gallerys=document.querySelectorAll('.carousel');let column=document.querySelector('[data-form="width-gallery-usage"]');for(let i=0;i<gallerys.length;i++){let width,heigth,iconAudio,playStop;let ratioElement=gallerys[i].querySelector('[data-form="ratio"]');let ratio=ratioElement.getAttribute('data-ratio');let arrows=gallerys[i].querySelectorAll('[data-form="gallery-arrow"]');if(arrows.length>1){arrows[0].gallery=gallerys[i];arrows[1].gallery=gallerys[i];arrows[0].href=arrows[1].href="#"+gallerys[i].getAttribute("id");for(let j=0;j<arrows.length;j++){arrows[j].addEventListener('click',function(){let active=this.gallery.querySelector('[class="item active"]');let iframes=active.querySelectorAll('.embed-responsive-item');let audios=active.querySelectorAll('audio');iframes.forEach(function(el){let cover=el.parentNode.querySelector('[data-form="cover-iframe"]');cover.className='';switch(this.getAttribute('data-type')){case "1":el.contentWindow.postMessage('{"event":"command","func":"'+'pauseVideo'+'","args":""}','*');break;case "2":el.contentWindow.postMessage('pause','*');break;case "3":el.contentWindow.postMessage('{"method":"pause"}','*');break}});audios.forEach(function(el){el.pause()});bootstrap.Carousel.getInstance(this.gallery).cycle()})}}else{if(document.querySelector('[data-form="cover-iframe"]'))
document.querySelector('[data-form="cover-iframe"]').remove();}
width=column.offsetWidth;heigth=(width/ratio);let audioDivs=gallerys[i].getElementsByClassName("audio-galery-classic");let videoDivs=gallerys[i].getElementsByClassName("video-galery-classic");let pollDivs=gallerys[i].getElementsByClassName("poll-galery-classic");if(audioDivs.length>0){importJS(PHPResponse.AppDomain+"core/js/audiojs/audio.min.js").then(()=>audiojs.createAll())}
for(let j=0;j<audioDivs.length;j++){audioDivs[j].style.height=heigth+"px";iconAudio=audioDivs[j].querySelector('[data-form="icon-audio"]');playStop=audioDivs[j].querySelector('div.play-pause');playStop.gallery=gallerys[i];playStop.addEventListener('click',function(){bootstrap.Carousel.getInstance(this.gallery).pause()});iconAudio.gallery=gallerys[i];iconAudio.addEventListener('click',function(){playStop.click()})}
let funcPolls=(pollDivs)=>{for(let j=0;j<pollDivs.length;j++){pollDivs[j].style.height=(heigth+9)+"px";let multiple=(pollDivs[j].querySelector('[data-multiple="1"]'))?!0:!1;if(!multiple){let inputs=pollDivs[j].querySelectorAll('[type="checkbox"]');for(let h=0;h<inputs.length;h++){inputs[h].setAttribute('type','radio')}}
let canvas=pollDivs[j].querySelector('[data-poll="canvas"]');let optionView=pollDivs[j].querySelector('[data-poll="poll-first-view"]');let btn=pollDivs[j].querySelector('[data-poll="vote"]');btn.poll=pollDivs[j];btn.canvas=canvas;btn.optView=optionView;btn.canvasView=pollDivs[j].querySelector('[data-form="canvas-view"]');pollDivs[j].style.width=width+"px";let color=[{color:"#F7464A",highlight:"#FF5A5E"},{color:"#46BFBD",highlight:"#5AD3D1"},{color:"#FDB45C",highlight:"#FFC870"},{color:"#5CFD8E",highlight:"#5CFDAB"},{color:"#6A228F",highlight:"#79228F"},{color:"#8F226D",highlight:"#8F224F"}];let options=pollDivs[j].querySelectorAll('[data-poll="option"]');let pollType=pollDivs[j].getAttribute('data-poll-type');let data;let colorIndex=0;switch(pollType){case '1':case '2':case '3':data={};data.labels=[];data.datasets=[];data.datasets[0]={};data.datasets[0].data=[];data.datasets[0].backgroundColor=[];data.datasets[0].hoverBackgroundColor=[];for(let ii=0;ii<options.length;ii++){data.labels.push(options[ii].getAttribute('data-option'));data.datasets[0].data.push(options[ii].getAttribute('data-votes'));data.datasets[0].backgroundColor.push(color[colorIndex].color);data.datasets[0].hoverBackgroundColor.push(color[colorIndex].color);colorIndex++;if(colorIndex==color.length){colorIndex=0}}
break;case '4':case '5':case '6':data={};data.labels=[];data.datasets=[];data.datasets[0]={};data.datasets[0].data=[];for(let ii=0;ii<options.length;ii++){data.labels.push(options[ii].getAttribute('data-option'));data.datasets[0].data.push(options[ii].getAttribute('data-votes'));data.datasets[0].backgroundColor='rgba(220,220,220,0.2)';data.datasets[0].borderColor='rgba(220,220,220,.8)';data.datasets[0].pointBackgroundColor='#04B2BF';data.datasets[0].pointBorderColor='#fff';data.datasets[0].pointHoverBackgroundColor='#04B2BF';data.datasets[0].pointHoverBorderColor='rgba(220,220,220,0.2)'}
break}
btn.data=data;btn.pollType=pollType;btn.options=options;Chart.defaults.global.legend.display=!1;Chart.defaults.global.defaultFontColor='rgba(0,0,0,.50)';Chart.defaults.global.defaultFontSize=12;Chart.defaults.global.responsive=!0;btn.addEventListener('click',function(){this.poll.classList.remove('tablecell');this.canvasView.classList.remove('hidden');this.canvas.classList.remove('hidden');this.optView.classList.add('hidden');let ctx=this.canvas.getContext("2d");ctx.canvas.height=150;let myNewChart;switch(this.pollType){case '2':ctx.canvas.height=130;myNewChart=new Chart(ctx,{type:'doughnut',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}});break;case '3':myNewChart=new Chart(ctx,{type:'polarArea',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}});break;case '4':myNewChart=new Chart(ctx,{type:'line',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}});break;case '5':myNewChart=new Chart(ctx,{type:'bar',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}});break;case '6':myNewChart=new Chart(ctx,{type:'radar',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}});break;default:ctx.canvas.height=130;myNewChart=new Chart(ctx,{type:'pie',data:this.data,animation:{animateScale:!0},options:{animation:{animateScale:!0,easing:'easeOutCubic',duration:500}}})}
let checks=[];let idPoll=this.poll.getAttribute('data-poll');let idContent=this.poll.getAttribute('data-content');let idReview=this.poll.getAttribute('data-review');if(this.options&&idContent!='0'){for(let hi=0;hi<this.options.length;hi++){if(this.options[hi].checked){checks.push(this.options[hi].getAttribute('value'))}}}
if(checks.length>0){BL_AjaxRequest({Url:'CalledContenedor.php',Request:{Action:'VotarEncuesta',Data:{poll:idPoll,idContent:idContent,idReview:idReview,option:checks}}})}})}}
if(pollDivs.length>0){importJs("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.0.2/Chart.min.js").then(()=>funcPolls(pollDivs))}
for(let j=0;j<videoDivs.length;j++){let iframe=videoDivs[j].querySelector('[data-form="iframe"]');let cover=videoDivs[j].querySelector('[data-form="cover-iframe"]');cover.iframe=iframe;cover.gallery=gallerys[i];cover.type=iframe.getAttribute('data-type');cover.addEventListener('click',function(){this.className='hidden';bootstrap.Carousel().getInstance(this.gallery).pause();switch(this.type){case "1":this.iframe.contentWindow.postMessage('{"event":"command","func":"'+'playVideo'+'","args":""}','*');break;case "2":this.iframe.contentWindow.postMessage('play','*');break;case "3":this.iframe.contentWindow.postMessage('{"method":"play"}','*');break}});iframe.height=heigth;if(ratio<1.77){videoDivs[j].setAttribute('style','padding-bottom:56.25% !important;')}else if(ratio>1.9){videoDivs[j].setAttribute('style','padding-bottom:52.50% !important;')}}
new bootstrap.Carousel(gallerys[i],{interval:5000,pause:"hover"})}}
function RenderPoll(){let contentPoll=document.querySelector('[data-content-poll]');if(contentPoll){let type=contentPoll.getAttribute('data-poll-type');switch(type){case '1':let appearPercents=function(contentPoll){let overDiv=contentPoll.querySelectorAll('[data-type="over-div"]');overDiv.classList.remove('hidden')};let opts=contentPoll.querySelectorAll('[data-poll-option="true"]');for(let mi=0;mi<opts.length;mi++){let a=opts[mi].querySelector('[data-poll-number]');let votes=contentPoll.querySelector('[data-opt="'+a.getAttribute('data-poll-number')+'"]');a.vote=votes;a.contentPoll=contentPoll;a.event=appearPercents;a.addEventListener('click',function(){this.event(this.contentPoll);this.classList.add('voted');this.vote.innerHTML=parseInt(this.vote.innerHTML)+1;let idPoll=this.contentPoll.getAttribute('data-poll');let idContent=this.contentPoll.getAttribute('data-content-poll');let idReview=this.contentPoll.getAttribute('data-review');let optionNumber=this.getAttribute('data-poll-number');if(idContent!='0'){BL_AjaxRequest({Url:'CalledContenedor.php',Request:{Action:'VotarEncuesta',Data:{poll:idPoll,idContent:idContent,idReview:idReview,option:[optionNumber]}}})}})}
break;case '2':let blockPoll=function(contentPoll){let msg=contentPoll.querySelector('[data-poll="msg"]');let msgTop=contentPoll.querySelector('[data-poll="msgTop"]');let overDiv=contentPoll.querySelectorAll('[data-type="over-div"]');overDiv.classList.remove('hidden');msg.innerHTML='Gracias por opinar';msgTop.innerHTML='Votaste:'};opts=contentPoll.querySelectorAll('[data-poll-option="true"]');for(let i=0;i<opts.length;i++){opts[i].contentPoll=contentPoll;opts[i].event=blockPoll;opts[i].addEventListener('click',function(){this.event(this.contentPoll);this.classList.add('voted');let idPoll=this.contentPoll.getAttribute('data-poll');let idContent=this.contentPoll.getAttribute('data-content-poll');let idReview=this.contentPoll.getAttribute('data-review');let optionNumber=this.getAttribute('data-poll-number');if(idContent!='0'){BL_AjaxRequest({Url:'CalledContenedor.php',Request:{Action:'VotarEncuesta',Data:{poll:idPoll,idContent:idContent,idReview:idReview,option:[optionNumber]}}})}})}
break}}}
function ReplaceThirdContent(){document.querySelectorAll(".third-content").forEach(function(element){let content=document.createElement('div');content.innerHTML=decodeURI(element.getAttribute("data-content"));element.classList.remove("third-content");element.innerHTML='';for(let child of content.children){if(child.tagName=='SCRIPT'){child.removeAttribute("async");let script=document.createElement("script");Object.keys(child.attributes).forEach(i=>{let attribute=child.attributes[i];script.setAttribute(attribute.name,attribute.value)});element.appendChild(script);if(!script.src){let f=new Function(script.textContent);f()}}else{element.appendChild(child.cloneNode(!0))}}
element.removeAttribute("data-content")})}
function ReplaceIframeNoteInText(){console.log("cambio de iframe");document.querySelectorAll('[data-elemete="Ver-Tambien"]').forEach(function(element){console.log("entrto cambio de iframe");setTimeout(function(){setTimeout(function(){let src=location.protocol=="http:"?element.src.replace("https","http"):element.src;console.log("llamada ajax a:"+element.src.replace("https","http"));const response=fetch(src,{headers:{'Access-Control-Allow-Origin':'*','Content-Type':'text/plain'},})
response.then(response=>response.text()).then(response=>{console.log("reponse:"+response);let note=document.createElement("div");note.innerHTML=response;note.querySelector("link").remove();console.log("entro");element.parentNode.insertBefore(note,element)
note.classList.add("clearfix");element.remove()})},200)},100)})}
function NoteNavigation(){let noteNav=document.getElementById("NoteNavegation");if(noteNav){let data={"action":"PrevAndNextNote","id_Content":PHPResponse.IdContent,"section":PHPResponse.Section};fetch(PHPResponse.AppDomain+'CalledConsultasExternas.php',{method:'POST',body:JSON.stringify(data)}).then(response=>response.json()).then((data)=>{if(data.prev){noteNav.querySelector('[data-nav="prev"]').setAttribute("href",data.prev)}else{noteNav.querySelector('.nav-previous').classList.add("no-link")}
if(data.next){noteNav.querySelector('[data-nav="next"]').setAttribute("href",data.next)}else{noteNav.querySelector('.nav-next').classList.add("no-link")}}).catch(e=>console.error(e))}}
function IframeHeightFitFContent(){const offset=40;document.querySelectorAll("#cuerpo iframe").forEach(el=>{el.onload=function(){let iframe=this;if(!this.getAttribute('data-elemete')){const resizeObserver=new ResizeObserver((entries)=>{const{contentRect}=entries[0];if(contentRect.height!=0&&(iframe.heightChange==undefined||iframe.heightChange<contentRect.height)){iframe.heightChange=contentRect.height;console.log({"state":"change",contentRect});iframe.style.height=(contentRect.height+offset)+"px"}});resizeObserver.observe(iframe.contentWindow.document.body)}}})}
function remplaceIframeSocial(){const iframesSocial=document.querySelectorAll('#cuerpo iframe[src*="Frame.php"]');iframesSocial.forEach(iframe=>{if(iframe.src.indexOf(PHPResponse.AppDomain)==-1){return};let parent=iframe.parentNode.parentNode;let newDiv=document.createElement("div");newDiv.classList.add("clearfix");parent.insertBefore(newDiv,iframe.parentNode);let url=iframe.src;iframe.src="";iframe.remove();fetch(url).then(response=>response.text()).then(html=>{let temp=document.createElement("div");temp.innerHTML=html
for(let child of temp.children){if(child.tagName=='SCRIPT'){child.removeAttribute("async");let script=document.createElement("script");Object.keys(child.attributes).forEach(i=>{let attribute=child.attributes[i];script.setAttribute(attribute.name,attribute.value)});newDiv.appendChild(script);if(!script.src){let f=new Function(script.textContent);f()}}else{newDiv.appendChild(child.cloneNode(!0))}}
let cuerpo=document.getElementById("cuerpo");let style=cuerpo.getAttribute("style");if(!cuerpo.classList.contains("oculto")&&style&&style.includes("height")){cuerpo.style.height="auto"}})})};function Paywall(){if(typeof SDPW!="undefined"){paywall=new SDPW();paywall.init()}}
window.addEventListener("resize",function(){let gallerys=document.querySelectorAll('.carousel');let column=document.querySelector('[data-form="width-gallery-usage"]');for(let i=0;i<gallerys.length;i++){let width,heigth;let ratioElement=gallerys[i].querySelector('[data-form="ratio"]');let ratio=ratioElement.getAttribute('data-ratio');width=column.offsetWidth;heigth=(width/ratio);let audioDivs=gallerys[i].getElementsByClassName("audio-galery-classic");let videoDivs=gallerys[i].getElementsByClassName("video-galery-classic");let pollDivs=gallerys[i].getElementsByClassName("poll-galery-classic");for(let j=0;j<audioDivs.length;j++){audioDivs[j].style.height=heigth+"px"}
for(let j=0;j<pollDivs.length;j++){pollDivs[j].style.height=heigth+"px";pollDivs[j].style.width=width+"px"}
for(let j=0;j<videoDivs.length;j++){videoDivs[j].querySelector('[data-form="iframe"]').style.height=heigth+"px"}}})