function printDate()
{
					 var now = new Date();
				 var tday = now.getDay();
				 var mth = now.getMonth()+1;
				 var year = now.getFullYear();
				 var date = now.getDate();

				//Day of the week
				 if (tday == '1')
				  {
				   tday = "Monday";
				  }
				   if (tday == '2')
				   {
					tday = "Tuesday";
				   }
				   if (tday == '3')
				   {
					tday = "Wednesday";
				   }
				   if (tday == '4')
				   {
					tday = "Thursday";
				   }
				   if (tday == '5')
				   {
					tday = "Friday";
				   }
				   if (tday == '6')
				   {
					tday = "Saturday";
				   }
				   if (tday == '0')
				   {
					tday = "Sunday";
				   }

				// Months
				 if (mth == '1')
				  {
				   mth = "January";
				  }
				   if (mth == '2')
				   {
					mth = "February";
				   }
				   if (mth == '3')
				   {
					mth = "March";
				   }
				   if (mth == '4')
				   {
					mth = "April";
				   }
				   if (mth == '5')
				   {
					mth = "May";
				   }
				   if (mth == '6')
				   {
					mth = "June";
				   }
				   if (mth == '7')
				   {
					mth = "July";
				   }
				 if (mth == '8')
				  {
				   mth = "August";
				  }
				   if (mth == '9')
				   {
					mth = "September";
				   }
				   if (mth == '10')
				   {
					mth = "October";
				   }
				   if (mth == '11')
				   {
					mth = "November";
				   }
				   if (mth == '12')
				   {
					mth = "December";
				   }

				 var strDate = tday + " ";
				 strDate = strDate + mth + " " + date + ", " + year;

				 document.write(strDate);
}



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 < 100) {
	theYear = "19" + theYear;
	}
else {
	if ((theYear - 100) < 10) {
		theYear = "0" + (theYear - 100);
		}
	else 
		{
		theYear = (theYear - 100) + "";
		}
	theYear = "20" + theYear
}

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)
		{
			
		} else {
			
		}

	  
		}
		else if ((numDays-Dt)<7)
				{
				//hotel search box
				//alert("line 125 " + numDays + " " + Dt);
				if (mthIdx==11)
				{
					
				} else {
					
				}
			
					
				}
		else
			{ 
			//hotel search box -- goes here if dates are in the same month.
			//alert("line 134 " + numDays + " " + Dt);
			
			}

		//document.hotsrchbox.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)
{
 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 bookmarkurl= parent.location.href
var bookmarktitle="HotRateHotels.com"

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function currYear()
{ 
	var today = new Date();
	currYear = today.getFullYear();
	document.write(currYear);
}

function showCal()
	{
	var calWindow = window.open('http://res.hotratehotels.com/nexres/reservations/calendar.cgi?&src=10005359', 'Calendar', 'scrollbars=YES, width=800,height=600');
	calWindow.focus;
	}
	
