
/*
* Start:uk/co/aimltd/resources/javascript/combo_date_selectorv0.1/tmInput.js
*/

/**
* Time Selector Input
*
* An intelligent set of 2 combo boxes for entering dates.
* The boxes update according to which Hour/Minute has been selected
* to account for days in each month (including leap years).
*
* @author Bruce Mundin
* @version 0.1
*/

/**
* The Time selector constructor
*
* @access public
* @param string objName      Name of the object that you create
* @param string formName	Name of the form this object is in (OPTIONAL)
*/
function tmInput( objName, formName ) {
	
	
	/* Properties */
	this.objName 		= objName;
	this.today          = new Date();
	this.hour           = this.today.getHours();		/* The Displayed Day */
	this.mins           = this.today.getMinutes();		/* The Displayed Minutes */
	this.minsStep		= 5;
	
	this.formName 		= arguments[1] ? arguments[1] : 'none';
	this.hourObj			= '';
	this.minsObj		= '';
	
	/* Public Methods */
	this.setToToday			= tm_setToToday;
	this.setTime			= tm_setTime;
	this.setTimeParts		= tm_setTimeParts;
	this.getSelHour			= tm_getHour;
	this.getSelMins			= tm_getMins;

	/* Private Methods */
	this._initOptions		= tm_initOptions;
	this._writeHourOptions 	= tm_writeHourOptions;
	this._writeMinsOptions 	= tm_writeMinOptions;
	
	/* Constructor Code */
	if( this.formName == 'none' ) 
		{
		this.srcObj  = eval("document.forms[0]." + this.objName );
		this.hourObj = eval("document.forms[0]." + this.objName + "H");
		this.minsObj = eval("document.forms[0]." + this.objName + "M");
		} 
	else 
		{
		this.srcObj = eval("document.forms['" + this.formName + "']." + this.objName );
		this.hourObj = eval("document.forms['" + this.formName + "']." + this.objName + "H");
		this.minsObj = eval("document.forms['" + this.formName + "']." + this.objName + "M");
		}
			
	this._initOptions();
	
	// Set up the initial value
	if ( this.srcObj.value == null )
		{
		// Use todays date
		this.setToToday();
		}
	else
		{
		// Use the value
		this.setTime(this.srcObj.value);
		}
}

/* Class Methods */


/*
 * Expects it in HH:MM style.
 *
 */
function tm_setTime( timeStr ) {

	//alert ( "tm_setTime=" + timeStr );

	var h, m;
	
	// Find the ":" seperator
	var sepPos = timeStr.indexOf(":");
	
	// Read the hours
	h = timeStr.substr(0,sepPos);
	
	// Read the minutes
	m = timeStr.substr(sepPos + 1,2);
	
	// Set the time parts
	this.setTimeParts( h, m );
}

/**
* Set the date boxes to today's date
*/
function tm_setToToday() {
	this.setTimeParts( this.hour, this.mins );
}

/**
* Set the date boxes to today's date
* @param integer year
* @param integer month
* @param integer day
*/
function tm_setTimeParts( hour, mins ) 
	{
	// Make sure we are comparing numbers
	hour = new Number(hour);
	
	//alert ( "tm_setTimeParts(" +hour+"," +mins+")" );
	// Set the day
	for( i=0; i < this.hourObj.length; i++ ) 
		{
		
		if ( this.hourObj[i].value == hour )
			{
			this.hourObj[i].selected = true;
			break;
			}
		}
	
	mins = new Number(mins);
	// Set the month year
	mins = mins - ( mins % this.minsStep);

	for( i=0; i < this.minsObj.length; i++ ) 
		{
		this.minsObj[i].selected = ( padZero(this.minsObj[i].value) == mins );
		}

}


function tm_getHour() {

	var selectedVal = this.hourObj[this.hourObj.selectedIndex].value;
	return selectedVal;
}

function tm_getMins() 
	{
	return this.minsObj[this.minsObj.selectedIndex].value;
	}


/* Private Methods */

function tm_initOptions() {
	this._writeHourOptions();
	this._writeMinsOptions();
}

function tm_getDaysInMonth( m, y ) {
	monthdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	if (m != 2) {
		return monthdays[m];
	} else {
		return ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ? 29 : 28);
	}
}


	
function tm_writeHourOptions() 
	{
	for( i= 0; 
		 i<= 23 ; 
		 i++ ) {
		var newOption = new Option( padZero(i) , i );
		var optionsColl = this.hourObj.options;
		optionsColl[optionsColl.length] = newOption;
	}
}

function tm_writeMinOptions() 
	{
	for( i= 0; 
		 i<= 59 ; 
		 i=i+this.minsStep ) {
		var newOption = new Option( padZero(i), i );
		var optionsColl = this.minsObj.options;
		optionsColl[optionsColl.length] = newOption;
	}
}


	// utility function
function padZero(num) {
	  return ((num <= 9) ? ("0" + num) : num);
	}

/*
* End:uk/co/aimltd/resources/javascript/combo_date_selectorv0.1/tmInput.js
*/


