
function setLocationType(form, state)
{
	var LtypeO;
	
	if(state.charAt(0)=='O')
	{
		document.BookTrip.PickUpAddress.value = '';
		document.BookTrip.PickUpAddressDisplay.value = '';
	}
	else if (state.charAt(0)=='D' && document.BookTrip.PickUpAddress.value == '')
	{
		alert('Please select a pick-up address!');
	}
	else
	{
		document.BookTrip.DropOffAddress.value = '';
		document.BookTrip.DropOffAddressDisplay.value = '';
	}
	document.BookTrip.FormState.value = '';
	
	if (document.BookTrip.PickUpLocationSelect[0].checked)
	{
		LtypeO = document.BookTrip.PickUpLocationSelect[0].value;
		
	}
	else if (document.BookTrip.PickUpLocationSelect[1].checked)
		LtypeO = document.BookTrip.PickUpLocationSelect[1].value;
	else if (document.BookTrip.PickUpLocationSelect[2].checked)
	{
		LtypeO = document.BookTrip.PickUpLocationSelect[2].value;
	//	document.BookTrip.PickUpAddressDisplay.focus();
	}


	if (document.BookTrip.DropOffLocationSelect[0].checked)
		LtypeD = document.BookTrip.DropOffLocationSelect[0].value;
	else if (document.BookTrip.DropOffLocationSelect[1].checked)
		LtypeD = document.BookTrip.DropOffLocationSelect[1].value;
	else if (document.BookTrip.DropOffLocationSelect[2].checked)
	{
		LtypeD = document.BookTrip.DropOffLocationSelect[2].value;
	} 	
	
/*	
	if(((document.BookTrip.PickUpLocationSelect[0].checked)||(document.BookTrip.PickUpLocationSelect[1].checked))&&((state=='OFrequent')||(state=='OLandmark')||(state=='O')))
	{
		if(state=='O')
		{
			document.BookTrip.PickUpAddressDisplay.value = '';
			document.BookTrip.PickUpAddress.value = '';
		}
		else if((document.BookTrip.PickUpLocationSelect[0].checked == true)&&(document.BookTrip.OLocationTypeSelect.value== ''))			{
			document.BookTrip.OLocationTypeSelect.value = LtypeO;
			return true;
		}
		else if((document.BookTrip.PickUpLocationSelect[0].checked == true)&&(document.BookTrip.OLocationTypeSelect.value=='Frequent'))	
		{
			return true;
		}
		else if((document.BookTrip.PickUpLocationSelect[1].checked == true)&&(document.BookTrip.OLocationTypeSelect.value=='Landmark'))	
		{
			return true;
		}
		document.BookTrip.OLocationTypeSelect.value = LtypeO;
	}*/
	var LtypeD;
	/*if (document.BookTrip.DropOffLocationSelect[0].checked)
		LtypeD = document.BookTrip.DropOffLocationSelect[0].value;
	else if (document.BookTrip.DropOffLocationSelect[1].checked)
		LtypeD = document.BookTrip.DropOffLocationSelect[1].value; */
/*
	if(((document.BookTrip.DropOffLocationSelect[0].checked)||(document.BookTrip.DropOffLocationSelect[1].checked))&&((state=='DFrequent')||(state=='DLandmark')||(state=='D')))
	{
		if(state=='D')
		{
			document.BookTrip.DropOffAddressDisplay.value = '';
			document.BookTrip.DropOffAddress.value = '';
		}
		else if((document.BookTrip.DropOffLocationSelect[0].checked == true)&&(document.BookTrip.DLocationTypeSelect.value== ''))			{
			document.BookTrip.DLocationTypeSelect.value = LtypeD;
			return true;
		}
		else if((document.BookTrip.DropOffLocationSelect[0].checked == true)&&(document.BookTrip.DLocationTypeSelect.value=='Frequent'))	
		{
			return true;
		}
		else if((document.BookTrip.DropOffLocationSelect[1].checked == true)&&(document.BookTrip.DLocationTypeSelect.value=='Landmark'))	
		{
			return true;
		}
		document.BookTrip.DLocationTypeSelect.value = LtypeD;
	} */


	if(state=='OFrequent')
	{
		document.BookTrip.OLocationType.value = '';
		document.BookTrip.PickUpAddress.value = '';
	}	
	if(state=='OLandmark')
	{
		document.BookTrip.PickUpAddress.value = '';
	}			
	if(state=='DFrequent')
	{
		document.BookTrip.DLocationType.value = '';
		document.BookTrip.DropOffAddress.value = '';
	}	
	if(state=='DLandmark')
	{
		document.BookTrip.DropOffAddress.value = '';
	}	
	
	if(document.BookTrip.OLocationType.value!='')
	{	
		document.BookTrip.FormState.value = 'FOrigin';
	}
	else if(document.BookTrip.DLocationType.value!='')
	{
		document.BookTrip.FormState.value = 'FDestination';
	}
	else
		document.BookTrip.FormState.value = '0';
	
	
	document.BookTrip.submit();
	return true;

}


