// JavaScript Document

function CheckForm () { 

	var errorMsg = "";
	if (document.frmEnquiry.firstName.value == ""){
		errorMsg += "\n\tNombre \t\t- Por favor ingrese su nombre";	
	}
	if (document.frmEnquiry.lastName.value == ""){
		errorMsg += "\n\tApellido \t\t- Por favor ingrese su apellido";
	}
	
	if (document.frmEnquiry.asunto.value == ""){
		errorMsg += "\n\tAsunto \t\t- Ingrese un tema para su e-mail";
	}
	if ((document.frmEnquiry.email.value == "") || (document.frmEnquiry.email.value.length > 0 && (document.frmEnquiry.email.value.indexOf("@",0) == - 1 || document.frmEnquiry.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail \t\t- Ingrese una dirección válida de correo";
	}
	if (document.frmEnquiry.enquiry.value == "") { 
 		errorMsg += "\n\tComentarios \t- Usted no ha ingresado sus comentarios aún";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Su comentario no ha sido enviado. Hay inconvenientes (s) con el formulario.\n";
		msg += "Por favor revíselo y corrija los campos requeridos.\n";
		msg += "______________________________________________________________\n\n";
		msg += "Los siguientes campos necesitan ser corregidos: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}

function CheckForm2 () { 

	//Initialise variables
	var errorMsg = "";

	//Check for a visitors name
	if (document.frmEnquiry.VisitorsName.value == ""){
		errorMsg += "\nSu Nombre \t\t- Ingrese su Nombre";	
	}
		 	
	//Check for a visitors e-mail address and that it is valid
	if ((document.frmEnquiry.VisitorsEmail.value == "") || (document.frmEnquiry.VisitorsEmail.value.length > 0 && (document.frmEnquiry.VisitorsEmail.value.indexOf("@",0) == - 1 || document.frmEnquiry.VisitorsEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nSu E-mail \t\t\t- Ingrese una dirección válida";
	}
	
	//Check for a friends name
	if (document.frmEnquiry.FriendsName.value == ""){
		errorMsg += "\nDestinatario \t\t- Ingrese el nombre del destinatario";
	}
	
	//Check for a friends e-mail address and that it is valid
	if ((document.frmEnquiry.FriendsEmail.value == "") || (document.frmEnquiry.FriendsEmail.value.length > 0 && (document.frmEnquiry.FriendsEmail.value.indexOf("@",0) == - 1 || document.frmEnquiry.FriendsEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail Destinatario \t\t- Ingrese una dirección válida de destinatario";
	}
	
	//Check for a subject
	if (document.frmEnquiry.Subject.value == ""){
		errorMsg += "\nAsunto \t\t\t- Ingrese el un tema en Asunto, que verá su amigo";
	}
			
	//Check for an message
	if (document.frmEnquiry.message.value == "") { 
 		errorMsg += "\nMensaje \t\t\t- Ingrese el comentario que recibirá su amigo";
	}
		
	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "_________________________________________________________________\n\n";
		msg += "Por favor complete todos los datos\n";
		msg += "e inténtelo nuevamente\n";
		msg += "________________________________________________________________\n\n";
		msg += "Los siguientes campos necesitan ser corregidos: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
// -->
