var now = new Date();

var dates = new Array();

var dateNames = new Array( "Check In", "Check Out" );

var initialNights = 7;
var daysAdjustment = 0;

var templatePrinted = false;

var includeNumber = 0;

var formBreak = 0;
var startInPast = 0;
var endInFuture = 5;

function array()
{
    for (i = 0; i< array.arguments.length; i++)
	{
		this[i] = array.arguments[i];
		this.length = array.arguments.length;
	}
}

var useMonthNames = true;
var monthNames = new array('January','February','March','April','May','June','July','August','September','October','November','December' );
var abbrMonthNames = new array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' );
var monthNums = new array('01','02','03','04','05','06','07','08','09','10','11','12' );
var daysOfWeek = new array('Su','Mo','Tu','We','Th','Fr','Sa');

function buildMonth(name, days)
{
	this.name = name;
	this.days = days;
}

function buildMonths(year) 
{
	var array = monthNames;
	
    for (i = 0; i< array.length; i++)
	{
        this[i] = new buildMonth( array[i], 32 - new Date(year, i, 32).getDate() );
		this.length = array.length;
	}
}

var months = null;

function calendarMonth( id )
{
	output = "<select name='Check" + dateType(id) + "_Month' onchange='changeDates(\"" + id + "\");' style='font-size: " + inputFontSize + ";'>";
	
	for ( var i = 0; i < months.length; i++ )
	{
		var selected = "";
		if ( i == dates[id].getMonth() )
			selected = "SELECTED";

		if ( useMonthNames )
			var name = months[i].name;
		else
			var name = zeroPad(i + 1);
			
		output += "<option value='" + i + "' " + selected + ">" + name + "</option>";
	}
	
	output += "</select> ";
	
	return output;
}

function calendarDate(id)
{
	output = "<select name='Check" + dateType(id) + "_Date' onchange='changeDates(\"" + id + "\");' style='font-size: " + inputFontSize + ";'>";
	
	for ( var i = 1; i <= months[dates[id].getMonth()].days; i++ )
	{
		var selected = "";
		if ( i == dates[id].getDate() )
			selected = "SELECTED";
			
		output += "<option value='" + i + "' " + selected + ">" + i + "</option>";
	}
	
	output += "</select> ";
	
	return output;
}

function calendarYear(id)
{
	output = "<select name='Check" + dateType(id) + "_Year' onchange='changeDates(\"" + id + "\");' style='font-size: " + inputFontSize + ";'>";
	
	for ( var i = now.getFullYear() - startInPast; i < now.getFullYear() + endInFuture; i++ )
	{
		var selected = "";
		if ( i == dates[id].getFullYear() )
			selected = "SELECTED";
			
		output += "<option value='" + i + "' " + selected + ">" + i + "</option>";
	}
	
	output += "</select> ";
	
	return output;
}

function fillCalendar(id)
{	
	if ( !document.getElementsByName( "Check" + dateType(id) + "_Year")[0] )
	{
		dates[id] = new Date();
		dates[id].setHours(0);
		dates[id].setMinutes(0);
		dates[id].setSeconds(0);
		dates[id].setMilliseconds(0);
		
		if ( resFormObj && resFormObj.resVars && resFormObj.resVars["Check" + dateType(id) + "_Month"] && resFormObj.resVars["Check" + dateType(id) + "_Month"] != "" )
		{
			dates[id].setDate(resFormObj.resVars["Check" + dateType(id) + "_Date"]);
			dates[id].setMonth(resFormObj.resVars["Check" + dateType(id) + "_Month"]);
			dates[id].setFullYear(resFormObj.resVars["Check" + dateType(id) + "_Year"]);
		}
	}
	
	months = new buildMonths( dates[id].getFullYear());
	
	var output = "";
	
	output += calendarMonth(id);
	output += calendarDate(id);
	output += calendarYear(id);
	
	document.getElementById("calendar_" + id ).innerHTML = output;
}

function dateType(id)
{
	if ( id == 0 )
		return "in";
	else if ( id == 1 )
		return "out";
	else if ( id == 2 )
		return "wedding";
	else
		return id;
	
}

var maxNights = 99;
var altMaxNightsMessage = "";

function changeDates( id )
{
	var potentialDate = new Date(document.getElementsByName("Check" + dateType(id) + "_Year")[0].value, 0, 1, 0, 0, 0, 0 );

	months = new buildMonths( potentialDate.getFullYear());

	if ( document.getElementsByName("Check" + dateType(id) + "_Date")[0].value > months[document.getElementsByName("Check" + dateType(id) + "_Month")[0].value].days )
		potentialDate.setDate( months[document.getElementsByName("Check" + dateType(id) + "_Month")[0].value].days );
	else
		potentialDate.setDate( document.getElementsByName("Check" + dateType(id) + "_Date")[0].value );
	
	potentialDate.setMonth( document.getElementsByName("Check" + dateType(id) + "_Month")[0].value );
	potentialDate.setFullYear( document.getElementsByName("Check" + dateType(id) + "_Year")[0].value );

	// START check
	var checked = true;
	
	if ( id == 0 )		// start date has changed
	{
		if ( document.getElementsByName("Number_of_nights")[0] )  // has number of nights
		{
			document.getElementsByName("Number_of_nights")[0].selectedIndex = daysDifference( dates[0], dates[1] ) - 1 - daysAdjustment;
			dates[id].setTime(potentialDate.getTime());
			fillCalendar(id);	
			changeNights();
			return;
		}
		else // no number of nights, likely just using the calendar for a single date, not a date range
		{
			dates[id].setTime(potentialDate.getTime());
			fillCalendar(id);	
			return;
		}
	}
	else if ( id == 1 )	// end date has changed
	{
		if ( potentialDate <= dates[0] && daysDifference( dates[0], potentialDate ) >= Math.abs(daysAdjustment) )
		{
			alert( "Your " + dateNames[0] + " date must be after your " + dateNames[1] + " date" );
			checked = false;
		}
		
		if ( daysDifference( dates[0], potentialDate ) > maxNights )
		{
			if ( altMaxNightsMessage != "" )
				alert( altMaxNightsMessage );
			else
				alert( "Your stay can be at most " + maxNights + " nights" );
			checked = false;
		}
	}
	
	// END check
			
	if ( checked )
	{
		dates[id].setTime(potentialDate.getTime());
	}
	
	if ( id == 1 )
	{
		document.getElementsByName("Number_of_nights")[0].selectedIndex = daysDifference( dates[0], dates[1] ) - 1 - daysAdjustment;
		//document.getElementsByName("Number_of_nights")[0].value = daysDifference( dates[0], dates[1] ) - 1 - daysAdjustment;
	}
	
	fillCalendar(id);	
}

function changeNights()
{
	if ( dates[0] && dates[1] )
	{
		dates[1].setTime( dates[0].getTime() );
		
		while ( daysDifference( dates[0], dates[1] ) < document.getElementsByName("Number_of_nights")[0].value )
		{
			dates[1].setDate( dates[1].getDate() + 1 );
		}
		
		dates[1].setDate( dates[1].getDate() + daysAdjustment );
	
		fillCalendar(1);	
	}
}

function inputNumber( name, min, max, defaultNumber, increment, extra )
{
	var output = "<select name='" + name + "' " + extra + " style='font-size: " + inputFontSize + ";'>";
	
	for ( var i = min; i <= max; i += increment )
	{
		var selected = "";
		if ( i == defaultNumber )
			selected = "SELECTED";
			
		output += "<option value='" + i + "' " + selected + ">" + i + "</option>";
	}
	
	output += "</select>";
	
	return output;	
}

function daysDifference( date1, date2 )
{
	var startDate = new Date();
	var endDate = new Date();
	
	date1.setHours( 0 );
	date1.setMinutes( 0 );
	date1.setSeconds( 0 );
	date1.setMilliseconds( 0 );
	
	date2.setHours( 0 );
	date2.setMinutes( 0 );
	date2.setSeconds( 0 );
	date2.setMilliseconds( 0 );
	
	if ( date1 == date2 )
	{
		return 0;
	}
	else if ( date1 < date2 )
	{
		startDate.setTime(date1.getTime());
		endDate.setTime(date2.getTime());
	}
	else 
	{
		startDate.setTime(date2.getTime());
		endDate.setTime(date1.getTime());
	}
	
	var days = 0;
	
	while ( startDate < endDate )
	{
		startDate.setDate( startDate.getDate() + 1 );
		days++;
	}
	
	return days;
}

function inputBreak()
{
	var output = "<input type='hidden' name='formBreak_" + formBreak + "' value='' />";
	formBreak++;
	return output;
}

