var AndinaLib = 

{	

	main : {

		init : function() {

//			AndinaLib.slide.init(); // es el init del slide de la parte posterior
			AndinaLib.cycle.init();
			AndinaLib.newcalendar.init();	
			AndinaLib.dato.init();				
		}

	},	


	/** << Set toggle

	* ---------------------*/
/*
//COMENTADO LA FUNCION DEL SLIDE
	slide : {

		init : function() {

			$(function(){

				$('#bottom-hover').hoverIntent(

					function () {

						$('#slide-top').animate({ top: '-140px' }, 600);				

						$('.content-menu .titulo').css('color','#ff6600');//animate({ "color": "#ff6600" },1).delay(1000).animate({ "color": "#fffccc" }, 1500);

					//	$('.content-menu .img').css('display','block');

					}, 

					function () {

						$('#slide-top').animate({ top: '0px' }, 600 );		

						$('.content-menu .titulo').css('color','#a3a394');//animate({ backgroundColor: "#FCFCD8" },1).delay(1000).animate({ backgroundColor: "#EFEAEA" }, 1500);

//						$('.content-menu .img').css('display','none');

					}

				);			

			});

		}

	},

	*/

	

	/** << Set toggle

	* ---------------------*/

	cycle : {

	init : function() {

		$('.text-img').cycle({

				fx: 'fade',

				timeout: 5000

		});

		$('#animacion').cycle({

				fx: 'fade',

				timeout: 5000

		});

		}

	},

			

	newcalendar :{	

	init : function() {

		$(function(){					

			$( "#datepicker" ).datepicker( "option", "showAnim", "fadeIn");

			$( "#datepicker" ).datepicker();

			var date = new Date();

			var m = date.getMonth(), d = date.getDate()+1, y = date.getFullYear();

			d2 = date.getDate()+2;			

		

			$( "#txtCI_1" ).datepicker( "option", "showAnim", "fadeIn");

			$( "#txtCI_1" ).datepicker({ minDate: new Date(y, m, d),dateFormat: 'dd-mm-yy', showOtherMonths: false,

				selectOtherMonths: false,constrainInput: true });

			$( "#txtCI_1" ).datepicker();

			$( "#txtCO_1" ).datepicker( "option", "showAnim", "fadeIn");

			$( "#txtCO_1" ).datepicker({ minDate: new Date(y, m, d2),dateFormat: 'dd-mm-yy', showOtherMonths: false,

				selectOtherMonths: false });	

		});

		}

	},						

								

	dato :{	

		 init : 

			 	function() {					

									function changeDateCO(id){

										var currCI_date = $( "#txtCI_"+id ).val();

										if(currCI_date!=""){

										var arrayCI_date = currCI_date.split("-");

										var dci = parseInt(arrayCI_date[0]);

										var mci = parseInt(arrayCI_date[1]);

										var yci = parseInt(arrayCI_date[2]);

								

										 $('#txtCO_'+id).datepicker("setDate", new Date(yci,mci-1,dci+1) );

										}else{

											$('#txtCO_'+id).val('Check-out');

										}

									}

									

									function changeDateCOEsp(id){

										var currCI_date = $( "#txtCI_"+id ).val();

										if(currCI_date!=""){

											var arrayCI_date = currCI_date.split("-");

											var dci = parseInt(arrayCI_date[0]);

											var mci = parseInt(arrayCI_date[1]);

											var yci = parseInt(arrayCI_date[2]);

									

											$('#txtCO_'+id).datepicker("setDate", new Date(yci,mci-1,dci+1) );

										}else{

											$('#txtCO_'+id).val('Salida');

										}

									}

									/*

									function validateSearch(id){

										$('#form_busqueda'+id).submit();

									}*/

					

				}

	}

}

AndinaLib.main.init();

function promotion(idioma){
	switch(idioma){
		case 1: 
			location.href="http://www.casa-andina.com/peru/ofertas/ofertas.php";	
		break;
			case 2:
		location.href="http://www.casa-andina.com/peru/ofertas/ofertas.php";
		break;
	}
}

function goReservations(lang){
	//location.href="https://reservations.casa-andina.com/rr1.php?xi="+lang;	
	location.href="http://www.casa-andina.com/peru/ofertas/ofertas.php";	
	}

	 

function closeProm(idioma){
	switch(idioma){
		case 1: 
		//document.getElementById("promotion_esp").visibility="hidden";	
			document.getElementById("flyer-home").style.display="none";	
		break;
		case 2:
			document.getElementById("flyer-home").style.display="none";	
		break;
	}


}

function facebookCA(){
		location.href="http://www.facebook.com/casaandina?sk=app_133395713410198";	

}
