function horizontal() {
 
   var navItems = document.getElementById("menu_dropdown").getElementsByTagName("li");
    
   for (var i=0; i< navItems.length; i++) {
      if(navItems[i].className == "submenu")
      {
         if(navItems[i].getElementsByTagName('ul')[0] != null)
         {
            navItems[i].onmouseover=function() {this.getElementsByTagName('ul')[0].style.display="block";this.style.backgroundColor = "#f9f9f9";}
            navItems[i].onmouseout=function() {this.getElementsByTagName('ul')[0].style.display="none";this.style.backgroundColor = "#FFFFFF";}
         }
      }
   }
 
}

function openAjax(){
	var Ajax;
	try{
		Ajax = new XMLHttpRequest();
	}catch(ee){
		try{
			Ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				Ajax = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				Ajax = false;
			}
		}
	}
	return Ajax;
}

function trocaCor(objeto)
{
	nNos = document.getElementById('legenda-link').getElementsByTagName('a').length;

	objeto.style.color="#FF0000";
	for (i=0;i<nNos;i++){
		if (document.getElementById('legenda-link').getElementsByTagName('a')[i] != objeto){
			document.getElementById('legenda-link').getElementsByTagName('a')[i].style.color="#000000";
		}
	}

}

function carregaFotosDestinos(id_destino, nome_arquivo)
{
	if(document.getElementById){
       
        var exibeResultado = document.getElementById("foto-destino");

		var dataArray = new Array();
		
		dataArray.push("funcao=" + "foto_produto");
		dataArray = dataArray.join("&");
		var Ajax = openAjax();

		Ajax.open("POST", "funcoes_produtos.php", true);
		
		Ajax.onreadystatechange = function()
		{
			if(Ajax.readyState == 1){
				exibeResultado.src = "http://www.resorthotelturismo.com.br/imgs/carregando_foto.gif";
			}
			
			if(Ajax.readyState == 4){
				//if(Ajax.status == 200){
					var resultado = Ajax.responseText;
					resultado = "http://www.resorthotelturismo.com.br/imgs/foto_destino/" + id_destino + "/" + nome_arquivo +".jpg";
					exibeResultado.src = resultado;
				//}
			}
		}
		Ajax.send(dataArray);
	}
}

function carregaFotosHoteis(id_pagina_hotel, nome_arquivo)
{
	if(document.getElementById){
       
        var exibeResultado = document.getElementById("foto-destino");

		var dataArray = new Array();
		
		dataArray.push("funcao=" + "foto_produto");
		dataArray = dataArray.join("&");
		var Ajax = openAjax();

		Ajax.open("POST", "funcoes_produtos.php", true);
		
		Ajax.onreadystatechange = function()
		{
			if(Ajax.readyState == 1){
				exibeResultado.src = "http://www.resorthotelturismo.com.br/imgs/carregando_foto.gif";
			}
			
			if(Ajax.readyState == 4){
				//if(Ajax.status == 200){
					var resultado = Ajax.responseText;
					resultado = "http://www.resorthotelturismo.com.br/imgs/foto_hotel/" + id_pagina_hotel + "/" + nome_arquivo +".jpg";
					exibeResultado.src = resultado;
				//}
			}
		}
		Ajax.send(dataArray);
	}
}

function abre_link(link_produto)
{
	if(link_produto != 'nda')
   		window.open(link_produto,'_self');
}

function abre_roteiro(id_roteiro)
{
	if(id_roteiro != 'nda')
   		window.open('resort_roteiro.php?roteiro='+id_roteiro,'_self');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function mostra_div(nome)
{
	if(navigator.appName == "Microsoft Internet Explorer")	
		document.getElementById(nome).style.display="block";
	else
		document.getElementById(nome).style.display="table-row";
}

function esconde_div(nome)
{
	document.getElementById(nome).style.display="none";
}