// JavaScript Document
////////// Guarda Registro /////////////////////////////////////////////////////////////////////////
	function Envia_Contacto() {
		var f=document.formac;
       
		
				if( document.getElementById('apellidop').value=="")
				  {
				  alert('Capture el apellido paterno');
				  document.getElementById('apellidop').focus();
				   return false;
				  }
				if( document.getElementById('nombre').value=="")
				  {
				  alert('Capture el nombre');
				  document.getElementById('nombre').focus();
				   return false;
				  }
				if(document.getElementById('correo_del_cto').value=="")
				  {
				  alert('Escriba su cuenta de correo electronico.');
				  document.getElementById('correo_del_cto').focus();
				return false;
				  }
				if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('correo_del_cto').value)))
                     {
                        alert("La dirección de email es incorrecta.");
                         document.getElementById('correo_del_cto').focus();
						 return false;
                     }
				
				
				  
				if(document.getElementById('content_of_msj').value=="")
				  {
				  alert('Escriba el mensaje.');
				  document.getElementById('content_of_msj').focus();
				  return false;
				  }
				
				
			    
				/*
				  http.open('get', url);
				  http.onreadystatechange = respuestaEnvio_Contacto;
				  http.send(null);
				 */
				            var url='../envia_contacto.php';
					        var valpars='apellidop='+document.getElementById('apellidop').value+'&apellidom='+document.getElementById('apellidom').value+'&nombre='+document.getElementById('nombre').value+'&correo_del_cto='+f.correo_del_cto.value+'&nssocurp='+document.getElementById('nssocurp').value+'&content_of_msj='+f.content_of_msj.value;
					        //alert(valpars);
							 //metodo POST
					        http.open('POST',url,true);
					        http.onreadystatechange = respuestaEnvio_Contacto;
					        http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
					        http.send(valpars);
         	
	}
	/////////////////////////////////////////////////////////////////////////////
	
	/////////////////////////////////////////////////////////////////////////
	
	function LimpiarForma(){
	document.getElementById('apellidop').value='';
	document.getElementById('apellidom').value='';
	document.getElementById('nombre').value='';		
	document.getElementById('correo_del_cto').value='';
	document.getElementById('content_of_msj').value='';
	document.getElementById('apellidop').focus();
	}
////////////////////////////////////////////////////////////////////////////
///////////////////FUNCION RECIBE RESPUESTA DEL GUARDA REGISTRO/////////////
function respuestaEnvio_Contacto()
	{
		if(http.readyState == 4)
		     {
			   if(http.status==200)
					{
			          var response = http.responseText;
			          if(response==1) 
					      {
				            alert('Correo Enviado.');
				            LimpiarForma();
							
			              }
			       else if(response==0)
				          {
			               alert('Ha ocurrido un error.');
			               LimpiarForma();
			             }
		          }
			 }
	}
