// JavaScript Document

<!-- language selection -->
function getLanguage() {
	if (window.location.search.length > 1 )
	{
		var query = window.location.search.substring(1);
		var vars = query.split("&");
		for (var i=0;i<vars.length;i++) {
	    var pair = vars[i].split("=");
	    if (pair[0] == 'language') {
	      return pair[1];
	    }
	  }
	}
	return 'en';
}

function gotoURL(url) {
	parent.mainFrame.location.href=getLanguage()+'/'+url;
}

<!-- Declaração da função menu -->
function menu(lang){


	// Declaração da matriz submenu nivel 1
	submenuProducts = [];
	for(i=0; i<2; i++)
		submenuProducts[i] = [];

	// Declaração da matriz submenu nivel 2
	submenuServices = [];
	for(i=0; i<2; i++)
		submenuServices[i] = [];

	// Declaração da matriz submenu nivel 3
	submenuG2 = [];
	for(i=0; i<2; i++)
		submenuG2[i] = [];

	// Declaração da matriz de html do nível 1
	htmlSubmenuNivel1 = [];

	// Declaração da matriz de html do nível 2
	htmlSubmenuNivel2 = [];

	// Declaração da matriz de html do nível 3
	htmlSubmenuNivel3 = [];

	// Carregando a matriz de html do nível 1
	htmlSubmenuNivel1[0] = ['<a href="#" onclick="javascript:void(0);" class="lumitecBody">Financial</a>',
            '<a href="#" onclick="javascript:void(0);" class="lumitecBody">Technology</a>']

	htmlSubmenuNivel1[1] = ['<a href="'+lang+'/services-consulting.html" target="mainFrame" class="lumitecBody">Consulting</a>',
					  '<a href="'+lang+'/services-application.html" target="mainFrame" class="lumitecBody">Application</a>',
					  '<a href="'+lang+'/services-BusinessPSimulation.html" target="mainFrame" class="lumitecBody">Business Process Modeling</a>']
					  //'<a href="'+lang+'/services-productTraining.html" target="mainFrame" class="lumitecBody">Product Training</a>']

	// Carregando a matriz de html do nível 2
	htmlSubmenuNivel2[0] = ['<a href="'+lang+'/omes.html" target="mainFrame" class="lumitecBody">OMES</a>']
	htmlSubmenuNivel2[1] = ['<a href="'+lang+'/coral8.html" target="mainFrame" class="lumitecBody">Coral8</a>',
  '<a class="lumitecBody">G2</a>',
  '<a href="'+lang+'/java.html" target="mainFrame" class="lumitecBody">Java</a>',
  '<a href="'+lang+'/dotNet.html" target="mainFrame" class="lumitecBody">.NET</a>']

	// Carregando a matriz de html do nível 3
	htmlSubmenuNivel3[0] = ['<a href="'+lang+'/g2KBits.html" target="mainFrame" class="lumitecBody">G2 Knowledge Bits</a>',
  '<a href="'+lang+'/g2Gateways.html" target="mainFrame" class="lumitecBody">G2 Gateways</a>']

  <!-- Declaração da matriz menu -->
	menus = [];
	if(document.getElementById){

  	menus[0] = document.getElementById("layerSubMenuProducts");
  	menus[1] = document.getElementById("layerSubMenuServices");
  	menus[2] = document.getElementById("layerSubMenuFinancial");
  	menus[3] = document.getElementById("layerSubMenuTechnology");
  	menus[4] = document.getElementById("layerSubMenuG2");

    <!-- altera background dos submenu ao passar o mouse -->
  	function over(){ this.style.backgroundColor = '#CFEF2F'; }
    <!-- Altera background dos submenus após passagem do mouse -->
  	function out(){ this.style.backgroundColor = '#B5DC10'; }

  	function show(){ this.style.visibility='visible'; }
  	function hide(){ this.style.visibility='hidden'; }

   	function showProducts(){
      menus[0].style.visibility='visible';
//      this.style.backgroundColor = '#CFEF2F';
      this.style.backgroundColor = '#B5DC10';
    }
  	function hideProducts(){
      menus[0].style.visibility='hidden';
//      this.style.backgroundColor = '#B5DC10';
      this.style.backgroundColor = '#CFEF2F';
    }

   	function showFinancial(){
      menus[2].style.visibility='visible';
      this.style.backgroundColor = '#CFEF2F';
    }
  	function hideFinancial(){
      menus[2].style.visibility='hidden';
      this.style.backgroundColor = '#B5DC10';
    }
   	function showTechnology(){
      menus[3].style.visibility='visible';
      this.style.backgroundColor = '#CFEF2F';
    }
  	function hideTechnology(){
      menus[3].style.visibility='hidden';
      this.style.backgroundColor = '#B5DC10';
    }
   	function showG2(){
      menus[4].style.visibility='visible';
      menus[0].style.visibility='visible';
//      this.style.backgroundColor = '#CFEF2F';
      this.style.backgroundColor = '#B5DC10';
    }
  	function hideG2(){
      menus[4].style.visibility='hidden';
      menus[0].style.visibility='hidden';
//      this.style.backgroundColor = '#B5DC10';
      this.style.backgroundColor = '#CFEF2F';
    }
   	function showProductsAndTechnology(){
      menus[0].style.visibility='visible';
      menus[3].style.visibility='visible';
      this.style.backgroundColor = '#CFEF2F';
//      this.style.backgroundColor = '#B5DC10';
    }
  	function hideProductsAndTechnology(){
      menus[0].style.visibility='hidden';
      menus[3].style.visibility='hidden';
      this.style.backgroundColor = '#B5DC10';
//      this.style.backgroundColor = '#CFEF2F';
    }

        // MONTA OS Sub menus de nivel 1
  	for(j=0; j<htmlSubmenuNivel1.length; j++){

    	for (i=0; i<htmlSubmenuNivel1[j].length; i++){

      	submenuProducts[j][i] = document.createElement("DIV");
      	submenuProducts[j][i].setAttribute("lumitecBody", "special");
      	submenuProducts[j][i].innerHTML = htmlSubmenuNivel1[j][i];
      	submenuProducts[j][i].style.padding = "8px"; <!-- espaçamento dos submenus -->
      	submenuProducts[j][i].style.border = "#FFFFFF 1px solid"
      	submenuProducts[j][i].style.background = "#B5DC10"
      	submenuProducts[j][i].style.height = "15px"

        if (j==0&&i==0)
        {
         	submenuProducts[j][i].onmouseover = showFinancial;
         	submenuProducts[j][i].onmouseout = hideFinancial;
        }
        else if (j==0&&i==1)
        {
         	submenuProducts[j][i].onmouseover = showTechnology;
         	submenuProducts[j][i].onmouseout = hideTechnology;
        }
        else
        {
         	submenuProducts[j][i].onmouseover = over;
         	submenuProducts[j][i].onmouseout = out;
        }
      	menus[j].appendChild(submenuProducts[j][i]);
    	}
    	menus[j].style.top = "147px";

    	menus[j].onmouseover = show;
    	menus[j].onmouseout = hide;
  	}

    // monta os sub menus de nivel 2
  	for(j=0; j<htmlSubmenuNivel2.length; j++){

    	for (i=0; i<htmlSubmenuNivel2[j].length; i++){

        submenuServices[j][i] = document.createElement("DIV");
      	submenuServices[j][i].setAttribute("lumitecBody", "special");
      	submenuServices[j][i].innerHTML = htmlSubmenuNivel2[j][i];
      	submenuServices[j][i].style.padding = "8px"; <!-- espaçamento dos submenus -->
      	submenuServices[j][i].style.border = "#FFFFFF 1px solid"
      	submenuServices[j][i].style.background = "#CFEF2F"
      	submenuServices[j][i].style.height = "15px"

        if (j==1&&i==1)
        {
         	submenuServices[j][i].onmouseover = showG2;
         	submenuServices[j][i].onmouseout = hideG2;
        }
        else
        {
      	submenuServices[j][i].onmouseover = showProducts;
      	submenuServices[j][i].onmouseout = hideProducts;
        }

      	menus[j+2].appendChild(submenuServices[j][i]);
     }
      	menus[j+2].onmouseover = show;
      	menus[j+2].onmouseout = hide;
   }


    // monta os sub menus de nivel 2
  	for(j=0; j<htmlSubmenuNivel3.length; j++){

    	for (i=0; i<htmlSubmenuNivel3[j].length; i++){

        submenuG2[j][i] = document.createElement("DIV");
      	submenuG2[j][i].setAttribute("lumitecBody", "special");
      	submenuG2[j][i].innerHTML = htmlSubmenuNivel3[j][i];
      	submenuG2[j][i].style.padding = "8px"; <!-- espaçamento dos submenus -->
      	submenuG2[j][i].style.border = "#FFFFFF 1px solid"
      	submenuG2[j][i].style.height = "15px"
      	submenuG2[j][i].style.background = "#B5DC10"
      	submenuG2[j][i].onmouseover = showProductsAndTechnology;
      	submenuG2[j][i].onmouseout = hideProductsAndTechnology;

      	menus[j+4].appendChild(submenuG2[j][i]);
     }
      	menus[j+4].onmouseover = show;
      	menus[j+4].onmouseout = hide;
   }



	}
}

