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); 
}
	 
 /*if(Trim(form1.ape_pat.value)==""){
   alert("¡Debe ingresar su apellido paterno!");
   form1.ape_pat.focus();
	return (false);
 }else
 var charpos = form1.ape_pat.value.search("[^A-Za-z]"&[ ]); 
	if(form1.ape_pat.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar un apellido paterno válido"); 
		form1.ape_pat.focus();
		return (false); 
	}*/
 else if(Trim(form1.ape_mat.value)==""){
   alert("¡Debe ingresar su apellido materno!");
   form1.ape_mat.focus();
	return (false);
 }else
 var charpos = form1.ape_mat.value.search("[^A-Za-z]"&[ ]); 
	if(form1.ape_mat.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar un apellido materno válido"); 
		form1.ape_mat.focus();
		return false; 
	}
 else if(Trim(form1.nombre.value)==""){
   alert("¡Debe ingresar su nombre!");
   form1.nombre.focus();
	return (false);
 }else
 var charpos = form1.nombre.value.search("[^A-Za-z]"&[ ]); 
	if(form1.nombre.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar un nombre válido"); 
		form1.nombre.focus();
		return false; 
	}
 else if(Trim(form1.dni.value)==""){
   alert("¡Debe ingresar su DNI!");
   form1.dni.focus();
	return (false);
 }else
 if (form1.dni.value.length < 8) {
	alert ("Introduzca un DNI válido");
	form1.dni.focus();
	return false;
	}else
	var1 = parseInt(form1.dni.value, 8)
	//valida que sean numeros
	var charpos = form1.dni.value.search("[^0-9]"); 
    if (form1.dni.value.length > 0 &&  charpos >= 0)  { 
    	alert("Debe ingresar un DNI válido"); 
	    form1.dni.focus();
	    return false; 
	}
	
 else if(Trim(form1.telef.value)==""){
   alert("¡Debe ingresar su teléfono!");
   form1.telef.focus();
	return (false);
 }else
 if (form1.telef.value.length < 7) {
	alert ("Introduzca un teléfono válido");
	form1.telef.focus();
	return false;
}else
var charpos = form1.telef.value.search("[^0-9]"); 
   if (form1.telef.value.length > 0 &&  charpos >= 0)  { 
    	alert("Debe ingresar un teléfono válido"); 
	    form1.teléfono.focus();
	    return false; 
	}
/*	
else if(form1.email.value==""){
   alert("¡Debe ingresar su e-mail!");
   form1.email.focus();
	return (false);
 }else
var s = form1.email.value;
var filter=(/^([a-zA-Z0-9\._]+)(@)([a-zA-Z0-9\_]+)(\.)([a-zA-Z0-9\_]{2,3})/;
if (s.length == 0 ) return true;
if (filter.test(s))
return true;
else
alert("Ingrese una dirección de correo válida");
form1.email.focus();
return false;
*/
/*
if(Trim(form1.email.value)==""){
	
 alert("¡Debe ingresar su e-mail!");
   form1.email.focus();
	return (false);
 }else{
var string1=document.getElementById('email').value
	if (string1.indexOf("@")==-1){ 
	alert("El Email introducido no es válido") 
	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, .gov o .mil)");
return false;
   }
//return alert("La dirección es  correcta");
	
	if (!(form1.constancia[0].checked)&&!(form1.constancia[1].checked))
	{
	alert('¿Desea Constancia de Participación?');
	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;LOS DATOS ESTAN SIENDO INGRESADOS  <br><br><br><img src=img/msn.gif><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)	 

}