function swfCode(f, w, h) {
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">'+
'<param name="movie" value="'+f+'">'+
'<param name="quality" value="high">'+
'<param name="wmode" value="transparent">'+
'<param name="menu" value="false">'+
'<embed src="'+f+
'" width="'+w+
'" height="'+h+
'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false"></embed></object>';
	// return '<object data="'+f+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"><param name="quality" value="high" /><param name="movie" value="'+f+'" /><param name="wmode" value="transparent" /><param name="menu" value="false" /></object>';
}

function writeswf(filename, width, height) {
  document.write(swfCode(filename, width, height));
}

function addListener(element, event, listener, bubble) {
	if(element.addEventListener) {
		if(typeof(bubble) == "undefined") bubble = false;
		element.addEventListener(event, listener, bubble);
	} else if(this.attachEvent) {
		element.attachEvent("on" + event, listener);
	}
}
function c(id) {
	return document.getElementById(id);
}

function url(link) {
  window.open(link, '_blank');
  return false;
}

function voltar() {
	history.go(-1);
	return false;
}

function H2ToSwf(id, file, w, h) {
	var h2 = document.getElementById(id);
	if (h2 && h2.style) {
		h2.style.display = 'block';
		h2.innerHTML = swfCode('./img/'+file, w, h) + '<span class="onlyprint">' + h2.innerHTML + '</span>';
	}
}

var idPrincDest=0,overPrincDest=0,changePDTime=5,iPDTime=1;boolRecallPD=0;
function showPrintDest(i,s){var a=c('ldest'+idPrincDest);if(a)a.style.display=s?'block':'none'}
function recallPD(){if(boolRecallPD)return;setTimeout('changePrincDest()',1000);boolRecallPD=1}
function changePrincDest(){boolRecallPD=0;if(overPrincDest)return(iPDTime=0);if(iPDTime++<changePDTime)return recallPD();showPrintDest(idPrincDest,0);idPrincDest+=(idPrincDest==3)?-3:1;showPrintDest(idPrincDest,1);iPDTime=1;recallPD()}
function changePrincDestTo(i){showPrintDest(idPrincDest,0);idPrincDest=i;showPrintDest(idPrincDest,1);overPrincDest=1}
function PrincDestOver(){overPrincDest=1}
function PrincDestOut(){overPrincDest=0;recallPD()}

var BodyOk = false;
var loadBody = function(){
	var a;
	if(BodyOk)return;

	if (a = c('dprincdest'))
		recallPD();

/*
	H2ToSwf('tdestaque', 'tit-destaque.swf', 150, 25);
	H2ToSwf('tgaleriadefotos', 'tit-galeriadefotos.swf', 220, 25);
	H2ToSwf('tclienteexclusivo', 'tit-clienteexclusivo.swf', 220, 25);
	H2ToSwf('treservas', 'tit-reservas.swf', 175, 25);
	H2ToSwf('tcontato', 'tit-contato.swf', 175, 25);
	H2ToSwf('tinformacoes', 'tit-informacoes.swf', 175, 25);
	H2ToSwf('tvillaviola', 'tit-villaviola.swf', 175, 25);
	H2ToSwf('tlocalizacao', 'tit-localizacao.swf', 350, 25);
*/

	BodyOk = true;
}
addListener(window, 'load', loadBody);

var menuOver=false,menuOverSetTimeout=false;
function checkMenuOut(){
	if(!menuOver){
		$('#menuglobal').find('ul > li > ul').hide();
		menuOverSetTimeout=false;
	}else{
		setTimeout('checkMenuOut()',1000);
		menuOverSetTimeout=true;
	}
}
$(document).ready(function(){
	$('#menuglobal').find('ul > li').click(function(){
		$(this).parent().find('ul').hide();
		$(this).find('ul:eq(0)').show();
	});
	$('#menuglobal').find('ul > li').hover(function(){
		menuOver=true;
		$(this).parent().find('ul').hide();
		$(this).find('ul:eq(0)').show();
	},function(){
		menuOver=false;
		if(!menuOverSetTimeout)setTimeout('checkMenuOut()', 1000);
	});
});

function closeBanner(id) {
	$('#banner'+id).hide();
}
