﻿function atribuiClasse(elemento, nomeClasse) {
    elemento.className = nomeClasse;
}

$(document).ready(function()
{

     $("#login [id$='Email']").focus(function(){
        $(this).val('');
     }); 
     
     $("#login [id$='Senha']").focus(function(){
        $(this).val('');
     });              
     
    $("#chkPolitica").click(function(){
        $("#modalPolitica").show();
        $("#tampa").show();
    });
    
    $("#fechar").click(function(){
        $("#modalPolitica").hide();
        $("#tampa").hide();
    });                
    
});
        


function mudaRegiao(nome) {
    var regiao = nome.toLowerCase().replace(' ','_');
    //Bunge.PrimorWS.SetRegiao(regiao,nome);
    atribuiValorCombo(nome,'msc_regiao','frm_regiao');
    //$("grafismo_regiao").className = regiao;
    popstatsRegiao(nome, "../home/default.aspx?reg="+nome);
}

function popstatsRegiao(nome, ql) {
    switch (nome)
    {
        case "Norte":
            click_pop(305, ql);
            return true;
        break;
        case "Sul":
            click_pop(306, ql);
            return true;
        break;
        case "Nordeste":
            click_pop(307, ql);
            return true;
        break;
        case "Sudeste":
           click_pop(308, ql);
           return true;
        break;
        case "Centro Oeste":
           click_pop(309, ql);
           return true;
        break;
        default:
            return false;
        break;
    }        
}

function wait(show) {
    var tampa = $("tampa");    
    if (show) {
        EscondeCombo();
        tampa.style.height=$("content").offsetHeight+"px";
        tampa.style.width=$("content").offsetWidth+"px";
        tampa.show();
    } else {    
        MostraCombo();
        tampa.hide();
    }
}

function showMessage(teste) {
    alert(teste);
}

function abreFechaPolitica() {
    if ($("modalPolitica").style.display=="none") {
        EscondeCombo();
        $("tampa").style.height=$("content").offsetHeight+"px";
        $("tampa").style.width=$("content").offsetWidth+"px";
        $("tampa").show();
        $("modalPolitica").show();
    } else {
        MostraCombo();
        $("tampa").hide();
        $("modalPolitica").hide();
    }
}

function MostraCombo() {
   qtdSelect = document.getElementsByTagName("select");
   for (i = 0; i < qtdSelect.length; i++) {
       objSelect = qtdSelect[i];
       objSelect.style.visibility = "visible";
   }
}
/*esconde todas combo*/
function EscondeCombo() {
   qtdSelect = document.getElementsByTagName("select");
   for (i = 0; i < qtdSelect.length; i++)
   {
       objSelect = qtdSelect[i];
       objSelect.style.visibility = "hidden";
   }
}

function abreFechaModalLogin() {
    if ($("boxModalLogin").style.display=="none") {
        $("tampa").style.height=$("aspnetForm").offsetHeight+"px";
        $("tampa").style.width=$("aspnetForm").offsetWidth+"px";
        $("tampa").show();
        $("boxModalLogin").show();
    } else {
        $("tampa").hide();
        $("boxModalLogin").hide();
    }
}

function abreFechaBoxEmail() {
    if ($("boxInformacoes").style.display == "none") {
        $("boxInformacoes").show();
        $("boxEmail").hide();
        $("tampa").hide();
    } else {
        $("boxInformacoes").hide();
        $("boxEmail").show();
    }

}

