//Valida longitud de campo
function longitud(item,len){
return (item.length >= len);
}

//correo electronico
function vmail(item){
if (!longitud(item,5)) return false;
if (item.indexOf('@',0) == -1) return false;
return true;
}

//funcion error
function error(elem,text){
if (hayerror) return;
window.alert(text);
elem.select();
elem.focus();
hayerror = true;
}

//comprueba la validez de una fecha
function y2k(anio) { return (anio < 1000) ? anio + 1900 : anio; }
function isDate (dia,mes,anio) {

    var hoy = new Date();
    anio = ((!anio) ? y2k(hoy.getYear()):anio);
    mes = ((!mes) ? hoy.getMonth():mes-1);
    if (!dia) return false
    var test = new Date(anio,mes,dia);
    if ( (y2k(test.getYear()) == anio) &&
         (mes == test.getMonth()) &&
         (dia == test.getDate()) )
        return true;
    else
        return false
}


function popUp(URL,a,b) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+a+",height="+b+",left = 65,top = 50');");
}