function setLocationValue(form,state)
{
	//alert(state);
	//alert("before: " + document.BookTrip.DropOffAddress.value);
	if(state == "FOrigin")
	{	
		document.BookTrip.PickUpAddress.value = 		document.BookTrip.MatchOrigin.options[document.BookTrip.MatchOrigin.selectedIndex].value;
document.BookTrip.PickUpAddressDisplay.value =document.BookTrip.MatchOrigin.options[document.BookTrip.MatchOrigin.selectedIndex].text;

		
	}
	if (state == "FDestination")
	{		
		document.BookTrip.DropOffAddress.value = 		document.BookTrip.MatchDestination.options[document.BookTrip.MatchDestination.selectedIndex].value;

document.BookTrip.DropOffAddressDisplay.value = 		document.BookTrip.MatchDestination.options[document.BookTrip.MatchDestination.selectedIndex].text;
		
	}
}

function he(form, event)
{
var error ='';

 if (event == 'ChangePassword')
 {
 	if ( (document.AccountPassword.OPW.value == '') || (document.AccountPassword.NPW.value == '') || (document.AccountPassword.RNPW.value == ''))
 	{
 		error += "Please ensure that old password, new password and repeat new password are filled.\n";
 	}
	if ( (document.AccountPassword.NPW.value) != (document.AccountPassword.RNPW.value) )
	{
		error += "Your new password has to match.\n";
	}
	
	if (error == '')
	{ 
		return true;
	}
	else
	{
		alert(error);		 
		return false;
	}
 }
 
	if (event == 'SetPickUpAddress')
	{
		if (document.BookTrip.PickUpAddressSelect.options[document.BookTrip.PickUpAddressSelect.selectedIndex].value != 'FUA')
		{
			document.BookTrip.PickUpAddressDisplay.value = document.BookTrip.PickUpAddressSelect.options[document.BookTrip.PickUpAddressSelect.selectedIndex].text;
			document.BookTrip.PickUpAddress.value = document.BookTrip.PickUpAddressSelect.options[document.BookTrip.PickUpAddressSelect.selectedIndex].value;
			//document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
			//document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;
			document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[document.BookTrip.PickUpDate.selectedIndex].value;
			document.BookTrip.Time.value = document.BookTrip.Time.options[document.BookTrip.Time.selectedIndex].value;
		}
	}

	if (event == 'SetDropOffAddress')
	{
	 	if (document.BookTrip.DropOffAddressSelect.options[document.BookTrip.DropOffAddressSelect.selectedIndex].value != 'FUA')
		{
			document.BookTrip.DropOffAddressDisplay.value = document.BookTrip.DropOffAddressSelect.options[document.BookTrip.DropOffAddressSelect.selectedIndex].text;
			document.BookTrip.DropOffAddress.value = document.BookTrip.DropOffAddressSelect.options[document.BookTrip.DropOffAddressSelect.selectedIndex].value;
			//document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
			//document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;
			document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[document.BookTrip.PickUpDate.selectedIndex].value;
			document.BookTrip.Time.value = document.BookTrip.Time.options[document.BookTrip.Time.selectedIndex].value;
		}

	}

	if (event == 'BookSubscription')
	{

		if (form.WS.checked || form.WM.checked || form.WT.checked || form.WW.checked || form.WH.checked || form.WF.checked || form.WA.checked)
		{
		}
		else
		{
				 error += "Please select at least one day\n";
		}		 

		if (form.PickUpAddressDisplay.value=='RA' || form.PickUpAddressDisplay.value=='')
		{
		 error += 'Please enter a pick-up address\n';
		}
		if (form.DropOffAddressDisplay.value=='RA' || form.DropOffAddressDisplay.value=='')
		{
		 error += 'Please enter a drop-off address\n';
		}
		if (form.PickUpAddressDisplay.value == form.DropOffAddressDisplay.value)
		{
	 	 if (! form.PickUpAddressDisplay.value == '')
		 		error += 'The drop-off address is the same as the pick-up address\n';
		}
		setPassengerList(form);
	
	} // end BookSubscription
	
	
	if (event == 'AddPassenger')
	{
	 var passenger = form.PassengerTypeSelect.value + ';' + form.SpaceTypeSelect.value;
	 var passengerdesc = form.PassengerTypeSelect.options[form.PassengerTypeSelect.selectedIndex].text + ':' + form.SpaceTypeSelect.options[form.SpaceTypeSelect.selectedIndex].text;
	 var i = 0;
	 	for (i;i<2;i++)
		{
		 if (form.PassengerListSelect.options[i].value == 'AP')
		 {
			form.PassengerListSelect.options[i].text= passengerdesc;
			form.PassengerListSelect.options[i].value= passenger;
			return;
			}
		}
	}

	if (event == 'DeletePassenger')
	{
		 if (eval(form.PassengerListSelect.selectedIndex) != -1)
 		 {
			 form.PassengerListSelect.options[form.PassengerListSelect.selectedIndex].value = 'AP';
			 form.PassengerListSelect.options[form.PassengerListSelect.selectedIndex].text = '-- Additional Passenger? --';
		 }
		 else
		 {
			 alert("You don't have any passengers selected");
		 }
	}

	if (event == 'RequestReturnTrip')
	{
		if (eval(form.ReturnPickUpTime.selectedIndex) == -1)
		{
			error += "No return trips are available.\nPlease select one of the other options.";
		}
	}
	
	if (error == '')
	{ 
		form.FormState.value = 'Valid';
		return true;
	}
  else
	{
	 alert (error);
	 return false;
	}
}