/*
* Start:uk/co/aimltd/resources/javascript/combo_date_selectorv0.1/dsInput.js
*/

/**
* Date Selector Input
*
* An intelligent set of 3 combo boxes for entering dates.
* The boxes update according to which day/month/year has been selected
* to account for days in each month (including leap years).
*
* @author Kevin Southworth <southwo8@msu.edu>
* @link http://kevin.tridubdesign.com
* @modified 2004-04-06
* @version 0.2
*/

/**
* The date selector constructor
*
* @access public
* @param string objName      Name of the object that you create
* @param string formName	Name of the form this object is in (OPTIONAL)
*/
function dsInput( objName, formName ) {
	
	/* Properties */
	this.objName 		= objName;
	this.today          = new Date();
	this.date           = this.today.getDate();			/* The Displayed Day */
	this.month          = this.today.getMonth()+1;		/* The Displayed Month */
	this.year           = this.today.getFullYear();		/* The Displayed Year */
	if(this.year < 2000) this.year += 1900; //for Netscape
	this.yearComboRange = 5;
	
	this.formName 		= arguments[1] ? arguments[1] : 'none';
	this.dayObj			= '';
	this.monthObj		= '';
	this.yearObj		= '';
	this.monthNames		= new Array( '','January','February','March','April','May','June','July','August','September','October','November','December' );
	
	this.startDateRange = null ;	/* If not set then there is no date limit. */
	this.endDateRange   = null ;
	
	/* Public Methods */
	this.setToToday			= ds_setToToday;
	this.adjustDaysInMonth 	= ds_adjustDaysInMonth;
	this.setDate			= ds_setDateYYYYMMDD;
	this.setDateDDMMYYYY	= ds_setDateDDMMYYYY;
	this.setDateParts		= ds_setDateParts;
	this.getSelYear			= ds_getYear;
	this.getSelMonth		= ds_getMonth;
	this.getSelDay			= ds_getDay;
	this.setDateRange    	= ds_setDateRange;

	/* Private Methods */
	this._initOptions		= ds_initOptions;
	this._writeYearOptions 	= ds_writeYearOptions;
	this._writeMonthOptions = ds_writeMonthOptions;
	this._writeMonthYearOptions = ds_writeMonthYearOptions;
	this._writeDayOptions 	= ds_writeDayOptions;
	this._getDaysInMonth	= ds_getDaysInMonth;
	
	/* Constructor Code */
	if( this.formName == 'none' ) 
		{
		this.srcObj  	  = eval("document.forms[0]." + this.objName );
		this.dayObj 	  = eval("document.forms[0]." + this.objName + "D");
		this.monthObj 	  = eval("document.forms[0]." + this.objName + "M");
		this.yearObj 	  = eval("document.forms[0]." + this.objName + "Y");
		this.monthyearObj = eval("document.forms[0]." + this.objName + "MY");
		} 
	else 
		{
		this.srcObj 	  = eval("document.forms['" + this.formName + "']." + this.objName );
		this.dayObj       = eval("document.forms['" + this.formName + "']." + this.objName + "D");
		this.monthObj     = eval("document.forms['" + this.formName + "']." + this.objName + "M");
		this.yearObj      = eval("document.forms['" + this.formName + "']." + this.objName + "Y");	
		this.monthyearObj = eval("document.forms['" + this.formName + "']." + this.objName + "MY");
		}	
	this._initOptions();
	
	// Set up the initial value
	if ( this.srcObj.value == null )
		{
		// Use todays date
		this.setToToday();
		}
	else
		{
		// Use the value
		this.setDateDDMMYYYY(this.srcObj.value);
		}
	
	this.adjustDaysInMonth();	
}

/* Class Methods */

/**
 * Set the date boxes to specific date
 * 
 * @param strStartDate Start date range for calendar (in yyyy-MM-dd format)
 * @param strEndDate End date range for calendar (in yyyy-MM-dd format)
 *
 */
function ds_setDateRange(strStartDate,strEndDate)
	{
	this.startDateRange = new Date();
	this.endDateRange   = new Date();

	var y, m, d;
	y = strStartDate.substr(0,4);
	m = strStartDate.substr(5,2);
	d = strStartDate.substr(8,2);
	this.startDateRange.setFullYear(new Number(y));	/* Not sure why but add on to year works */
	this.startDateRange.setMonth(new Number(m)-1);
	this.startDateRange.setDate(d);

	y = strEndDate.substr(0,4);
	m = strEndDate.substr(5,2);
	d = strEndDate.substr(8,2);
	this.endDateRange.setYear(new Number(y));	/* Not sure why but add on to year works */
	this.endDateRange.setMonth(new Number(m)-1);
	this.endDateRange.setDate(d);
	
	//alert ( "month" + strStartDate + "," + m  );
	
	this._initOptions();	
	this.adjustDaysInMonth();
	}

/**
 * Set the date boxes to specific date
 * 
 * @param dateStr Start date range for calendar (in yyyy-MM-dd format)
 *
 */
