﻿temp_idu=1; function abrir()
{ var nueva = window.open("gestion/condiciones.aspx","Disclamer","width=600,height=400,toolbar=no,menubar=no,status=yes,scrollbars=yes, top=25, left=25, location=no,resizable=yes");}
function Registrate()
{ document.location.href="default.aspx";}
function get_pos_X(element) { var current_left = 0; if (element.offsetParent) { while (element.offsetParent) { current_left += element.offsetLeft
element = element.offsetParent;}
} else if (element.x)
current_left += element.x; return current_left ;}
function get_pos_Y(element) { var current_top = 0; if (element.offsetParent) { while (element.offsetParent) { current_top += element.offsetTop
element = element.offsetParent;}
} else if (element.y)
current_top += element.y; return current_top;}
function ErrorMensaje(origen,capa)
{ var textbox = document.getElementById(origen); var selectbox = document.getElementById(capa); selectbox.style.display = ''; selectbox.style.position = 'absolute'; selectbox.style.left = get_pos_X(textbox) + document.getElementById(origen).offsetWidth +10 + 'px'; selectbox.style.top = (get_pos_Y(textbox) ) + 'px'; selectbox.style.display='inline';}
function ERRORusupass()
{ var textbox = document.getElementById("txtUsuarioRegistrado"); var selectbox = document.getElementById("diverrRegUP"); selectbox.style.left = get_pos_X(textbox) -120 + 'px'; selectbox.style.top = (get_pos_Y(textbox) +38) + 'px'; selectbox.style.position = 'absolute'; selectbox.style.display='inline';}
var validarformulariocount=0; function validarformulario()
{ document.getElementById("diverrU").style.display="none"; document.getElementById("diverrUBlanco").style.display="none"; document.getElementById("diverrUEx").style.display="none"; document.getElementById("diverrC").style.display="none"; document.getElementById("diverrCBlanco").style.display="none"; document.getElementById("diverrCIgual").style.display="none"; document.getElementById("diverrEEx").style.display="none"; document.getElementById("diverrE2").style.display="none"; document.getElementById("diverrE3").style.display="none"; document.getElementById("diverrA").style.display="none"; document.getElementById("diverrSex").style.display="none"; document.getElementById("diverrGenerico").style.display="none"; var ok=""; if(document.getElementById("dlSexo").value=="")
ErrorMensaje("dlSexo","diverrSex"); if(trimjs(document.getElementById("txtUsuario").value) =="" || trimjs(document.getElementById("txtUsuario").value).length<3 || trimjs(document.getElementById("txtUsuario").value).length>21)
ErrorMensaje("txtUsuario","diverrU"); else
{ if(trimjs(document.getElementById("txtUsuario").value).indexOf(" ")>=0)
ErrorMensaje("txtUsuario","diverrUBlanco");}
if(trimjs(document.getElementById("txtPassword").value) =="" || trimjs(document.getElementById("txtPassword").value).length<3 || trimjs(document.getElementById("txtPassword").value).length>21)
ErrorMensaje("txtPassword","diverrC"); else
{ if(trimjs(document.getElementById("txtUsuario").value) == trimjs(document.getElementById("txtPassword").value))
ErrorMensaje("txtUsuario","diverrCIgual"); else
{ if(trimjs(document.getElementById("txtPassword").value).indexOf(" ")>=0)
ErrorMensaje("txtPassword","diverrCBlanco");}
}
if(trimjs(document.getElementById("txtEmail").value).length<3 || trimjs(document.getElementById("txtEmail").value).length>40)
ErrorMensaje("txtEmail","diverrE"); else
{ if(echeck(trimjs(document.getElementById("txtEmail").value))==false)
ErrorMensaje("txtEmail","diverrE3");}
validarformulariocount++; if(validarformulariocount>20)
return; if(document.getElementById("cAcepto").checked == false)
ErrorMensaje("div_diverrA","diverrA"); else document.getElementById("diverrA").style.display="none"; if(document.getElementById("diverrU").style.display=="none"
&& document.getElementById("diverrUBlanco").style.display=="none"
&& document.getElementById("diverrUEx").style.display=="none"
&& document.getElementById("diverrC").style.display=="none"
&& document.getElementById("diverrCBlanco").style.display=="none"
&& document.getElementById("diverrCIgual").style.display=="none"
&& document.getElementById("diverrEEx").style.display=="none"
&& document.getElementById("diverrE2").style.display=="none"
&& document.getElementById("diverrE3").style.display=="none"
&& document.getElementById("diverrA").style.display=="none"
&& document.getElementById("diverrSex").style.display=="none"
&& document.getElementById("diverrGenerico").style.display=="none"
)
ejecutafaIni();}
function subRestringe(txtCampo){ var intTecla = event.keyCode; var sLetra = String.fromCharCode(intTecla).toUpperCase(); var sPermitidos = "0123456789.-+ABCDEFGHIJKLMNÑOPQRSTUVWXYZ_"; if(sPermitidos.indexOf(sLetra) == -1)event.keyCode = 0; return;}
function echeck(str) { var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){return false}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false}
if (str.indexOf(at,(lat+1))!=-1){return false}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false}
if (str.indexOf(dot,(lat+2))==-1){return false}
if (str.indexOf(" ")!=-1){return false}
var sM = str.substring(lat+1,ldot); if (sM=="ahoo" || sM=="yaho" || sM=="hotma" || sM=="gmai" || sM=="gmil" || sM=="gail" || sM=="otmai" || sM=="htmail" || sM=="homail" || sM=="hotail" || sM=="hotmil" || sM=="hotmal" || sM=="hotmai" )
{ return false;}
return true;}
function trimjs(texto){ if (texto.length == 1 && texto.charCodeAt(0) == 160) texto = ''; texto = texto.replace (/^\s*/,'').replace(/\s*$/,'').replace(" ",""); return(texto);}
function CarProhibidos()
{ var intTecla = event.keyCode; var sLetra = String.fromCharCode(intTecla).toUpperCase(); var sNoPermitidos = "&¿?#·|'%*<>\""; if(sNoPermitidos.indexOf(sLetra) != -1)
return false;}
function reloadtodo()
{ document.location.reload();}
function ver_tooltip(e,sCAB,sMENSAJE)
{ var s; var alto; alto = ((sMENSAJE.length*15)/50)+30; alto=5; var ancho =260; s = "<div><table class='tooltip'  width='200px' border=0 cellspacing=6 cellpadding=0 bordercolor='#000000' bgcolor='#FFFF66'><tr><td>"; s+= "<font style='font:Courier New' color='#000000'>"; s+= "<u>" + sCAB + "</u><br>"; s+= sMENSAJE; s+= "</font></td></tr></table></div>"; document.getElementById("divtooltip").innerHTML = s; var x; var y; if (window.ActiveXObject)
{ x= window.event.x; y= window.event.y+10;}
else
{ x = (window.event) ? window.event.pageX : e.clientX; y = (window.event) ? window.event.pageY : e.clientY;}
var z = window.document.getElementById("divtooltip").style; if(x + 300 >= ancho + e.left )
x = x - 300; if(y > (alto - 20))
y = y - alto; else
y = y + 16; document.getElementById("divtooltip").style.top = y; document.getElementById("divtooltip").style.left = x;}
function oculta_tooltip()
{ document.getElementById("divtooltip").innerHTML = "";}
function ejecutafaIni()
{ document.getElementById("mdivMsgProceso").style.display="inline"; setTimeout(faIni,60);}
function faIni()
{ temprespuesta=""; var xG= GeneraXml("ALTAUSUS","<U><![CDATA["+document.getElementById("txtUsuario").value+"]]></U><P><![CDATA["+document.getElementById("txtPassword").value+"]]></P><S><![CDATA["+document.getElementById("dlSexo").value+"]]></S><M><![CDATA["+document.getElementById("txtEmail").value+"]]></M>"); LoadXml_Url("gestion/procesa.aspx",xG,faFIN);}
function faFIN(xmlhttp)
{ if (xmlhttp.readyState==4)
{ if (xmlhttp.status==200)
{ if(xmlhttp.responseText.indexOf("Error")<0)
{ document.location.href = xmlhttp.responseText;}
else
{ eval(xmlhttp.responseText); document.getElementById("mdivMsgProceso").style.display="none";}
}
}
}
function GeneraXml(OP,CAMPOS)
{ var sXml; sXml="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"; sXml+="	<DATOS><CABECERA><OPE>" + OP + "</OPE></CABECERA><RESPUESTA><ROW>"+CAMPOS+"</ROW></RESPUESTA></DATOS>"; return sXml;}
function LoadXml_Url(surl,sxml,sFuncionF)
{ var xmlhttp; xmlhttp=null; if (window.XMLHttpRequest)
{ xmlhttp=new XMLHttpRequest();}
else if (window.ActiveXObject)
{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
if (xmlhttp!=null)
{ xmlhttp.onreadystatechange=function() {sFuncionF(xmlhttp)}
xmlhttp.open("POST",surl,true); xmlhttp.send(sxml); return xmlhttp.responseXML;}
else
{ alert("Your browser does not support XMLHTTP.");}
}