function setLocationT(form,state)
{
	form.FormState.value = state;
	setPassengerList(form);

	if (state == "FOrigin")
	{		
		form.OLocationType.value = form.OriginLocationType.value;
	}

	if (state == "FDestination")
	{		
		form.DLocationType.value = form.DestinationLocationType.value;
	}

	form.submit();
}

function setLocationText(form, state)
{

	if (state == "MOrigin")
	{		

		document.PB.PAD.value = form.MOrigin[form.MOrigin.selectedIndex].text;

		document.PB.PAN.value = form.MOrigin[form.MOrigin.selectedIndex].value;
	}

	if (state == "MDestination")
	{		
		document.PB.DAD.value = form.MDestination[form.MDestination.selectedIndex].text;

		document.PB.DAN.value = form.MDestination[form.MDestination.selectedIndex].value;
	}

	if (state == "SelectOrigin")
	{		
 		form.PickUpAddressDisplay.value = form.OriginLocationType[form.OriginLocationType.selectedIndex].text;

		form.PickUpAddress.value = form.OriginLocationType[form.OriginLocationType.selectedIndex].value;		
		//return makeVisible("StartLandmarkCategories");

		document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
		document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;
	}

	if (state == "SelectDestination")
	{		
 		form.DropOffAddressDisplay.value = form.SelectDestination[form.SelectDestination.selectedIndex].text;

		form.DropOffAddress.value = form.SelectDestination[form.SelectDestination.selectedIndex].value;
		//return makeVisible("EndLandmarkCategories");

		document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
		document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;
	}

}


function setLocation(form,state)
{
	form.FormState.value = state;
	setPassengerList(form);

	if (state == "FOrigin")
	{		
	
		form.OLocationType.value = form.OriginLocationType.value;
	}

	if (state == "FDestination")
	{		
		form.DLocationType.value = form.DestinationLocationType.value;
	}

	form.submit();
}

