
/* Drop-down Navigation 
---------------------------------------------------------- */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover); 

/* Drop Down List navigation
    (used by the global locations list in the header)
---------------------------------------------------------- */
function goto_dropdown_selection(entered) {
	with (entered) 	{
  	ref = options[selectedIndex].value; 
  	splitcharacter = ref.lastIndexOf("&"); 

	  if (splitcharacter != -1) {
  	  loc = ref.substring(0,splitcharacter); 
  	  target = ref.substring(splitcharacter+1,1000).toLowerCase();
	  }
    else {
      loc = ref;
      target = "_self";
      }

  	lowloc = loc.toLowerCase();
	
  	if (lowloc == "false" || lowloc == "") {
	    return;
	    }
	  else if (target=="_self") {
  	  document.location=loc;
	    } 
	  else if (target=="_top") {
  	  top.location=loc;
	    } 
	  else if (target=="_blank") {
  	  window.open(loc);
	    } 
	  else if (target=="_parent") {
  	  parent.location=loc;
	    }
	  else {
  	  parent.frames[target].location = loc;
	    } 
	  }
	}
	
	
//FUNCÃO DO MENU 
var niveis = location.pathname.split("/");
$(function(){
	//FUNÇÃO QUE MARCA O MENU 
	var linksSuperior = $('#menuSuperior ul li');
	var linksLateral = $('#menuLateral ul li a');
	var ulsLateral = $('#menuLateral ul');
	
	for(var i = 0; i < niveis.length; i++)
	{
		for(var c = 0; c < linksSuperior.length; c++)
		{
			if(niveis[1] == ''){
				$(linksSuperior[0]).addClass('current');
			}
			
			if(linksSuperior[c].id == niveis[i])
			{
				$(linksSuperior[c]).addClass('current');
			}
		}
		
		for(var b = 0; b < linksLateral.length; b++)
		{
			if(linksLateral[b].id == niveis[1])
			{
				$(linksLateral[b]).addClass('marcadoPrimeiroNivel');
			}
			
			if(linksLateral[b].id == niveis[i])
			{
				$(linksLateral[b]).addClass('marcado');
			}
		}	
		for(var c = 0; c < ulsLateral.length; c++)
		{
			if(ulsLateral[c].id == niveis[i])
			{
				$(ulsLateral[c]).css('display','block');
			}
		}		
	}
});

$(function RedimensionaLateral(){
	//ajusto o tamanho do menu lateral
	if(document.getElementById('menuLateral') != null)
	{
		var altura = $('#controlaConteudo').height();
		var lateral = $('#menuLateral').height();
		
		if(lateral <= altura){
			altura = altura + 20;
			$('#controlaConteudo').css('height',altura);
		}
		else{
			lateral = lateral + 20;
			$('#controlaConteudo').css('height',lateral);
		}
	}
});