function fillRooms()
{
  var i = 1;
  
  var output = '';

  for ( i = 1; i <= document.getElementsByName("Number_of_Rooms")[0].value ; i++ )
  {
  	output += inputBreak() + "<input type='hidden' name='Room #" + i + "' value='' />";

  	output += "<table border='0' cellpadding='4' cellspacing='0' style='margin: auto; ";
	
	if ( resFormObj.hotel )
		output += "	border: solid 1px #000000;";
		
		output += "'>";
		
	if ( resFormObj.hotel )
		output += "<tr><td colspan='4' style='padding: 3px; font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: center;'>Room " + i + "</td></tr>";
		
  	output += "<tr>";
		
		if ( resFormObj.rooms.length >= 1 )
		{
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Room Type:</td><td style='text-align: left; padding-right: 30px;'>" + roomTypeList( resFormObj, i ) + "</td>";
			var alignment = "center";
		}
		else
		{
			output += "<td></td><td></td>";
			var alignment = "right";
		}
			
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Number of Adults:</td><td style='text-align: left; padding-right: 20px;'>" + inputNumber( "Room_" + i + "_Number_of_Adults", 1, 6, ( ( resFormObj.resVars["num_adults"] ) ? resFormObj.resVars["num_adults"] : 2 ), 1, "" ) + "</td>";
    output += "</tr><tr>";
	
	if ( resFormObj.hotel )
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Smoking or Non:</td><td style='text-align: left; padding-right: 30px;'><select style='font-size: " + resFormObj.inputFontSize + "; width: " + resFormObj.inputWidth + ";' name='Room_" + i + "_Smoking'><option value='no'>Non-Smoking</option><option value='yes'>Smoking</option></select></td>";
	else
		output += "<td></td><td></td>";
		
    	output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Number of Children:</td><td style='text-align: left;'>" + inputNumber( "Room_" + i + "_Number_of_Children", 0, 6,  ( ( resFormObj.resVars["num_children"] ) ? resFormObj.resVars["num_children"] : 0 ), 1, "onchange='add_child(this, " + i + ");'" ) + "</td></tr>";
	output += "<tr><td colspan='4' style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right; padding-right: 13px;'><div id='children_info_" + i + "'></div></td></tr>";
	
	if ( resFormObj.hotel )
		output += "<tr><td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right; vertical-align: top; padding-left: 20px;'>Room comments:</td><td colspan='3' style='padding-right: 19px;'><textarea name='Room_" + i + "_Comment' style='width: 100%; height: 60px;'></textarea></td></tr>";
	
	output += '<tr><td></td></tr></table>';    
	output += "<img src='images/spacer.gif' height='5' width='1' /><br />";
  }

  document.getElementById("roomInfo").innerHTML = output;
  
  for ( i = 1; i <= document.getElementsByName("Number_of_Rooms")[0].value ; i++ )
	  add_child(document.getElementsByName("Room_" + i + "_Number_of_Children")[0], i);
}

function roomTypeList( resObj, roomNumber )
{
	var output = "<select name='Room_" + roomNumber + "_Type' style='font-size: " + resObj.inputFontSize + ";'>";
	
	for ( var i = 0; i < resObj.rooms.length; i++ )
	{
		if ( resObj.rooms[i].match( resObj.resVars["roomNick"] ) )
			var selected = " SELECTED ";
		else
			var selected = "";
			
		output += "<option value='" + resObj.rooms[i] + "' " + selected + ">" + resObj.rooms[i] + "</option>";
	}
	
	output += "</select>";
	
	return output;	
}
function add_child(children, roomNumber)
{
	var output = "";
	for ( var i = 1; i <= children.value; i++ )
	{
		output += "Child #" + i + " Age: ";
		output += inputNumber( "Room_" + roomNumber + "_Child_" + i + "_Age", 0, 18, 0, 1, "" );
		output += "<br />";
	}
	
	document.getElementById('children_info_' + roomNumber ).innerHTML = output;
}

function blanko()
{
}

function GUIMonth( calendarDate, todayDate )
{
	months = new buildMonths(calendarDate.getFullYear());
	
	var output = "<table cellspacing='2' cellpadding='0' border='0' style='border: solid 1px #000000;'>";
	
	output += "<tr><td colspan='7' class='cal_title'>" + months[calendarDate.getMonth()].name + " " + calendarDate.getFullYear() + "</td></tr>";

	output += "<tr>";
	for ( var i = 0; i < daysOfWeek.length; i++ )
	{
		output += "<td class='cal_dow'>" + daysOfWeek[i] + "</td>";
	}
	output += "</tr>";
	
	
	var startDay = new Date( calendarDate.getFullYear(), calendarDate.getMonth(), 1 ).getDay() - 1;
	
	for ( var i = 0; i < 6; i++ )
	{
		output += "<tr>";
		for ( var j = 0; j < daysOfWeek.length; j++ )
		{
			if ( i*daysOfWeek.length + j > startDay && i*daysOfWeek.length + j - startDay <= months[calendarDate.getMonth()].days )
			{
				var currentDate =  (i*daysOfWeek.length + j - startDay);
				
				var style="";
				
				if ( GUIid == undefined )
				{
					GUIid = 100;
					if ( todayDate == undefined )
						dates[GUIid] = new Date();
					else
						dates[GUIid] = todayDate;
				}
					
				if ( calendarDate.getFullYear() == dates[GUIid].getFullYear() && calendarDate.getMonth() == dates[GUIid].getMonth() && currentDate == dates[GUIid].getDate() )
					style = "style='color: #DD0000;'";
					
				if ( GUIid == undefined )
					var link = "handleDateRequest(" + calendarDate.getFullYear() + "," + calendarDate.getMonth() + "," + currentDate + ");";
				else
					var link = "GUIChooseDate(" + calendarDate.getFullYear() + "," + calendarDate.getMonth() + "," + currentDate + ");";
				
				output += "<td><a class='cal_ondate' id='" + calendarDate.getFullYear() + "_" + calendarDate.getMonth() + "_" + currentDate + "' " + style + " href='javascript: " + link + "'> " +  currentDate + "</a></td>";
			}
			else
				output += "<td><a class='cal_ondate'>&nbsp;</a></td>";
		}
		output += "</tr>";
	}
	
	output += "</table>";
	
	return output;
}

var GUIid;
var GUIincrement;

function GUICalendar(id)
{
	GUIid = id;
	GUIincrement = 0;
	
	GUIChangeMonths(0);
	
	var targetLeft = Math.min( ( 1*0 + getElementPosition( document.getElementById( "calendar_" + id + "_GUIanchor" ), "left" ) ), getFrameWidth() - document.getElementById( "GUICalendarObject" ).offsetWidth - 20 );  // the 20 is for the scrollbar width
				
	document.getElementById( "GUICalendarArea" ).style.paddingLeft = targetLeft + "px";
	document.getElementById( "GUICalendarArea" ).style.paddingTop = (1*3 + getElementPosition( document.getElementById( "calendar_" + id + "_GUIanchor" ), "top" )) + "px";
	document.getElementById( "GUICalendarArea" ).style.zIndex = 5;
	document.getElementById( "GUICalendarArea" ).style.visibility = "visible";

	if ( msie )
	{	
		document.getElementById( "subFrame" ).style.zIndex = document.getElementById( "GUICalendarArea" ).style.zIndex - 1;
		document.getElementById( "subFrame" ).style.left = document.getElementById( "GUICalendarArea" ).style.paddingLeft;
		document.getElementById( "subFrame" ).style.top = document.getElementById( "GUICalendarArea" ).style.paddingTop;
		document.getElementById( "subFrame" ).style.width = document.getElementById( "GUICalendarObject" ).offsetWidth + "px";
		document.getElementById( "subFrame" ).style.height = document.getElementById( "GUICalendarObject" ).offsetHeight + "px";
		document.getElementById( "subFrame" ).style.visibility = "visible";
	}
	
}

function GUIChangeMonths( direction )
{
	GUIincrement += direction;
	
	var this_month = new Date();
	this_month.setTime( dates[GUIid].getTime() );
	this_month.setDate( 1 );
	this_month.setMonth( this_month.getMonth() + GUIincrement );

	months = new buildMonths(this_month.getFullYear());

	if ( dates[GUIid].getDate() > months[this_month.getMonth()].days )
		this_month.setDate(months[this_month.getMonth()].days)
	else
		this_month.setDate(dates[GUIid].getDate())
		
	var next_month = new Date();
	next_month.setTime( this_month.getTime() );
	next_month.setDate( 1 );
	next_month.setMonth( this_month.getMonth() + 1 );

	months = new buildMonths(next_month.getFullYear());

	if ( dates[GUIid].getDate() > months[next_month.getMonth()].days )
		next_month.setDate(months[next_month.getMonth()].days)
	else
		next_month.setDate(dates[GUIid].getDate())
	
	document.getElementById("this_month").innerHTML = GUIMonth(this_month);
	document.getElementById("next_month").innerHTML = GUIMonth(next_month);
}

function GUIChooseDate(year, month, date)
{
	document.getElementsByName("Check" + dateType(GUIid) + "_Year")[0].selectedIndex = year - now.getFullYear() + startInPast;
	document.getElementsByName("Check" + dateType(GUIid) + "_Month")[0].selectedIndex = month;
	
	document.getElementsByName("Check" + dateType(GUIid) + "_Date")[0].selectedIndex = date - 1;
	//document.getElementsByName("Check" + dateType(GUIid) + "_Date")[0].value = date;

	/*if ( document.getElementsByName("Check" + dateType(GUIid) + "_Date")[0].value != date )
	{
		document.getElementsByName("Check" + dateType(GUIid) + "_Date")[0].value = date - 1;
	}*/

	hideGUI();
	changeDates(GUIid);
}

function hideGUI()
{
	document.getElementById( "subFrame" ).style.visibility = "hidden";
	document.getElementById( "GUICalendarArea" ).style.visibility = "hidden";
}