/*

function setLandmarkLocationValue(form,state)
{
	if(state == "FOrigin")

	{	
		//document.BookTrip.PickUpAddress.value =document.BookTrip.FOrigin[form.FOrigin.selectedIndex].value;
		
		
		//form.PickUpAddressDisplay.value = form.FOrigin.text;
		form.PickUpAddress.value = form.FOrigin.value;
		alert(form.FOrigin.value);

		if(form.FOrigin[form.FOrigin.selectedIndex] != null)
		{
			form.PickUpAddressDisplay.value = form.FOrigin[form.FOrigin.selectedIndex].text;

			form.PickUpAddress.value = form.FOrigin[form.FOrigin.selectedIndex].value;
			alert("here");
		}		
		//return makeVisible("StartLandmarkCategories");

		document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
		if(document.BookTrip.Time != null)
		  document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;

	}
	if (state == "FDestination")
	{		
		//document.BookTrip.DropOffAddress.value = form.FDestination[form.FDestination.selectedIndex].value;

		if(form.FDestination[form.FDestination.selectedIndex] != null)
		{
			form.DropOffAddressDisplay.value = form.FDestination[form.FDestination.selectedIndex].text;

			form.DropOffAddress.value = form.FDestination[form.FDestination.selectedIndex].value;
		}
		//return makeVisible("EndLandmarkCategories");

		document.BookTrip.PickUpDate.value = document.BookTrip.PickUpDate.options[0].value;
		
		if(document.BookTrip.Time != null)
			document.BookTrip.Time.value = document.BookTrip.Time.options[0].value;
	}	
	return true;
}
*/

function setLandmarkLocationValue(form,state)
{
	if(state == "FOrigin")
	{	
		
		document.BookTrip.PickUpAddress.value = document.BookTrip.FOrigin[document.BookTrip.FOrigin.selectedIndex].value;
		form.PickUpAddressDisplay.value = form.FOrigin[form.FOrigin.selectedIndex].text;



	}
	else if (state == "FDestination")
	{		
		document.BookTrip.DropOffAddress.value = document.BookTrip.FDestination[document.BookTrip.FDestination.selectedIndex].value;
		form.DropOffAddressDisplay.value = form.FDestination[form.FDestination.selectedIndex].text;
	}	
	return true;
}

function setLandmarkLocationValueExtra(form)
{
		
	document.BookTrip.PickUpAddress.value = form.FOrigin[form.FOrigin.selectedIndex].value;
	
	RefreshDestLandMark(form,true);
			
	return true;
}

function RefreshDestLandMark(form,RemoveOrgLandM)
{
	//remove all options
	var count = form.FDestination.length;
	
	for(var i = 0; i < count; i++)
		form.FDestination.remove(count-i-1);

	//addon all options
	var selDIndex = 0;
	count = form.FOrigin.length;
	var idx = -1;
	for(i = 0; i < count; i++)
	{
		
		var IsOrgLandmark = false;
		if(RemoveOrgLandM && form.FOrigin.options[i].value == document.BookTrip.PickUpAddress.value)
		{
			idx = i;
			IsOrgLandmark = true;
		}
		if(!RemoveOrgLandM || !IsOrgLandmark)
		{
		var lm=document.createElement('option');
  		lm.text=form.FOrigin.options[i].text;
		lm.value=form.FOrigin.options[i].value;
		if(lm.value == document.BookTrip.DropOffAddress.value)
		   selDIndex = i;


		if(navigator.appName=="Microsoft Internet Explorer")
    			form.FDestination.add(lm);
		else
			form.FDestination.add(lm,null);
			
		} 
		
		
	}
	if(RemoveOrgLandM && idx != -1 && selDIndex> idx )
			selDIndex--;	
	form.FDestination.selectedIndex = selDIndex;

}


function printPage()
{
if (window.print) if (confirm("Print this page?")) window.print();
}

function escapeXML(str) 
{

document.write(escape(str));

}

function setText(form, activity)
{

	if (activity == "PA")
	{		

		document.PB.PA.value = form.PAS[form.PAS.selectedIndex].text;

		document.PB.PAN.value = form.PAS[form.PAS.selectedIndex].value;
	}

	if (activity == "DA")
	{		

		document.PB.DA.value = form.DAS[form.DAS.selectedIndex].text;

		document.PB.DAN.value = form.DAS[form.DAS.selectedIndex].value;
	}
}

var isRegAddressUsed = false;