function ds_setDateYYYYMMDD( dateStr ) 
	{
	//alert ( dateStr );
	
	var y, m, d;
	y = dateStr.substr(0,4);
	m = dateStr.substr(5,2);
	d = dateStr.substr(8,2);
	this.setDateParts( y, m, d );
	}

/**
* Set the date boxes to today's date
*/
function ds_setToToday() {
	this.setDateParts( this.year, this.month, this.date );
}
/**
* Set the date boxes to specific date
* @param string dateStr 'DD-MM-YYYY'
*/
function ds_setDateDDMMYYYY( dateStr ) {
	var y, m, d;
	d = dateStr.substr(0,2);
	m = dateStr.substr(3,2);
	y = dateStr.substr(6,4);
	
	this.setDateParts( y, m, d );
}
/**
* Set the date boxes to today's date
* @param integer year
* @param integer month
* @param integer day
*/
function ds_setDateParts( year, month, date ) 
	{
	//alert ( "ds_setDateParts(" +year+"," +month+"," +date+ ")" );
	
	// Ensure the date, month & year are numbers
	year = new Number(year);
	month = new Number(month);
	date = new Number(date);
	
	// Set the day
	for( i=0; i < this.dayObj.length; i++ ) 
		{
		if( this.dayObj[i].value == date )
			this.dayObj[i].selected = true;
		}
	
	// Set the month year
	if ( this.monthyearObj == null )
		{
		this.monthObj[month-1].selected = true;
		for( i=0; i < this.yearObj.length; i++ ) {
			if( this.yearObj[i].value == year )
				this.yearObj[i].selected = true;
			}
		}
	else
		{
		// Find the correct value
		var targetVal = year + "-" + month ;
		//alert ( "ds_setDateParts : targetVal=" + targetVal + " len=" + this.monthyearObj.length );
		
		for( i=0; i < this.monthyearObj.length; i++ ) 
			{
			if( this.monthyearObj[i].value == targetVal )
				{
				//alert ( "ds_setDateParts: SELECT: val=" + this.monthyearObj[i].value + "idx:" + i );
				this.monthyearObj.selectedIndex = i ;
				//alert ( "ds_setDateParts: SELECTED:" + this.monthyearObj[this.monthyearObj.selectedIndex].value );
				}
			}
		
		}
	this.adjustDaysInMonth();
}


function ds_getYear() {

	if ( this.monthyearObj == null )
		{
		Year = this.yearObj[this.yearObj.selectedIndex].value;
		}
	else
		{
		var selectedVal = this.monthyearObj[this.monthyearObj.selectedIndex].value;
		Year  = selectedVal.substr(0,4);
		}

	return Year;
}

function ds_getMonth() {

	if ( this.monthyearObj == null )
		{
		Month = this.monthObj[this.monthObj.selectedIndex].value;
		}
	else
		{
		var selectedVal = this.monthyearObj[this.monthyearObj.selectedIndex].value;
		Month = selectedVal.substr(5,2);
		}

	return Month;
}

function ds_getDay() {
	return this.dayObj[this.dayObj.selectedIndex].value;;
}

/**
* Adjust the 'days' box according to the
* current month and year
*/
function ds_adjustDaysInMonth() 
{
	//alert ( "ds_adjustDaysInMonth" );
	
	var startDay = 1 ;
	
	Year  = this.getSelYear();
	Month = this.getSelMonth();

	//alert ( "ds_adjustDaysInMonth = " + Year + "-" + Month );

		
	DaysForThisSelection = this._getDaysInMonth(Month, Year);
	PrevDaysInSelection = this.dayObj.length;
	
	if ( ( this.startDateRange != null ) && ( this.endDateRange != null ) )
		{
		// Check to see if we need to trim the set further
		if ( ( Year == this.endDateRange.getFullYear() )
		     &&
		     ( Month == (this.endDateRange.getMonth()+1) ) )
			{
			DaysForThisSelection = this.endDateRange.getDate();
			}
			
		// See if we need to remove the start items
		if ( ( Year == this.startDateRange.getFullYear() )
		     &&
		     ( Month == (this.startDateRange.getMonth()+1) ) )
			{
			startDay =  this.startDateRange.getDate();
			}
			
		}
	
	var origSelected = new Number(this.getSelDay());
	
	//alert ( "ds_adjustDaysInMonth, origSelected=" + origSelected );
	
	var newSelected  = 0 ;
	if (origSelected < 0)
		origSelected = 0 ;

	// Remove the options		
	this.dayObj.options.length = 0 ;
	for( i = startDay ; i <= DaysForThisSelection; i++ ) 
		{
		var newOption = new Option( indentZero(i) , i );
		var optionsColl = this.dayObj.options;
		optionsColl[optionsColl.length] = newOption;
		
		if ( origSelected == i )
			{
			// Select this item
			newSelected = optionsColl.length - 1 ; /* zeo based index */
			}
			
		}

	//alert ( "ds_adjustDaysInMonth, newSelected=" + newSelected );

	this.dayObj.selectedIndex = newSelected;

	return ;	
}