function GUICalendarTemplate()
{
	if ( templatePrinted )
		return;
		
	var output = "";
	
	output += "<div id='GUICalendarArea' style='visibility: hidden; position: absolute; left: 0px; top: 0px;'>";
	output += "<table id='GUICalendarObject' cellspacing='5' cellpadding='0' border='0' style='background-color: #FFFFFF; border: solid 1px #000000;'>";
	output += "	<tr>";
	output += "		<td colspan='2' style='text-align: right;'><a href='javascript: hideGUI();'><img src='http://www.innoventureconsultants.com/resForm/images/close.gif' style='border: 0px;'/></a></td>";
	output += "	</tr>";	
	output += "	<tr>";
	output += "		<td id='this_month'>";
	output += "		</td>";
	output += "		<td id='next_month'>";
	output += "		</td>";
	output += "	</tr>";
	output += "	<tr>";
	output += "		<td><a class='scroll_month' href='javascript: GUIChangeMonths(-1);'>Go To Previous Month</a></td>";
	output += "		<td><a class='scroll_month' href='javascript: GUIChangeMonths(1);'>Go To Next Month</a></td>";
	output += "	</tr>";
	output += "</table>";
	output += "</div>";
	output += "	<IFRAME id='subFrame' style='background-color: #FFFFFF; visibility: hidden; position: absolute; left: 0px; top: 0px' src='javascript:false;' frameBorder='0' scrolling='no'></IFRAME>";
	
	return output;
}

	
function getElementPosition(element, type ) 
{
	var offset = 0;
	
		if (element)
		{
			while (element)
			{
				if ( type == "left" )
					offset += element.offsetLeft
				else if ( type == "top" )
					offset += element.offsetTop;
				
				element = element.offsetParent;
			}
		}
		
	return offset;
}

function getFrameWidth()
{
	var frameWidth = 0;
	var frameHeight = 0;
	
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	
	return frameWidth;
}

function timeList( name )
{
	var ante = new Array("am", "pm" );
	
	var output = "<select name='" + name + "'>";
	
	for ( var i = 0; i < 24; i++ )
	{
		var hour = (i + 12 - 1) % 12 + 1;
		
		if ( i == 12 )
			var selected = "SELECTED";
		else
			var selected = "";
			
		//output += "<option value='" + hour + ante[parseInt(i/12)].substr(0,1).toUpperCase() + "' " + selected + ">" + hour + ":00 " + ante[parseInt(i/12)] + "</option>";
		output += "<option value='" + i + "' " + selected + ">" + hour + ":00 " + ante[parseInt(i/12)] + "</option>";
	}
	
	output += "</select>";
	
	return output;
}

var detect = navigator.userAgent.toLowerCase();

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

var msie = checkIt('msie') && !checkIt('safari') && !checkIt('omniweb') && !checkIt('opera') && !checkIt('webtv') && !checkIt('icab') && checkIt('win') && !checkIt('linux') && !checkIt('mac') && !checkIt('x11');

function hotelList( hotels )
{
	if ( !hotels ) return "";
	
	var output = "<select name='hotel_id' style='font-size: " + inputFontSize + ";'>";
	
	var hotelArray = hotels.split( "<>" );
	
	for ( var i = 0; i < hotelArray.length ; i++ )
	{
		var details = hotelArray[i].split(":");
		var hotelInfo = details[1].split(";");
		
		output += "<option value='" +  hotelInfo[0] + ";" + hotelInfo[1] + "'>" + details[0] + "</option>";
	}
	
	output += "</select>";
	
	return output;	
}

function airList( hotels, type )
{
	if ( !hotels ) return "";
	
	var output = "<select name='airList' onload='changeAir(this, this.form, \"" + type + "\");' onchange='changeAir(this, this.form, \"" + type + "\");' style='font-size: " + inputFontSize + ";'>";
	
	var hotelArray = hotels.split( "<>" );
	
	for ( var i = 0; i < hotelArray.length ; i++ )
	{
		var details = hotelArray[i].split(":");
		var hotelInfo = details[1].split(";");
		
		if ( formObj && hotelInfo[1] == formObj.hotel )
			var selected = "SELECTED";
		else
			var selected = "";
		
		if ( !( type == "package" && hotelInfo[2] == 0 ) )		
			output += "<option value='" + hotelInfo[2] + ";" + hotelInfo[3] + "' " + selected + " >" + details[0] + "</option>";
	}
	
	output += "</select>";
	
	return output;	
}

function changeAir(toField, form, type)
{
	var data = toField.value.split(";");

	if ( type == "car" )
	{
		form.puair.value = data[1];
	}
	else
	{
		form.propertyIds.value = data[0];
		form.goingTo.value = data[1];
	}
}

function finishAir(form)
{
	form.leavingDate.value = ( dates[0].getMonth()*1 + 1 ) + "/" + dates[0].getDate() + "/" + dates[0].getFullYear();
	form.returningDate.value = ( dates[1].getMonth()*1 + 1 ) + "/" + dates[1].getDate() + "/" + dates[1].getFullYear();
	return true;
}

function finishPackage(form)
{
	if ( finishAir(form) )
	{
		for ( var i = 1; i <= form.numOfRooms.value; i++ )
		{
			form.elements["adult" + i].value = form.adults.value;
			form.elements["children" + i].value = form.children.value;
		}
		return true;
	}

	return false;
}

function finishCar(form)
{
	form.chk_in.value = zeroPad( dates[0].getMonth()*1 + 1 ) + "/" + zeroPad(dates[0].getDate()) + "/" + dates[0].getFullYear();
	form.chk_out.value = zeroPad( dates[1].getMonth()*1 + 1 ) + "/" + zeroPad(dates[1].getDate()) + "/" + dates[1].getFullYear();
	
	form.pu_month.value = zeroPad( dates[0].getMonth()*1 + 1 );
	form.do_month.value = zeroPad( dates[1].getMonth()*1 + 1 );
	
	form.pu_day.value = zeroPad(dates[0].getDate());
	form.do_day.value = zeroPad(dates[1].getDate());
	
	form.pu_year.value = dates[0].getFullYear();
	form.do_year.value = dates[1].getFullYear();
	
	return true;
}

/**************************/
// All Reservation Form
/**************************/

var allFormObj;

function allFormSmall( element, hotels, affiliateID, airAffiliateID )
{
	if ( airAffiliateID !== undefined )
		this.airAffiliateID = airAffiliateID;
	else
		this.airAffiliateID = affiliateID;
		
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawBriefAllForm;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.offBackgroundColor = "#CCCCCC";
	this.padding = "5px";
	this.borderColor = "#000000";
	
	this.packageForm = new packageFormSmall( this.element, this.hotels, this.affiliateID );
	this.airForm = new airFormSmall( this.element, this.hotels, this.airAffiliateID );
	this.resForm = new reservationFormSmall( this.element, this.hotels, this.affiliateID );
}

function drawBriefAllForm()
{
	allFormObj = this;
	
	var output = "<table cellspacing='0' cellpadding='0' border='0' style='border-left: solid 1px " + this.borderColor + "; width: " + this.element.style.width + ";'><tr>";
	
	var linkStyle = "font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; color: #000000; text-decoration: underline; display: block; width: 180px; text-align: center; border: solid 1px " + this.borderColor + "; border-left: 0px; background-color: " + this.offBackgroundColor + "; padding: 3px 0px 3px 0px;";
	output += "<td><a style='" + linkStyle + "' id='hotelLink' href='javascript: switchForm(\"hotel\");'>Hotels</a></td><td><a style='" + linkStyle + "' id='airLink' href='javascript: switchForm(\"air\");'>Flights</a></td><td><a style='" + linkStyle + "' id='packageLink' href='javascript: switchForm(\"package\");'>Hotel + Flight Packages</a></td>";
	output += "<td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; width: 100%; border-bottom: solid 1px " + this.borderColor + ";'>&nbsp;</td>";
	output += "</tr></table>";
	
	output += "<table cellspacing='0' cellpadding='0' border='0' style='width: " + this.element.style.width + ";'><tr><td>";
	
	output += "<div id='innerResForm'></div>";
	
	output += "</td></tr></table>";
	
	this.element.innerHTML = output;
	
	this.packageForm.element = this.airForm.element = this.resForm.element = document.getElementById("innerResForm");
	
	switchForm("hotel");
	//this.packageForm.draw();
}

var lastType;

function switchForm( type )
{
	if 		( type == "package" )	allFormObj.packageForm.draw();
	else if ( type == "air" )		allFormObj.airForm.draw();
	else if ( type == "hotel" )		allFormObj.resForm.draw();
	
	if ( lastType )
	{
		document.getElementById(lastType + "Link").style.borderBottom = "solid 1px " + allFormObj.borderColor;
		document.getElementById(lastType + "Link").style.backgroundColor = allFormObj.offBackgroundColor;
	}
	
	lastType = type;
	
	document.getElementById(type + "Link").style.borderBottom = "solid 1px " + allFormObj.backgroundColor;
	document.getElementById(type + "Link").style.backgroundColor = allFormObj.backgroundColor;
	
	allFormObj.packageForm.element.style.borderTop = "0px";
	
}

/**************************/
// Brief Package Reservation Form
/**************************/

function packageFormSmall( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawBriefPackageForm;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
}

var inputFontSize = "";