function getAddress(file,window) {

	msgWindow=open(file,window,'resizable=no,width=500,height=400');
  	
	if (msgWindow.opener == null) msgWindow.opener = self;
}

function okAddress()
{
	self.close();
}

function cancelAddress(field)
{
 if (isRegAddressUsed)
 {
  if (field ='P')
 	{
		opener.document.PB.PAD.value = '';
		opener.document.PB.PAN.value = '';
		opener.document.PB.PAM.value = '';
 	}
	else
 	{
		opener.document.PB.DAD.value = '';
		opener.document.PB.DAN.value = '';
		opener.document.PB.DAM.value = '';
  }
 }
	self.close();
}

var passengerList = new Array(2);


function setPassengerList(form)
{
	var i = 0;

	for (i;i<2;i++)
	{
			passengerList[i] = form.PassengerListSelect.options[i].value;
	}

  form.PassengerList.value = passengerList;
	
}


function resetForm()
{
	setPassengerList(document.BookTrip);
	document.BookTrip.FormState.value = 0;
	if(document.BookTrip.OLocationType.value!='')
	{
		document.BookTrip.FormState.value = 'FOrigin';
	}
	else if(document.BookTrip.DLocationType.value!='')
	{
		document.BookTrip.FormState.value = 'FDestination';
	}
	CheckNewAddrSr();
	document.BookTrip.submit();
}
/*
function resetForm(form)
{
 	setPassengerList(form);
	form.FormState.value = 0;
 	form.submit();
}
*/



function bookTrip(form,isSub)
{

var error ='';

	if(isSub == true)
	{ // check if at least one day has been checked off
		if (form.WS.checked || form.WM.checked || form.WT.checked || form.WW.checked || form.WH.checked || form.WF.checked || form.WA.checked)
		{
		}
		else
		{
			 error += "Please select at least one day\n";
		}		 
	}

	if (form.PickUpAddressDisplay.value=='RA' || form.PickUpAddressDisplay.value=='')
	{
		error += 'Please enter a pick-up address\n';
	}

	if (form.DropOffAddressDisplay.value=='RA' || form.DropOffAddressDisplay.value=='')
	{
		error += 'Please enter a drop-off address\n';
	}
	else if(form.DropOffAddress.value=='')
	{
		error += 'Please select a drop-off address\n';	
	}
	if (form.PickUpAddressDisplay.value == form.DropOffAddressDisplay.value)
	{
	 if (! form.DropOffAddressDisplay.value == '')
		error += 'The drop-off address is the same as the pick-up address\n';
	}
	if (form.PickUpDate.value == '')
	{
		error += 'Please select a date\n';
	}
	if (form.Time.value == '')
	{
		error += 'Please select a time\n';
	}

	setPassengerList(form);

	CheckNewAddrSr();

	if (error == '' && form.DropOffNewAddrSel.value != 'search' && form.PickUpNewAddrSel.value != 'search')
	{ 	
		form.FormState.value = 'Valid';
		return true;
	}
	else if (form.DropOffNewAddrSel.value == 'search' || form.PickUpNewAddrSel.value == 'search')
	{
		if(document.BookTrip.OLocationType.value!='')
		{	
			document.BookTrip.FormState.value = 'FOrigin';
		}
		else if(document.BookTrip.DLocationType.value!='')
		{
			document.BookTrip.FormState.value = 'FDestination';
		}
		return true;
	}
	else
	{
		if(error != '')
			alert(error);
	
	 return false; 
	}

}

function CheckNewAddrSr()
{
	
	if (document.BookTrip.PickUpLocationSelect[2].checked)
	{		
		var Lon = FindLKey(document.BookTrip.PickUpAddress.value, 'O=');
		var Lat = FindLKey(document.BookTrip.PickUpAddress.value, 'T=');
		if(Lon!='' && Lat!='' || str_trim(document.BookTrip.PickUpAddressDisplay.value)=='')
			document.BookTrip.PickUpNewAddrSel.value = '0';
		else
			document.BookTrip.PickUpNewAddrSel.value = 'search';	
	}
	if (document.BookTrip.DropOffLocationSelect[2].checked)
	{		
		var Lon = FindLKey(document.BookTrip.DropOffAddress.value, 'O=');
		var Lat = FindLKey(document.BookTrip.DropOffAddress.value, 'T=');
	
		if(Lon!='' && Lat!='' || str_trim(document.BookTrip.DropOffAddressDisplay.value)=='')
			document.BookTrip.DropOffNewAddrSel.value = '0';
		else
			document.BookTrip.DropOffNewAddrSel.value = 'search';	
	}
}

