﻿/// <reference path="HtmlHelpers.js" />

// Views will be based on the value of the radio button (i.e. 'hot', 'flt', 'fltcar', etc)
function View()
{
	this._value = null;
	
	// All array values for dropdowns are in a value,text format
	this.Rooms = [ '1,1', '2,2', '3,3', '4,4', '5,5', '6,6', '7,7', '8,8', '9,9+' ];
	this.PackageRooms = ['1,1', '2,2', '3,3' ];
	this.Adults = [ '0,0', '1,1', '2,2', '3,3', '4,4', '5,5', '6,6', '7,7', '8,8', '9,9', '10,10', '11,11', '12,12', '13,13', '14,14' ];
	this.Seniors = [ '0,0', '1,1', '2,2', '3,3', '4,4', '5,5', '6,6' ];
	this.Children = [ '0,0', '1,1', '2,2', '3,3', '4,4', '5,5', '6,6' ];
	this.ChildrenAges = [ '-1,-?-', '0,<1', '1,1', '2,2', '3,3',  '4,4', '5,5', '6,6', '7,7', '8,8', '9,9', '10,10', '11,11', '12,12', '13,13', '14,14', '15,15', '16,16', '17,17', '18,18' ];
	this.CarTypes = [ 'NoPreference,No Preference', 'Economy,Economy', 'Compact,Compact', 'Midsize,Midsize', 'Standard,Standard', 'FullSize,Full Size', 'Premium,Premium', 'Luxury,Luxury', 'Convertible,Convertible', 'Minivan,Minivan', 'SUV,Sport Utility Vehicle', 'SportsCar,Sports Car' ]
	this.CruiseDestinations = [ '6023184,Africa', '203,Alaska', '6050677,Asia', '13,Bahamas', '20,Bermuda', '6023742,Canada - New England', '6022969,Caribbean', '6023743,Caribbean - Eastern', '6023744,Caribbean - Southern', '6023745,Caribbean - Western', '6022967,Europe', '213,Hawaii', '6023183,Mediterranean', '6023750,Mediterranean - Eastern', '6023751,Mediterranean - Western', '6050655,Mexico', '6049796,Northern Europe', '-2,Nowhere (no port stops)', '6023753,Panama Canal', '6050676,South America', '6023738,South Pacific', '-3,Transatlantic', '-4,Transpacific', '6050649,United States & Canada', '6023746,US Pacific Coast', '-5,World' ];
	this.CruiseLines = [ '-1,Show All', '1,Carnival', '2,Celebrity', '5,Crystal', '6,Disney', '7,Holland America', '8,Norwegian', '9,Princess', '10,Royal Caribbean' ];
	this.Times = [ '362,Any', '12AM,12 AM', '1AM,1 AM', '2AM,2 AM', '3AM,3 AM', '4AM,4 AM', '5AM,5 AM', '6AM,6 AM', '7AM,7 AM', '8AM,8 AM', '9AM,9 AM', '10AM,10 AM', '11AM,11 AM', '12PM,12 PM', '1PM,1 PM', '2PM,2 PM', '3PM,3 PM', '4PM,4 PM', '5PM,5 PM', '6PM,6 PM', '7PM,7 PM', '8PM,8 PM', '9PM,9 PM', '10PM,10 PM', '11PM,11 PM', '361,Morn.', '721,Noon', '1081,Eve.' ];
	this.SimpleTimes = [ '12AM,12 AM', '1AM,1 AM', '2AM,2 AM', '3AM,3 AM', '4AM,4 AM', '5AM,5 AM', '6AM,6 AM', '7AM,7 AM', '8AM,8 AM', '9AM,9 AM', '10AM,10 AM', '11AM,11 AM', '12PM,12 PM', '1PM,1 PM', '2PM,2 PM', '3PM,3 PM', '4PM,4 PM', '5PM,5 PM', '6PM,6 PM', '7PM,7 PM', '8PM,8 PM', '9PM,9 PM', '10PM,10 PM', '11PM,11 PM' ];
	this.States = [ '0,-- Select a state --', '202,Alabama', '203,Alaska', '204,Arizona', '205,Arkansas', '206,California', '31,Canada', '207,Colorado', '208,Connecticut', '209,Delaware', '210,District of Columbia', '211,Florida', '212,Georgia', '213,Hawaii', '214,Idaho', '215,Illinois', '216,Indiana', '217,Iowa', '218,Kansas', '219,Kentucky', '220,Louisiana', '221,Maine', '222,Maryland', '223,Massachusetts', '224,Michigan', '225,Minnesota', '226,Mississippi', '227,Missouri', '228,Montana', '229,Nebraska', '230,Nevada', '231,New Hampshire', '232,New Jersey', '233,New Mexico', '234,New York', '235,North Carolina', '236,North Dakota', '237,Ohio', '238,Oklahoma', '239,Oregon', '240,Pennsylvania', '241,Rhode Island', '242,South Carolina', '243,South Dakota', '244,Tennessee', '245,Texas', '246,Utah', '247,Vermont', '248,Virginia', '249,Washington', '250,West Virginia', '251,Wisconsin', '252,Wyoming' ];
	
	// Departure month calculation for cruise
	var _months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
	var date = new Date();
	this.DepartureMonth = [ ];
	
	var nextMonth = date.getMonth() == 11 ? 1 : date.getMonth() + 2;
	var nextMonthYear = date.getMonth() == 11 ? date.getFullYear() + 1 : date.getFullYear();
	var nextMonthValue = nextMonth + "/1/" + nextMonthYear;
	this.DepartureMonth.push(nextMonthValue + ',Select a date');
	
	this.DepartureMonth.push('1/1/4501,All dates');
	
	for (var month = date.getMonth(); month < 12; month++)
	{
		var value = (month + 1) + '/1/' + date.getFullYear();
		var text = _months[month] + ' ' + date.getFullYear();
		
		this.DepartureMonth.push(value + ',' + text);
	}
	
	var nextYear = date.getFullYear() + 1;
	for (var i = 0; i < 12; i++)
	{
		var value = (i + 1) + '/1/' + nextYear;
		var text = _months[i] + ' ' + nextYear;
		
		this.DepartureMonth.push(value + ',' + text);
	}

	// room values in adults,seniors,children format
	this._roomValues = null;
	this._childAgeValues = null;
	
	// Hotel View
	this.hot = CreateLabel('Destination')
	 + CreateTextBox('destination', 'fullWidth')
	 + CreatePanel(
		CreatePanel(
			CreateLabel('Check-in', 'floatLeft clearBoth') 
			+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
		, 'floatLeft')
		+ CreatePanel(
			CreateLabel('Check-out', 'floatLeft clearBoth') 
			+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
		, 'floatLeft checkoutContainer')
	, 'floatLeft fullWidth')
	 + CreatePanel(
		CreateLabel('Rooms', 'floatLeft clearBoth')
		+ CreateDropDown('rooms', this.Rooms, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateRoomOptions(\'roomOptionsContainer\', this.value, true, false, true);')
	, 'floatLeft roomsContainer')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Adults (19+)', 'floatLeft clearBoth')
			+ CreateDropDown('adults', this.Adults, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateAdultsValue(0, this.value)', '2')
		, 'floatLeft adultsContainer')
		 + CreatePanel(
			CreateLabel('Children (0-18)', 'floatLeft clearBoth')
			+ CreateDropDown('children', this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value, 0); FindOptionByValue(\'this._value\').get_ViewObject().UpdateChildrenValue(0, this.value)')
		, 'floatLeft childrenContainer')
	 ,'floatLeft', 'roomOptionsContainer')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	 + CreatePanel(
		CreateLink('Additional hotel options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=HOTLAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Car View
	this.car = CreateLabel('What airport or city?')
	 + CreateTextBox('destination','fullWidth') 
	 + CreatePanel(
		CreateLabel('Car type', 'floatLeft clearBoth') 
		+ CreateDropDown('carType', this.CarTypes, 'floatLeft clearBoth')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Pick-up on', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('fromTime', this.SimpleTimes, 'smallDropdown floatLeft clearBoth timeDropdown', null, '11AM')
			, 'floatLeft' )
		, 'firstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Drop-off on', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('toTime', this.SimpleTimes, 'smallDropdown floatLeft clearBoth timeDropdown', null, '11AM')
			, 'floatLeft' )
		, 'secondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreateLink('Additional car options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=CARWIZD&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Flight View
	this.flt = CreatePanel(
		CreatePanel(
			CreateLabel('Leaving from') 
			+ CreateTextBox('from', '')
		, 'halfWidth floatLeft')
		+ CreatePanel(
			CreateLabel('Going to') 
			+ CreateTextBox('to', '')
		, 'halfWidth floatRight')
	, 'floatLeft fullWidth')
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Departing', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('fromTime', this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'firstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Returning', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('toTime', this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'secondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Adults (19+)', 'floatLeft clearBoth')
			+ CreateDropDown('adults', this.Adults, 'smallDropdown floatLeft clearBoth', null, '2')
		, 'floatLeft adultsContainer')
		 + CreatePanel(
			CreateLabel('Seniors (65+)', 'floatLeft clearBoth')
			+ CreateDropDown('seniors', this.Seniors, 'smallDropdown floatLeft clearBoth')
		, 'floatLeft seniorContainer')
		 + CreatePanel(
			CreateLabel('Children (0-18)', 'floatLeft clearBoth')
			+ CreateDropDown('children', this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value);')
		, 'floatLeft childrenContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	 + CreatePanel(
		CreateLink('Additional flight options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=FLIGHTWIZ&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Cruise View
	this.cru = CreateLabel('Select from top destinations')
	 + CreateDropDown('destination', this.CruiseDestinations, '', null, '6022969')
	 + CreatePanel(
		CreateLabel('Departure month') 
		+ CreateDropDown('departureMonth', this.DepartureMonth, 'floatLeft clearBoth')
	, 'departureMonthContainer')
	 + CreatePanel(
		CreateLabel('Cruise line', 'floatLeft clearBoth') 
		+ CreateDropDown('cruiseLine', this.CruiseLines, 'floatLeft clearBoth')
	, 'cruiseLineContainer')
	 + CreatePanel(
		CreateLink('Additional cruise options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=CRUISELAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Flight + Hotel View
	this.flthot = CreatePanel(
		CreatePanel(
			CreateLabel('Leaving from') 
			+ CreateTextBox('from', '')
		, 'halfWidth floatLeft')
		+ CreatePanel(
			CreateLabel('Going to') 
			+ CreateTextBox('to', '')
		, 'halfWidth floatRight')
	, 'floatLeft fullWidth')
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Departing', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('fromTime', this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'firstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Returning', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('toTime', this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'secondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Rooms', 'floatLeft clearBoth')
			+ CreateDropDown('rooms', this.PackageRooms, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'flthot\').get_ViewObject().CreateRoomOptions(\'roomOptionsContainer\', this.value, true, true, true);')
		, 'floatLeft roomsContainer')
		+ CreatePanel(
			 CreatePanel(
				CreateLabel('Adults (19+)', 'floatLeft clearBoth')
				+ CreateDropDown('adults', this.Adults, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateAdultsValue(0, this.value)', '2')
			, 'floatLeft adultsContainer')
			 + CreatePanel(
				CreateLabel('Seniors (65+)', 'floatLeft clearBoth')
				+ CreateDropDown('seniors', this.Seniors, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateSeniorValue(0, this.value)')
			, 'floatLeft seniorContainer')
			 + CreatePanel(
				CreateLabel('Children (0-18)', 'floatLeft clearBoth')
				+ CreateDropDown('children', this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value, 0); FindOptionByValue(\'this._value\').get_ViewObject().UpdateChildrenValue(0, this.value)')
			, 'floatLeft childrenContainer')
		, 'floatLeft', 'roomOptionsContainer')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreateLink('Additional package options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=PKGLAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Flight + Car View
	this.fltcar = CreatePanel(
		CreatePanel(
			CreateLabel('Leaving from') 
			+ CreateTextBox('from','')
		, 'halfWidth floatLeft')
		+ CreatePanel(
			CreateLabel('Going to') 
			+ CreateTextBox('to','')
		, 'halfWidth floatRight')
	, 'floatLeft fullWidth')
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Departing', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('fromTime',this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'firstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Returning', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('toTime',this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'secondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Adults (19+)', 'floatLeft clearBoth')
			+ CreateDropDown('adults',this.Adults, 'smallDropdown floatLeft clearBoth', null, '2')
		, 'floatLeft adultsContainer')
		 + CreatePanel(
			CreateLabel('Seniors (65+)', 'floatLeft clearBoth')
			+ CreateDropDown('seniors',this.Seniors, 'smallDropdown floatLeft clearBoth')
		, 'floatLeft seniorContainer')
		 + CreatePanel(
			CreateLabel('Children (0-18)', 'floatLeft clearBoth')
			+ CreateDropDown('children',this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value);')
		, 'floatLeft childrenContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreateLabel('Car type', 'floatLeft clearBoth') 
		+ CreateDropDown('carType',this.CarTypes, 'floatLeft clearBoth')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	 + CreatePanel(
		CreateLink('Additional package options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=PKGLAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Flight + Hotel + Car View
	this.flthotcar = CreatePanel(
		CreatePanel(
			CreateLabel('Leaving from') 
			+ CreateTextBox('from','')
		, 'halfWidth floatLeft')
		+ CreatePanel(
			CreateLabel('Going to') 
			+ CreateTextBox('to','')
		, 'halfWidth floatRight')
	, 'floatLeft fullWidth')
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Departing', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('fromTime',this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'firstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Returning', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Time', 'floatLeft clearBoth timeLabel') 
				+ CreateDropDown('toTime',this.Times, 'smallDropdown floatLeft clearBoth timeDropdown')
			, 'floatLeft' )
		, 'secondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Rooms', 'floatLeft clearBoth')
			+ CreateDropDown('rooms',this.PackageRooms, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'flthotcar\').get_ViewObject().CreateRoomOptions(\'roomOptionsContainer\', this.value, true, true, true);')
		, 'floatLeft roomsContainer')
		 + CreatePanel(
			 CreatePanel(
				CreateLabel('Adults (19+)', 'floatLeft clearBoth')
				+ CreateDropDown('adults',this.Adults, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateAdultsValue(0, this.value)', '2')
			, 'floatLeft adultsContainer')
			 + CreatePanel(
				CreateLabel('Seniors (65+)', 'floatLeft clearBoth')
				+ CreateDropDown('seniors',this.Seniors, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateSeniorValue(0, this.value)')
			, 'floatLeft seniorContainer')
			 + CreatePanel(
				CreateLabel('Children (0-18)', 'floatLeft clearBoth')
				+ CreateDropDown('children',this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value, 0); FindOptionByValue(\'this._value\').get_ViewObject().UpdateChildrenValue(0, this.value)')
			, 'floatLeft childrenContainer')
		, 'floatLeft', 'roomOptionsContainer')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreateLink('Additional package options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=PKGLAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');

	// Hotel + Car View
	this.hotcar = CreateLabel('What location?')
	 + CreateTextBox('from','fullWidth') 
	 + CreatePanel(
		CreatePanel(
			CreatePanel(
				CreateLabel('Hotel check-in', 'floatLeft') 
				+ CreateDateTextBox('fdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Car pick-up time', 'floatLeft clearBoth bigTimeLabel') 
				+ CreateDropDown('fromTime', this.SimpleTimes, 'smallDropdown floatLeft clearBoth timeDropdown', null, '11AM')
			, 'floatLeft bigTimeLabelContainer' )
		, 'bigFirstDateTimeContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Hotel check-out', 'floatLeft') 
				+ CreateDateTextBox('tdt', 'dateBoxWidth floatLeft clearBoth')
			, 'floatLeft dateContainer' )
			+ CreatePanel(
				CreateLabel('Car drop-off time', 'floatLeft clearBoth bigTimeLabel') 
				+ CreateDropDown('toTime', this.SimpleTimes, 'smallDropdown floatLeft clearBoth timeDropdown', null, '11AM')
			, 'floatLeft bigTimeLabelContainer' )
		, 'bigSecondDateTimeContainer')
	, 'floatLeft fullWidth clearBoth bigDateTimeContainer')
	 + CreatePanel(
		 CreatePanel(
			CreateLabel('Rooms', 'floatLeft clearBoth')
			+ CreateDropDown('rooms',this.PackageRooms, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'hotcar\').get_ViewObject().CreateRoomOptions(\'roomOptionsContainer\', this.value, true, false, true);')
		, 'floatLeft roomsContainer')
		 + CreatePanel(
			CreatePanel(
				CreateLabel('Adults (19+)', 'floatLeft clearBoth')
				+ CreateDropDown('adults',this.Adults, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().UpdateAdultsValue(0, this.value)', '2')
			, 'floatLeft adultsContainer')
			 + CreatePanel(
				CreateLabel('Children (0-18)', 'floatLeft clearBoth')
				+ CreateDropDown('children',this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'this._value\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value, 0); FindOptionByValue(\'this._value\').get_ViewObject().UpdateChildrenValue(0, this.value)')
			, 'floatLeft childrenContainer')
		, 'floatLeft', 'roomOptionsContainer')
	 + CreatePanel(null, 'floatLeft fullWidth clearBoth', 'childrenAgeContainer')
	, 'floatLeft fullWidth clearBoth')
	 + CreatePanel(
		CreateLink('Additional package options', 'http://www.expedia-aarp.com/pubspec/scripts/eap.asp?GOTO=PKGLAUNCH&eapid=0-30029')
	, 'floatLeft fullWidth clearBoth aoLink');
}

View.prototype = {
	get_View : function(value)
	{
		this._resetValues();
		this._value = value;
		return this[value].replace(/this._value/g, this._value);
	},
	_resetValues : function()
	{
		// room values in adults,seniors,children format
		this._roomValues = [ [ '2','0','0'] ];
		this._childAgeValues = [ [ '-1','-1','-1','-1','-1','-1' ] ];
	},
	CreateChildrenAgeOptions : function(id, count, room)
	{
		var element = document.getElementById(id);
		
		var childAges = [ '-1','-1','-1','-1','-1','-1' ];
		
		if (room)
		{
			if (room < this._childAgeValues.length)
			{
				childAges = this._childAgeValues[room].slice();
			}
			else
			{
				this._childAgeValues.push( [ '-1','-1','-1','-1','-1','-1' ] );
			}
		}
				
		if (element)
		{
			var options = '';
			
			if (count != 0)
			{
				if (element.innerHTML == '')
				{
					var labels = CreateLabel('Specify ages of children at time of travel:', 'bold floatLeft fullWidth');
					labels += CreateLabel('Discounts may be offered to children of certain ages.', 'floatLeft fullWidth');
					
					element.innerHTML = labels;
				}
				
				var childOptions = '';
				
				if (room)
				{
					childOptions += CreateLabel('Room ' + (room + 1), 'floatLeft fullWidth bold roomsLabel');
				}
				else
				{
					room = 0;
				}
				var ageDropdowns = '';
				for (var i = 0; i < count; i++)
				{
					ageDropdowns += CreatePanel(
										CreateLabel('Child ' + (i + 1) + ':', 'floatLeft clearBoth')
										+ CreateDropDown('childAge' + (room + 1) + '_' + i, this.ChildrenAges, 'floatLeft clearBoth', 'FindOptionByValue(\'' + this._value + '\').get_ViewObject().UpdateChildAgeValue(' + room + ', ' + i + ', this.value)', childAges[i])
									, 'floatLeft');
				}
				childOptions += CreatePanel(ageDropdowns, 'floatLeft');
				options += CreatePanel(childOptions, 'floatLeft fullWidth', 'childAgeOptions' + (room + 1));
			
				var optionsContainer = document.getElementById('childAgeOptions' + (room + 1))
				
				if (optionsContainer)
				{
					element = optionsContainer;
					element.innerHTML = '';
				}
				
				element.innerHTML += options;
			}
			else
			{
				element.innerHTML = '';
				
				var rooms = document.getElementById('rooms');
				
				if (rooms)
				{
					for (var j = 0; j < rooms.value; j++)
					{
						var childrenId = 'children';
						childrenId += j == 0 ? '' : j;
						
						var childrenValue = document.getElementById(childrenId).value;
						
						if (childrenValue != 0)
						{
							this.CreateChildrenAgeOptions('childrenAgeContainer', childrenValue, j);
						}
					}
				}
				
				rooms = null;
			}
		}
		
		element = null;
	},
	CreateRoomOptions : function(id, count, showAdults, showSeniors, showChildren)
	{
		var element = document.getElementById(id);
		
		if (element)
		{
			var childrenAgeContainer = document.getElementById('childrenAgeContainer');
			
			if (childrenAgeContainer)
			{
				childrenAgeContainer.innerHTML = '';
			}
			
			childrenAgeContainer = null;
			
			var options = '';
			for (var i = 0; i < count; i++)
			{
				var adultsValue = 2;
				var seniorsValue = 0;
				var childValue = 0;
				
				if (i < this._roomValues.length)
				{
					adultsValue = this._roomValues[i][0];
					seniorsValue = this._roomValues[i][1];
					childValue = this._roomValues[i][2];
				}
				else
				{
					this._roomValues.push( [ '2','0','0' ] );
				}
				
				var idAttr = i == 0 ? '' : i;
				
				options += CreateLabel('Room ' + (i + 1), 'floatLeft fullWidth clearBoth bold');
				
				var optionItems = '';
				if (showAdults)
				{
					optionItems += CreatePanel(
									CreateLabel('Adults (19+)', 'floatLeft clearBoth')
									+ CreateDropDown('adults' + idAttr, this.Adults, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'' + this._value + '\').get_ViewObject().UpdateAdultsValue(' + i + ', this.value)', adultsValue)
								, 'floatLeft adultsContainer');
				}
				
				if (showSeniors)
				{
					optionItems += CreatePanel(
									CreateLabel('Seniors (65+)', 'floatLeft clearBoth')
									+ CreateDropDown('seniors' + idAttr, this.Seniors, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'' + this._value + '\').get_ViewObject().UpdateSeniorValue(' + i + ', this.value)', seniorsValue)
								, 'floatLeft seniorContainer');
				}
				
				if (showChildren)
				{
					optionItems += CreatePanel(
									CreateLabel('Children (0-18)', 'floatLeft clearBoth')
									+ CreateDropDown('children' + idAttr, this.Children, 'smallDropdown floatLeft clearBoth', 'FindOptionByValue(\'' + this._value + '\').get_ViewObject().CreateChildrenAgeOptions(\'childrenAgeContainer\', this.value, ' + i + '); FindOptionByValue(\'' + this._value + '\').get_ViewObject().UpdateChildrenValue(' + i + ', this.value)', childValue)
								, 'floatLeft childrenContainer');
							
					if (childValue > 0)
					{
						this.CreateChildrenAgeOptions('childrenAgeContainer', childValue, i);
					}
				}
				
				options += CreatePanel(optionItems, 'fullWidth floatLeft clearBoth');
			}
			
			if (options != '')
			{
				element.innerHTML = options;
			}
		}
		
		element = null;
	},
	UpdateAdultsValue : function(room, value)
	{
		if (room < this._roomValues.length)
		{
			this._roomValues[room][0] = value;
		}
	},
	UpdateSeniorValue : function(room, value)
	{
		if (room < this._roomValues.length)
		{
			this._roomValues[room][1] = value;
		}
	},
	UpdateChildrenValue : function(room, value)
	{
		if (room < this._roomValues.length)
		{
			this._roomValues[room][2] = value;
		}
	},
	UpdateChildAgeValue : function(room, child, value)
	{
		if (room < this._childAgeValues.length)
		{
			this._childAgeValues[room][child] = value;
		}
	}
}