function drawBriefPackageForm()
{
	inputFontSize = this.inputFontSize;
	
	var output = "";

	output += '<form name="InitialSearchForm" action="http://go.res99.travelpn.com/trips/ClarifySearchTimekeeper.do?Service=RES99&searchType=hotel" method="POST" onsubmit="return finishPackage(this)" style="margin: 0px;" target="_blank">';
	output += '<input type="hidden" name="affiliateId" value="' + this.affiliateID + '">';
	output += '<input type="hidden" name="aspHeader" value="customtrip">';
	output += '<input type="hidden" name="aspFooter" value="customtrip">';
	output += '<input type="hidden" name="dateLeavingTime" value="">';
	output += '<input type="hidden" name="dateReturningTime" value="">';
	output += '<input type="hidden" id="leavingDate" name="leavingDate" value="mm/dd/yyyy">';
	output += '<input type="hidden" id="returningDate" name="returningDate" value="mm/dd/yyyy">';
	
	output += '<input type="hidden" name="adult1" value="">';
	output += '<input type="hidden" name="adult2" value="">';
	output += '<input type="hidden" name="adult3" value="">';
	output += '<input type="hidden" name="adult4" value="">';
	output += '<input type="hidden" name="children1" value="">';
	output += '<input type="hidden" name="children2" value="">';
	output += '<input type="hidden" name="children3" value="">';
	output += '<input type="hidden" name="children4" value="">';

	var hotelArray = this.hotels.split( "<>" );
	var details = hotelArray[0].split(":");
	var hotelInfo = details[1].split(";");
	
	output += '<input type="hidden" name="propertyIds" value="' + hotelInfo[2] + '">';
	output += '<input type="hidden" name="goingTo" value="' + hotelInfo[3] + '">';
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%;'>";
	
	output += "<tr><td>";
	
		output += "<table cellspacing='5' border='0' cellpadding='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>From: </td><td style='text-align: left;'><input type='text' name='leavingFrom' style='font-size: " + inputFontSize + ";' /></td></tr>";
		
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>To: </td><td style='text-align: left;'>" + airList(this.hotels, "package") + "</td></tr>";
		output += "</table>";
	
	output += "</td><td>";
	
		output += "<table cellspacing='0' border='0' cellpadding='0'>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-In: </td><td><span id='calendar_0'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_0_GUIanchor'></div></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr><td></td><td></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-Out:</td><td><span id='calendar_1'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_1_GUIanchor'></div></td><td></td></tr>";
		output += "</table>";
		
		output += GUICalendarTemplate();
				
	output += "</td>";
	
	output += "<td>";
		
		output += "<table cellpadding='0' cellspacing='0' border='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Rooms:</td><td>" + inputNumber( "numOfRooms", 1, 4, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Adults: (per room)</td><td>" + inputNumber( "adults", 1, 5, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Children: (per room)</td><td>" + inputNumber( "children", 0, 5, 0, 1, "" ); + "</td></tr>";
		output += "</table>";
		
	output += "</td>";
	
	output += "<td><input type='submit' name='submit_search' value=' Go ' /></td></tr></table>";
	output += "</form>";
	
	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}

/**************************/
// Full Package Reservation Form
/**************************/

function packageForm( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.hotel = 0;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawPackageForm;
	this.fontSize = "9pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "10pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.target = "_blank";
}

var inputFontSize = "";
var resFormObj;
var formObj;

function drawPackageForm()
{
	formObj = this;

	inputFontSize = this.inputFontSize;
	
	var output = "";

	output += '<form name="packageSearchForm" action="http://go.res99.travelpn.com/trips/ClarifySearchTimekeeper.do?Service=RES99&searchType=hotel" method="POST" onsubmit="return finishPackage(this)" style="margin: 0px;" target="' + this.target + '">';
	output += '<input type="hidden" name="affiliateId" value="' + this.affiliateID + '">';
	output += '<input type="hidden" name="aspHeader" value="customtrip">';
	output += '<input type="hidden" name="aspFooter" value="customtrip">';
	output += '<input type="hidden" name="dateLeavingTime" value="">';
	output += '<input type="hidden" name="dateReturningTime" value="">';
	output += '<input type="hidden" id="leavingDate" name="leavingDate" value="mm/dd/yyyy">';
	output += '<input type="hidden" id="returningDate" name="returningDate" value="mm/dd/yyyy">';
	
	output += '<input type="hidden" name="adult1" value="">';
	output += '<input type="hidden" name="adult2" value="">';
	output += '<input type="hidden" name="adult3" value="">';
	output += '<input type="hidden" name="adult4" value="">';
	output += '<input type="hidden" name="children1" value="">';
	output += '<input type="hidden" name="children2" value="">';
	output += '<input type="hidden" name="children3" value="">';
	output += '<input type="hidden" name="children4" value="">';

	var hotelArray = this.hotels.split( "<>" );
	var details = hotelArray[0].split(":");
	var hotelInfo = details[1].split(";");
	
	output += '<input type="hidden" name="propertyIds" value="' + hotelInfo[2] + '">';
	output += '<input type="hidden" name="goingTo" value="' + hotelInfo[3] + '">';
	
	output += "<table cellspacing='4' border='0' cellpadding='0' style='width: 100%;'>";
	
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>From: </td><td style='text-align: left;'><input type='text' name='leavingFrom' style='font-size: " + inputFontSize + ";' /></td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>To: </td><td style='text-align: left;'>" + airList(this.hotels, "package") + "</td></tr>";
	
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-In: </td><td><span id='calendar_0'></span> <a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_0_GUIanchor'></div></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr><td></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-Out:</td><td><span id='calendar_1'></span> <a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_1_GUIanchor'></div></td><td></td></tr>";
		
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'><nobr>Rooms:</nobr></td><td>" + inputNumber( "numOfRooms", 1, 4, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'><nobr>Adults: (per room)</nobr></td><td>" + inputNumber( "adults", 1, 5, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'><nobr>Children: (per room)</nobr></td><td>" + inputNumber( "children", 0, 5, 0, 1, "" ); + "</td></tr>";

		output += "<tr><td><br /></td><td><br /></td></tr>";

	output += "<tr><td></td><td><input type='submit' name='submit_search' value='Find Packages' /></td></tr></table>";
	output += "</form>";
	
	output += GUICalendarTemplate();

	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	changeAir(document.packageSearchForm.airList, document.packageSearchForm, "package" );

	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}


/**************************/
// Brief Air Reservation Form
/**************************/

function airFormSmall( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawBriefAirForm;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.target = "_blank";
}

var inputFontSize = "";

function drawBriefAirForm()
{
	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	output += '<form name="AirSearchForm" action="http://go.travelpn.com/flights/InitialSearch.do?Service=TPN&affiliateId=' + this.affiliateID + '&subAffiliateId=&aspHeader=air&aspFooter=air" onsubmit="return finishAir(this)" method="post" style="margin: 0px;" target="' + this.target + '">';

	output += '<input type="hidden" name="flightType" value="roundtrip"/>';
	output += '<input type="hidden" name="tripType" value="airPlusHotel" disabled="disabled" id="airTripType"/> ';
	output += '<input type="hidden" name="Service" value="TPN" />';
	output += '<input type="hidden" name="pref_aln" value="exclude">';
	output += '<input type="hidden" id="leavingDate" name="leavingDate" value="mm/dd/yyyy">';
	output += '<input type="hidden" id="returningDate" name="returningDate" value="mm/dd/yyyy">';
	
	var hotelArray = this.hotels.split( "<>" );
	var details = hotelArray[0].split(":");
	var hotelInfo = details[1].split(";");
	
	output += '<input type="hidden" name="propertyIds" value="' + hotelInfo[2] + '">';
	output += '<input type="hidden" name="goingTo" value="' + hotelInfo[3] + '">';
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%;'>";
	
	output += "<tr><td>";
	
		output += "<table cellspacing='5' border='0' cellpadding='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>From: </td><td style='text-align: left;'><input type='text' name='leavingFrom' style='font-size: " + inputFontSize + ";' /></td></tr>";
		
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>To: </td><td style='text-align: left;'>" + airList(this.hotels, "air") + "</td></tr>";
		output += "</table>";
	
	output += "</td><td>";
	
		output += "<table cellspacing='0' border='0' cellpadding='0'>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-In:</td><td><span id='calendar_0'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_0_GUIanchor'></div></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr><td></td><td></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-Out:</td><td><span id='calendar_1'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_1_GUIanchor'></div></td><td></td></tr>";
		output += "</table>";
		
		output += GUICalendarTemplate();
				
	output += "</td>";
	
	output += "<td>";
		
		output += "<table cellpadding='0' cellspacing='0' border='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Adults:</td><td>" + inputNumber( "adults", 1, 5, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Children:</td><td>" + inputNumber( "children", 0, 5, 0, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Seniors:</td><td>" + inputNumber( "seniors", 0, 5, 0, 1, "" ); + "</td></tr>";
		output += "</table>";
		
	output += "</td>";
	
	output += "<td><input type='submit' name='submit_search' value=' Go ' /></td></tr></table>";
	output += "</form>";
	
	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}


/**************************/
// Full Air Reservation Form
/**************************/

function airForm( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawAirForm;
	this.fontSize = "9pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "10pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.target = "_blank";
}

var inputFontSize = "";

function drawAirForm()
{
	formObj = this;

	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	output += '<form name="airSearchForm" action="http://go.travelpn.com/flights/InitialSearch.do?Service=TPN&affiliateId=' + this.affiliateID + '&subAffiliateId=&aspHeader=air&aspFooter=air" onsubmit="return finishAir(this)" method="post" style="margin: 0px;" target="' + this.target + '">';

	output += '<input type="hidden" name="flightType" value="roundtrip"/>';
	output += '<input type="hidden" name="tripType" value="airPlusHotel" disabled="disabled" id="airTripType"/> ';
	output += '<input type="hidden" name="Service" value="TPN" />';
	output += '<input type="hidden" name="pref_aln" value="exclude">';
	output += '<input type="hidden" id="leavingDate" name="leavingDate" value="mm/dd/yyyy">';
	output += '<input type="hidden" id="returningDate" name="returningDate" value="mm/dd/yyyy">';
	
	var hotelArray = this.hotels.split( "<>" );
	var details = hotelArray[0].split(":");
	var hotelInfo = details[1].split(";");
	
	output += '<input type="hidden" name="propertyIds" value="' + hotelInfo[2] + '">';
	output += '<input type="hidden" name="goingTo" value="' + hotelInfo[3] + '">';
	
	output += "<table cellspacing='4' border='0' cellpadding='0' style='width: 100%;'>";
	
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>From: </td><td style='text-align: left;'><input type='text' name='leavingFrom' style='font-size: " + inputFontSize + ";' /></td></tr>";
		
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>To: </td><td style='text-align: left;'>" + airList(this.hotels, "air") + "</td></tr>";
	
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Depart:</td><td><span id='calendar_0'></span> <a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_0_GUIanchor'></div></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr><td></td><td></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Return:</td><td><span id='calendar_1'></span> <a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_1_GUIanchor'></div></td><td></td></tr>";
		
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Adults:</td><td>" + inputNumber( "adults", 1, 5, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Children:</td><td>" + inputNumber( "children", 0, 5, 0, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Seniors:</td><td>" + inputNumber( "seniors", 0, 5, 0, 1, "" ); + "</td></tr>";
		
		output += "<tr><td><br /></td><td><br /></td></tr>";

	output += "<tr><td></td><td><input type='submit' name='submit_search' value='Search Flights' /></td></tr></table>";
	output += "</form>";
	
	output += GUICalendarTemplate();

	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	changeAir(document.airSearchForm.airList, document.airSearchForm, "air" );

	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}

/**************************/
// Full Car Reservation Form
/**************************/

function carForm( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawCarForm;
	this.fontSize = "9pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "10pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.target = "_blank";
}

var inputFontSize = "";

function drawCarForm()
{
	formObj = this;

	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	//output += '<form name="carSearchForm" action="http://www.marcfallows.com/wct/printpost.php" onsubmit="return finishCar(this)" method="get" style="margin: 0px;" target="' + this.target + '">';
	output += '<form name="carSearchForm" action="http://res99.com/nexres/start-pages/gateway.cgi" onsubmit="return finishCar(this)" method="get" style="margin: 0px;" target="' + this.target + '">';

	var hotelArray = this.hotels.split( "<>" );
	var details = hotelArray[0].split(":");
	var hotelInfo = details[1].split(";");
	
	output += '<input type="hidden" name="puair" value="' + hotelInfo[3] + '">';
	output += '<input type="hidden" name="puwhere" value="airport">';
	output += '<input type="hidden" name="same" value="n">';
	
	output += '<input type="hidden" name="src" value="' + this.affiliateID + '">';
	output += '<input type="hidden" name="src_aid" value="">';
	output += '<input type="hidden" name="engine" value="car">';
	
	output += '<input type="hidden" name="chk_in" value="">';
	output += '<input type="hidden" name="chk_out" value="">';

	output += '<input type="hidden" name="pu_day" value="">';
	output += '<input type="hidden" name="pu_month" value="">';
	output += '<input type="hidden" name="pu_year" value="">';
	output += '<input type="hidden" name="do_day" value="">';
	output += '<input type="hidden" name="do_month" value="">';
	output += '<input type="hidden" name="do_year" value="">';

	
	output += "<table cellspacing='4' border='0' cellpadding='0' style='width: 100%;'>";
	
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>City: </td><td style='text-align: left;'>" + airList(this.hotels, "air") + "</td></tr>";
	
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Pick-up Date:</td><td><span id='calendar_0'></span> <a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Pick-up Time:</td><td><div id='calendar_0_GUIanchor'></div>" + timeList("pu_time") + "</td>";
		output += "</tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Drop-off Date:</td><td><span id='calendar_1'></span> <a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Drop-off Time:</td><td><div id='calendar_1_GUIanchor'></div>" + timeList("do_time") + "</td>";
		output += "</tr>";
		
		output += "<tr><td><br /></td><td><br /></td></tr>";

		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Car Type:</td><td>";
			output += "<select name='carcode'>";
				output += "<option value='TB'>5 basic types</option>";
				output += "<option value='CC' >Compact</option>";
				output += "<option value='CP' >Pickup Truck</option>";
				output += "<option value='EC' >Economy</option>";
				output += "<option value='FC' >Full Size</option>";
				output += "<option value='IC' >Intermediate</option>";
				output += "<option value='LC' >Luxury</option>";
				output += "<option value='MV' >Van</option>";
				output += "<option value='PC' >Premium</option>";
				output += "<option value='SC' >Standard</option>";
				output += "<option value='SF' >Sport Utility</option>";
				output += "<option value='ST' >Convertible</option>";
				output += "<option value='SW' >Station Wagon</option>";
				output += "<option value='XC' >Specialty</option>";
			output  += "</select>";
				  
		output += "</td></tr>";
		
    	output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Rental Company:</td><td>";
			  
			output += "<select name='vendor'>";
				output += "<option value='BV' SELECTED>No Preference</option>";
				output += "<option value='AD' >Advantage</option>";
				output += "<option value='AL' >Alamo</option>";
				output += "<option value='ZI' >Avis</option>";
				output += "<option value='ZD' >Budget</option>";
				output += "<option value='ZR' >Dollar</option>";
				//output += "<option value='EZ' >EZ Rent a Car</option>";
				output += "<option value='ET' >Enterprise</option>";
				//output += "<option value='EP' >EuropCar</option>";
				output += "<option value='ZE' >Hertz</option>";
				output += "<option value='ZL' >National</option>";
				output += "<option value='ZA' >Payless</option>";
				//output += "<option value='ZP' >Practical</option>";
				output += "<option value='ZT' >Thrifty</option>";
			output += "</select>";
				  
		output += "</td></tr>";				  

	output += "<tr><td></td><td><input type='submit' name='submit_search' value='Search Cars' /></td></tr></table>";
	output += "</form>";
	
	output += GUICalendarTemplate();

	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	changeAir(document.carSearchForm.airList, document.carSearchForm, "car");

	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}


/**************************/
// Horizontal Banner Reservation Form 
/**************************/

function reservationFormHorizontalBanner( element, hotel, affiliateID )
{
	this.hotel = hotel;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawReservationFormHorizontalBanner;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.headerColor = "#000000";
	this.padding = "5px";
	this.borderColor = "#000000";
	
	useMonthNames = false;
}

var inputFontSize = "";

function drawReservationFormHorizontalBanner()
{
	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	output += "<form method='get' action='rates.php' onsubmit='return checkAction(this)' style='margin: 0px;'>";
	output += "<input type='hidden' name='hotel' value='0' />";
	output += "<input type='hidden' name='hotel_id' value='" + this.hotel + "' />";
	output += "<input type='hidden' name='availability_given' value='1'/>";

	output += "<input type='hidden' name='smoking_pref' value='NP'/>";
	output += "<input type='hidden' name='bed_type' value='NP'/>";
	output += '<input type="hidden" name="src" value="' + this.affiliateID + '">';
	output += "<input type='hidden' name='doa_dd' value=''/>";
	output += "<input type='hidden' name='doa_mm' value=''/>";
	output += "<input type='hidden' name='doa_yy' value=''/>";
	output += "<input type='hidden' name='dod_dd' value=''/>";
	output += "<input type='hidden' name='dod_mm' value=''/>";
	output += "<input type='hidden' name='dod_yy' value=''/>";
	output += "<input type='hidden' name='hotels_id' value=''/>";
	
	output += "<div style='color: " + this.headerColor + "; font-family: " + this.fontFamily + "; font-size: 10pt; text-align: center; font-weight: bold;'>Check Availability Online!</div>";
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%; margin: 5px 0px 10px 0px;'>";
	output += "<tr><td style='vertical-align: top;'>";

		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td colspan='2' style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: left;'>Check-In:</td></tr>";
			output += "<tr><td><nobr><span id='calendar_0'></span></nobr></td><td style='text-align: left;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr>";
			output += "<tr><td colspan='2'><div id='calendar_0_GUIanchor'></div></td></tr>";
		output += "</table></div>";
	
	output += "</td><td style='vertical-align: top;'>";
	
		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td colspan='2' style='padding-top: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: left;'>Nights:</td></tr>";
			output += "<tr><td colspan='2' style='text-align: left;'>" + inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" ) + "</td></tr>";
		output += "</table></div>";

	output += "</td><td style='vertical-align: top;'>";

		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td colspan='2' style='padding-top: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: left;'>Check-Out:</td></tr>";
			output += "<tr><td><nobr><span id='calendar_1'></span></nobr></td><td style='text-align: left;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr>";
			output += "<tr><td colspan='2'><div id='calendar_1_GUIanchor'></div>";
		output += "</table></div>";
	
	output += "</td></tr>";

	output += "<tr><td style='vertical-align: top; padding-top: 10px;'>";

		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Rooms:</td></tr><tr><td>" + inputNumber( "num_rooms", 1, 4, 1, 1, "" ) + "</td></tr>";
		output += "</table></div>";
	
	output += "</td><td style='vertical-align: top; padding-top: 10px;'>";

		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Adults (per room):</td></tr><tr><td>" + inputNumber( "num_adults", 1, 4, 2, 1, "" ) + "</td></tr>";
		output += "</table></div>";
	
	output += "</td><td style='vertical-align: top; padding-top: 10px;'>";

		output += "<div align='center'><table cellspacing='0' border='0' cellpadding='0'>";
			output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Children (per room):</td></tr><tr><td>" + inputNumber( "num_children", 0, 4, 0, 1, "" ) + "</td></tr>";
		output += "</table></div>";
	
	output += "</td></tr>";
	output += "</table>";
			
	
	//output += "<tr><td colspan='2' style='text-align: center;'><input type='submit' name='submit_search' value=' Go '  style='font-size: " + this.inputFontSize + ";'/></td></tr>";
	//output += "</table>";
	
	output += GUICalendarTemplate();

	output += "</form>";
	
	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}


/**************************/
// Vertical Banner Reservation Form 
/**************************/

function reservationFormVerticalBanner( element, hotel, affiliateID )
{
	this.hotel = hotel;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawReservationFormVerticalBanner;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.headerColor = "#000000";
	this.padding = "5px";
	this.borderColor = "#000000";
	
	useMonthNames = false;
}

var inputFontSize = "";

function drawReservationFormVerticalBanner()
{
	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	output += "<form method='get' action='rates.php' onsubmit='return checkAction(this)' style='margin: 0px;'>";
	output += "<input type='hidden' name='hotel' value='0' />";
	output += "<input type='hidden' name='hotel_id' value='" + this.hotel + "' />";
	output += "<input type='hidden' name='availability_given' value='1'/>";

	output += "<input type='hidden' name='smoking_pref' value='NP'/>";
	output += "<input type='hidden' name='bed_type' value='NP'/>";
	output += '<input type="hidden" name="src" value="' + this.affiliateID + '">';
	output += "<input type='hidden' name='doa_dd' value=''/>";
	output += "<input type='hidden' name='doa_mm' value=''/>";
	output += "<input type='hidden' name='doa_yy' value=''/>";
	output += "<input type='hidden' name='dod_dd' value=''/>";
	output += "<input type='hidden' name='dod_mm' value=''/>";
	output += "<input type='hidden' name='dod_yy' value=''/>";
	output += "<input type='hidden' name='hotels_id' value=''/>";
	
	output += "<div style='color: " + this.headerColor + "; font-family: " + this.fontFamily + "; font-size: 10pt; text-align: center; font-weight: bold;'>Check Availability Online!</div>";
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%; margin-top: 10px'>";
	
	output += "<tr><td colspan='2' style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: left;'>Check-In:</td></tr>";
	output += "<tr><td><nobr><span id='calendar_0'></span></nobr></td><td style='text-align: left; width: 100%;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr>";
	output += "<tr><td colspan='2'><div id='calendar_0_GUIanchor'></div></td></tr>";
	
	output += "<tr><td colspan='2' style='padding-top: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: left;'>Nights:</td></tr>";
	output += "<tr><td colspan='2' style='text-align: left;'>" + inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" ) + "</td></tr>";

	output += "<tr><td colspan='2' style='padding-top: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: left;'>Check-Out:</td></tr>";
	output += "<tr><td><nobr><span id='calendar_1'></span></nobr></td><td style='text-align: left; width: 100%;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr>";
	output += "<tr><td colspan='2'><div id='calendar_1_GUIanchor'></div>";
		
	output += GUICalendarTemplate();
			
	output += "</td></tr>";
	output += "</table>";
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%; margin-top: 10px;'>";

	output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Rooms:</td><td style='padding: 5px 0px 5px 0px;'>" + inputNumber( "num_rooms", 1, 4, 1, 1, "" ) + "</td></tr>";
	output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Adults (per room):</td><td style='padding: 5px 0px 5px 0px;'>" + inputNumber( "num_adults", 1, 4, 2, 1, "" ) + "</td></tr>";
	output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: left;'>Children (per room):</td><td style='padding: 5px 0px 5px 0px;'>" + inputNumber( "num_children", 0, 4, 0, 1, "" ) + "</td></tr>";
		
	
	output += "<tr><td colspan='2' style='text-align: center;'><input type='submit' name='submit_search' value=' Go '  style='font-size: " + this.inputFontSize + ";'/></td></tr>";
	output += "</table>";
		
	output += "</form>";
	
	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}


/**************************/
// Small Reservation Form
/**************************/

function reservationFormSmall( element, hotels, affiliateID )
{
	this.hotels = hotels;
	this.affiliateID = affiliateID;
	this.element = element;
	this.draw = drawBriefReservationForm;
	this.fontSize = "8pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
}

var inputFontSize = "";

function drawBriefReservationForm()
{
	inputFontSize = this.inputFontSize;
	
	var output = "";
	
	output += "<form method='get' action='rates.php' onsubmit='return checkAction(this)' style='margin: 0px;'>";
	output += "<input type='hidden' name='hotel' value='0' />";
	output += "<input type='hidden' name='availability_given' value='1'/>";

	output += "<input type='hidden' name='smoking_pref' value='NP'/>";
	output += "<input type='hidden' name='bed_type' value='NP'/>";
	output += '<input type="hidden" name="src" value="' + this.affiliateID + '">';
	output += "<input type='hidden' name='doa_dd' value=''/>";
	output += "<input type='hidden' name='doa_mm' value=''/>";
	output += "<input type='hidden' name='doa_yy' value=''/>";
	output += "<input type='hidden' name='dod_dd' value=''/>";
	output += "<input type='hidden' name='dod_mm' value=''/>";
	output += "<input type='hidden' name='dod_yy' value=''/>";
	output += "<input type='hidden' name='hotels_id' value=''/>";
	
	output += "<table cellspacing='0' border='0' cellpadding='0' style='width: 100%;'>";
	
	output += "<tr><td>";
	
		output += "<table cellspacing='0' border='0' cellpadding='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + ";'>Hotel:</td></tr>";
		output += "<tr><td>" + hotelList(this.hotels) + "</td></tr>";
		output += "</table>";
	
	output += "</td><td>";
	
		output += "<table cellspacing='0' border='0' cellpadding='0'>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-In:</td><td><span id='calendar_0'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_0_GUIanchor'></div></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + ";  font-size: " + this.fontSize + "; text-align: right;'>Nights:</td><td style='text-align: left;'>";
		output += inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" );
		output += "</td><td></td>";
		output += "</tr>";
		output += "<tr><td></td><td></td><td></td></tr>";
		output += "<tr>";
		output += "	<td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Check-Out:</td><td><span id='calendar_1'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td>";
		output += "</tr>";
		output += "<tr><td></td><td><div id='calendar_1_GUIanchor'></div></td><td></td></tr>";
		output += "</table>";
		
		output += GUICalendarTemplate();
				
	output += "</td>";
	
	output += "<td>";
		
		output += "<table cellpadding='0' cellspacing='0' border='0'>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Rooms:</td><td>" + inputNumber( "num_rooms", 1, 4, 1, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Adults (per room):</td><td>" + inputNumber( "num_adults", 1, 4, 2, 1, "" ); + "</td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; padding-right: 5px; text-align: right;'>Children (per room):</td><td>" + inputNumber( "num_children", 0, 4, 0, 1, "" ); + "</td></tr>";
		output += "</table>";
		
	output += "</td>";
	
	output += "<td><input type='submit' name='submit_search' value=' Go ' /></td></tr></table>";
	output += "</form>";
	
	this.element.style.padding = this.padding;
	this.element.style.border = "solid 1px " + this.borderColor;
	this.element.style.backgroundColor = this.backgroundColor;
	
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	changeNights();
}

function checkAction( form )
{
	var info = form.hotel_id.value.split(';'); 

	if ( info[0] == 0 )
	{
		form.setAttribute('action', 'reservation_form.php' );
		form.setAttribute('target', '_blank' );
		form.hotel.value = info[1];
	}
	else
	{
		form.setAttribute('action', 'http://www.res99.com/nexres/reservations/availability.cgi' );
		form.setAttribute('target', '_blank' );
		form.hotel.value = 0;
		form.doa_dd.value = dates[0].getDate();
		form.doa_mm.value = ( dates[0].getMonth()*1 + 1 );
		form.doa_yy.value = dates[0].getFullYear();
		form.dod_dd.value = dates[1].getDate();
		form.dod_mm.value = ( dates[1].getMonth()*1 + 1 );
		form.dod_yy.value = dates[1].getFullYear();
		form.hotels_id.value = info[0];
	}

	return true;
}



/**************************/
// Big Reservation Form
/**************************/

function reservationForm( element, title, rooms, getVars )
{
	this.rooms = rooms.split(";");
	this.title = title;
	this.resVars = new Array();
	
	var getArray = new Array();
	getArray = getVars.split("&");
	
	for ( var i = 0; i < getArray.length; i++ )
	{
		var data = getArray[i].split("=");
		this.resVars[data[0]] = unescape( data[1] );
	}
	
	this.element = element;
	this.draw = drawReservationForm;
	this.fontSize = "9pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	this.inputWidth = "180px";
	this.headerFontSize = "11pt;";
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.hotel = true;
	this.header = true;
	
	this.formAction = "reservationMailer.php?hotel=" + this.resVars["hotel"];
}

function contactInfoForm()
{
	// Contact Information Table
	
	var output = "";
	
	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + resFormObj.backgroundColor + "; border: solid 1px " + resFormObj.borderColor + ";'>";
	output += "<tr><td colspan='4' style='padding: 3px; font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: center;'>Guest Information</td></tr>";
	
	output += "<tr>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Name *</td><td><input type='text' name='Customer_Name' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>E-mail *</td><td><input type='text' name='Customer_Email' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
	output += "</tr>";
	
	output += "<tr>";
		if ( resFormObj.hotel )
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Phone</td><td><input type='text' name='Customer_Phone' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
		else
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Fax</td><td><input type='text' name='Customer_Fax' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";

		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Confirm E-mail *</td><td><input type='text' name='Customer_Email_Confirm' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
	output += "</tr>";
	
	if ( !resFormObj.hotel )
	{
		output += "<tr>";
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Address</td><td style='vertical-align: top;' rowspan='3'><textarea name='Customer_Address' rows='4' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></textarea></td>";
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Phone *</td><td><input type='text' name='Customer_Phone' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
		output += "</tr>";
		
		output += "<tr>";
			output += "<td></td>";
			output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Confirm Phone *</td><td><input type='text' name='Customer_Phone_Confirm' style='width: " + resFormObj.inputWidth + "; font-size: " + resFormObj.inputFontSize + ";'></td>";
		output += "</tr>";
		
		if ( !resFormObj.driver )
		{
			output += "<tr>";
				output += "<td></td>";
				output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Repeat Guest</td><td><div style='width: " + ( parseInt(resFormObj.inputWidth) + 14 ) + "px; text-align: left;'><input type='checkbox' name='Repeat_Guest' /></div></td>";
			output += "</tr>";
		}
		else
		{
			output += "<tr><td></td><td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + ";'>&nbsp;</td><td></td></tr>";
		}
	}
	
	output += "<tr><td></td></tr>";
	output += "</table>";
	
	return output;
}

function drawReservationForm()
{
	resFormObj = this;
	
	inputFontSize = this.inputFontSize;

	var output = "";
	
	if ( this.header )
		output += "<div style='font-size: " + this.headerFontSize + "; font-family: " + this.fontFamily + "; font-weight: bold; text-align: center; line-height: 14pt; margin-bottom: 4px;'>Reservation Request Form<br />" + this.title + "</div>";
		
	output += "<form action='" + this.formAction + "' method='post' onSubmit='return checkResForm(this)'>";
	
	if ( this.hotel )
		output += "<input type='hidden' name='Hotel_Name' value='" + this.title + "' />" + inputBreak();

	output += contactInfoForm();
	
	output += inputBreak() + "<img src='images/spacer.gif' height='5' width='1' /><br />";
	
	
	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
	output += "<tr><td colspan='3' style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Reservation Information</td></tr>";
	output += "<tr><td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Check-In:</td><td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Nights: </td><td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Check-Out:</td></tr>";
	output += "<tr><td>";
		output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'><tr><td><span id='calendar_0'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr><tr><td><div id='calendar_0_GUIanchor'><img src='images/spacer.gif' height='1' width='1' /></div></td><td></td></tr></table>";
	output += "</td><td>";
		output += inputNumber( "Number_of_nights", 1, 99, ( ( this.resVars["Number_of_nights"] ) ? this.resVars["Number_of_nights"] : initialNights ), 1, "onchange='changeNights()'" );
	output += "</td><td>";
		output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'><tr><td><span id='calendar_1'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr><tr><td><div id='calendar_1_GUIanchor'><img src='images/spacer.gif' height='1' width='1' /></div></td><td></td></tr></table>";
	output += "</td></tr>";
	
	output += "<tr><td></td></tr>";
	output += "</table>";

	output += inputBreak() + "<img src='images/spacer.gif' height='5' width='1' /><br />";
	
	if ( this.resVars["type"] == "wedding" )
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td colspan='2' style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Wedding Information</td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Wedding Date:</td><td style='text-align: left;'><table cellspacing='0' border='0' cellpadding='0'><tr><td><span id='calendar_2'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(2);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr><tr><td><div id='calendar_2_GUIanchor'><img src='images/spacer.gif' height='1' width='1' /></div></td><td></td></tr></table></td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Guests:</td><td style='text-align: left;'><input type='text' name='Number_of_Guests' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Rooms Required:</td><td style='text-align: left;'><input type='text' name='Number_of_Rooms' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td></td></tr>";
		output += "<tr><td colspan='2'style='font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Special Requests:</td></tr>";
		output += "<tr><td colspan='2'><textarea style='width: 500px; height: 80px;' name='Special_Requests'></textarea></td></tr>";
	
		output += "<tr><td></td></tr>";
		output += "</table>";
	}
	else if ( this.resVars["type"] == "group" )
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td colspan='2' style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Group & Retreat Information</td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Guests:</td><td style='text-align: left;'><input type='text' name='Number_of_Guests' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Rooms Required:</td><td style='text-align: left;'><input type='text' name='Number_of_Rooms' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td></td></tr>";
		output += "<tr><td colspan='2'style='font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Special Requests:</td></tr>";
		output += "<tr><td colspan='2'><textarea style='width: 500px; height: 80px;' name='Special_Requests'></textarea></td></tr>";
	
		output += "<tr><td></td></tr>";
		output += "</table>";
	}
	else if ( this.resVars["type"] == "meeting" )
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td colspan='2' style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Meeting & Conventions Information</td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Guests:</td><td style='text-align: left;'><input type='text' name='Number_of_Guests' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td style='width: 50%; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Number of Rooms Required:</td><td style='text-align: left;'><input type='text' name='Number_of_Rooms' style='width: 50px; font-size: " + this.inputFontSize + ";'/></td></tr>";
		output += "<tr><td></td></tr>";
		output += "<tr><td colspan='2'style='font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Special Requests:</td></tr>";
		output += "<tr><td colspan='2'><textarea style='width: 500px; height: 80px;' name='Special_Requests'></textarea></td></tr>";
	
		output += "<tr><td></td></tr>";
		output += "</table>";
	}
	else
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Room Information</td></tr>";
		
		if ( this.hotel )
			output += "<tr><td style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Number of Rooms: " + inputNumber( "Number_of_Rooms", 1, 10, ( ( this.resVars["num_rooms"] ) ? this.resVars["num_rooms"] : 1 ), 1, "onchange='fillRooms()'" ) + "</td></tr>";
		else 
			output += "<input type='hidden' name='Number_of_Rooms' value='1' />";
		
		output += "<tr><td><div id='roomInfo'></div></td></tr>";
		
		output += "<tr><td></td></tr>";
		output += "</table>";
	}
		
	output += inputBreak() + "<img src='images/spacer.gif' height='5' width='1' /><br />";
	
	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
	output += "<tr><td style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Additional Comments</td></tr>";
	output += "<tr><td colspan='2' style='text-align: center;'><textarea style='width: 90%; height: 80px;' name='Additional_Comments'>" + ( ( this.resVars["Additional_Comments"] ) ? decodeURI(this.resVars["Additional_Comments"]) : "" ) + "</textarea></td></tr>";
	output += "<tr><td></td></tr>";
	output += "</table>";
	
	output += inputBreak() + "<img src='images/spacer.gif' height='5' width='1' /><br />";

	if ( this.hotel )
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: #FFB3B3; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td style='font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Travel Agent IATA:</td><td><input type='text' name='IATA' style='font-size: " + this.inputFontSize + ";'></td><td style='font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: right;'>Corporate ID:</td><td><input type='text' name='Corporate_ID' style='font-size: " + this.inputFontSize + ";'></td></tr>";
		output += "</table>";
		
		output += "<img src='images/spacer.gif' height='5' width='1' /><br />";
	}
	else
	{
		output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
		output += "<tr><td style='padding: 5px;'><input type='checkbox' name='Refer Reservation Request To Others' value='Yes' checked='checked' /></td><td style='padding: 5px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: left;'>Please forward my reservation request to nearby affiliated accommodations if there is no availability for my requested dates</td></tr>";
		output += "</table>";
		
		output += "<img src='images/spacer.gif' height='5' width='1' /><br />";
	}

	output += "<div style='text-align: center;'><input type='submit' value='Submit Request' /></div>";
	output += "</form>";
	
	output += GUICalendarTemplate();
		
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	
	changeNights();
	
	if ( this.resVars["type"] == "wedding" )
		fillCalendar(2);
		
	if ( !(this.resVars["type"]) )
		fillRooms();
}
//*/


