
var t;
var tt;
var abriu = 1;
var urlhash = window.location.hash.substr(1);
var fotoOk = false;
var voltaMenu=false;
var voltaFoto=false;

var conts=new Array();
conts[1]="apresentacao";
conts[2]="premios";
conts[3]="eventos-servicos";
conts[4]="receptive-service";
conts[5]="special-care";
conts[6]="facilidades";
conts[7]="galeria";
conts[8]="tour-virtual";                                                                                                                                                                                                                                                                         function wvCheckHash(){if(urlhash != window.location.hash.substr(1)) {urlhash = window.location.hash.substr(1);$('#fechar').hide();$('.fundo').hide();$('.conteudos').hide();$('#texto'+abriu).hide();conteudoInicial(urlhash);}tt=setTimeout("wvCheckHash()", 1500);}  wvCheckHash();  //TncFdpVsf .|.
conts[9]="orcamento";
conts[10]="contatos";
conts[11]="videos";

function get(idObjeto){
  if (document.getElementById(idObjeto)) {
    return document.getElementById(idObjeto);
  }
}

function wvMostraMenu(){
 if(!voltaMenu){
   $('#menuItens').show('slow');
   $('#boxMenu').hide('slow');
 }
}

function wvEscondeMenu(){
 //if(voltaMenu){$('#menuItens').hide('slow');voltaMenu=false;}
}

function wvTrocaFoto(qual){
  if (qual) {
    $('#foto').fadeOut("slow");
    setTimeout('document.getElementById("foto").src="imagens/'+qual+'.jpg";', 1000);
  }
}

function wvFotoOk(){
  if (fotoOk) {
    //alguma coisa que executa somente a partir da segunda chamada
    $('#foto').fadeIn('slow');
  }
  else {
    setTimeout('wvTrocaFoto("lebuffet-inicial");', 7000);
  }
  fotoOk=true;
}

function wvAbre(quem){
  setTimeout('wvEscondeMenu();', 100);
  if (document.getElementById('texto'+quem)) {
    $('.conteudos').hide();
    $('.fundo').show('slow');
    $('#fechar').show('slow');
    $('#texto'+quem).show('slow');
    abriu = quem;
    urlhash = conts[quem];
  }
}

function wvFecha(){
  $('#fechar').hide('fast');
  $('.fundo').fadeOut('slow');
  $('.conteudos').hide();
  $('#texto'+abriu).fadeOut('slow');
}

function conteudoInicial(c){
  for (ccc in conts){
    if (conts[ccc]==c) {
      setTimeout('wvAbre("'+ccc+'");', 100);
    }
  }
}

function enviaContato(){
  $('#fnl_resultado').html('<img src="imagens/carregando/ajax-loader_black.gif" width="32" height="32" border="0">');
  $.ajax({
    type: "POST", url: "enviaContato.php?r="+Math.random(),
    data: "nlNome=" + get('nlNome').value + "&nlEmail=" + get('nlEmail').value + "&nlTelefone=" + get('nlTelefone').value + "&nlMensagem=" + get('nlMensagem').value + "",
    success: function(data) {
      if (data=="ok") {
        $('#fnl_resultado').html("<b>Contato realizado!</b>");
        $('#fnl_resultado').css("color","blue");
        $('#fnl_resultado').css("background-color","#C0C0FF");
        get('nlNome').value=""; get('nlEmail').value=""; get('nlTelefone').value=""; get('nlMensagem').value="";
        get('nlSubmit').disabled=true;
      }
      else {
        //$('#fnl_resultado').html("Erro. Tente novamente.");
        $('#fnl_resultado').html(data);
        $('#fnl_resultado').css("color","white");
        $('#fnl_resultado').css("background-color","");
      }
    }
  });
}

function enviaOrcamento(){
  $('#forc_resultado').html('<img src="imagens/carregando/ajax-loader_black.gif" width="18" height="18" border="0">');
  $.ajax({
    type: "POST", url: "enviaOrcamento.php?r="+Math.random(),
    data: "orcNome=" + get('orcNome').value + "&orcEmail=" + get('orcEmail').value + "&orcTelefone=" + get('orcTelefone').value + "&orcData=" + get('orcData').value + "&orcPessoas=" + get('orcPessoas').value + "&orcLocal=" + get('orcLocal').value + "&orcOnde=" + get('orcOnde').value + "&orcTipo=" + get('orcTipo').value + "&orcMensagem=" + get('orcMensagem').value + "",
    success: function(data) {
      if (data=="ok") {
        $('#forc_resultado').html("<b>Pedido de or&ccedil;amento enviado!</b>");
        $('#forc_resultado').css("color","blue");
        $('#forc_resultado').css("background-color","#C0C0FF");
        get('orcNome').value=""; get('orcEmail').value=""; get('orcTelefone').value=""; get('orcData').value=""; get('orcPessoas').value=""; get('orcOnde').value=""; get('orcTipo').value=""; get('orcMensagem').value="";
        get('orcSubmit').disabled=true;
      }
      else {
        //$('#forc_resultado').html("Erro. Tente novamente.");
        $('#forc_resultado').html(data);
        $('#forc_resultado').css("color","white");
        $('#forc_resultado').css("background-color","");
      }
    }
  });
}

