﻿// JScript File

function toggleLayer(whichLayer,bOnOff)
{
    whichLayer = "ctl00_MainContent_" + whichLayer;
	getElement(whichLayer).style.display = !bOnOff? "none":"block";	
}

/*------------------------------------------------------------------------------------------------------*/

function origtoggleLayer(whichLayer,bOnOff)
{
   getElement(whichLayer).style.display = !bOnOff? "none":"block";
}

/*------------------------------------------------------------------------------------------------------*/

/*This function used to live in the adventure-bus.js file, but I moved it here because of an issue with *
 *the id not being recognized, for some reason. - SW                                                    */

function evaluateproduct()
{
    var w, x, y, z;
    x = getobject('ctl00_MainContent_busyes');
    y = getobject('ctl00_MainContent_ticketyes');
    z = getobject('ctl00_MainContent_travelrequest1');
    w = getobject('ctl00_MainContent_travelrequest2');

    if (z.checked && !w.checked)
    {
    	y.style.display = 'block';
		x.style.display = 'none';
	}
	else if (!z.checked && w.checked)
	{
		y.style.display = 'none';
		x.style.display = 'block';
	}
}

/*------------------------------------------------------------------------------------------------------*/

function CheckBoxCheck(sender, args)
{
    var sValue = args.Value;
	args.IsValid = (sValue.Length > 0) ? true : false;
	return;
}
  
/*------------------------------------------------------------------------------------------------------*/
  
function getElement(sID)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		return document.getElementById(sID);
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		return document.all[sID];
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		return document.layers[sID];
	}
}

/*------------------------------------------------------------------------------------------------------*/

function switchFocusOffSelect(name)
{
   //getElement("ctl00_MainContent_pickUpTime").blur();
   getElement(name).focus(); 
}

/*------------------------------------------------------------------------------------------------------*/

function confirmTime(name)
{
	var T = getElement(name);
	T.focus();
	T.style.color = '#009900';
	T.style.fontWeight = 'bold';
	T.innerHTML = 'Time confirmed';	
}

/*------------------------------------------------------------------------------------------------------*/

function resetTime(name)
{
	var T = getElement(name);
	T.style.color = '#000000';	
	T.innerHTML = '(select time and click <strong><a href="javascript:confirmTime(\''+ name+ '\');">here</a></strong> to confirm)';
}