// Driver Reservation Form

function driverReservationForm( element, title )
{
	this.title = title;
	
	this.element = element;
	this.draw = drawDriverReservationForm;
	this.fontSize = "9pt";
	this.fontFamily = "Verdana, Arial, Sans-Serif";
	this.inputFontSize = "9pt";
	this.inputWidth = "180px";
	this.headerFontSize = "10pt;";
	this.useHeaders = false;
	
	this.backgroundColor = "#F2F2F2";
	this.padding = "5px";
	this.borderColor = "#000000";
	this.driver = true;
	
	this.formAction = "driver_reservationMailer.php";
	
	// form elements:
	this.Hotel_Condo_Complex_Name = "";
	this.Hotel_Condo_Suite_Number = "";
}

function drawDriverReservationForm()
{
	resFormObj = this;
	
	inputFontSize = this.inputFontSize;

	var output = "";
	
	if ( this.useHeaders )
		output += "<h1>Reservation Request Form</h1><h2 style='margin-bottom: 12px;'>" + this.title + "</h2>";
	else
		output += "<div style='font-size: " + this.headerFontSize + "; font-family: " + this.fontFamily + "; font-weight: bold; text-align: center; line-height: 13pt; margin-bottom: 4px;'>Reservation Request Form<br />" + this.title + "</div>";
		
	output += "<form action='" + this.formAction + "' method='post' onSubmit='return checkResForm(this)' style='margin: 0px;'>";
	
	if ( this.hotel )
		output += "<input type='hidden' name='Hotel_Name' value='" + this.title + "' />" + inputBreak();

	output += contactInfoForm();
	
	output += inputBreak() + "<div><img src='images/spacer.gif' height='5' width='1' /></div>";
	
	
	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
	output += "<tr><td colspan='3' style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Reservation Information</td></tr>";
	
	output += "<tr><td>";
		output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'>";
		output += "<tr><td colspan='2' style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Arrive at SJD Airport:</td></tr>";
		output += "<tr><td colspan='2' style='padding-bottom: 5px;'>";
			output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'><tr><td><span id='calendar_0'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(0);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr><tr><td><div id='calendar_0_GUIanchor'><img src='images/spacer.gif' height='1' width='1' /></div></td><td></td></tr></table>";
		output += "</td><td>";		
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Flight Time: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Arrival_Time' style='width: 80px;'/></td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Flight #: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Arrival_Number' style='width: 80px;'/></td>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Airline: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Arrival_Airline' style='width: 80px;'/></td>";
		output += "</table>";
	output += "</td>";
		
	output += inputBreak()

	output += "<td style='vertical-align: top;'>";
		output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'>";
		output += "<tr><td style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Nights: </td></tr>";
		output += "<tr><td>" + inputNumber( "Number_of_nights", 1, 99, initialNights, 1, "onchange='changeNights()'" ) + "</td></tr>";
		output += "</table>";
	output += "</td>";
	
	output += inputBreak();
	
	output += "<td>";
		output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'>";
		output += "<tr><td colspan='2' style='padding-right: 5px; font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: center;'>Depart SJD Airport:</td></tr>";
		output += "<tr><td colspan='2' style='padding-bottom: 5px;'>";
			output += "<table cellspacing='0' border='0' cellpadding='0' style='margin: auto;'><tr><td><span id='calendar_1'></span></td><td style='padding-left: 3px;'><a href='javascript: GUICalendar(1);'><img style='border: 0px;' src='http://www.innoventureconsultants.com/resForm/images/calendar.gif' /></a></td></tr><tr><td><div id='calendar_1_GUIanchor'><img src='images/spacer.gif' height='1' width='1' /></div></td><td></td></tr></table>";
		output += "</td><td>";		
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Flight Time: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Departure_Time' style='width: 80px;'/></td></tr>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Flight #: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Departure_Number' style='width: 80px;'/></td>";
		output += "<tr><td style='font-family: " + this.fontFamily + "; font-size: " + this.fontSize + "; text-align: right;'>Airline: &nbsp;</td><td style='text-align: left;'> <input type='text' name='Flight_Departure_Airline' style='width: 80px;'/></td>";
		output += "</table>";
	output += "</td></tr>";

	output += inputBreak();

	output += "<tr><td colspan='3' style='padding: 5px 0px 2px 0px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Additional Flight Information</td></tr>";
	output += "<tr><td colspan='3' style='text-align: center;'><textarea style='width: 90%; height: 80px;' name='Additional_Flight_Info'></textarea></td></tr>";

	output += "<tr><td></td></tr>";
	output += "</table>";

	output += inputBreak() + inputBreak() + "<div><img src='images/spacer.gif' height='5' width='1' /></div>";

	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + resFormObj.backgroundColor + "; border: solid 1px " + resFormObj.borderColor + ";'>";
	output += "<tr><td colspan='4' style='padding: 3px; font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: center;'>Travel Information</td></tr>";
	output += "<tr>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Transfer Type &nbsp;</td><td style='text-align: left;'><select name='Transfer Type' style='font-size: " + resFormObj.inputFontSize + ";'><option value='Private Transfer'>Private Transfer</option><option value='Shuttle Service'>Shuttle Service</option></select></td>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'><a class='link' href='javascript: var windowContents = \"<h1>Concierge Service</h1>Concierge Level Service is an added charge of $10 USD per person.  The Concierge Level Service <b>includes</b>:<br /><ul style=\\\"margin-top: 5px;\\\"><li>Personalized welcome sign</li><li>Bottle of Champagne, cold soft drinks, bottled water and fresh towels</li><li>Special beverages by request (charge may apply)</li><li>Lounge music</li><li>Giveaway (eg. Natural Soaps from La Baja)</li></ul>\";  if( window.windowAlert !== undefined ) { windowAlert(windowContents); } else { customAlert(windowContents); }'>Concierge Service</a> &nbsp;</td><td style='text-align: left;'><input type='checkbox' name='Concierge Level Service' value='Yes'></td>";
	output += "</tr>";

	output += inputBreak();

	output += "<tr>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Trip Type &nbsp;</td><td style='text-align: left;'><select name='Trip Type' style='font-size: " + resFormObj.inputFontSize + ";'><option value='Round Trip'>Round Trip</option><option value='One Way'>One Way</option></select></td>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'><a class='link' href='javascript: var windowContents = \"<h1>Grocery Shopping Service</h1>Grocery Shopping Service can be added to any private transfer at an additional cost of $25 USD per vehicle.  The Grocery Shopping Service <b>includes</b>:<br /><ul style=\\\"margin-top: 5px;\\\"><li>A maximum 1 hour stop at Mega, Costco or your favorite Supermarket.</li></ul>\";  if( window.windowAlert !== undefined ) { windowAlert(windowContents); } else { customAlert(windowContents); }'>Grocery Service</a> &nbsp;</td><td style='text-align: left;'><input type='checkbox' onclick='if(this.checked && this.form[\"Transfer Type\"].value != \"Private Transfer\" ) { var windowContents = \"Grocery Service can only be added to a Private Transfer\"; if( window.windowAlert !== undefined ) { windowAlert(windowContents); } else { customAlert(windowContents); } this.checked = false; }' name='Grocery Service' value='Yes'></td>";
	output += "</tr>";

	output += inputBreak();

	output += "<tr>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'># of Travellers &nbsp;</td><td style='text-align: left;'>" + inputNumber( "Number of Travellers", 1, 99, 2, 1, "" ) + "</td>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'></td><td style='text-align: left;'></td>";
	output += "</tr>";

	output += inputBreak();

	output += "<tr>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Hotel/Condo Name * &nbsp;</td><td style='text-align: left;'><input type='text' name='Hotel_Condo_Complex_Name' style='width: 100px; font-size: " + resFormObj.inputFontSize + ";' value='" + resFormObj.Hotel_Condo_Complex_Name + "'></td>";
		output += "<td style='font-size: " + resFormObj.fontSize + "; font-family: " + resFormObj.fontFamily + "; text-align: right;'>Hotel/Condo Suite # &nbsp;</td><td style='text-align: left;'><input type='text' name='Hotel_Condo_Suite_Number' style='width: 100px; font-size: " + resFormObj.inputFontSize + ";' value='" + resFormObj.Hotel_Condo_Suite_Number + "'></td>";
	output += "</tr>";
	output += "</table>";
	
	output += inputBreak() + "<div><img src='images/spacer.gif' height='5' width='1' /></div>";
	
	output += "<table border='0' cellspacing='4' cellpadding='0' style='margin: auto; text-align:center; width: 100%; background-color: " + this.backgroundColor + "; border: solid 1px " + this.borderColor + ";'>";
	output += "<tr><td style='padding: 3px; font-size: " + this.fontSize + "; font-family: " + this.fontFamily + "; text-align: center;'>Additional Requests</td></tr>";
	output += "<tr><td colspan='2' style='text-align: center;'><textarea style='width: 90%; height: 80px;' name='Additional_Requests'></textarea></td></tr>";
	output += "<tr><td></td></tr>";
	output += "</table>";
	
	output += inputBreak() + "<div><img src='images/spacer.gif' height='5' width='1' /></div>";

	output += "<div style='text-align: center;'><input type='submit' value='Submit Request' /></div>";
	output += "</form>";
	
	output += GUICalendarTemplate();
		
	this.element.innerHTML = output;
	
	fillCalendar(0);
	fillCalendar(1);
	
	changeNights();
}
//*/

