var calCheckIn= new CalendarPopup("calendarCheckIn");

calCheckIn.setReturnFunction("showDateCheckIn");

calCheckIn.setDayHeaders('Su','M','Tu','W','Th','F','Sa');

var offsetX=0;

var offsetY=0;

var bn=navigator.platform

var leftmargin=0

var scrheight=0;scrwidth=0;

var bw=navigator.userAgent;

var os="Win"

var ie=false;

var ns=false;

var sf=false;

var fx=false

var op=false;

var mz=false;

scrheight =(window.screen.height);

scrwidth =(window.screen.width);

//alert("scrheight:" +scrheight +" scrwidth:" +scrwidth);

//alert(bw);

if(bn.indexOf("Win32")==-1){os="Mac";}

if(bw.indexOf("Opera")!=-1)

{op=true;}

else if(bw.indexOf("Safari")!=-1)

{sf=true;}

else if(bw.indexOf("Firefox")!=-1)

{fx=true;}

else if(bw.indexOf("MSIE")!=-1)

{ie=true;}

else if(bw.indexOf("Netscape")!=-1 && bw.indexOf("Mozilla")!=-1)

{ns=true;}

else if(bw.indexOf("Mozilla")!=-1)

{mz=true;}

else

{op=true;}

//cal one

var pos=new Array(-50,18,-50,18,-50,18,-50,18,  		// win-ie 800x600;1024x768;1152x864;1280x720 

				  -248,0,-248,0,-248,0,-248,0, 	  		// win-op 800x600;1024x768;1152x864;1280x720

				  550,336,600,336,664,336,730,336,	// win-fx 800x600;1024x768;1152x864;1280x720 

				  550,336,600,336,664,336,730,336,	// win-ns 800x600;1024x768;1152x864;1280x720

				  550,336,600,336,664,336,730,336,	// win-mz 800x600;1024x768;1152x864;1280x720

				   

				 -250,-308,-296,-308,-364,-308,-426,-308,// mac-ie 800x600;1024x768;1152x864;1280x720 

				  -248,0,-248,0,-248,0,-248,0, 	           // mac-op 800x600;1024x768;1152x864;1280x720 

				  550,336,600,336,664,336,730,336,	// mac-fx 800x600;1024x768;1152x864;1280x720 

				  550,336,600,336,664,336,730,336,	// mac-ns 800x600;1024x768;1152x864;1280x720

				  550,336,600,336,664,336,730,336,

				  730,730,730);   // mac-sf 800x600;1024x768;1152x864;1280x720 			

setPos(pos);



function setPos(pos)

{

	if(os=="Win")

	{

		if(ie)

		{

			if(parseInt(scrwidth)=="800" && parseInt(scrheight)=="600") {offsetX=parseInt(pos[0]);offsetY=parseInt(pos[1]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[2]);offsetY=parseInt(pos[3]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[4]);offsetY=parseInt(pos[5]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}

			//alert("X:"+offsetX+"   Y:"+offsetY);

		}

		else if(op)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[8]);offsetY=parseInt(pos[9]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[10]);offsetY=parseInt(pos[11]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[12]);offsetY=parseInt(pos[13]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}

			//alert("X:"+offsetX+"   Y:"+offsetY);



		}

		else if(fx)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[16]);offsetY=parseInt(pos[17]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[18]);offsetY=parseInt(pos[19]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[20]);offsetY=parseInt(pos[21]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[22]);offsetY=parseInt(pos[23]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[23]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[23]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[23]);}

			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );

		}

		else if(ns)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[24]);offsetY=parseInt(pos[25]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[26]);offsetY=parseInt(pos[27]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[28]);offsetY=parseInt(pos[29]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[30]);offsetY=parseInt(pos[31]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[31]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[31]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[31]);}

			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );

		}

		else if(mz)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[32]);offsetY=parseInt(pos[33]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[34]);offsetY=parseInt(pos[35]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[36]);offsetY=parseInt(pos[37]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[38]);offsetY=parseInt(pos[39]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[39]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[39]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[39]);}

			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );

		}

	}

	else if(os=="Mac")

	{

		if(ie)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[40]);offsetY=parseInt(pos[41]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[42]);offsetY=parseInt(pos[43]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[44]);offsetY=parseInt(pos[45]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[46]);offsetY=parseInt(pos[47]);}

			//alert("X:"+offsetX +"Y:" +offsetY);

		}

		else if(op)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[48]);offsetY=parseInt(pos[49]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[50]);offsetY=parseInt(pos[51]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[52]);offsetY=parseInt(pos[53]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[54]);offsetY=parseInt(pos[55]);}

			//alert("X:"+offsetX +"Y:" +offsetY);

		}

		else if(fx)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[56]);offsetY=parseInt(pos[57]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[58]);offsetY=parseInt(pos[59]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[60]);offsetY=parseInt(pos[61]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[62]);offsetY=parseInt(pos[63]);}

			//alert("X:"+offsetX +"Y:" +offsetY);

		}

		else if(ns)

		{

			

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[64]);offsetY=parseInt(pos[65]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[66]);offsetY=parseInt(pos[67]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[68]);offsetY=parseInt(pos[69]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[70]);offsetY=parseInt(pos[71]);}

			//alert("X:"+offsetX +"Y:" +offsetY);

		}

		

		else if(sf)

		{

			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[72]);offsetY=parseInt(pos[73]);}

			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[74]);offsetY=parseInt(pos[75]);}

			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[76]);offsetY=parseInt(pos[77]);}

			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[78]);offsetY=parseInt(pos[79]);}

			//alert("X:"+offsetX +"Y:" +offsetY);

		}

	}

}	

