

var summitea = 'LOG';

function valorSubmit(valor)
{
	summitea = valor;
}

function error()
{
if (document.forms[0].error.value != "") 
	{
	alert(document.forms[0].error.value);
	window.location = "/index.asp";
	}
}

// Validación del login
function ValidarLogin()
{   
	if (document.forms[0].LOGUSU.value == "" || document.forms[0].LOGPAS.value == "")
	{ 
		alert("Rellene Usuario y Contraseña.");
		return;
	}
	else
	{
		document.forms[0].action = "/Principal.asp";
		document.forms[0].submit();			
	}
}

function buscar()
{	
if (document.forms[0].comando[2].checked)
	buscarEmp();
else
	buscarSol();
}

function buscarSol()
{		
var bTipoSolicitud = window.document.forms[0].bTipoSolicitud.value;
window.document.forms[0].pagina.value = 1;
window.document.forms[0].action = "/Buscador.asp";		
window.document.forms[0].submit();
}

function buscarEmp()
{		
window.document.forms[0].action = "/LstEmpresasPbl.asp";		
window.document.forms[0].submit();
}

/**
* funcion de captura de pulsación de tecla en Internet Explorer
*/ 
var tecla;
function capturaTecla(e) 
{
if(document.all)
	tecla=event.keyCode;
else
{
	tecla=e.which; 
}
if(tecla==13)
	{
	switch (summitea)
		{
		case 'LOG':
		ValidarLogin();
		break;
		case 'BUS':
		buscar();
		break;
		case 'CAT':
		Activar();
		break;
		}
	}
}

function VerificaInfo() {
    if( checkField( document.forms[0].INFCON, isDescription, false) &&
        checkField( document.forms[0].INFEMP, isDescription, false) &&
        checkField( document.forms[0].INFPOB, isDescription, false) &&
        checkField( document.forms[0].INFTEL, isDescription, false) &&
        checkField( document.forms[0].INFFAX, isDescription, true) &&
        checkField( document.forms[0].INFMAI, isEmail, false) &&
        checkField( document.forms[0].INFTXT, isDescription, false))
        return true;
	else
	    return false;
}

function VerificaInfo_Pbl() {
    if( checkField( document.forms[0].INFCON, isDescription, false) &&
        checkField( document.forms[0].INFPOB, isDescription, false) &&
        checkField( document.forms[0].INFMAI, isEmail, false) &&
        checkField( document.forms[0].INFTXT, isDescription, false))
        return true;
	else
	    return false;
}

//Comprueba q se ha chekeado en LPDCP (Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal)
function VerificaLPDCPInfo() {
	if (!document.forms[0].LPDCP.checked)
	{
		alert('Para poder registrarse debe aceptar la política de privacidad de datos de OchoaNegocio marcando la casilla correspondiente.');
		document.forms[0].LPDCP.focus();
	    return false;
	}
	else
		return true;
}

function validaInfo()
{
if (VerificaInfo()) 
	{
	if (VerificaLPDCPInfo())
		{
		document.FrmPrincipal.action = 'contacto.asp';
		document.FrmPrincipal.submit();
		}
	}
}

function validaInfo_Pbl()
{
if (VerificaInfo_Pbl()) 
	{
	if (VerificaLPDCPInfo())
		{
		document.FrmPrincipal.action = 'contacto_pbl.asp';
		document.FrmPrincipal.submit();
		}
	}
}

document.onkeydown = capturaTecla;
