<!--
// All JavaScripts contained herein are
// Copyright 2001-2003 MejorAmor.com
// All rights reserved.
// Commercial distribution or modification prohibited without
// express written permission.

/*
Autor: Oscar Salazar Romero
Fecha: 03/26/2007
Nombre Funcion: FormValid_CheckBoxChangeStatus

Descripcion:

	Esta función nos ayuda a seleccionar todos los CheckBox de una colección.

Nota importante:

	Esta función utliza el método de recorrido de elementos para reconocer los CheckBox, esto se debe a
	que el nombre del ChckBox puede estar escrito como Nombre[], entonces, para siportar cualquier caso
	lo hacemos de esta manera.

	Siempre deberemos saber los índices exactos para este tipo de campos cuando deseamos limitarlos.
	
Parámetros

	strFormName			= Nombre de la forma donde se encuentra el cechbox
		
	strCheckBoxName		= Nombre del checkbox que se quiere afectar
	
	blnCheckedStatus	= Status deseado para checked, es decir, si queremos seleccionados o sin selección el checkbox
	
*/
function str_fnFormValid_Email(strEmail, strEmailConfirm, blnConfirmField)
{
	var strError = "";
	var strErrorLocal = "";
	var blnEmailValid = "";
	
	var intAtLoc = 0;
	var intDotLoc = 0;
	var intLenEmail = 0;
	var intAts = 0;
	
	// Revisar el e-mail
	if (strEmail != "")
	{
		intAtLoc = strEmail.indexOf('@');
		intDotLoc = strEmail.indexOf('.');
		intLenEmail = strEmail.length;
		intAts = strEmail.lastIndexOf('@');
		
		strErrorLocal = "Email '" + strEmail + "' is not a valid email";
		
		if (intAtLoc != intAts)
			intAts = 2;
		else
			intAts = 1;
		
		if ((intAtLoc <= 0) || (intAtLoc >= intLenEmail) || (intDotLoc <= 0) || (intDotLoc >= intLenEmail) || (intAtLoc == (intDotLoc+1)) || (intDotLoc == (intAtLoc+1)) || (intAts > 1))
			strError = strErrorLocal + ". An example of a valid email is: jose@hotmail.com";
		
		else if ((strEmail.toLowerCase() == "account@domain.subdomain"))
			strError = strErrorLocal + ". Please write your personal email.";
			
		else if (strEmail.indexOf(' ') >= 0)
			strError = strErrorLocal + " because it has blank spaces.";
			
		else if (strEmail.indexOf(',') >= 0)
			strError = strErrorLocal + " because it has commas.";
			
		else if (strEmail.match("www."))
			strError = strErrorLocal + " because it has the string 'www.'";
		
		else if (strEmail.match("@mejoramor.com"))
			strError = strErrorLocal + ". Please write your personal email.";
			
		else if (strEmail.match("@hotmail.com.mx"))
			strError = strErrorLocal + ". The domain hotmail.com.mx is not valid.";
			
		else if (strEmail.match("@hotmeil.com"))
			strError = strErrorLocal + ". The domain hotmeil.com is not valid.";
			
		else if (strEmail.match("@homail.com"))
			strError = strErrorLocal + ". The domain homail.com is not valid.";
			
		else if (strEmail.match("@hotamil.com"))
			strError = strErrorLocal + ". The domain hotamil.com is not valid.";
			
		else if (strEmail.match("@hotamil.com"))
			strError = strErrorLocal + ". The domain hotamil.com is not valid.";
			
		else if (strEmail.match("@hotmal.com"))
			strError = strErrorLocal + ". The domain hotmal.com is not valid.";
			
		else if (strEmail.match("@holmail.com"))
			strError = strErrorLocal + ". The domain holmail.com is not valid.";
			
		else if (strEmail.match("@hotmil.com"))
			strError = strErrorLocal + ". The domain hotmil.com is not valid.";
			
		else if (strEmail.match("@htomail.com"))
			strError = strErrorLocal + ". The domain htomail.com is not valid.";
			
		else if (strEmail.match("@hotml.com"))
			strError = strErrorLocal + ". The domain hotml.com is not valid.";
			
		else if (strEmail.match("@hotamail.com"))
			strError = strErrorLocal + ". The domain hotamail.com is not valid.";
			
		else if (strEmail.match("@yaho.com"))
			strError = strErrorLocal + ". The domain yaho.com is not valid.";
			
		else if (strEmail.match("@jahoo.com"))
			strError = strErrorLocal + ". The domain jahoo.com is not valid.";
			
		else if (strEmail.match("@yajoo.com"))
			strError = strErrorLocal + ". The domain yajoo.com is not valid.";
			
		else if (strEmail.match("@yahho.com"))
			strError = strErrorLocal + ". The domain yahho.com is not valid.";
			
		else if (strEmail.match("@yiahu.com"))
			strError = strErrorLocal + ". The domain yiahu.com is not valid.";
		
		else if (strEmail.match("@hayoo.com"))
			strError = strErrorLocal + ". The domain hayoo.com is not valid.";
			
		else if (strEmail.match("@hayoo.com"))
			strError = strErrorLocal + ". The domain hayoo.com is not valid.";

		else if (strEmail.match("@siempregente.com"))
			strError = strErrorLocal + ". SiempreGente no provee el servicio de correo electrónico público.";
	}
	else
	{
		if (blnConfirmField == true)
		{
			strError = "Email and Confirm Email cannot be blank."
		}
		else
		{
			strError = "Email cannot be blank."
		}
	}
	
	if (strError == "")
	{
		// Revisar el campo de confirmar e-mail
		if (blnConfirmField == false)
		{
			strEmail = strEmailConfirm;
		}
		
		if (strEmail != strEmailConfirm)
		{
			strError = "Email and Confirm Email are different.";
		}
	}
	
	return strError;
}

