<!-- Begin
var firstDate1 = 0;
var lastDate1 = 0;
var firstDate2 = 0;
var lastDate2 = 0;
var prevAr = 0;
var prevDp = 0;
var selectedDate = "#87B6AE";
var prevLastDay = 0;
var prevLastDay2 = 0;
//var arrM = Array();
var ArriveDate = 0;
var DepartDate = 0;
function doGetAvailBox(){
	if(!ArriveDate || ! DepartDate){
		alert("You must pick both an arrival date and a depature date");
	}else{
		document.forms[0].submit();
	}

}

function doGetAvailBox2(){ // this gets the SelectRate with args
	if(!ArriveDate || ! DepartDate){
		alert("You must pick both an arrival date and a depature date");
	}else{
		document.forms[0].submit();
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function maxDays(mm, yyyy){
var mDay;
	if((mm == 3) || (mm == 5) || (mm == 8) || (mm == 10)){
		mDay = 30;
  	}
  	else{
  		mDay = 31
  		if(mm == 1){
   			if (yyyy/4 - parseInt(yyyy/4) != 0){
   				mDay = 28
   			}
		   	else{
   				mDay = 29
  			}
		}
  }
return mDay;
}

var preAr = "";
function changeBg(id){
var ref_arrM = new Array("January","February","March","April","May","June","July","August","September","October","November","December")

	if (eval(id).style.backgroundColor != selectedDate ){
		eval(id).style.backgroundColor = selectedDate 
		if(preAr){
			eval(preAr).style.backgroundColor = "#ffffff"
		}
		baseID = id.replace("sp","");
	//	alert(baseID);
		if(baseID <lastDate1){
			var thisDate = baseID - (firstDate1-1);
			var monthOffset = 0;
		}else{
			var thisDate = baseID - (lastDate1-1);
			var monthOffset = 1;
		}
		//selMonth
		//inyear
		var yearObj = MM_findObj('inyear');
		//alert(yearObj)
		var selectedOption = yearObj.options.selectedIndex;
		//alert(selectedOption);
		var selectedArYear = yearObj.options[selectedOption].text;
		//alert("The Date = "+thisDate +" | The Year = "+selectedArYear);
		var monthObj = MM_findObj('selMonth');
		var selectedOption = monthObj.options.selectedIndex;
		var selectedArMonth = monthObj.options[selectedOption].value;
		selectedArMonth = parseInt(selectedArMonth) + 1 + monthOffset;
		if(thisDate < 1){
			offset = thisDate;
			thisDate = (prevLastDay + offset);
			selectedArMonth = parseInt(selectedArMonth) - 1
		}
		//document.forms[0].selMonth.value = selectedArMonth;
		document.forms[0].inday.value =thisDate;
		document.forms[0].inmonth.value = ref_arrM [selectedArMonth-1];
		//document.forms[0].inyear.value =selectedArYear;
	  //alert("The Date = "+thisDate +" | The Year = "+selectedArYear+" The Month = "+document.forms[0].inmonth.value);
	}
	else{
		eval(id).style.backgroundColor = "#ffffff"
	}	
		ArriveDate = thisDate;
		preAr = id;

}

var preDp = "";
function changeBg2(id){
var ref_arrM = new Array("January","February","March","April","May","June","July","August","September","October","November","December")

	var monthOffet = 0
	if (eval(id).style.backgroundColor != selectedDate ){
		eval(id).style.backgroundColor = selectedDate 
		baseID = id.replace("spb","");
		if(preDp){
			eval(preDp).style.backgroundColor = "#ffffff"
		}
		if(baseID <lastDate2){
			var thisDate = baseID - (firstDate2-1);
			var monthOffet = 0
		}else{
			var thisDate = baseID - (lastDate2-1);
			var monthOffet = 1
		}
		var yearObj = MM_findObj('outyear');
		//alert(yearObj)
		var selectedOption = yearObj.options.selectedIndex;
		//alert(selectedOption);
		var selectedArYear = yearObj.options[selectedOption].text;
		var monthObj = MM_findObj('selMonth2');
		var selectedOption = monthObj.options.selectedIndex;
		var selectedArMonth = monthObj.options[selectedOption].value;
		selectedArMonth = parseInt(selectedArMonth) + 1 + monthOffet ;
		if(thisDate < 1){
			offset = thisDate;
			thisDate = (prevLastDay2 + offset);
			selectedArMonth = parseInt(selectedArMonth) - 1
		}

		//document.forms[0].selMonth2.value = selectedArMonth;
		document.forms[0].outday.value =thisDate;
		document.forms[0].outmonth.value = ref_arrM [selectedArMonth-1];
		//document.forms[0].outyear.value =selectedArYear;
		//alert("The Date = "+thisDate +" | The Year = "+selectedArYear+" The Month = "+ref_arrM [selectedArMonth-1]);

	}
	else{
		eval(id).style.backgroundColor = "#ffffff"
	}	
	DepartDate = thisDate
	preDp = id;
}

function writeCalendar(){
var now = new Date
var dd = now.getDate()
var mm = now.getMonth()
var dow = now.getDay()
var yyyy = now.getFullYear()
var arrM = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var arrY = new Array("2005","2006","2007")
	for (ii=0;ii<=4;ii++){
		arrY[ii] = yyyy - 2 + ii
	}
var arrD = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")

var text = ""
text = ""
text += "<table border='0'>\n"
text += "<tr><td>\n"
text += "<table width=100% border='0' class='table-header'><tr>\n"
text += "<td align=left>\n"
text += "<select name=selMonth onChange='changeCal()' class='form-pulldown'>\n"
	for (ii=0;ii<=11;ii++){
		if (ii==mm){
			text += "<option value= " + ii + " Selected>" + arrM[ii] + "</option>\n"
		}
		else{
			text += "<option value= " + ii + ">" + arrM[ii] + "</option>\n"
		}
	}

text += "</select>\n"
text += "</td>\n"
text += "<td align=right>\n"
text += "<select name=inyear onChange='changeCal()' class='form-pulldown'>\n"
	for (ii=0;ii<=4;ii++){
		if (ii==2){
			text += "<option value= " + arrY[ii] + " Selected>" + arrY[ii] + "</option>\n"
		}
		else{
			text += "<option value= " + arrY[ii] + ">" + arrY[ii] + "</option>\n"
		}
	}
text += "</select>\n"
text += "</td>\n"
text += "</tr></table>\n"
text += "</td></tr>\n"
text += "<tr><td class='table-header'>\n"
text += "<table border=0 cellpadding=0 cellspacing=0 width='100%'>\n"
text += "<tr>\n"
	for (ii=0;ii<=6;ii++){
		text += "<td align=center bgcolor='#FFFFFF'><span class=label>&nbsp;" + arrD[ii] + "&nbsp;</span></td>\n"
	}
text += "</tr>\n"
aa = 0
	for (kk=0;kk<=5;kk++){
		text += "<tr>"
		for (ii=0;ii<=6;ii++){
			text += "<td align=center bgcolor='#FFFFFF'><span id=sp" + aa + " onClick='changeBg(this.id)'>1</span></td>\n"
			aa += 1
		}
		text += "</tr>\n"
	}
text += "</table>\n"
text += "</td></tr>\n"
text += "</table>\n"
text += ""
document.write(text)
changeCal()
}

function changeCal(){

var now = new Date
var dd = now.getDate()
//alert(dd);
var mm = now.getMonth()
var dow = now.getDay()
var yyyy = now.getFullYear()
var currM = parseInt(document.resrvForm.selMonth.value)
var prevM
	if (currM!=0){
		prevM = currM - 1
	}
	else{
		prevM = 11
	}
var currY = parseInt(document.resrvForm.inyear.value)
var mmyyyy = new Date()
mmyyyy.setFullYear(currY)
mmyyyy.setMonth(currM) 
mmyyyy.setDate(1)

if(dd == 31 && mm != currM){
	currM = prevM+1
	mmyyyy.setMonth(currM)
	mmyyyy.setDate(1)
	//alert(mmyyyy)
}

var day1 = mmyyyy.getDay()
	if (day1 == 0){
		day1 = 7
	}

var arrN = new Array(41)



var aa
	for (ii=0;ii<day1;ii++){
		arrN[ii] = maxDays((prevM),currY) - day1 + ii + 1
	}
	aa = 1
	for (ii=day1;ii<=day1+maxDays(currM,currY)-1;ii++){
		arrN[ii] = aa
		aa += 1
	}
	aa = 1
	for (ii=day1+maxDays(currM,currY);ii<=41;ii++){
		arrN[ii] = aa
		aa += 1
	}
	for (ii=0;ii<=41;ii++){
		eval("sp"+ii).style.backgroundColor = "#FFFFFF"
	}
var dCount = 0
//alert(arrN);
	for (ii=0;ii<=41;ii++){
		if (((ii<7)&&(arrN[ii]>20))||((ii>27)&&(arrN[ii]<20))){
			if(arrN[ii] == 1){
				//alert("Last Date Index = "+ii)
				lastDate1 = ii;
			}
			eval("sp"+ii).innerHTML = arrN[ii];
			eval("sp"+ii).className = "c3"
		}
		else{
			eval("sp"+ii).innerHTML = arrN[ii];
			if ((dCount==0)||(dCount==6)){
				eval("sp"+ii).className = "c2"
				if(arrN[ii] == 1){					
					prevLastDay = maxDays((prevM),currY);
					firstDate1 = ii;
				}
			}
			else{
				eval("sp"+ii).className = "c1"
				if(arrN[ii] == 1){
					prevLastDay = maxDays((prevM),currY);
					//alert("FirstDate Index = "+ii)
					firstDate1 = ii;
				}
			}
			if ((arrN[ii]==dd)&&(mm==currM)&&(yyyy==currY)){
				eval("sp"+ii).style.backgroundColor="#90EE90"
			}
		}
	dCount += 1
		if (dCount>6){
			dCount=0
		}
	}
}

function writeCalendar2(){
var now2 = new Date
var dd2 = now2.getDate()
var mm2 = now2.getMonth()
var dow2 = now2.getDay()
var yyyy2 = now2.getFullYear()
var arrM2 = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var arrY2 = new Array()
	for (ii=0;ii<=4;ii++){
		arrY2[ii] = yyyy2 - 2 + ii
	}
var arrD2 = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")

var text2 = ""
text2 = ""
text2 += "<table border='0'>\n"
text2 += "<tr><td class='table-header'>\n"
text2 += "<table width=100% border='0'><tr>\n"
text2 += "<td align=left>\n"
text2 += "<select name=selMonth2 onChange='changeCal2()' class='form-pulldown'>\n"
	for (ii=0;ii<=11;ii++){
		if (ii==mm2){
			text2 += "<option value= " + ii + " Selected>" + arrM2[ii] + "</option>\n"
		}
		else{
			text2 += "<option value= " + ii + ">" + arrM2[ii] + "</option>\n"
		}
	}
text2 += "</select>\n"
text2 += "</td>\n"
text2 += "<td align=right>\n"
text2 += "<select name=outyear onChange='changeCal2()' class='form-pulldown'>\n"
	for (ii=0;ii<=4;ii++){
		if (ii==2){
			text2 += "<option value= " + arrY2[ii] + " Selected>" + arrY2[ii] + "</option>\n"
		}
		else{
			text2 += "<option value= " + arrY2[ii] + ">" + arrY2[ii] + "</option>\n"
		}
	}
text2 += "</select>\n"
text2 += "</td>\n"
text2 += "</tr></table>\n"
text2 += "</td></tr>\n"
text2 += "<tr><td class='table-header'>\n"
text2 += "<table border=0 cellpadding=0 cellspacing=0>\n"
text2 += "<tr>\n"
	for (ii=0;ii<=6;ii++){
		text2 += "<td align=center bgcolor='#FFFFFF'><span class=label>&nbsp;" + arrD2[ii] + "&nbsp;</span></td>\n"
	}
text2 += "</tr>\n"
aaa = 0
	for (kk=0;kk<=5;kk++){
		text2 += "<tr>\n"
		for (ii=0;ii<=6;ii++){
			text2 += "<td align=center bgcolor='#FFFFFF'><span id=spb" + aaa + " onClick='changeBg2(this.id)'>1</span></td>\n"
			aaa += 1
		}
		text2 += "</tr>\n"
	}
text2 += "</table>\n"
text2 += "</td></tr>\n"
text2 += "</table>\n"
text2 += "\n"
document.write(text2)
changeCal2()
}

function changeCal2(){
var now2 = new Date
var dd2 = now2.getDate()
var mm2 = now2.getMonth()
var dow2 = now2.getDay()
var yyyy2 = now2.getFullYear()
var currM2 = parseInt(document.resrvForm.selMonth2.value);
var prevM2
//return
	if (currM2!=0){
		prevM2 = currM2 - 1
	}
	else{
		prevM2 = 11
	}
var currY2 = parseInt(document.resrvForm.outyear.value)
var mmyyyy2 = new Date()
mmyyyy2.setFullYear(currY2)
mmyyyy2.setMonth(currM2)
mmyyyy2.setDate(1)

if(dd2 == 31 && mm2 != currM2){
	currM2 = prevM2+1
	mmyyyy2.setMonth(currM2)
	mmyyyy2.setDate(1)
}

var day12 = mmyyyy2.getDay()
	if (day12 == 0){
		day12 = 7
	}
var arrN2 = new Array(41)
var aa2
	for (ii=0;ii<day12;ii++){
		arrN2[ii] = maxDays((prevM2),currY2) - day12 + ii + 1
	}
	aa2 = 1
	for (ii=day12;ii<=day12+maxDays(currM2,currY2)-1;ii++){
		arrN2[ii] = aa2
		aa2 += 1
	}
	aa2 = 1
	for (ii=day12+maxDays(currM2,currY2);ii<=41;ii++){
		arrN2[ii] = aa2
		aa2 += 1
	}
	for (ii=0;ii<=41;ii++){
		eval("spb"+ii).style.backgroundColor = "#FFFFFF"
	}
var dCount2 = 0
	for (ii=0;ii<=41;ii++){
		if (((ii<7)&&(arrN2[ii]>20))||((ii>27)&&(arrN2[ii]<20))){
			if(arrN2[ii] == 1){
				//alert("Last Date Index = "+ii)
				lastDate2 = ii;
			}
			eval("spb"+ii).innerHTML = arrN2[ii];
			eval("spb"+ii).className = "c3"
		}
		else{
			eval("spb"+ii).innerHTML = arrN2[ii]
			if ((dCount2==0)||(dCount2==6)){
				eval("spb"+ii).className = "c2"
				if(arrN2[ii] == 1){
					//alert("FirstDate Index = "+ii)
					firstDate2 = ii;
					prevLastDay2 = maxDays((prevM2),currY2);
				}
			}
			else{
				eval("spb"+ii).className = "c1"
				if(arrN2[ii] == 1){
					//alert("FirstDate Index = "+ii)
					firstDate2 = ii;
					prevLastDay2 = maxDays((prevM2),currY2);
				}
			}
			if ((arrN2[ii]==dd2)&&(mm2==currM2)&&(yyyy2==currY2)){
				eval("spb"+ii).style.backgroundColor="#90EE90"
			}
		}
	dCount2 += 1
		if (dCount2>6){
			dCount2=0
		}
	}
}
//  End -->