function validate_and_submit () {
// 	alert($("#ingreso").get(0).getAttribute('action'));
	ocurrencia = posicion= 0;
	RefString = "1234567890";
	incorrecto=false;
	if ( document.ingreso.userid.value == "" ) {
		document.ingreso.userid.select ();
		document.ingreso.userid.focus ();
		alert ( "Usted no ha ingresado el usuario." );
		return false;
	}
	for (i=0; i<document.ingreso.userid.value.length; i++)	{
		TempChar = document.ingreso.userid.value.substring ( i, i+1 );
		if (  TempChar == "_" ) { ocurrencia++; if (  ocurrencia == 2 ) { posicion=i; } }
	}
	codigo=document.ingreso.userid.value.substring(posicion+1,document.ingreso.userid.value.length);
	for (i=0; i<codigo.length; i++) {
		TempChar = codigo.substring ( i, i+1 );
		if ( RefString.indexOf (TempChar,0) == -1) { incorrecto=true; }
	}
	if ( ocurrencia<2 || ocurrencia >2 || incorrecto) {
		document.ingreso.userid.select ();
		document.ingreso.userid.focus ();
		alert ( "El nombre del usuario no tiene el formato correcto.\n\n Debe ser:\n [PRIMER NOMBRE]_[PRIMER APELLIDO]_[CODIGO AFILIADO].\n\nTiene que estar separado por el guion bajo y el codigo afiliado es un numero proveido por Informconf, tal como se muestra en \"Ayuda para ingreso\". " );
		return false;
	}
	if ( document.ingreso.password.value == "" ) {
		document.ingreso.password.select ();
		document.ingreso.password.focus ();
		alert ( "Usted no ha ingresado la clave." );
		return false;
	}
	return true;
}


