// JavaScript Document
function showrate() {
	document.getElementById("description").style.display="none";
	document.getElementById("rate").style.display="block";
	document.getElementById("desclink").className="";
	document.getElementById("ratelink").className="current";
}

function showdesc() {
	document.getElementById("rate").style.display="none";
	document.getElementById("description").style.display="block";
	document.getElementById("ratelink").className="";
	document.getElementById("desclink").className="current";
}

function changethumb(houseimage) {
	document.getElementById("bigpics").src=houseimage;
} 

var scenes=new Array(); 
scenes[0]="image/carousel1.jpg";
scenes[1]="image/pier.jpg";
scenes[2]="image/kid1.jpg";
scenes[3]="image/sunset1.jpg";
scenes[4]="image/pelican.jpg";
var num=0; 

function getslide() {
	document.getElementById("slideshow").src=scenes[num];
	num++;
	if(num>=scenes.length){ 
		num=0;
	}
	setTimeout("getslide()",2000);
}

function rentalpopup(housenumber) {
	window.open("rental_Pop_up.php?houseid="+housenumber,null,"height=600,width=780,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function showCalendar(formname, inputname){
	dateUpdateTargetForm=formname; 
	dateUpdateTarget=inputname;
	$('datePickerBox').style.left = posX + "px";
	$('datePickerBox').style.top = posY + "px";
	$('datePickerBox').style.display = "block";
}

/**
 * @function: getMouseCoordinates
 * @description: continuously gets mouse coordinates and also calculates the relative mouse coordinates.
 * 				 If dragging is turned on, also move the selected object
 * @param: event
 * @dependency: sets global variable value posX and posY
 * @return: none
 */
var posX = null;
var posY = null;
function getMouseCoordinates(e){

	if(!e) var e = window.event;
	
	// get absolute mouse position
	if (e.pageX || e.pageY)
	{
		posX = e.pageX;
		posY = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posX = e.clientX + document.body.scrollLeft;
		posY = e.clientY + document.body.scrollTop;
	}
	
}
// end function

function checkSearchForm(myForm){
	if(myForm.arrivaldate.value == ""){
		alert('Please choose an arrival date');
		return false;
	}
	else if(myForm.departuredate.value == ""){
		alert('Please choose a departure date');
		return false;
	}
	else{
		return true;
	}
}