	// JavaScript Document

/*
$(function(){
	$('.swfaddress').click(function() {
		rel = $(this).attr('rel');
		parent.SWFAddress.setValue(rel);
		return false;
	});
})
*/

function abrePgFancybox(pagina) {
		/// abri o colorbox
		$(document).ready(function() {  
       	$.fancybox({href:pagina, 
		overlayOpacity:0.1, 
		transitionIn:'elastic', 
		transitionOut:'elastic', 
		autoScale:false, 
		'onClosed': function() { 
			parent.location='.'; }
			});
    	});	
}


function abrePgFancyboxSemFechar(pagina) {
		/// abri o colorbox
		$(document).ready(function() {  
       	$.fancybox({href:pagina, 
		overlayOpacity:0.1, 
		transitionIn:'elastic', 
		transitionOut:'elastic', 
		autoScale:false,
			});
    	});	
}

//FADEIN / FADEOUT DA PAGINA

$(document).ready(function(){

if($.browser.msie){

    $("body").fadeIn(2000);

	$('.menu a').click(function(event){
		event.preventDefault();
		alink = $(this).attr('href');
		$('body .conteudo').fadeOut('slow',carregapagina);
	});
	
	function carregapagina(){
		window.location=alink;
	}

}
else{
	$("body").css("display", "none");

    $("body").fadeIn(2000);

	$('.menu a').click(function(event){
		event.preventDefault();
		alink = $(this).attr('href');
		$('body .conteudo').fadeOut('slow',carregapagina);
	});
	
	function carregapagina(){
		window.location=alink;
	}

}


});


