$(document).ready(function(){
	
	$("#fecharDiv").click(function()
	{
		$("#divdois").css('display', 'none');
	});
	
		$('#cliente').click(function(){
        var email = $('#div_cliente #email_cliente');
        var senha = $('#div_cliente #senha_cliente');
        if(email.val().length == 0)
        {
            alert('Digite seu e-mail!');
            email.focus();
            return false;
        }else
        {
            if(!checkMail(email))
            {
                alert('Digite um e-mail válido!');
                email.focus();
                return false;
            }
        }

        if(senha.val().length == 0)
        {
            alert('Digite sua Senha!');
            senha.focus();
            return false;
        }
        window.location="http://www.numero.com.br/app/processaLogin.jsp?"+$('#div_cliente input').serialize();
    });

    $('#intranet').click(function(){
        var email = $('#div_intranet #email_intranet');
        var senha = $('#div_intranet #senha_intranet');
        if(email.val().length == 0)
        

        if(senha.val().length == 0)
        {
            alert('Digite sua Senha!');
            senha.focus();
            return false;
        }
        window.location="http://www.numero.com.br/app/processaLoginIntranet.jsp";
    });

});


function mostra(item1){
    var item1 = document.getElementById(item1);
    if (item1.style.display=='none'){
        item1.style.display='';
    }else{
        item1.style.display='none';
    }
}

function abrefecha(obj){
    var el = document.getElementById(obj);
    if(el.style.display != "block"){
        el.style.display = "block";
    }else{
        el.style.display = "none";
    }
}

function enviar(){
    if (document.frmLogin.email.value.length==0 ||
        document.frmLogin.senha.value.length==0 ){
        alert('Por favor, informe todos os campos!');
        document.frmLogin.email.focus();
    }else{
        window.location="http://www.numero.com.br/app/processaLogin.jsp?email="+document.frmLogin.email.value+"&senha="+document.frmLogin.senha.value;
        window.status="Fazendo login do cliente...";
        document.frmLogin.email.value="";
        document.frmLogin.senha.value="";
    }
}

$(function(){

    $('#efeito').accordion({

        autoheight:false

    });

});

function checkMail(mail)
{
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    
    if(typeof(mail) == "string")
    {
        if(er.test(mail))
        {
            return true;
        }
    }else if(typeof(mail) == "object")
    {
        if(er.test(mail.val()))
        {
            return true;
        }
    }else
    {
        return false;
    }
}
