function validar(div1)
{

if(Trim(document.getElementById('ape_pat').value)=='')
	{
		alert("¡Debe ingresar su Apellido Paterno!");
		document.getElementById('ape_pat').focus();
		return false;		
 	}
 else
 var charpos = document.getElementById('ape_pat').value.search("[^A-Za-z]"&[ ]); 
	if(document.getElementById('ape_pat').value.length > 0 &&  charpos >= 0) 
	{ 
		alert("Debe ingresar un Apellido Paterno válido"); 
		document.getElementById('ape_pat').focus();
		return (false); 
	}
	 
 
 else if(Trim(document.getElementById('ape_mat').value)=='')
	{
		alert("¡Debe ingresar su Apellido Materno!");
		document.getElementById('ape_mat').focus();
		return false;		
 	}
 else
 var charpos = document.getElementById('ape_mat').value.search("[^A-Za-z]"&[ ]); 
	if(document.getElementById('ape_mat').value.length > 0 &&  charpos >= 0) 
	{ 
		alert("Debe ingresar un Apellido Materno válido"); 
		document.getElementById('ape_mat').focus();
		return (false); 
	}

 
 else if(Trim(document.getElementById('nombre').value)=='')
	{
		alert("¡Debe ingresar su(s) Nombre(s)!");
		document.getElementById('nombre').focus();
		return false;		
 	}
 else
 var charpos = document.getElementById('nombre').value.search("[^A-Za-z]"&[ ]); 
	if(document.getElementById('nombre').value.length > 0 &&  charpos >= 0) 
	{ 
		alert("Debe ingresar un Nombre válido"); 
		document.getElementById('nombre').focus();
		return (false); 
	}

 
 else if(Trim(document.form1.dni.value)=="") {
   alert("¡Debe ingresar su DNI!");
   document.form1.dni.focus();
   return (false);
 } 
 else if(document.form1.dni.value.length < 8) {
	alert ("Introduzca un DNI válido");
	document.form1.dni.focus();
	return false;
	}else
	var1 = parseInt(document.form1.dni.value, 8)
	//valida que sean numeros
	var charpos = document.form1.dni.value.search("[^0-9]"); 
    if (document.form1.dni.value.length > 0 && charpos >= 0) { 
    	alert("Debe ingresar un DNI válido"); 
	    document.form1.dni.focus();
	    return false; 
	}
	

else if(Trim(document.form1.telef.value)==""){
   alert("¡Debe ingresar su Teléfono!");
   document.form1.telef.focus();
	return (false);
 }else
 if (document.form1.telef.value.length < 7) {
	alert ("Introduzca un Teléfono válido");
	document.form1.telef.focus();
	return false;
}else
var charpos = document.form1.telef.value.search("[^0-9]"); 
   if (document.form1.telef.value.length > 0 &&  charpos >= 0)  { 
    	alert("Debe ingresar un Teléfono válido"); 
	    document.form1.teléfono.focus();
	    return false; 
	}

txt=document.form1.email.value;
if (txt.indexOf("@")<3){
alert("¡Debe ingresar su e-mail!. Por favor, "
+" comprueba el prefijo y el signo '@'.");
document.form1.email.focus();
return false;
}
if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
&&(txt.indexOf(".gob")<5)&&(txt.indexOf(".net")<5)
&&(txt.indexOf(".pe")<5)&&(txt.indexOf(".es")<5)
&&(txt.indexOf(".mil")<5)&&(txt.indexOf(".edu")<5)){
alert("Lo siento. Pero esa cuenta de correo parece errónea. Por favor,"
+" comprueba el sufijo (que debe incluir alguna terminación como: "
+".com, .es, .edu, .net, .org, ó .gob)");
return false;
   }
//return alert("La dirección es  correcta");
	
	if (!(document.form1.constancia[0].checked)&&!(document.form1.constancia[1].checked))
	{
	alert('¿Desea Constancia de Participación?');
	document.form1.constancia[0].focus();
	return false;
	}


var inscripcion = '';
    inscripcion = '&paterno='   	 + $F('ape_pat')        + 
				  '&materno='  	     + $F('ape_mat')        + 
	              '&nombre='    	 + $F('nombre')         + 
				  '&participante='   + $F('participante')   + 
				  '&num_dni='    	 + $F('dni')     	    +
				  '&telefono='   	 + $F('telef')          +
				  '&email='      	 + $F('email')          +
				  '&empresa='		 + $F('empresa')        +
				  '&cargo='			 + $F('cargo')          +
				  '&constancia='   	 + $F('constancia')     
			
	
	document.getElementById(div1).innerHTML = '<p class="load"><center><br><br>&nbsp;&nbsp;&nbsp;<font face="Verdana" size="2">LOS DATOS ESTAN SIENDO INGRESADOS</font>  <br><br><br><img src=imagenes/tux.png><font face="Verdana" size="1">Cargando Información ..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></font></center></p>';
	function mostrare(){
		if(http.readyState==4){
			var response=http.responseText
			$(div1).innerHTML=response
			return true
		}
	}
	http.open('post','recibe.php?valor=on&time='+new Date().getTime(),true)
	http.onreadystatechange=mostrare
	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")
	http.send(inscripcion)	 

}