calCheckIn.offsetX = offsetX ;// 55;

calCheckIn.offsetY = offsetY//15;



//calCheckIn.offsetX = 0;

//calCheckIn.offsetY = 35;

function changeDate(varSelectedDate)

{

	var takeDay = parseInt(varSelectedDate.value);

	var SelectedDate = new Date(window.document.quicksearch.checkInDate1.value);

	var dispDate=new Date(parseInt(SelectedDate.getMonth()+1,10) + "/" + (parseInt(SelectedDate.getDate()+takeDay)) + "/" + SelectedDate.getFullYear());

	var dispDay = dispDate.getDate();

	var dispMonth = parseInt(dispDate.getMonth()+1,10);

	var dispYear = dispDate.getFullYear();

	

	// display check out date

	window.document.quicksearch.checkOutDate1.value=dispMonth+"/"+dispDay+"/"+dispYear;

}



function showDateCheckIn(y,m,d)

{

	// display check in date

	window.document.quicksearch.checkInDate1.value=m+"/"+d+"/"+y ;

	var dispNights="";

	var dispDate="";

	var dispMonth ="";

	var dispYear ="";

	var iShowNights ;

	var SelectedDate = new Date(window.document.quicksearch.checkInDate1.value);

	var dtShowCheckOut =new Date(window.document.quicksearch.checkOutDate1.value);

	if (dtShowCheckOut<SelectedDate)

	{

		iShowNights = 1;

	}

	else

	{

		iShowNights = Math.ceil((dtShowCheckOut.getTime() - SelectedDate.getTime())/(1000*60*60*24));

		if (iShowNights > 30) 

		{

			iShowNights = 30;

		}

	}

	window.document.quicksearch.numberOfNights.value = iShowNights;

	dispNights=parseInt(window.document.quicksearch.numberOfNights.value);

	

	dispDate=new Date(parseInt(SelectedDate.getMonth()+1,10) + "/" + (SelectedDate.getDate()+dispNights) + "/" + SelectedDate.getFullYear());

	dispDay = dispDate.getDate();

	dispMonth = parseInt(dispDate.getMonth()+1,10);

	dispYear = dispDate.getFullYear();

	

	// display check out date

	

	window.document.quicksearch.checkOutDate1.value=dispMonth+"/"+dispDay+"/"+dispYear;

}

document.write(calCheckIn.getStyles());



//calendar 2



var calCheckOut= new CalendarPopup("calendarCheckOut");

calCheckOut.setReturnFunction("showDateCheckOut");

calCheckOut.setDayHeaders('Su','M','Tu','W','Th','F','Sa');



var pos=new Array(-50,18,-50,18,-50,18,-50,18,  		// win-ie 800x600;1024x768;1152x864;1280x720 

				  -248,0,-248,0,-248,0,-248,0, 	  		// win-op 800x600;1024x768;1152x864;1280x720

				  550,366,600,366,664,366,730,366,	// win-fx 800x600;1024x768;1152x864;1280x720 

				  550,366,600,366,664,366,730,366,// win-ns 800x600;1024x768;1152x864;1280x720

				  550,366,600,366,664,366,730,366,	// win-mz 800x600;1024x768;1152x864;1280x720

				   

				  -250,-304,-300,-304,-368,-304,-430,-304,// mac-ie 800x600;1024x768;1152x864;1280x720 

				  -248,0,-248,0,-248,0,-248,0, 	           // mac-op 800x600;1024x768;1152x864;1280x720 

				  550,366,600,366,664,366,730,366,// mac-fx 800x600;1024x768;1152x864;1280x720 

				  550,366,600,366,664,366,730,366,// mac-ns 800x600;1024x768;1152x864;1280x720

				  550,366,600,366,664,366,730,366,

				  730,730,730);   // mac-sf 800x600;1024x768;1152x864;1280x720 			

setPos(pos);



calCheckOut.offsetX = offsetX;

calCheckOut.offsetY = offsetY;



function calDatesNights()

{

	var dtCheckIn = new Date(window.document.quicksearch.checkInDate1.value);

	var dtCheckOut = new Date(window.document.quicksearch.checkOutDate1.value);

	var iNights = Math.ceil((dtCheckOut.getTime() - dtCheckIn.getTime())/(1000*60*60*24));

	var displayNights = "";

	if ( dtCheckOut < dtCheckIn )

	{

		var showDate1=new Date(parseInt(dtCheckIn.getMonth()+1,10) + "/" + (dtCheckIn.getDate()+1) + "/" + dtCheckIn.getFullYear());

		window.document.quicksearch.checkOutDate1.value=parseInt(showDate1.getMonth()+1,10)+"/"+showDate1.getDate()+"/"+showDate1.getFullYear();

		iNights = 1;

	}

	if (iNights > 30) 

	{

		displayNights = 30;

		var showDate=new Date(parseInt(dtCheckIn.getMonth()+1,10) + "/" + (dtCheckIn.getDate()+displayNights) + "/" + dtCheckIn.getFullYear());

		window.document.quicksearch.checkOutDate1.value=parseInt(showDate.getMonth()+1,10)+"/"+showDate.getDate()+"/"+showDate.getFullYear();

	}

	else

	{

		displayNights = iNights

	}

	window.document.quicksearch.numberOfNights.value = displayNights;

}

function showDateCheckOut(y,m,d)

{

	/*window.document.quicksearch.checkOutMonth.value = m;

	window.document.quicksearch.checkOutDay.value = d;

	window.document.quicksearch.checkOutYear.value = y;*/

	window.document.quicksearch.checkOutDate1.value=m+"/"+d+"/"+y

	calDatesNights();

	

}

document.write(calCheckOut.getStyles());