//res calendar
function checkfields() {
	var error=0;
    var now = new Date();
    var curMonth = (now.getMonth()+1);
    if (document.formHO.dateLeavingMonth.value < curMonth)
       {theyear = now.getFullYear()+1;}
    else if (document.formHO.dateLeavingMonth.value >= curMonth)
       {theyear = now.getFullYear();}
	 document.formHO.checkin.value=document.formHO.dateLeavingMonth.value+'/'+document.formHO.dateLeavingDay.value+'/'+theyear;
	 document.formHO.checkout.value=document.formHO.dateReturningMonth.value+'/'+document.formHO.dateReturningDay.value+'/'+theyear;

	 /*var theRadioValue=0;
	 for (i=0;i<5;i++) {
	     if (document.formHO.elements[i].checked) {
	         theRadioValue = document.formHO.elements[i].value;
	         break;
	     }
	 }*/

	/* if (theRadioValue==0)
		{alert('Please select the campsite type you would like to search for.');}
	 else
	    {URLVars='id=234&checkin='+document.formHO.checkin.value+'&checkout='+document.formHO.checkout.value+'&adults='+document.formHO.adults.value+'&children='+document.formHO.children.value+'&rooms='+document.formHO.rooms.value+'&selgroupID='+theRadioValue;
		 //window.open('https://secure.guestdesk.com/rooms/?'+URLVars,'RoomReservations','toolbar=no,scrollbars=auto,location=no,resizable=no,directories=no,status=yes,menubar=no,width=790,height=490,screenX=1,screenY=1,top=1,left=1')
		document.formHO.action='https://secure.guestdesk.com/rooms/main.cfm?'+URLVars;
		document.formHO.submit();
		}*/
}

function rePositionCal () {
  var theCoodinates=checkwhere();
  var coodinateArray=theCoodinates.split(":");
  var Xcoodinate=parseInt(coodinateArray[0])-parseInt(document.formHO.offsetX.value)-290;
  var Ycoodinate=parseInt(coodinateArray[1])+parseInt(document.formHO.offsetY.value)-50;
  var ifr = 
    document.all ? document.all['iframeCal'] : 
      document.getElementById('iframeCal');
  ifr.style.top=Ycoodinate+'px';
  ifr.style.left=Xcoodinate+'px';
  //ifr.style.visibility='hidden';
}

function checkwhere(e) {
  // returns the mouse x and y coodinates to position the calendar
        if (document.layers){
        xCoord = e.x;
        yCoord = e.y;
}
        else if (document.all){
        xCoord = event.clientX;
        yCoord = event.clientY;
}
        else if (document.getElementById){
        xCoord = e.clientX;
        yCoord = e.clientY;
}
   return (xCoord+':'+yCoord)
}

function selectradiobutton(thisRadioButton) {
	for (i=formHO.roomGroup.length-1; i > -1; i--) {
		formHO.roomGroup[i].checked = false;
		if (i == thisRadioButton - 1) {
			formHO.roomGroup[i].checked = true;
		}
	}
}