function str_trim(stringValue)
{
	if(stringValue && stringValue.length)
	{
		var startix = 0;
		var endix = stringValue.length;

		while(char_isWhiteSpace(stringValue.charAt(startix)) && endix > startix)
			startix++;

		while(char_isWhiteSpace(stringValue.charAt(endix - 1)) && endix > startix)
			endix--;

		return stringValue.substring(startix, endix);
	}

	return stringValue; 
}

function char_isWhiteSpace(charValue)
{
	switch(charValue)
	{
		case " ":
		case "\t":
		case "\r":
		case "\n":
			return true;
	}

	return false;
}

function FindLKey(sLoc, sKey)
{
	
	if(sLoc.length > 3)
	{
		var index1 = sLoc.search(sKey);
		var TValue = '';
		if(index1 > 0)
		{
			TValue = sLoc.substring(index1);			
			var index2 = TValue.search(';');
			if(index2 > 1)
			{
				var str = TValue.substring(2, index2);
				if(str.length > 1)
				return str;
			}
		}
	}
		return '';

}

function setBookingTime(form, dir)
{
 var time = form.Time.value;
 if (dir == 'P')
 {
 	 document.BookTripSchedule.PickUpTime.value = time;
	}
	if (dir == 'D')
	{
 	 document.BookTripSchedule.DropOffTime.value = time;
	}
}


function login(form)
{
	

var error ='';


	if (form.UN.value=='') 
	{
		error += 'Please enter your Client Code\n';
		
	}


	if (form.PW.value=='')
	{
		error += 'Please enter a password\n';
		
	}


	if (error == '')
	{ 
		return true;
	}
	else
	{
	 alert(error);
	 
	 return false;
	 
	}

}

function checkPassword(form)
{
	
var error ='';

	if (form.OPW.value=='') 
	{
		error += 'Please enter your old password\n';
		
	}
	if (form.NPW.value=='')
	{
		error += 'Please enter a new password\n';
		
	}
	if (form.RNPW.value=='')
	{
		error += 'Please enter your new password again\n';
		
	}
	if (form.NPW.value != form.RNPW.value)
	{
		error += 'Your new password has to match\n';
		
	}

	if (error == '')
	{ 
		return true;
	}
	else
	{
	 alert(error);
	 
	 return false;
	 
	}

}

var visibleStartPanel = 'StartFrequentAddress';
var visibleEndPanel = 'EndFrequentAddress';

function setVisible(start,end)
{
 if (start == '' && end == '')
 {
 makeVisible(visibleStartPanel);
 makeVisible(visibleEndPanel);
 }
 if (start == 'Landmarks')
 		makeVisible('StartLandmarks');
 if (start == 'FrequestAddress')
 		makeVisible('StartFrequestAddress');
 if (start == 'Address')
 		makeVisible('StartAddress');
 if (end == 'Landmarks')
 		makeVisible('EndLandmarks');
 if (end == 'FrequestAddress')
 		makeVisible('EndFrequestAddress');
 if (end == 'Address')
 		makeVisible('EndAddress');
 
 
}

function makeVisible(element)
{
// hide the visible element and make visible the new one 

	var isStart = element.indexOf('Start')==-1?false:true;
	var isEnd = element.indexOf('End')==-1?false:true;

	var oldObj;
	if (isStart == true)
	{
		oldObj = document.getElementById(visibleStartPanel);
	}
	else if (isEnd == true)
	{ 
		oldObj = document.getElementById(visibleEndPanel);
	}

				if (oldObj.style) 
				{ 
					oldObj=oldObj.style.visibility = 'hidden'; 
				}
	
				var obj = document.getElementById(element); 

				if (obj) 
				{ 
					obj=obj.style.visibility = 'visible'; 
				}
				
 	if (isStart)
	{
		visibleStartPanel = element;
	}

	if (isEnd)
	{
		visibleEndPanel = element;
	}

	return true;
}

