// JavaScript Document
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->


<!--

function selectDate()
{
  var now = new Date();
  var mth = now.getMonth();
  var dd = now.getDate();

  if (mth < 10)
   {
     mth == 0 + mth;
    }
  if (dd < 10)
   {
     dd == 0 + dd;
   }
  if (dd >= 30)
   {
    document.resrvForm.doa_mm.selectedIndex = mth;
    document.resrvForm.doa_dd.selectedIndex = dd - 1;
    document.resrvForm.dod_dd.selectedIndex = dd - dd;
    document.resrvForm.dod_mm.selectedIndex = mth + 1;
   //alert(mth + 1);
   }
  else
   {
  	document.resrvForm.doa_mm.selectedIndex = mth;
  	document.resrvForm.doa_dd.selectedIndex = dd;
  	document.resrvForm.dod_mm.selectedIndex = mth;
  	document.resrvForm.dod_dd.selectedIndex = dd + 1;
  }

  document.resrvForm.city.focus();

 }

function IsLeapYear(yrStr)
{
 var leapYear = false;
 var year = parseInt(yrStr, 10);
 if (year%4 == 0) 
  { 
	leapYear = true;
	if (year%100 == 0)
	 {
	  leapYear = false;
	  if (year%400 == 0)
	   {
	    leapYear = true;
		}
	  }
   }
  return leapYear;
 }


function getDaysInMonth(mthIdx, yrStr) 
{
 var maxDays = 31;
 if (mthIdx == 1)
	{
	 if (IsLeapYear(yrStr))
	   { 
	    maxDays = 29;
	   }
	 else
		{
		  maxDays = 28;
		}
     }
 if (mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10)
	{
	 maxDays = 30;
	 }
 return maxDays;
}

function adjustDate(mthIdx, Dt, initDate)
{
var value = 0;

var today = new Date();
var theYear = parseInt(today.getYear(),10);

if (mthIdx < today.getMonth()) {
	theYear = (parseInt(today.getYear(),10) + 1);
}
if (theYear < 1000)//IE check
{
	if (theYear < 100) {
		theYear = "19" + theYear;
		}
	else {
		if ((theYear - 100) < 10) {
			theYear = "0" + (theYear - 100);
			}
		else 
			{
			theYear = (theYear - 100) + "";
			}
		theYear = "20" + theYear
	}
}
document.resrvForm.doa_year.value = theYear ;
document.resrvForm.dod_year.value = theYear ;
//Set the year


var numDays = getDaysInMonth(mthIdx, theYear);

 
// checks whether to initialize date or not.
if (initDate == 1) 
	{
	  // only goes here if seven days left in the month.
	  if ((numDays-Dt)==7)
		{
		//hotel search box
		//alert("line 116 " + numDays + " " + Dt);
		if (mthIdx==11)
		{
			document.resrvForm.doa_mm.options.selectedIndex = mthIdx;
			document.resrvForm.dod_mm.options.selectedIndex = 0;
		} else {
			document.resrvForm.doa_mm.options.selectedIndex = mthIdx;
			document.resrvForm.dod_mm.options.selectedIndex = mthIdx+1;
		}

	    document.resrvForm.doa_dd.options.selectedIndex = numDays - 1;
	    document.resrvForm.dod_dd.options.selectedIndex =  7 - (numDays - Dt);
		}
		else if ((numDays-Dt)<7)
				{
				//hotel search box
				//alert("line 125 " + numDays + " " + Dt);
				if (mthIdx==11)
				{
					document.resrvForm.doa_mm.options.selectedIndex = 0;
					document.resrvForm.dod_mm.options.selectedIndex = document.resrvForm.doa_mm.options.selectedIndex;
				} else {
					document.resrvForm.doa_mm.options.selectedIndex = mthIdx+1;
					document.resrvForm.dod_mm.options.selectedIndex = document.resrvForm.doa_mm.options.selectedIndex;
				}
			
				document.resrvForm.doa_dd.options.selectedIndex = 6 - (numDays - Dt);
				document.resrvForm.dod_dd.options.selectedIndex = 7 - (numDays - Dt);	
				}
		else
			{ 
			//hotel search box -- goes here if dates are in the same month.
			//alert("line 134 " + numDays + " " + Dt);
			document.resrvForm.doa_mm.options.selectedIndex = mthIdx;
			document.resrvForm.doa_dd.options.selectedIndex = (Dt - 1) + 7;
			document.resrvForm.dod_mm.options.selectedIndex = document.resrvForm.doa_mm.options.selectedIndex;
			document.resrvForm.dod_dd.options.selectedIndex = (Dt - 1) + 8;
			}

		//document.resrvForm.city.focus();

		}
else
	{		
	if (mthIdx == 1)
		{
		if (Dt.options.selectedIndex + 1 < numDays) 
			{
			return 0;
			}
		else
			{
			Dt.options.selectedIndex=numDays - 1;
			if (numDays == 29)
				{
				return 99;
				}
			else
				{
				return 1;
				}
			}
		}
	 if (Dt.options.selectedIndex + 1 < numDays)
		{
		value = 0;
		}
	 else
		{
		if (Dt.options.selectedIndex + 1 > numDays)
			{
			Dt.options.selectedIndex--;
			value = 3;
			}
		else
			{
			value = 2;
			}
		}
	 return value;
	}
}


function amadChange(inM, inD, outM, outD, inY, outY)
{
//@Desc - need to set the year based what the user has selected.
  var jnow = new Date();
  var jmth = jnow.getMonth();
  var jdate = jnow.getDate();
  var inY = "2005" ;
  var outY = "2005"; 
  if (inM.options.selectedIndex <= jmth)
	{
		if (inD.options[inD.options.selectedIndex].value < jdate)
		{
			inY = jnow.getFullYear() + 1 ;
			outY = jnow.getFullYear() + 1 ;
			
			
		}
		else
		{
			inY = jnow.getFullYear() ;
			outY = jnow.getFullYear() ;	
			
		}
	}else
	{
			inY = jnow.getFullYear() ;
			outY = jnow.getFullYear();
			
	}
	document.resrvForm.doa_year.value = inY;
	document.resrvForm.dod_year.value = outY;
	
 var res = adjustDate(inM.options.selectedIndex, inD, 0);
 if (res != 0 )
	{
		outD.options.selectedIndex = 0;
		if (outM.options.selectedIndex == 11) {
			outM.options.selectedIndex = 0;
			}
		else {
			outM.options.selectedIndex = inM.options.selectedIndex + 1;
			}
		}
 else
	{
	outM.options.selectedIndex = inM.options.selectedIndex;
	outD.options.selectedIndex = inD.options.selectedIndex + 1;
	}
return;
}

function initDate()
{
	var today = new Date();
	var currMth = today.getMonth();
	var currDate = today.getDate();

	var mth = document.resrvForm.doa_dd.options.selectedIndex = currMth;
	var Dt = document.resrvForm.doa_dd.options.selectedIndex = currDate;
	adjustDate(mth, Dt, 1);
}


function currYear()
{ 
	var today = new Date();
	currYear = today.getFullYear();
	document.write(currYear);
}

//-->