function checkResForm(form)
{
  if ( resFormObj && resFormObj.resVars && resFormObj.resVars["type"] == "wedding" )
  {
  	if ( dates[2].getTime() < dates[0].getTime() || dates[2].getTime() > dates[1].getTime() )
  	{
  		alert ("Please ensure that your Wedding Date is within your Check In and Check Out Date." );
  		form.Checkwedding_Month.focus();
  		return false;
  	}
  }
  
  if ( form.Customer_Name.value == "" )
  {
  	alert ("Please enter your name.");
  	form.Customer_Name.focus();
  	return false;
  }
  
  if ( !is_email(form.Customer_Email.value) )
  {
  	alert ("Please enter a valid e-mail address.");
  	form.Customer_Email.focus();
  	return false;
  }
  
  if ( form.Customer_Email_Confirm.value != form.Customer_Email.value )
  {
    alert ("Please check that your e-mail addresses match");
  	form.Customer_Email_Confirm.focus();
  	return false;
  }
  
  var domains = new Array( "yahoo.ca", "yahoo.com" );
  for ( var i = 0; i < domains.length; i++ )
  {
	  if ( form.Customer_Email.value.match("@" + domains[i] ) )
	  {
		if ( !confirm ("Our responses to email addresses at " + domains[i] + " often get blocked or sent to the junk mail folder.\n\nClick 'OK' to proceed and check your junk mail regularly for our response.\nClick 'Cancel' to provide a different email address.") )
		{
			form.Customer_Email.focus();
			return false;
		}
		break;
	  }
  }

  
  if ( !resFormObj.hotel && form.Customer_Phone.value == "" )
  {
  	alert ("Please enter your phone number.");
  	form.Customer_Phone.focus();
  	return false;
  }
  if ( !resFormObj.hotel && form.Customer_Phone_Confirm.value != form.Customer_Phone.value )
  {
    alert ("Please check that your phone numbers match");
  	form.Customer_Phone_Confirm.focus();
  	return false;
  }
  
  if ( resFormObj.driver && form.Hotel_Condo_Complex_Name.value == "" )
  {
     alert ("Please supply the Condo or Hotel you will be staying at");
	  form.Hotel_Condo_Complex_Name.focus();
	  return false;
  }
   
  /*
  if ( resFormObj.driver && form.Hotel_Condo_Suite_Number.value == "" )
  {
     alert ("Please supply the Suite # at the Condo/Hotel");
	  form.Hotel_Condo_Suite_Number.focus();
	  return false;
  }
  */
  
  var today = new Date();
	today.setHours( 0 );
	today.setMinutes( 0 );
	today.setSeconds( 0 );
	today.setMilliseconds( 0 );
   
	if ( today.getTime() > dates[0].getTime() )
	{
		alert ( "Please ensure that your dates of stay are in the future" );
		
		form.Checkin_Month.focus();
		return false;
	}
	
  return true;
}

function is_email(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
    
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function zeroPad( value )
{
	if ( value < 10 )
		return "0" + value;
	else
		return value;
}

// ** LEAVE INFORMATION BELOW THIS COMMENT EXACTLY AS IS ** //

// start css include
document.write( '<link href="http://innoventureconsultants.com/resForm/css/calendar.css" rel="stylesheet" type="text/css" />' );