


<!--


function ValidaNombre(valor,titulo){			
	var text;	
	text = valor;	
	SwError=false;
	//false=No Hay Error, True=Si Hay Error

	if (text.length > 1 ){
		for(var i=0 ;i < text.length; i++){
			var ch = text.substring(i,i+1);
			if (ch < "A" || ch > "Z" ){
				if (ch < "a" || ch > "z" ){				
					if (ch != "Ñ" && ch != "ñ" && ch !="á" && ch !="é" && ch !="í" && ch !="ó" && ch !="ú" && ch !="ü" && ch !=" " && ch !="'") {
						SwError=true;
					}
				}
			}
		}	
	}
	else{
	SwError=true;}
	
	if (SwError){
		alert("Ingresó Incorrectamente " + titulo + ".");
	}	
	return SwError;

}

function ValidaTexto(Valor,Nombre){
	var text;	
	var MsgError;
	var SwError;

	text = Valor;	
	SwError=false;
	MsgError="";
	//false=No Hay Error, True=Si Hay Error

	if (text.length > 1 ){
		for(var i=0 ;i < text.length; i++){
			var ch = text.substring(i,i+1);
			if (ch=="'") {
				SwError=true;
				MsgError="Ingresó Incorrectamente " + Nombre + ". No se acepta Apóstrofe. Por favor Ingrese " + Nombre + " nuevamente.";
				break;
			}
		}	
	}
	else{
		MsgError="Ingresó Incorrectamente " + Nombre + ". Al menos debe ingresar 3 caracteres. Por favor Ingrese " + Nombre + " nuevamente.";
		SwError=true;
	}
	if (SwError){alert(MsgError);}
	return SwError;
}

function ValidaEMail(email,titulo){
	var SwError;
	var MsgError;
	
	SwError=true;
	MsgError= "Ingresó incorrectamente EMail. Por favor ingrese nuevamente." ;
	at=0;
	ats=0;	
	dot=0;
	elen = email.length;
	
	for (i=0; i<=elen; i++)
	{	if (email.charAt(i)=="@")	{ats++; 	at = i;}
		if (email.charAt(i)==".")	{dot = i;}
		if (email.charAt(i)==" ")	{SwError=false;}
	}
	if ( at>0 && ats==1 && dot-1>at && (dot+3==elen || dot+4==elen)){
		SwError=false;
	}

	if (SwError) alert(MsgError);
	return SwError;
}
 
function ValidaCampo(Objeto,Nombre,Valor,Requerido,Tipo){
	//False=No Hay Error
	//True =Si Hay Error
	
	SwError=true;
	if (Valor!=""){
			switch(Tipo){
				case "Nombre":
					SwError= ValidaNombre(Valor,Nombre);
					break;

				case "Texto":	
					SwError= ValidaTexto(Valor,Nombre);
					break;

				case "EMail" :
					SwError=ValidaEMail(Valor,Nombre);
					break;
			}
	}
	else{
			if (Requerido==1)
				if (Tipo=="Combo" )
					alert("No se ha Seleccionado " + Nombre + ".");
				else
					alert("No ingresado datos en el campo " + Nombre + ".");
			else SwError=false;
	}
	if (SwError){
		Objeto.focus();		
	}
	return SwError;
}

function Enviar(){
	if (!ValidaCampo(document.frmContactenos.txtNombre,"Nombre",document.frmContactenos.txtNombre.value,1,"Nombre")){
		if (!ValidaCampo(document.frmContactenos.txtApellido,"Apellido",document.frmContactenos.txtApellido.value,1,"Nombre")){
			if (!ValidaCampo(document.frmContactenos.txtEmail,"E-mail",document.frmContactenos.txtEmail.value,1,"EMail")){
				if (!ValidaCampo(document.frmContactenos.txtTelefono,"Telefono",document.frmContactenos.txtTelefono.value,1,"Texto")){
					if (!ValidaCampo(document.frmContactenos.txtConsulta,"Consulta",document.frmContactenos.txtConsulta.value,1,"Texto")){
						document.frmContactenos.submit();
					}
				}
			}
		}
	}
}





//-->
