// JavaScript Document

function AbreMenu(paramIdDivPrincipal)
{
	var divSelecionado = document.getElementById(paramIdDivPrincipal);
	
	var idMenu = "divMenu";
	
	var divMenu = document.getElementById('divMenuJs');
	
	var divsMenu = divMenu.getElementsByTagName('DIV');
	
	for(var i = 0; i < divsMenu.length; i++)
	{
		var divInterno = divsMenu[i];
		
		if(divInterno.attributes['class'].value.indexOf('SubPai') >= 0)
			divInterno.style.display = 'none';
		else if(divInterno.attributes['class'].value.indexOf('itemPai') >= 0)
			divInterno.attributes['class'].value = "itemPai";
	}
	
	divSelecionado.attributes['class'].value = "itemPai MenuSelecionado";
	
	var idFilho = divSelecionado.id + '.1';
	
	var divFilho = document.getElementById(idFilho);
	
	if(divFilho != null)

	divFilho.style.display = 'block'
}

function EnviaBusca()
{
   var palavraChave = document.getElementById('palavraChaveBuscaPagina');

   if (palavraChave.value != "") {
		   window.location = "pagina.aspx?26&palavraChaveBuscaPagina=" + escape(palavraChave.value);
   } else {
		   alert("Preencha o campo com o conteúdo que deseja buscar");
		   palavraChave.focus();
   }
}

function BarraHide(){
		document.getElementById('barraie').style.visibility="hidden";
	}

function MostraCase(paramLink){

	var item = paramLink.parentNode;
	item.style.display = "none";

	do{
		item = item.parentNode;
		if(item.tagName == "TABLE")
			break;
	}while(item.tagName != "BODY");

	item.getElementsByTagName("TD")[3].style.display=item.getElementsByTagName("TD")[4].style.display="block";

}//function

function FechaCase(paramLink){

	var item = paramLink.parentNode;
	item.style.display = "none";

	do{
		item = item.parentNode;
		if(item.tagName == "TABLE")
			break;
	}while(item.tagName != "BODY");

	item.getElementsByTagName("TD")[3].style.display="none";
	item.getElementsByTagName("TD")[2].style.display="block";

}//function

/* Cria Cookie */

function createCookie(name,value,days) {
	if(days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}//if
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function AcessaHomeIngles()
{
	parent.window.location = "/cmi/Pagina.aspx?120";
	}