// JavaScript Document

//funcion para abrir el formato de inscripción de usuarios
function registro() {
//var page = ".../popup/popup.php";
var page = "popup/registro.php";
windowprops = "height=410,width=410,location=no,"
+ "scrollbars=no,menubars=no,toolbars=no,resizable=no";

window.open(page, "Popup", windowprops);
}
/*
funcion para abrir el formato de inscripción de usuarios invocando a otro dominio
function registro() {
//var page = ".../popup/popup.php";
var page = "http://www.yamaha-motocentrosa.com/popup/registro.php";
windowprops = "height=410,width=410,location=no,"
+ "scrollbars=no,menubars=no,toolbars=no,resizable=no";

window.open(page, "Popup", windowprops);
}
*/


//funcion para abrir el formato de inscripción de usuarios
  function es_email_contacto()
	{
		if(document.formulario.email.value.indexOf("@") != "-1" && 
		   document.formulario.email.value.indexOf(".") != "-1" &&
		   document.formulario.email.value != " ")
			return true;
		else
			return false; 
	} 
	
	
 function valido()
 {
	
	
	with(document.formulario)
   {
		 if ( nombre.value == "" )
		 {
			alert("Olvidaste el nombre");
			nombre.focus();
			return false;
		}
		
		 if ( apellido.value == "" )
		 {
			alert("Olvidaste el Apellido");
			apellido.focus();
			return false;
		 }
		 
		 if(email.value == "" || !es_email())
		 {		
			alert("Olvidaste el e-mail o es incorrecto");
			email.focus();
			return false;
		 }
		 
		  if ( telefono.value == "" )
		 {
			alert("Olvidaste el teléfono");
			telefono.focus();
			return false;
		 }
		 
		  if ( mensaje.value == "" )
		 {
			alert("Olvidaste el mensaje");
			mennsaje.focus();
			return false;
		 }
		 
		 alert("Se van a enviar tus datos. Este proceso puede tardar unos segundos");
		 return true;
    }
 }
