// JavaScript Document
$(document).ready(function(){
	$('#checkin').datepicker({minDate:0, dateFormat:"dd/mm/yy"});
	$('#checkout').datepicker({minDate:0, dateFormat:"dd/mm/yy"});
/*	$("#location").autocomplete("inc/auto-complete.php", {
			width: 180,
			scroll:true,
			formatResult: function(data,value) {
				return value.split(";")[3];
			}	
			
		});
*/
		$('#frmSearch').submit(function() {
			var noNights = (($("#checkout").datepicker('getDate') - $("#checkin").datepicker('getDate')) / 1000 / 60 / 60 / 24 );
			if ($("#checkin").val() !='' && $("#checkout").val() !='' && noNights < 0) {
				alert('CheckIn date can not be greater than CheckOut date');
				return false;
			} else if ($("#checkin").val() !='' && $("#checkout").val() !='' && noNights ==0) {
				alert('CheckIn and CheckOut can not be on the same day');
				return false;
			}
		});
});

/*function checkLocation() {
	if (document.frmSearch.location.value=="") {
		alert('Please correct the following problems to search:\n- You must select a location name from list.');
		return false;
	}   
}
*/
/***************  Google Analytics  *************/
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-10148344-1");
pageTracker._trackPageview();
} catch(err) {}

/****** google analytics end here */

