
function fu_foco()
{
	if (document.layers)
	{
		document.layers["contenido"].document.wsel_auth.usuario.focus();
	}
	else
	{
		document.wsel_auth.usuario.focus();
	}
}

function fu_fococlave()
{
	if (document.layers)
	{
		document.layers["contenido"].document.wsel_auth.contrasenia.focus();
	}
	else
	{
		document.wsel_auth.contrasenia.focus();
	}
}

function fu_focoboton()
{
	if (document.layers)
	{
		document.layers["contenido"].document.wsel_auth.btn_aceptar.focus();
	}
	else
	{
		document.wsel_auth.btn_aceptar.focus();
	}
}

function fu_cambioUsuario(objeto)
{
	if (objeto.value != top.usuario_ant)
	{
		top.usuario_ant = objeto.value;
		top.otro_usuario = true;
	}
	else
		top.otro_usuario = false;
}

function fu_validar()
{  //if1
	if (document.layers)
	{  //if2
		if (document.layers["contenido"].document.wsel_auth.usuario.value.toUpperCase() == "TELONXXX")
		{			
			document.wsel_auth.action= top.destino + "telon/telon.asp";
			document.wsel_auth.submit();
		}
		else
		{ // if3
			if (document.layers["contenido"].document.wsel_auth.htelon.value == "1")
			{
				mensaje="Estamos mejorando <BR>  WWW.CREDISTAR.COM <BR> les rogamos tramiten, temporalmente, <BR> sus operaciones a traves de nuestro Call Center"
				destino = top.destino + "telon/mensajeTelon.asp?mensaje=" + mensaje;
				window.open(destino,"wAviso","menubar=NO, resizable=NO, status=NO, toolbar=NO,height=50, width=20");
			}	
			else
			{ //if4
				if (document.layers["contenido"].document.wsel_auth.usuario.value == "")
				{
					window.alert ("Debe rellenar el campo usuario");
					fu_foco();
				}
				else
				{ //if5
					if (document.layers["contenido"].document.wsel_auth.usuario.value == document.layers["contenido"].document.wsel_auth.contrasenia.value)
					{
						top.primera="SI";
					}
					if (top.otro_usuario)
					{
						document.layers["contenido"].document.wsel_auth.intentos.value = 0;
					}	
					document.layers["contenido"].document.wsel_auth.submit();
				} //5
			} //4
		}	//3
	}	//2
	else
	{ //if2
		if (document.wsel_auth.usuario.value.toUpperCase() == "TELONXXX")
		{			
			document.wsel_auth.action= top.destino + "telon/telon.asp";
			document.wsel_auth.submit();
		}
		else
		{
			if (document.wsel_auth.htelon.value == "1")
			{
				mensaje="Estamos mejorando <BR>  WWW.CREDISTAR.COM <BR> les rogamos tramiten, temporalmente, <BR> sus operaciones a traves de nuestro Call Center"
				destino = top.destino + "telon/mensajeTelon.asp?mensaje=" + mensaje;
				window.open(destino,"wAviso","menubar=NO, resizable=NO, status=NO, toolbar=NO,height=50, width=20");
			}	
			else
			{
				if (document.wsel_auth.usuario.value == "")
				{
					window.alert ("Debe rellenar el campo usuario");
					fu_foco();
				}
				else
				{
//			top.usuario = document.wsel_auth.usuario.value;
					if (document.wsel_auth.usuario.value == document.wsel_auth.contrasenia.value)
					{
						top.primera = "SI";
					}
					if (top.otro_usuario)
					{
						document.wsel_auth.intentos.value = 0;
					}	
					document.wsel_auth.submit();
				}	

			}
		}
	}	
	
}

netscape = "";
ver = navigator.appVersion; 
len = ver.length;

for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;

netscape = (ver.charAt(iln+1).toUpperCase() != "C");

function keyDown(DnEvents) 
{
	k = (netscape) ? DnEvents.which : window.event.keyCode;
	if (k == 13) 
	{
		fu_validar();
		return false;
	}
}

document.onkeydown = keyDown;

if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);