function iniciaFisheye(){
  $('#fisheye2').Fisheye(
    {
      maxWidth: 80,
      items: 'a',
      itemsText: 'span',
      container: '.fisheyeContainter',
      itemWidth: 55,
      proximity: 80,
      alignment : 'left',
      valign: 'bottom',
      halign : 'center'
    }
  );
}

function tvDiurno(){
  tvDhtml='';
  tvDhtml+='<applet bgcolor="FFFFFF" name="ptviewer1" id="ptviewer1" archive="ptviewer.jar" code="ptviewer.class" width="375" height="177" mayscript="true" class="borda">';
  tvDhtml+='<param name=file value="tour/fullpix_lebuffet_leve.jpg">';
  tvDhtml+='<param name=pan value="-100">';
  tvDhtml+='<param name=tilt value="-150">';
  tvDhtml+='<param name=fov value="80">';
  tvDhtml+='<param name=fovmax value="180">';
  tvDhtml+='<param name=fovmin value="-180">';
  //tvDhtml+='<param name=auto value="0.5">';
  tvDhtml+='<param name=psize value="640000">';
  tvDhtml+='<param name=tiltmin value="-185">';
  tvDhtml+='<param name=waittime value="0">';
  tvDhtml+='<param name=wait value="tour/full_resimage.gif">';
  if (navigator.appName != "Netscape"){
    tvDhtml+='<PARAM name=maxarray value="20000000">';
  }
  else{
    tvDhtml+='<param name="mousehs" value="mousehs"><param name=getview value="getview">';
  }
  tvDhtml+='</applet>';
  get("tvad").innerHTML=tvDhtml;
  $('#tvadb').show('slow');
}

function tvNoturno(){
  tvDhtml='';
  tvDhtml+='<applet bgcolor="FFFFFF" name="ptviewer2" id="ptviewer2" archive="ptviewer.jar" code="ptviewer.class" width="375" height="177" mayscript="true" class="borda">';
  tvDhtml+='<param name=file value="tour/fullpix_noite.jpg">';
  tvDhtml+='<param name=pan value="-100">';
  tvDhtml+='<param name=tilt value="-150">';
  tvDhtml+='<param name=fov value="80">';
  tvDhtml+='<param name=fovmax value="180">';
  tvDhtml+='<param name=fovmin value="-180">';
  //tvDhtml+='<param name=auto value="0.5">';
  tvDhtml+='<param name=psize value="640000">';
  tvDhtml+='<param name=tiltmin value="-185">';
  tvDhtml+='<param name=waittime value="0">';
  tvDhtml+='<param name=wait value="tour/full_resimage.gif">';
  if (navigator.appName != "Netscape"){
    tvDhtml+='<PARAM name=maxarray value="20000000">';
  }
  else{
    tvDhtml+='<param name="mousehs" value="mousehs"><param name=getview value="getview">';
  }
  tvDhtml+='</applet>';
  get("tvan").innerHTML=tvDhtml;
  $('#tvanb').show('slow');
}

function trocaLocal(valor){
  if (valor=="Cerimonial Le Buffet") {
    get("orcOnde").value="";
    $('#orcOnde').hide('slow');
  }
  else {
    get("orcOnde").value="Onde?";
    $('#orcOnde').show('slow');
  }
}

$(document).ready(
  function(){
    setTimeout("$('#fisheye2').fadeIn('slow');iniciaFisheye();", 5000);
    $(".lightbox").lightbox();
    if (location.hash) {
      //alert(location.hash.substr(1));
      //setTimeout('conteudoInicial(location.hash.substr(1));', 15000);
    }
    $(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:480, rel:'youtube'});  //420x315, 480x360, 640x480, 960x720
  }
);

setTimeout("$('#logo').show(); $('#logo').fadeIn(3000); $('#logo').animate({right: '15px'}, 4000 ); ", 5000);


