// Procurando por um flog existente
function _procuraFlog(flog)
{
    if ( flog != "" ) {
        xmlhttp.open("GET", "/ajax_procuraFlog:" + flog, true);
        xmlhttp.onreadystatechange = function() {
            if ( xmlhttp.readyState==4 ) {
                if (xmlhttp.status == 200) {
                    var tempStatus = xmlhttp.responseText;
                    if ( tempStatus.length > 0 ) {
                        alert("El nombre de videolog elegido ya está siendo utilizado, por favor elija uno diferente.");
                    }
                } else {
                    alert("Ocurrió un problema al obtener los datos");
                }
            }
        }

        xmlhttp.send(null);
    }
    return false;
}

// procurando por um usuário existente
function _procuraEmail(email)
{
    if ( email != "" )
    {
        xmlhttp.open("GET", "/ajax_procuraEmail:" + email, true);
        xmlhttp.onreadystatechange = function() {
            if ( xmlhttp.readyState==4 ) {
                if (xmlhttp.status == 200) {
                    var tempStatus = xmlhttp.responseText;
                    if ( tempStatus.length > 0 ) {
                        alert("El e-mail " + email + " ya existe en nuestros registros. Por favor, elija uno diferente.");
                    }
                } else {
                    alert("Ocurrió un problema al obtener los datos");
                }
            }
        }

        xmlhttp.send(null);
    }
    return false;
}

function validar_cadastro() {
	nacimiento = new Date(document.getElementById('f_ano_nascimento').value,document.getElementById('f_mes_nascimento').value-1,document.getElementById('f_dia_nascimento').value,0,0,0);
	hoy = new Date();
	if (nacimiento > hoy) {
		alert('Ha ingresado una fecha de nacimiento mayor a la fecha actual.');
		return false;
	}
	return true;
}

function limpiar_login() {
    login = document.getElementById('usuario_login');
    if (login.value == 'Dirección de e-mail') {
        login.value = '';
    }
}
