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_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.nacionalidad.value)==""){
   alert("ˇDebe ingresar Nacionalidad!");
   form1.nacionalidad.focus();
	return (false);
 }else
 var charpos = form1.nacionalidad.value.search("[^A-Za-z]"&[ ]); 
	if(form1.nacionalidad.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar una Nacionalidad válido"); 
		form1.nacionalidad.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.profesion.value)==""){
   alert("ˇDebe ingresar Profesion!");
   form1.profesion.focus();
	return (false);
 }else
 var charpos = form1.profesion.value.search("[^A-Za-z]"&[ ]); 
	if(form1.profesion.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar una Profesion válido"); 
		form1.profesion.focus();
		return false; 
	}	
	
 else if(Trim(form1.org_razonsocial.value)==""){
   alert("ˇDebe ingresar Razón Social!");
   form1.org_razonsocial.focus();
	return (false);
 }else
 var charpos = form1.org_razonsocial.value.search("[^A-Za-z]"&[ ]); 
	if(form1.org_razonsocial.value.length > 0 &&  charpos >= 0) { 
		alert("Debe ingresar una Razón Social válido"); 
		form1.org_razonsocial.focus();
		return false; 
	}			
txt=document.form1.email1.value;
if (txt.indexOf("@")<3){
alert("ˇDebe ingresar su e-mail!. Por favor, "
+" comprueba el prefijo y el signo '@'.");
document.form1.email1.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");

var inscripcion = '';
    inscripcion = '&paterno='   	 + $F('ape_pat')        + 
				  '&materno='  	     + $F('ape_mat')        + 
	              '&nombre='    	 + $F('nombre')         + 
				  '&nacionalidad='   + $F('nacionalidad')   + 
				  '&dni='    		 + $F('dni')     	    +
				  '&profesion='   	 + $F('profesion')      +
				  '&telefijo='     	 + $F('tel_fijo')       +
				  '&telecelular='	 + $F('tel_celular')    +
				  '&emaildatos='	 + $F('email1')         +
				  '&razonsocial='	 + $F('org_razonsocial')+
				  '&direccion='	 	 + $F('org_direccion')  +
				  '&pais='			 + $F('org_pais')       +
				  '&telefijoorg='	 + $F('org_telfijo')    +
				  '&telefaxorg='	 + $F('org_telfax')     +
				  '&emailorg='	 	 + $F('email2')         +
				  '&cargoorg='	 	 + $F('org_cargo')
	
	
	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)	 

}