// JScript File
function Logar()
{   
    if(document.getElementById('login').value == "")
    {                
        alert('O preenchimento do campo login é obrigatório.');
        document.getElementById('login').focus();   
        return false;     
    }
    
    if(document.getElementById('senha').value == "")
    {
        alert('O preenchimento do campo senha é obrigatório.');
        document.getElementById('senha').focus();
        return false;
    }
    
    var aux = faca_eventos_login.Logar(document.getElementById('login').value,document.getElementById('senha').value).value;
    
    
    if( aux <= 0 )
    {
         alert('Dados incorretos. Por favor verifique seu login ou senha.'); 
         document.getElementById('senha').value = '';
         return false;
        
    }
    else
    {
         window.location = 'http://www.aguasquentes.com/faca_eventos_painel.aspx?id='+aux;
    }

}

function Deslogar()
{
    faca_eventos_login.Deslogar();

    window.location = 'http://www.aguasquentes.com/default.aspx';

}

function EmptyField(field) 
{
    
    var fieldValue = field.value.replace(/ /g, '');

    if (fieldValue.length == 0) {
        return true;
    } else {
        return false;
    }
}

//Função para ao se dá um Enter cair sobre o evento de submit da pagina de contato
//param:evt = Evento do keyPress
//param:botao = Id do botão que dá o submit na página
function EnterContato(evt,botao)
{
    //Verificando se o que é digitado é somente campos numéricos
    var charCode = (evt.which) ? evt.which : evt.keyCode;
  
    if(charCode==13)
    {
         document.getElementById(botao).onclick();		
         return false;
    }
    return true;
}