<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place

//-->
function numbersonly(myfield, e, dec)
{
	var key;
	var keychar;
	
	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);
	
	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
	   return true;
	
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	   return true;
	
	// decimal point jump
	else if (dec && (keychar == "."))
	   {
	   myfield.form.elements[dec].focus();
	   return false;
	   }
	else
	   return false;
}

function IsValidDate(Day,Mn,Yr){
    var DateVal = Mn + "/" + Day + "/" + Yr;
    var dt = new Date(DateVal);

    if(dt.getDate()!=Day){
        //alert('Invalid Date');
        return(false);
        }
    else if(dt.getMonth()!=Mn-1){
    //this is for the purpose JavaScript starts the month from 0
        //alert('Invalid Date');
        return(false);
        }
    else if(dt.getFullYear()!=Yr){
        //alert('Invalid Date');
        return(false);
        }
        
    return(true);
 }
 
/* function escorreo(campo,correo){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(correo)){ 
		return true;
	} else {
	 alert(correo + "  no es una dirección de correo");
	 eval("document.formulario." + campo + ".focus()");
	 eval("document.formulario." + campo + ".value = ''");
	}
	return false;
}
*/

function escorreo(formulario, campo, correo) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(correo)) {
        return true;
    } else {
        alert(correo + "  no es una dirección de correo");
        eval("document." + formulario + "." + campo + ".focus()");
        eval("document." + formulario + "." + campo + ".value = ''");
    }
    return false;
}

//function validartexto(campo,cadena, longitud){
//	if (cadena.length > longitud){
//		alert("Este campo como máximo es de: " + longitud + " carácteres.");
//		eval("document.formulario." + campo + ".value = cadena.substring(0, longitud)");
//		eval("document.formulario." + campo + ".focus()");
//	}
//}


function validartexto(myfield,longitud){
	if (myfield.value.length > longitud){
		alert("Este campo como máximo es de: " + longitud + " carácteres.");
		eval("myfield.value = myfield.substring(0, longitud)");
		myfield.focus();
	}
}