function emptyvalidation(entered, alertbox)
{

	with (entered)
	{
		if (value==null || value=="")
		{
			if (alertbox!="") 
			{
				alert(alertbox);
			}
			
			return false;
		}
		else 
		{
			return true;
		}
	}
}



function validate_correo(field,alerttxt){
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

function formvalidation(thisform){   
    with (thisform)
    {   if (emptyvalidation(nombreCont,"Escribe tu nombre")==false) {nombreCont.focus(); return false;}
        if (emptyvalidation(correoCont,"Escribe tu correo")==false) {correoCont.focus(); return false;}
        if (emptyvalidation(telefonoCont,"Escribe tu Teléfono")==false) {telefonoCont.focus(); return false;}
        if (emptyvalidation(mensajeCont,"Escribe un mensaje")==false) {mensajeCont.focus(); return false;}
        if (validate_correo(correoCont,"Tu correo no es válido")==false) {correoCont.focus();return false;}
    }
}