/* Private Methods */

function ds_initOptions() {
	if ( this.monthyearObj == null )
		{
		// Seperate month and year
		this._writeYearOptions();
		this._writeMonthOptions();
		}
	else
		{
		// Single month year
		this._writeMonthYearOptions();
		}
	this._writeDayOptions();
}

function ds_getDaysInMonth( m, y ) {
	monthdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	if (m != 2) {
		return monthdays[m];
	} else {
		return ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ? 29 : 28);
	}
}


function ds_writeMonthYearOptions() 
	{
	//alert ( "ds_writeMonthYearOptions START:" + this.monthyearObj.options.length );
	var startYear = (this.year-this.yearComboRange);
	var endYear   = (this.year+this.yearComboRange);
	var startMonth = 1 ;
	var endMonth   = 12 ;
	
	if ( ( this.startDateRange != null ) && ( this.endDateRange != null ) )
		{
		// Use these date ranges
		startYear = this.startDateRange.getFullYear();
		endYear   = this.endDateRange.getFullYear();
		
		startMonth = this.startDateRange.getMonth()+1;
		endMonth   = this.endDateRange.getMonth()+1;
		}
	
	//alert ( "ds_writeMonthYearOptions=" + startYear + "-" + startMonth + "," + endYear + "-" + endMonth  );

	var selectedVal = "";
	
	if ( this.monthyearObj.selectedIndex >= 0 )
		selectedVal = this.monthyearObj[this.monthyearObj.selectedIndex].value;
	//alert ( "ds_writeMonthYearOptions selectedVal=" + selectedVal );
	
	
	// Clear any existing
	this.monthyearObj.options.length = 0 ;
	this.monthyearObj.selectedIndex	= 0 ;
	//alert ( "ds_writeMonthYearOptions CLEARED:" + this.monthyearObj.options.length );
	
	var optionsColl = this.monthyearObj.options;
	
	for( year= startYear; 
		 year<= endYear ; 
		 year++ ) 
		 {
		 var thisYearStartMonth = 1 ;
		 var thisYearEndMonth = 12 ;
		 
		 // Adjust the range
		 if ( year == startYear )  thisYearStartMonth = startMonth ;
		 if ( year == endYear	)  thisYearEndMonth   = endMonth ;
		 
		 //alert ( year + ": " + thisYearStartMonth + " to " + thisYearEndMonth );
		 
		 // Loop around all months for this year
		for( mon=thisYearStartMonth; mon <= thisYearEndMonth; mon++ ) 
			{
			var newValue = year + "-" + mon ;
			var newOption = new Option( this.monthNames[mon] + " " + year , newValue );
						  
			optionsColl[optionsColl.length] = newOption;
			
			if ( newValue == selectedVal )
				{
				this.monthyearObj.selectedIndex	= optionsColl.length - 1 ;
				//alert ( "ds_writeMonthYearOptions SELECT:" + this.monthyearObj[this.monthyearObj.selectedIndex].value );
				}
			}
		}
	
	if ( selectedVal == "" )	this.monthyearObj.selectedIndex = 0 ;
		
	//alert ( "ds_writeMonthYearOptions END:" + this.monthyearObj.options.length );
	//alert ( "ds_writeMonthYearOptions END:" + this.monthyearObj[this.monthyearObj.selectedIndex].value );
	
	}
	
function ds_writeYearOptions() 
	{
	var startYear = (this.year-this.yearComboRange);
	var endYear   = (this.year+this.yearComboRange);
	
	if ( ( this.startDateRange != null ) && ( this.endDateRange != null ) )
		{
		// Use these date ranges
		startYear = this.startDateRange.getFullYear();
		endYear   = this.endDateRange.getFullYear();
		}
	
	// Clear any existing
	this.yearObj.options.length = 0 ;
	
	for( i= startYear; 
		 i<= endYear ; 
		 i++ ) {
		var newOption = new Option( i, i );
		var optionsColl = this.yearObj.options;
		optionsColl[optionsColl.length] = newOption;
	}
}

function ds_writeMonthOptions() {
	for( i=1; i <= 12; i++ ) {
		var newOption = new Option( this.monthNames[i], i );
		var optionsColl = this.monthObj.options;
		optionsColl[optionsColl.length] = newOption;
	}
}

function ds_writeDayOptions() 
	{
	for( i=1; i <= 31; i++ ) 
		{
		var newOption = new Option( indentZero(i), i );
		var optionsColl = this.dayObj.options;
		optionsColl[optionsColl.length] = newOption;
		}
	}

	// utility function
function indentZero(num) {
	  return ((num <= 9) ? ("0" + num) : num);
	}

/*
* End:uk/co/aimltd/resources/javascript/combo_date_selectorv0.1/dsInput.js
*/

/**
 * pageLanderWizard Form Generator Scripts
 * - Creates the template from the following Javascript.
 * - The interface can be expanded but binary compatability can not be broken.
 * - All dates and times must be zero padded.
 */
