
function init_bgslide(){

	$.supersized({
				//Functionality
				random					:	1,
				autoplay				:	1,
				transition				:	1, 		//0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
				transition_speed		:	1000,	//Speed of transition
				new_window				:	0,		//Image links open in new window/tab
				keyboard_nav			:	0,		//Keyboard navigation on/off

				//Size & Position
				min_width				:	1024,		//Min width allowed (in pixels)
				min_height				:	700,		//Min height allowed (in pixels)				

				slides					:	IMGS
	}); 
}

function init_function_date(datain, dataout, form, button, idhotel){
			$('#'+datain).datepicker({
				onSelect: function(dateText, inst) {
					$('#'+dataout).datepicker('setDate', '' );
					$(this).trigger('change');
				},
				duration: '',
				altField: '#'+dataout,
				minDate: '+0D', 
				maxDate: '12M31D',
				yearRange: '-0:+1',
				dateFormat: 'dd/mm/yy', 
				showOtherMonths: true,
				firstDay: 1,
				changeMonth: false,
				changeYear: false
			});
			$('#'+dataout).datepicker({
				beforeShow: function(dateText, inst) {
					xd1 = new Date(inst.currentYear, inst.currentMonth, inst.currentDay);
					xd2 = new Date(inst.currentYear, inst.currentMonth, inst.currentDay);
					xd1 = $('#'+datain).datepicker('getDate');
					xd2 = $('#'+datain).datepicker('getDate');
					if (!xd1) xd1=new Date();
					if (!xd2) xd2=new Date();
					xd1.setDate(xd1.getDate()+1);
					xd2.setDate(xd2.getDate()+15);
					$(this).datepicker('option', 'minDate', xd1 );
					$(this).datepicker('option', 'maxDate', xd2 );
				},
				dateFormat: 'dd/mm/yy', 
				duration: '' ,
				minDate: '+0D', 
				maxDate: '12M31D',
				yearRange: '-0:+1',
				showOtherMonths: true,
				firstDay: 1,
				changeMonth: false,
				changeYear: false
			});

	
			$('#'+button).click(function(eve){
				eve.preventDefault();
				var dtin=$('#'+datain).val(); dtin= dtin.replace(/\//g,'-');
				var dtout=$('#'+dataout).val(); dtout= dtout.replace(/\//g,'-');
				if( !dtin || !dtout ){
					alert('Escolha datas válidas para prosseguir!');
					return;
				}
				$('#'+form).attr('action','https://www.gramadosite.com.br/hotel/from:hotel/datain:' +dtin +'/dataout:'+dtout+'/idhotel:'+idhotel+'/lang:pt');
				$('#'+form).submit();
			});

}
function monta_form_reserva(idhotel){

		var  V = '';
/*
		if(!window.jQuery){
			V += '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>';
		}
*/		
		V += '<form id="res_busca" name="res_busca" action="https://www.gramadosite.com.br/hotel/from:hotel/idhotel:'+idhotel+'/lang:pt" method="post" target="_blank">' +
			'<table width="100%" cellspacing="0" cellpadding="0" border="0">' +
			 '<tbody>' +
			 '	<tr valign="middle">' +
			 '		<td height="10" >Data de chegada:</td>' +
			 '		<td class="foot_text">Data de saída:</td>' +
			 '		<td>&nbsp;</td>' +
			 '	</tr>' +
			 '	<tr valign="middle">' +
			 '		<td ><input type="text" size="10" class="res_input" name="res_datain" id="res_datain"></td>' +
			 '		<td ><input type="text" size="10" class="res_input" name="res_dataout" id="res_dataout"></td>' +
			 '		<td ><input type="submit" id="res_btn" value="Reservas On-line"></td>' +
			 '	</tr>' +
			 '</tbody>' +
			'</table>' +
			'</form>';
		
			document.write(V);
		
		// init_function_date('res_datain','res_dataout','res_busca','res_btn', idhotel);
}

acao = 0;
function fullscreen(){

		if(acao == 0)
		{
			$('.barra_sup').animate({ 'top': -140 }, 750);
			$('.rodape').fadeOut(); 
			$('.formReserva').fadeOut(); 
			$('.barra_inf').fadeOut();
			$('#container').fadeOut();
			acao = 1;
			$('#btn_full').html('Voltar');

		}else{
		
			$('.barra_sup').animate({ 'top': 60 }, 1000);
			$('.formReserva').fadeIn();
			$('.rodape').fadeIn();
			$('.barra_inf').fadeIn();
			$('#container').fadeIn();
			$('#btn_full').html('Ver Imagem');
			acao = 0;
		}

}

function atualiza_alvo(halvo){

	H = $(window).height() - 300 
	if(halvo > H) halvo = H;
	
	Halvo = halvo;
	
	alvoT = $(window).height() - (halvo + $('.rodape').height() + 30);
	$('.alvo').animate({ 'height': halvo }, 1000, function(){
		$(this).animate({ 'top': alvoT }, 1000);
		var hDiv = alvoT - $('.barra_inf').height();
		$('.barra_inf').animate({ 'top': hDiv }, 750);
	});
}

$(window).resize(function()
{

	var positionAtual = $('.alvo').position();
	
	H = $(window).height() - 300 
	if(Halvo > H) Halvo = H;

	alvoT = $(window).height() - (Halvo + $('.rodape').height() + 30);

	$('.alvo').animate({ 'height': Halvo }, 500, function()
	{
		$(this).animate({ 'top': alvoT }, 500);
		var hDiv = alvoT - $('.barra_inf').height() - 10;
		$('.barra_inf').animate({ 'top': hDiv }, 750);
	});

});




