/*--------------------------------------------------Lista de Funciones--------------------------------------
EsMail(string) true or false 
EstaLleno(string) true or false 
*/

//---------------------------------------------------------Funciones----------------------------------------
function EsMail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}
function EstaLleno(string) {
    if (string.search(/[A-Za-z0-9]/) != -1)    
        return true;
    else
        return false;
}
function EsNumero(string) {
    if (string.search(/[0-9]/) != -1)    
        return true;
    else
        return false;
}
function EsTelefono(string) {
    if ((string.search(/^[0-9]/) != -1) && (string.length >= 6))
        return true;
    else
        return false;
}
function Esdni(string) {
    if ((string.search(/^[0-9]/) != -1) && (string.length = 8))
        return true;
    else
        return false;
}
function Esdia(string) {
    if ((string.search(/^[0-9]/) != -1) && (string > 0) && (string < 32) )
        return true;
    else
        return false;
}
function Esanio(string) {
    if ((string.search(/^[0-9]/) != -1) && (string > 2000) && (string < 2010) )
        return true;
    else
        return false;
}
function Espasado(dia, mes, ano ) {
	var now = new Date();
	var resta;
	mes=mes-1
	var then = new Date(ano,mes,dia);
	var gap = then.getTime() - now.getTime();

	resta = Math.floor(gap / (1000 * 60 * 60 * 24));
	    if (   (resta >= 1)     )
	        return true;
	   else
	        return false;
}
function EsRuc(string) {
    if ((string.search(/^[0-9]/) != -1) && (string.length >= 11))
        return true;
    else
        return false;
}
function ControlFoco(control){
	control.focus();
	control.select();
}
function ControlFoco(control){
	control.focus();
	control.select();
}
function SiesFecha(dia,mes,ano){
	alert(dia + mes + ano);
	if (ano!=2004 && mes==2 && dia==29)	{ return false; }
	else
	{	alert('entro a validar');
		if (dia>30 && mes<8 && (mes%2==0))		
		{return false;}
		if (dia>30 && mes>7 && (mes%2!=0))
		{return false;}
		if (dia>28 && mes==2)
		{return false;}
	}
	return true;
}