/** Date and time code adapted from dateTime.js */
var mainJourneyRequestDetails_timeSelect = null ;
var mainJourneyRequestDetails_dateSelect = null ;
var currentTime = new Date();

/**
 *	Populate the "time" element associated with the passed element.
 */
function UpdatemainJourneyRequestDetails_timeSelect(fieldOnFormWithTime)
	{
	var h = new String( mainJourneyRequestDetails_timeSelect.getSelHour() );
	var m = padZero( mainJourneyRequestDetails_timeSelect.getSelMins() );
	fieldOnFormWithTime.form.time.value = h + ':' + m + ':00';
	}

/**
 * Create the input element and the accociated selection boxes
 */
function CreatemainJourneyRequestDetails_timeSelect()
	{
	var htmloutput = '';
	var now = ( currentTime.getHours() ) + ':' + ( currentTime.getMinutes() );
	htmloutput += '<input name="time" id="mainJourneyRequestDetailstime" type="text" value="' + now + '" style="display: none;"/>';
	htmloutput += '<select name="timeH" tabindex="220" id="timeH" onChange="UpdatemainJourneyRequestDetails_timeSelect(this)" style="margin-left:3px;margin-right:5px;padding:0px;text-indent:0px;border-width:2px;border-style:inset;border-color:rgb(224,223,227);font:size:12px;color:rgb(0,0,0);width:43px;float:none;"></select>';
	htmloutput += '<select name="timeM" tabindex="221" id="timeM" onChange="UpdatemainJourneyRequestDetails_timeSelect(this)" style="padding:0px;text-indent:0px;border-width:2px;border-style:inset;border-color:rgb(224,223,227);font:size:12px;color:rgb(0,0,0);width:43px;float:none;"></select>';
	return htmloutput;
	}

/**
 * Should be linked to the date selectors as the onchange action.
 * It updates the value in the underlying text input to contain the chosen date.
 */
function UpdatemainJourneyRequestDetails_dateSelect(fieldOnFormWithDate)
	{
	var y = new String( mainJourneyRequestDetails_dateSelect.getSelYear() );
	var m = padZero( mainJourneyRequestDetails_dateSelect.getSelMonth() );
	var d = padZero( mainJourneyRequestDetails_dateSelect.getSelDay() );
	mainJourneyRequestDetails_dateSelect.setDateParts(y,m,d);
	var y2 = new String( mainJourneyRequestDetails_dateSelect.getSelYear() );
	var m2 = padZero( mainJourneyRequestDetails_dateSelect.getSelMonth() );
	var d2 = padZero( mainJourneyRequestDetails_dateSelect.getSelDay() );
	fieldOnFormWithDate.form.date.value = d2 + '/' + m2 + '/' + y2;
	}

/**
 * Create the input element and the accociated selection boxes
 */
function CreatemainJourneyRequestDetails_dateSelect()
	{
	var htmloutput = '';
	var today = ( padZero(currentTime.getDate()) ) + "/" + ( padZero(currentTime.getMonth() + 1)) + "/" + currentTime.getFullYear() ;
	htmloutput += '<input name="date" id="mainJourneyRequestDetailsdate" type="text" value="' + today + '" style="display: none;"/>';
	htmloutput += '<select name="dateD" tabindex="230" id="dateH" onChange="UpdatemainJourneyRequestDetails_dateSelect(this)" style="margin-left:4px;margin-right:6px;margin-top:3px;padding:0px;text-indent:0px;border-width:2px;border-style:inset;border-color:rgb(224,223,227);font:size:12px;color:rgb(0,0,0);width:43px;float:none;"></select>';
	htmloutput += '<select name="dateMY" tabindex="231" id="dateM" onChange="UpdatemainJourneyRequestDetails_dateSelect(this)" style="padding:0px;text-indent:0px;border-width:2px;border-style:inset;border-color:rgb(224,223,227);font:size:12px;color:rgb(0,0,0);width:122px;float:none;"></select>';
	return htmloutput;
	}

/**
 * For the given form the date and time simple text inputs are replaced
 * with select lists.
 */
function PageLanderSetupDateTimeInputs(customFormName) {

	var formName = 'journeyPlannerForm';

	if (typeof customFormName !== 'undefined') {
		formName = customFormName;
	}

	// setup time input
	mainJourneyRequestDetails_timeSelect = new tmInput( 'time', formName );

	// setup date input
	mainJourneyRequestDetails_dateSelect = new dsInput( 'date', formName );
	mainJourneyRequestDetails_dateSelect.monthNames = new Array( '','January','February','March','April','May','June','July','August','September','October','November','December' );
	mainJourneyRequestDetails_dateSelect._initOptions();
	mainJourneyRequestDetails_dateSelect.setDateRange("2012-01-30", "2012-05-04");
}

/* create a string replace all function */
if ( typeof String.prototype.replaceAll == 'undefined' ) {
	String.prototype.replaceAll = function(regex, replace) {
		var a = this;
		while (a.search(regex) >= 0) {
			a = a.replace(regex, replace);
		}
		return a;
	}
}

