$(document).ready(function() {	
	$('#top_dropDown').change(function() {
		if ($(this).val() != "") {
			window.location.href = $(this).val();
		}
	});
	
	
	$("#callout_booking_start").dynDateTime({				
		dateStatusFunc: dateValidator,
		ifFormat: "%d/%m/%Y"
	});
	
	$("#callout_booking_end").dynDateTime({				
		dateStatusFunc: dateValidator,
		ifFormat: "%d/%m/%Y"
	});
	
	$("#callout_booking_checkin_wrapper a").click(function(e) {
		e.preventDefault();
		$("#callout_booking_start").trigger("click");
	});
	
	$("#callout_booking_checkout_wrapper a").click(function(e) {
		e.preventDefault();
		$("#callout_booking_end").trigger("click");
	});
	
});

$("#random_box").easySlider({
	continuous: true,
	prevText: '',
	nextText: 'next',
	prevId: 'bottom_arrow_prev',
	nextId:  'bottom_arrow',	
	speed: 0
});


function dateValidator(date) {
	var currentTime = new Date()
	var currentMonth = currentTime.getMonth() + 1;
	var currentDay = currentTime.getDate();
	var currentYear = currentTime.getFullYear();
	
	if (date.getFullYear() < currentYear)
		return true;
	else if (date.getFullYear() <= currentYear && (date.getMonth() + 1) < currentMonth)
		return true;
	else if (date.getFullYear() <= currentYear && (date.getMonth() + 1) <= currentMonth && date.getDate() < currentDay)
		return true;
	else return false;
}
