function verifDatos()
{
var datosForm = document.getElementById("modifDatosForm");
//datosForm.dato.value = trim(datosForm.dato.value);
/*if (datosForm.dato.value == "")
	{
    alert("Debe ingresar la información antes de guardarla");
    return false;
    }*/
if (datosForm.dato.id == "Nombre" || datosForm.dato.id == "Direccion" || datosForm.dato.id == "Mail")
	{
	if (datosForm.dato.value.length > 100)
		{
		 alert("Ingrese un largo máximo de 50 caracteres");
		 return false;
		} 
    }
if (datosForm.dato.id == "Telefono" || datosForm.dato.id == "Celular")
	{
	/*if (datosForm.codigo.value == "" || datosForm.dato.value == "")
		{
		 alert("Debe completar la información antes de guardarla");
		 return false;
		}*/
	var cod = datosForm.codigo.value;
	var fono = datosForm.dato.value;	
	if (isNaN(cod) == true  || isNaN(fono) == true)
		{
		 alert("Debe ingresar sólo datos numéricos");
		 return false;		
		}
	if ((cod.length + fono.length) > 15 )
		{
		 alert("El largo del número de teléfono no debe superar los 15 dígitos");
		 return false;
		}
    }
if (datosForm.dato.id == "Mail")
	{ 
	  if(datosForm.dato.value != "" && !fValidarEmail(datosForm.dato.value))
		{
		 alert("Direccion de E-mail incorrecta, verifique @ y puntos");
		 return false;		
		}		
	}
datosForm.aceptar_dato_Socio.value = 1;
datosForm.submit();
}

function verifDatosSocio(datosForm)
{
//var datosForm = document.getElementById("datosSocioEditarForm");

//datosForm.dato.value = trim(datosForm.dato.value);
/*if (datosForm.dato.value == "")
	{
    alert("Debe ingresar la información antes de guardarla");
    return false;
    }*/
if (datosForm.direccion.value.length > 30)
	{
	 alert("Ingrese un largo máximo de 30 caracteres para la dirección");
		 return false;
    }
if (datosForm.ciudad.value.length > 20)
	{
	 alert("Ingrese un largo máximo de 20 caracteres para la ciudad");
		 return false;
    }
if (datosForm.comuna.value.length > 20)
	{
	 alert("Ingrese un largo máximo de 20 caracteres para la comuna");
		 return false;
    }	
if (datosForm.mail.value.length > 30)
	{
	 alert("Ingrese un largo máximo de 30 caracteres para el e-mail");
		 return false;
    }		

 if(datosForm.mail.value != "" && !fValidarEmail(datosForm.mail.value))
	{
		 alert("Direccion de E-mail incorrecta, verifique @ y puntos");
		 return false;		
	}		
 if (datosForm.cod_fono.value.length > 3)
	{
	 alert("Ingrese hasta 3 números para el código de área");
		 return false;
    }	
 if (datosForm.fono.value.length > 7)
	{
	 alert("El largo del número de teléfono fijo no debe superar los 7 dígitos");
		 return false;
    }		
 if (datosForm.cod_celu.value.length > 2)
	{
	 alert("Ingrese hasta 2 números para el código del celular");
		 return false;
    }	
 if (datosForm.celu.value.length > 9)
	{
	 alert("El largo del número para el celular no debe superar los 9 dígitos");
		 return false;
    }	
	
var cod_fono = datosForm.cod_fono.value;
var fono = datosForm.fono.value;	
var cod_celu = datosForm.cod_celu.value;
var celu = datosForm.celu.value;

	if (isNaN(cod_fono) == true  || isNaN(fono) == true)
		{
		 alert("Debe ingresar sólo datos numéricos para el teléfono");
		 return false;		
		}
	if (isNaN(cod_celu) == true  || isNaN(celu) == true)
		{
		 alert("Debe ingresar sólo datos numéricos para el celular");
		 return false;		
		}	

datosForm.aceptar_datos_socio.value = 1;
datosForm.submit();
}

function verifSugerencias()
{
var datosForm = document.getElementById("sugerenciasForm");

if (datosForm.sugerencias.value == "")
	{
    alert("Debe ingresar el texto para enviar la sugerencia");
    return false;
    }
if (datosForm.sugerencias.value.length > 1000)
	{
	 alert("Ingrese un largo máximo de 1000 caracteres");
	 return false;
	} 
datosForm.sugerencia_socio.value = 1;
datosForm.submit();
}

function trim(s){
s = s.replace(/\s+/gi, ' '); //sacar espacios repetidos dejando solo uno
s = s.replace(/^\s+|\s+$/gi, ''); //sacar espacios blanco principio y final

return s;
}

function fValidarEmail (cadena)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadena))
   return (true)
else 
   return (false);
}