function str_fnFormValid_Email_es(strEmail, strEmailConfirm, blnConfirmField)
{
	var strError = "";
	var strErrorLocal = "";
	var blnEmailValid = "";
	
	var intAtLoc = 0;
	var intDotLoc = 0;
	var intLenEmail = 0;
	var intAts = 0;
	
	if (strEmail != "")
	{
		intAtLoc = strEmail.indexOf('@');
		intDotLoc = strEmail.indexOf('.');
		intLenEmail = strEmail.length;
		intAts = strEmail.lastIndexOf('@');
		
		strErrorLocal = "Email '" + strEmail + "' es inválido";
		
		if (intAtLoc != intAts)
			intAts = 2;
		else
			intAts = 1;
		
		if ((intAtLoc <= 0) || (intAtLoc >= intLenEmail) || (intDotLoc <= 0) || (intDotLoc >= intLenEmail) || (intAtLoc == (intDotLoc+1)) || (intDotLoc == (intAtLoc+1)) || (intAts > 1))
			strError = strErrorLocal + ". Un ejemplo de email válido es: jose@hotmail.com";
		
		else if ((strEmail.toLowerCase() == "account@domain.subdomain"))
			strError = strErrorLocal + ". Por favor escribe tu propio emial.";
			
		else if (strEmail.indexOf(' ') >= 0)
			strError = strErrorLocal + " por que contiene espacios en blanco.";
			
		else if (strEmail.indexOf(',') >= 0)
			strError = strErrorLocal + " por que contiene comas.";
			
		else if (strEmail.match("www."))
			strError = strErrorLocal + " por que contiene la cadena 'www.'";
		
		else if (strEmail.match("@mejoramor.com"))
			strError = strErrorLocal + " por favor escribe tu propio emial.";
			
		else if (strEmail.match("@hotmail.com.mx"))
			strError = strErrorLocal + ". El dominio hotmail.com.mx is not valid.";
			
		else if (strEmail.match("@hotmeil.com"))
			strError = strErrorLocal + ". El dominio hotmeil.com es inválido.";
			
		else if (strEmail.match("@homail.com"))
			strError = strErrorLocal + ". El dominio homail.com es inválido.";
			
		else if (strEmail.match("@hotamil.com"))
			strError = strErrorLocal + ". El dominio hotamil.com es inválido.";
			
		else if (strEmail.match("@hotamil.com"))
			strError = strErrorLocal + ". El dominio hotamil.com es inválido.";
			
		else if (strEmail.match("@hotmal.com"))
			strError = strErrorLocal + ". El dominio hotmal.com es inválido.";
			
		else if (strEmail.match("@holmail.com"))
			strError = strErrorLocal + ". El dominio holmail.com es inválido.";
			
		else if (strEmail.match("@hotmil.com"))
			strError = strErrorLocal + ". El dominio hotmil.com es inválido.";
			
		else if (strEmail.match("@htomail.com"))
			strError = strErrorLocal + ". El dominio htomail.com es inválido.";
			
		else if (strEmail.match("@hotml.com"))
			strError = strErrorLocal + ". El dominio hotml.com es inválido.";
			
		else if (strEmail.match("@hotamail.com"))
			strError = strErrorLocal + ". El dominio hotamail.com es inválido.";
			
		else if (strEmail.match("@yaho.com"))
			strError = strErrorLocal + ". El dominio yaho.com es inválido.";
			
		else if (strEmail.match("@jahoo.com"))
			strError = strErrorLocal + ". El dominio jahoo.com es inválido.";
			
		else if (strEmail.match("@yajoo.com"))
			strError = strErrorLocal + ". El dominio yajoo.com es inválido.";
			
		else if (strEmail.match("@yahho.com"))
			strError = strErrorLocal + ". El dominio yahho.com es inválido.";
			
		else if (strEmail.match("@yiahu.com"))
			strError = strErrorLocal + ". The domain yiahu.com es inválido.";
		
		else if (strEmail.match("@hayoo.com"))
			strError = strErrorLocal + ". El dominio hayoo.com es inválido.";
			
		else if (strEmail.match("@hayoo.com"))
			strError = strErrorLocal + ". El dominio hayoo.com es inválido.";
			
		else if (strEmail.match("@siempregente.com"))
			strError = strErrorLocal + ". SiempreGente no provee el servicio de correo electrónico público.";			
	}
	else
	{
		if (blnConfirmField == true)
		{
			strError = "Email y Confirmar Email no pueden estar en blanco."
		}
		else
		{
			strError = "Email no puede estar en blanco."
		}
	}
	
	if (strError == "")
	{		
		// Revisar el campo de confirmar e-mail
		if (blnConfirmField == false)
		{
			strEmail = strEmailConfirm;
		}
		
		if (strEmail != strEmailConfirm)
		{
			strError = "Email y Confirmar Email son diferentes.";
		}
	}
	
	return strError;
}
//-->