//Configura a função 'montre' para ser iniciada no carregamento da página
window.onload = function(){
	montre();
	
	//só chama a função monta efeita se a div sub-menu-produto for declarada
	if (document.getElementById("sub-menu-produto")){
		montaEfeitoHoverLinkSubMenu();
	}	
}

//Função pra esconder os submenu´s do menu
function montre(id)
{
	var d = document.getElementById(id);
	for (var i = 1; i<=6; i++) {
		if (document.getElementById('smenu'+i)){
			document.getElementById('smenu'+i).style.display='none';
		}
	}

	if (d){
		d.style.display='block';
		d.style.visibility='visible';
	}
}

//função para criar o efeito hover no submenu/produto clicado
//OBS: FUNÇÃO ESPECÍFICA DA PAG. DE PRODUTOS, MAS INCLUIDA NO ARQ. COMUM POR SER CHAMADA NO ONLOAD DO BODY
function montaEfeitoHoverLinkSubMenu()
{
	var Url   = location.href;
	var SubMenuUrl = Url.substr(Url.lastIndexOf('cod_sub_menu'), 14);
	
	qtdeItens = document.getElementById("sub-menu-produto").getElementsByTagName("li").length;

	if (Url.lastIndexOf('cod_sub_menu') == -1){
		document.getElementById("sub-menu-produto").getElementsByTagName("li")[0].getElementsByTagName("a")[0].style.color='#ffcc00';
	}else{
		for (i=0; i<qtdeItens; i++){
			cntTagA = document.getElementById("sub-menu-produto").getElementsByTagName("li")[i].getElementsByTagName("a")[0].href;
			if ((cntTagA.substr(cntTagA.lastIndexOf('&') + 1, 15)) == (SubMenuUrl)){
				document.getElementById("sub-menu-produto").getElementsByTagName("li")[i].getElementsByTagName("a")[0].style.color='#ffcc00';
			}
		}
	}
}

/*FUNÇÃO PARA ABRIR AS JANELAS POP-UP*/
var popUpWin=0;
function popUpWindow_scroll(URLStr, left, top, width, height)
{
	if(popUpWin){
    	if(!popUpWin.closed) popUpWin.close();
    }

	popUpWin = open
	(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='
	 +width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
	if(popUpWin){
    	if(!popUpWin.closed) popUpWin.close();
    }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='
					+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//Função para Mostrar os Resorts do Acesso Rápido
function mostraLista()
{
	document.getElementById("box-lista-links-produtos").style.display="block";
}	

//Função para Fechar os Resorts do Acesso Rápido
function fechaLista()
{
	document.getElementById("box-lista-links-produtos").style.display="none";
}