/*
 * Below here is the PageLanderTemplate object. The correct way to use this it to
 * instansiate a copy, set all the values within it to specify the desired template,
 * then call the renderTemplate function.
 */

/**
 * Function to construct a page lander template object.
 */
function PageLanderTemplate() {
	this.type = 1;
	this.locationName = "";
	this.locationEasting = 0;
	this.locationNorthing = 0;
	this.isLocality = false;
	this.localityID = "";
	this.locationTitle = "";
	this.serverPath = "";
	this.skinPath = "";
}

/**
 * Within the raw template code values to be replaced appear as {0} - {7},
 * this function assocaites these numbers with the value with which they
 * are to be replaced.
 */
PageLanderTemplate.prototype.matchTemplateValue = function(valueIndex) {

	var value = null;

	switch(valueIndex) {
	case 0:
		value = this.locationName;
		break;
	case 1:
		value = new String(this.locationEasting);
		break;
	case 2:
		value = new String(this.locationNorthing);
		break;
	case 3:
		value = this.serverPath;
		break;
	case 4:
		value = this.skinPath;
		break;
	case 5:
		value = this.locationTitle;
		break;
	case 6:
		value = new String(this.isLocality);
		break;
	case 7:
		value = new String(this.localityID);
		break;
	}

	return value;
}

/**
 * Gets the template code depending on what type has been set.
 */
PageLanderTemplate.prototype.getRawSource = function() {

	var templateCode = "";

	// select the raw template code
	switch (this.type) {
	case 1:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:54px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:54px;width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><input type="hidden" name="searchType" value="To here..."/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0px 0px 0px 25px; padding: 0px; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:54px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none"></div></div><div style="clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	case 2:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:54px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:54px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none;text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px;"><input name="searchType" type="submit" value="To here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/><input name="searchType" type="submit" value="From here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:54px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	case 3:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:112px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:112px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:3" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><input type="hidden" name="searchType" value="To here..."/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none;text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; font-size:12px; width:30px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; margin: 0; width:29px; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:32px; height:30px;"><input class="inputButton" type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:112px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	case 4:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:142px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:142px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:4" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:10px 0 0 40px; padding: 0; border: none; outline: none; float: none; clear: none;"><input type="radio" id="depart" name="departureTimeFlag" value="true" checked="checked" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="depart" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Depart</label><input type="radio" id="arrive" name="departureTimeFlag" value="false" style="margin: 0 0 0 20px; padding: 0; border: none; outline: none; float: none; clear: none; "/><label for="arrive" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Arrive</label></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; font-size:12px; width:30px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; margin: 0; width:29px; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:31px; height:30px;"><input name="searchType" type="submit" value="To here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/><input name="searchType" type="submit" value="From here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:142px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	case 5:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/locationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear: both; float: left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:82px; width:11px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;);width:265px;height:82px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptNonFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="originLocation" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 35px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your origin</label><input type="text" id="originLocation" name="originLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:4px 0 0 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="destinationLocation" style="color:white; width:120px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your destination</label><input type="text" id="destinationLocation" name="destinationLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:82px; width:4px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div></div><div style="float:none;clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	case 6:
		templateCode = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/locationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:168px; width:11px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;);width:265px;height:168px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:6" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptNonFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="originLocation" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 35px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your origin</label><input type="text" id="originLocation" name="originLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-indent:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:4px 0 0 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="destinationLocation" style="color:white; width:120px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your destination</label><input type="text" id="destinationLocation" name="destinationLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-indent:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:10px 0 0 40px; padding: 0; border: none; outline: none; float: none; clear: none;"><input type="radio" id="depart" name="departureTimeFlag" value="true" checked="checked" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="depart" style="color:white;font-family: Arial;  width:40px; font-size:12px;margin: 0 0 0 3px; padding: 0; border: none; outline: none; float: none; clear: none;">Depart</label><input type="radio" id="arrive" name="departureTimeFlag" value="false" style="margin: 0 0 0 20px; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="arrive" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Arrive</label></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; width:30px; font-size:12px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; width:29px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:31px; height:30px;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:168px; width:4px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div></div><div style="float:none;clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');
		break;
	}

	return templateCode;
}

/**
 * Gets the raw tempalate source.
 * It replaces the markers {0} - {6} with the values set in the PateLanderTemplate instance.
 * It replaces the markers {TimeInput} and {DateInput} with the selectors.
 */
PageLanderTemplate.prototype.getReplacedSource = function() {

	var templateCode = this.getRawSource();

	// replace the properties in the template code
	for (var i = 0; i < 8; ++i) {
		var replacementText = this.matchTemplateValue(i);
		if (replacementText !== null) {
			templateCode = templateCode.replaceAll(new RegExp("\\{"+i+"\\}"), replacementText);
		}
	}

	// replace time input placeholder
	var timeinput = CreatemainJourneyRequestDetails_timeSelect()
	templateCode = templateCode.replaceAll(new RegExp("\\{TimeInput\\}"), timeinput);

	// replace date input placeholder
	var dateinput = CreatemainJourneyRequestDetails_dateSelect()
	templateCode = templateCode.replaceAll(new RegExp("\\{DateInput\\}"), dateinput);

	return templateCode;
}