$(document).ready(function(){


//BANNER ROTATOR

	$('.imagem ul').cycle({
		fx: 'fade'
	});

//FIM BANNER ROTATOR




//INDEX

	//MOSTRA TEXTO
	$('.descricao').css({
                        width:'0px',
                        height:'0px'})
                     .animate({
                        width:'20px',
                        height:'50px',
                        opacity:'0.9'});
		
	$('.descricao p').css('display','block').hide();
	
	
//VAI ABRIR LOGO QUE CARREGAR



	
	$('.descricao, .descricaoQuartos').click(function(){
     
          if($('.descricao').width() < 300)
          {
               if($.browser.msie){//se for IE
                    $('.descricao').animate({
                                   width: '390px',
                                   height:'450px',
                                   opacity:0.95}, 1800, function(){
                                             $('.descricao p, .descricao br').css({marginLeft:'9px', marginRight:'9px'}).fadeIn(1500);
                                             $('.descricao p.abertoPublico').css('marginLeft','160px');
                                        }).fadeIn(1200);                                             
               }
               else{//senao
                    $('.descricao').animate({
                              width:'420px',
                              height:'450px'
                         }, 1800, function(){
                                   $('.descricao p, .descricao br').fadeIn(500);
                              });
                              $('.descricaoSpa').fadeIn();
               }
          }
          else{}
	}).click();
     
	
	
	
	//ESCONDE TEXTO E RECOLHE A PAGINA

	$('.titulo img').click(function(){
		$('.descricao').animate({
							width:'20px',
							height:'50px'
							}).find('p').fadeOut();
          
          $('.descricaoSpa').fadeOut();
			
		return false;
	});


//FIM INDEX



	
//QUARTOS


	//MOSTRA TEXTO
	//mosta apenas a primeira li com imagem	
	if($.browser.msie)
	{
		$('.imagem ul li:first').css('display','block');
		}
	
	
	$('.descricaoQuartos').animate({
								width:'0px', 
								height:'0px', 
								marginLeft:'-10px', 
								marginTop:'-10px'})
						  .animate({
							  	width:'20px', 
								height:'40px',
								marginLeft:0, 
								marginTop:0,
								opacity:'0.9'},1000);

	$('.descricaoQuartos p').hide();


		$('.descricaoQuartos p').hide();


function mostraDescricao() 
{

			$('.legenda').css({
							height:'0px', 
							marginTop:'330px', 
							opacity:0});
							
			 if($.browser.msie){
				$('.descricaoQuartos').animate({
							//width:'350px',
                                          width:'210px',
							height:'340px'
							}, function(){$('.descricaoQuartos p').fadeIn();});
			}else{
			$('.descricaoQuartos').animate({
						//width:'350px',
                                    width:'174px',
						height:'330px'
						}, function(){$('.descricaoQuartos p').fadeIn();});
               }

}

mostraDescricao();
$('.descricaoQuartos').click(function(){
     mostraDescricao();
});
	
		//ESCONDE
		$('.titulo img').click(function(){
			$('.descricaoQuartos p').hide('fast');
			$('.descricaoQuartos').animate({			
										width:'0px',
										height:'0px'
										});
			$('.descricaoQuartos').animate({
										width:'20px',
										height:'40px'
										});
			return false;
		});
	
	
	
	
	//OPACIDADE QUARTOS
	$('.quarto img').css('opacity',0.5);
	$('.quarto').hover(function(){
			$(this).css('color','#75a4c0')
				   .children('img')
				   .animate({opacity:1});				   
		}, function(){
				$(this).css('color','#666')
					   .children('img')
					   .animate({opacity:0.5});
			});


	///LENGENDA
	$('.legenda').css({
					height:'0px', 
					marginTop:'330px', 
					opacity:0});
					
/*
	$('.quarto').hover(function(){
		var nomeQuarto = $(this).parents('a').attr('rel');
		if($.browser.msie)
		{
			$('.descricaoQuartos').animate({
										//width:'20px',
										height:'300px'})/*
								  .find('p')
								  .hide()*;
								  
			$('.legenda').animate({
								height:'30px',
								opacity:0.9,
								top:'-20px'})
						 .find('.'+nomeQuarto)
						 .css('opacity',1)
						 .fadeIn('slow');
		}
		else{
			$('.descricaoQuartos').animate({
										//width:'20px',
										height:'290px'})/*
								  .find('p')
								  .hide()*;
								  
			$('.legenda').animate({
								height:'30px',
								opacity:0.9,
								top:'-30px',
								zIndex:1000})
						  .find('.'+nomeQuarto)
						  .css('opacity',1)
						  .fadeIn('slow');
                               
		}
	},function(){//some legenda
            $('.legenda').animate({
                              height:'0px',
                              opacity:0,
                              top:'0px'},{queue:false})
                        .find('p')
                        .css('display','none');
                                   
               if($.browser.msie)
               {
                 $('.descricaoQuartos').animate({height:'340px'},{queue:false})
               }
               else{
                 $('.descricaoQuartos').animate({height:'330px'},{queue:false});
               }

	});

*/

//FIM QUARTOS



//PACOTES
$('.pacote').css('opacity',0.5).hover(function(){
          $(this).animate({opacity:1});
     }, function(){
               $(this).animate({opacity:0.5});
          });


//FIM PACOTES






//RESTAURANTES
//opacidade restaurantes

	$('.rest img').css('opacity',0.5).hover(function(){
            $(this).animate({opacity:1});
      }, function(){
            $(this).animate({opacity:0.5});
      });

//FIM RESTAURANTES



//CONTATO

	$('.formContato table td:even').css('textAlign','right');
	
//FIM CONTATO




//IMPRENSA

	$('.loadImprensa').load('press/press.html');
	
//FIM IMPRENSA




//EXPRESS CHECK-INDEX

       $('select').change(function(){
            qtd = $(this).val();
            $('.acompanhante').html('');
            for(i=0;i<qtd;i++)
            {                                             
                  

                  $('.acompanhante').append('<tr><td colspan="2" class="destaque">Documento de Identidade (Acompanhantes '+(i+1)+')</td></tr><tr><td class="alignRight">Nome Completo:</td><td><input type="text" name="Acompanhantes['+i+'][nome]" id="acompanhantes-nome-'+i+'" class="expressNome validate[required]" /></td></tr><tr><td class="alignRight">N&uacute;mero:</td><td><input type="text" name="Acompanhantes['+i+'][numero]" id="acompanhantes-numero-'+i+'" class="validate[onlyNumber] validate[required]" /></td></tr><tr><td class="alignRight">Tipo:</td><td><input type="text" name="Acompanhantes['+i+'][tipo]" class="validate[required]" id="acompanhante-tipo-'+i+'" /></td></tr><tr><td class="alignRight">Org&atilde;o Expeditor:</td><td><input type="text" name="Acompanhantes['+i+'][orgao]" class="validate[required]" id="acompanhante-orgao-'+i+'" /></td></tr><tr><td class="alignRight">Envie sua identidade:</td><td><input type="file" name="Acompanhantes['+i+'][img]" /><br /><span class="fileLegenda">(.jpg, .gif ou .png at&eacute; 200kb)</span></td></tr><tr><td class="alignRight">Data de Nascimento:</td><td><input type="text" name="Acompanhantes['+i+'][nascimento]" id="acompanhante-data-'+i+'" class="datepicker2 validate[required]" /></td></tr><tr><td class="alignRight">E-mail:</td><td><input type="text" name="Acompanhantes['+i+'][email]" id="acompanhante-email-'+i+'" class="validate[required]" /></td></tr>');
            }
            
            date();
            validation();
              
      });

      
      
//RESTAURANTES
      $('.thumb img').click(function(){
            var nomeImg = $(this).attr('alt');
            $('.atlantico img').fadeOut(200, function(){
                  $(this).attr('src','../images/restaurantes/'+nomeImg+'.jpg').fadeIn(200);
            });
      });
      

});
