
jQuery(document).ready(function(){
	jQuery(".totop").click(function() {
		jQuery("html, body").animate({ scrollTop:0 });
		return false;
	});
	jQuery('.promocode').click(function(){
		jQuery('.promodropdown').toggle();
		jQuery('.promocode').toggleClass('active');
	});
});

date = new Date();
arrDay = date.getDate();
arrMonth = date.getMonth ();
arrYear = date.getFullYear();

jQuery(document).ready(function(){
	console.log("test");

	// Datepicker arrival date init
	jQuery('#date_arr').datepicker({
		dateFormat: 'dd/mm/yy',
		defaultDate: 0,
		minDate: 0,
		firstDay: 1,
		changeMonth: true,
		changeYear: true,
		yearRange: '-1:+1',
		showOn: 'both', 
		buttonImage: '/themes/apollo/images/icons/cal.png',
		buttonImageOnly: true,
		hideIfNoPrevNext: true,
		// Set minDate on departure date when calendar closes
		onClose: function(dateText, inst) {
			inst.selectedDay = inst.selectedDay * 1;
			arrDay = inst.selectedDay;
			arrMonth = inst.selectedMonth;
			arrYear = inst.selectedYear;
			jQuery('#date_dep').datepicker('option',	'minDate', new Date (inst.selectedYear, inst.selectedMonth, inst.selectedDay +1));
		}
	});
	
	console.log("test2");
	
	// Datepicker departure date init
	jQuery('#date_dep').datepicker({
		dateFormat: 'dd/mm/yy',
		defaultDate: +1,
		minDate: 1,
		firstDay: 1,			
		changeMonth: true,
		changeYear: true,
		yearRange: '-1:+1',
		showOn: 'both', 
		buttonImage: '/themes/apollo/images/icons/cal.png',
		buttonImageOnly: true,
		hideIfNoPrevNext: true
	});
	jQuery('#date_arr').datepicker('setDate', new Date);
	jQuery('#date_dep').datepicker('setDate', +1);
	
	console.log("test3");
	
});

function update()
{
	document.getElementById('arrive').value=document.getElementById('date_arr').value;
}

function update2()
{
	document.getElementById('depart').value=document.getElementById('date_dep').value;
}

function updateDeparture(datum)
{
	bar = datum.options[datum.selectedIndex].value;
	bar = bar * 1;
	jQuery('#date_dep').datepicker('setDate', new Date(arrYear,arrMonth,arrDay+bar));
	update2();
}