/**
 * Writes the fully usable template code to the document.
 */
PageLanderTemplate.prototype.renderTemplate = function() {

	// get the template code with all values inserted
	var templateCode = this.getReplacedSource();

	// write the output to the page
	document.write(templateCode);
}

/*
 * EVERYTHING BELOW THIS IS AN OLD WAY OF GENERATING THE TEMPLATES, KEPT FOR BACKWARDS
 * COMPATABILITY. IT WAS LIMITED BY THE FUNCTION PROTOTYPES AND COULD NOT BE EXPANDED.
 *
 * Used by code generated by page lander wizard
 * versions < 6.02.000
 * versions < 7.01.000
 * versions < 8.01.000
 */

/** Code to generate the forms */

/**
 * Writes to the document a template with the given parameters
 */
function PageLanderFormTemplate(type, locationName, easting, northing, serverPath, skinPath, locationTitle) {
	/* check type */
	switch(type) {
	case 1:
		PageLanderPostcodeOnlyTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	case 2:
		PageLanderPostcodePlusToFromTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	case 3:
		PageLanderPostcodePlusDateTimeTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	case 4:
		PageLanderFixedFullTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	case 5:
		PageLanderNonFixedNowTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	case 6:
		PageLanderNonFixedFullTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle);
		break;
	}
}

/**
 * Replaces option markers in the given raw template code.
 * It replaces the markers {0} - {6} with the values set in the PateLanderTemplate instance.
 * It replaces the markers {TimeInput} and {DateInput} with the selectors.
 */
function PageLanderFormTemplateReplacements(number, raw, locationName, easting, northing, serverPath, skinPath, locationTitle) {

	var output = raw;

	// replace locationName
	output = output.replaceAll(new RegExp("\\{0\\}"), locationName);
	// replace easting
	output = output.replaceAll(new RegExp("\\{1\\}"), easting);
	// replace northing
	output = output.replaceAll(new RegExp("\\{2\\}"), northing);
	// replace serverPath
	output = output.replaceAll(new RegExp("\\{3\\}"), serverPath);
	// replace serverPath
	output = output.replaceAll(new RegExp("\\{4\\}"), skinPath);
	// replace serverPath
	if (typeof(locationTitle) != 'undefined' && locationTitle != null)
		{
		output = output.replaceAll(new RegExp("\\{5\\}"), locationTitle);
		}

	// replace time input placeholder
	var timeinput = CreatemainJourneyRequestDetails_timeSelect()
	output = output.replaceAll(new RegExp("\\{TimeInput\\}"), timeinput);

	// replace date input placeholder
	var dateinput = CreatemainJourneyRequestDetails_dateSelect()
	output = output.replaceAll(new RegExp("\\{DateInput\\}"), dateinput);

	return output;
}

