﻿
function clicarLink(nome) {
    var oLnk = document.getElementById(nome);
    /*if (oLnk.dispatchEvent) {
        //var e = document.createEvent("MouseEvents");
        //e.initEvent("click", true, true);
        //oLnk.dispatchEvent(e);
        var oEvent = document.createEvent("MouseEvents");
        oEvent.initMouseEvent("click", true, true, window, 1, 1, 1, 1, 1, false, false, false, false, 0, oLnk);
        oLnk.dispatchEvent(oEvent);

    }
    else
        oLnk.click();*/
    location.href = oLnk.href;
}

function clicarBotao(nome) {
    var oBotao = document.getElementById(nome);
    if (oBotao.dispatchEvent) {
        var e = document.createEvent("MouseEvents");
        e.initEvent("click", true, true);
        oBotao.dispatchEvent(e);
    }
    else
        oBotao.click();
}

function validaCandidatura(checkboxInteresse) {
    var oAvancarCand = document.getElementById("ctl00_ContentPlaceHolder1_btnConf");
    if (checkboxInteresse.checked) oAvancarCand.style.visibility = "visible";
    else oAvancarCand.style.visibility = "hidden";
}

function colocaMostraSubOpcoes(celulaMostrar) {
    var oCelulaMostrar = document.getElementById(celulaMostrar);
    oCelulaMostrar.style.display = "inline";
    return true;
}

function colocaOpcaoSelNSel(celulaFundo) {
    var oCelula = document.getElementById(celulaFundo);
    if (oCelula.style.backgroundColor != "#FE7F00"){
        oCelula.style.backgroundColor = "#FE7F00";
        colocaMostraSubOpcoes(celulaFundo + "_Op");
        
        var itemsMenu = new Array(
          new Array('ctl00_dvCarrinha', '0')
            , new Array('ctl00_dvContactos', '0')
            , new Array('ctl00_dvProjectosEmpresa', '4')
            , new Array('ctl00_dvMissao', '0')
            , new Array('ctl00_dvStartegicDevel', '0') /* acrescentada para startegic devel*/
            , new Array('ctl00_dvFormacaoPME', '0')
            , new Array('ctl00_dvPortcom', '0')
          );
        /*, new Array('ctl00_tdAgenda', '4')*/
        
        var numItems = itemsMenu.length;
        for(auxVal = 0; auxVal < numItems; auxVal++)
            if(itemsMenu[auxVal][0] != celulaFundo){
                var oMenu = document.getElementById(itemsMenu[auxVal][0]);
                oMenu.style.backgroundColor = "#ffffff";
            }
    }
    else{
        oCelula.style.backgroundColor = "#ffffff";
        var oCelulaOp = document.getElementById(celulaFundo + "_Op");
        if(oCelulaOp) oCelulaOp.style.display = "none";
        /*for(var numOp = 0; numOp < numOps; numOp++){
            var oCelulaMostrar = document.getElementById(celulaMostrar + numOp);
            oCelulaMostrar.style.display = "#ffffff";
        }*/
    }
}

function carregaPagina(pag){
    switch (pag){
        case "agesemina.aspx":
        case "agework.aspx":
            break;
        case "projsustenta.aspx":
        case "projsustage.aspx":
        case "projempreage.aspx":
        case "projempreende.aspx":
        case "projautoaval.aspx":
            colocaMostraSubOpcoes("ctl00_dvProjectosEmpresa_Op");
            break;
    }
    return true;
}