/** Template 1 */
function PageLanderPostcodeOnlyTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:54px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:54px;width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><input type="hidden" name="searchType" value="To here..."/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0px 0px 0px 25px; padding: 0px; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:54px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none"></div></div><div style="clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(1, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

/** Template 2 */
function PageLanderPostcodePlusToFromTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:54px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:54px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none;text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px;"><input name="searchType" type="submit" value="To here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/><input name="searchType" type="submit" value="From here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:54px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(2, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

/** Template 3 */
function PageLanderPostcodePlusDateTimeTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:112px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:112px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:3" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><input type="hidden" name="searchType" value="To here..."/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none;text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; font-size:12px; width:30px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; margin: 0; width:29px; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:32px; height:30px;"><input class="inputButton" type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:112px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(3, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

/** Template 4 */
function PageLanderFixedFullTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/toLocationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:142px; width:11px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;); height:142px; width:265px; clear: none; margin: 0; padding: 0; border: none; outline: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:4" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><input type="hidden" name="confirmedLocationName" value="{0}"/><input type="hidden" name="confirmedLocationEasting" value="{1}"/><input type="hidden" name="confirmedLocationNorthing" value="{2}"/><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="locationName" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your postcode</label><input type="text" id="locationName" name="userLocationName" value="" size="15" style="margin:0 0 0 25px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:10px 0 0 40px; padding: 0; border: none; outline: none; float: none; clear: none;"><input type="radio" id="depart" name="departureTimeFlag" value="true" checked="checked" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="depart" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Depart</label><input type="radio" id="arrive" name="departureTimeFlag" value="false" style="margin: 0 0 0 20px; padding: 0; border: none; outline: none; float: none; clear: none; "/><label for="arrive" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Arrive</label></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; font-size:12px; width:30px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; margin: 0; width:29px; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:31px; height:30px;"><input name="searchType" type="submit" value="To here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/><input name="searchType" type="submit" value="From here..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:142px; width:4px; clear: none; margin: 0; padding: 0; border: none; outline: none;"></div></div><div style="clear:both;margin: 0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(4, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

/** Template 5 */
function PageLanderNonFixedNowTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/locationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear: both; float: left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:82px; width:11px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;);width:265px;height:82px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><form id="journeyPlannerForm" name="journeyPlannerForm" method="post" action="{3}/pagelanderwizard/acceptNonFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="originLocation" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 35px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your origin</label><input type="text" id="originLocation" name="originLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:4px 0 0 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="destinationLocation" style="color:white; width:120px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your destination</label><input type="text" id="destinationLocation" name="destinationLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-index:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="float:right; min-height:32px; height:30px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:82px; width:4px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div></div><div style="float:none;clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(5, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

/** Template 6 */
function PageLanderNonFixedFullTemplate(locationName, easting, northing, serverPath, skinPath, locationTitle) {

	// raw form format
	var raw = new String('<div xmlns="http://www.w3.org/1999/xhtml" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><img src="{3}/{4}/images/pagelander/resources/locationHeader.gif" width="280" height="93" alt="template header" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div><div style="clear:both;float:left; margin: 0; padding: 0; border: none; outline: none;"><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/leftEdge.gif&quot;); height:168px; width:11px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/background.gif&quot;);width:265px;height:168px; margin: 0; padding: 0; border: none; outline: none; clear: none;"><form id="journeyPlannerForm" name="journeyPlannerForm:6" style="color:white;" method="post" action="{3}/pagelanderwizard/acceptNonFixedJPDetails.do" target="_blank" enctype="application/x-www-form-urlencoded"><div style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="originLocation" style="color:white; width:90px; font-family: Arial; font-size:12px;margin:0 0 0 35px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your origin</label><input type="text" id="originLocation" name="originLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-indent:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:4px 0 0 0; padding: 0; border: none; outline: none; float: none; clear: none;"><label for="destinationLocation" style="color:white; width:120px; font-family: Arial; font-size:12px;margin:0 0 0 5px; padding: 0; border: none; outline: none; float: none; clear: none;">Enter your destination</label><input type="text" id="destinationLocation" name="destinationLocationName" value="" size="15" style="margin:0 0 0 10px; padding: 0; float: none; clear: none; text-indent:0px; border-width:2px; border-style:inset; border-color:rgb(224,223,227); font-size:12px; color:rgb(0,0,0); height:18px; width:112px;"/></div><div style="margin:10px 0 0 40px; padding: 0; border: none; outline: none; float: none; clear: none;"><input type="radio" id="depart" name="departureTimeFlag" value="true" checked="checked" style="margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="depart" style="color:white;font-family: Arial;  width:40px; font-size:12px;margin: 0 0 0 3px; padding: 0; border: none; outline: none; float: none; clear: none;">Depart</label><input type="radio" id="arrive" name="departureTimeFlag" value="false" style="margin: 0 0 0 20px; padding: 0; border: none; outline: none; float: none; clear: none;"/><label for="arrive" style="color:white;font-family: Arial; font-size:12px;margin: 0 0 0 3px; width:40px; padding: 0; border: none; outline: none; float: none; clear: none;">Arrive</label></div><div style="margin-left:30px; margin-top:10px;"><label for="mainJourneyRequestDetailstime" style="color:white;font-family: Arial; width:30px; font-size:12px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Time</label>{TimeInput}</div><div style="margin-left:30px"><label for="mainJourneyRequestDetailsdate" style="color:white;font-family: Arial; font-size:12px; width:29px; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;">Date</label>{DateInput}</div><div style="float:right; min-height:31px; height:30px;"><input type="submit" value="Search..." style="margin-top:5px; margin-right:12px;background-image:  url(&quot;{3}/{4}/images/pagelander/resources/BlueGradient27pxHigh.gif&quot;);background-repeat: repeat-x;background-color:#02019a;filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=\'#ff7373e1\',EndColorStr=\'#ff02019a\'); font-size:13px; font-family:verdana,arial,helvetica,sans-serif;color:white;border-top:1px solid #4e4e8c; border-left:1px solid #4e4e8c; border-right:1px solid #413f7e; border-bottom:1px solid #413f7e;font-weight:normal;cursor:pointer;"/></div></form></div><div style="float:left;background:  url(&quot;{3}/{4}/images/pagelander/resources/rightEdge.gif&quot;); height:168px; width:4px; margin: 0; padding: 0; border: none; outline: none; clear: none;"></div></div><div style="float:none;clear:both;margin:0 0 0 8px; padding: 0; border: none; outline: none;"><img src="{3}/{4}/images/pagelander/resources/footer.gif" width="272" height="11" alt="template footer" style="display: block; margin: 0; padding: 0; border: none; outline: none; float: none; clear: none;"/></div></div>');

	// replace special text
	var output = PageLanderFormTemplateReplacements(6, raw, locationName, easting, northing, serverPath, skinPath, locationTitle);

	// write the output to the page
	document.write(output);
}

