function correctPageLoad(id) {
	if(document.getElementById(id)!= null)
	document.getElementById(id).style.display = 'none';
}

function ifJavascriptisEnabled() {
	if (document.getElementById('scriptRouteMenu') != null)document.getElementById('scriptRouteMenu').style.display = 'block';
	
	if (document.all) {if (document.getElementById('mainDataDiv') != null)document.getElementById('mainDataDiv').style.marginTop = '-14px';
	}
}

function showButtons(imgId){
	if(document.getElementById(imgId)!= null)
	document.getElementById(imgId).style.display ="block";
}
function makeDraggableHelp(boxId){

	var leftOfDiv = 0;
	//assign following values only to help files (messageBoxHelpBig, messageBoxHelpBig)
	if (Ext.get(boxId).hasClass("messageBoxHelpBig"))
		leftOfDiv = Ext.getBody().getBox().width / 2 - 425;
	else if (Ext.get(boxId).hasClass("messageBoxHelpSmall"))
		leftOfDiv = Ext.getBody().getBox().width / 2 - 250;
	if (leftOfDiv != 0)
	{
		Ext.get(boxId).dom.style.marginLeft = "0";
		Ext.get(boxId).dom.style.left = leftOfDiv + "px";
	}
	var dd11 = Ext.get(boxId);
	dd11.dd = new Ext.dd.DD(boxId, 'group', {
		defaultPadding:5
	});
	dd11.dd.setOuterHandleElId(boxId + "Draggable");
	dd11.dd.startDrag = function() {
		this.constrainTo(Ext.getBody());

	}
}
function showHideServiceCallingStations(divId, imageId) {
	var div = document.getElementById(divId);
	var control = document.getElementById(imageId);
	if (div.style.display != 'none') {
		jcheckSlideOut(divId,'t',500,{duration:.5,useDisplay:true});
		div.style.display = 'none';
		control.src = control.src.replace('hide', 'show');
		control.alt = "show calling pattern";
		control.title = "show calling pattern";
	} else {
		div.style.display = 'block';
		jcheckSlideIn(divId,'t',500,{duration:.5,useDisplay:true});
		control.src = control.src.replace('show', 'hide');
		control.alt = "hide calling pattern";
		control.title = "hide calling pattern";
		control.style.paddingTop = "5px";
	}
}
function showEmissionDataBox(boxId, fromStationEasting, fromStationNorthing, toStationEasting, toStationNorthing,editImgId) {
	var control = document.getElementById("showHideButtonCo2Emission");
	var editImage =  document.getElementById(editImgId);
	if ((control.src.search('btn_hide_f2.png') > 0)) {
		jcheckSlideOut(boxId,'t',500,{duration:.5,useDisplay:true});
		document.getElementById(boxId).style.display = "none";
		control.src = control.src.replace('hide_f2.png', 'show_f2.png');
		control.alt ="show button";
		control.title ="show button";
		if(editImage!= null)
				editImage.style.display = "none";
	} else {
		if ((control.src.search('btn_show_f2.png') > 0)) {
			document.getElementById(boxId).style.display = "block";

			getDistance(fromStationEasting, fromStationNorthing, toStationEasting, toStationNorthing);

			if(distanceInMiles >= minTreshholdDistance)
			{
				document.getElementById("co2EditSectionDiv").style.display ="block";
				document.getElementById("co2Data").style.display ="block";
				document.getElementById("colourSchemeTable").style.display ="block";
				document.getElementById("co2DisclaimerMessage").style.display ="block";
				document.getElementById("editCo2EmissionGraph").style.display ="block";
				document.getElementById("co2MinimumDistanceInfo").style.display ="none";

				document.getElementById("distanceCal").innerHTML =  distanceInMiles+ "   miles. ";
				printGraph(1);
				control.src = control.src.replace('show_f2.png', 'hide_f2.png');
				control.alt ="hide button";
				control.title ="hide button";
				if(editImage!= null)
					editImage.style.display = "block";
				jcheckSlideIn(boxId,'t',500,{duration:.5,useDisplay:true});
			}
			else{
				document.getElementById("co2EditSectionDiv").style.display ="none";
				document.getElementById("co2Data").style.display ="none";
				document.getElementById("colourSchemeTable").style.display ="none";
				document.getElementById("co2DisclaimerMessage").style.display ="none";
				document.getElementById("editCo2EmissionGraph").style.display ="none";
				document.getElementById("co2MinimumDistanceInfo").style.display ="block";
			}
		}
	}
}

function generateCO2GraphOnPageLoad(){
	
	if (distanceInMiles >= minTreshholdDistance) {
		printGraph(1);
		document.getElementById("distanceCal").innerHTML = distanceInMiles + "   miles. ";
		if (document.getElementById('co2EmissionInformation') != null)document.getElementById('co2EmissionInformation').style.display = 'block';
		if (document.getElementById('co2Data') != null)document.getElementById('co2Data').style.display = 'block';
		if (document.getElementById('co2DisclaimerMessage') != null)document.getElementById('co2DisclaimerMessage').style.display = 'block';
		if (document.getElementById('colourSchemeTable') != null)document.getElementById('colourSchemeTable').style.display = 'block';
		if (document.getElementById('editCo2EmissionGraph') != null)document.getElementById("editCo2EmissionGraph").style.display ="block";
	}
	else {
		document.getElementById("co2EditSectionDiv").style.display = "none";
		document.getElementById("editCo2EmissionGraph").style.display ="none";
		document.getElementById("co2Data").style.display = "none";
		document.getElementById("editCo2RightGraph").style.display = "none";
		document.getElementById("colourSchemeTable").style.display = "none";
		document.getElementById("co2DisclaimerMessage").style.display = "none";
		document.getElementById("co2MinimumDistanceInfo").style.display = "block";
	}
}
function showHideDiv(divId, controlId,editImgId) {
	var div = document.getElementById(divId);
	var editImage =  document.getElementById(editImgId);
	var control = document.getElementById(controlId);
	if (div.style.display != 'none') {
		jcheckSlideOut(divId,'t',500,{duration:.5,useDisplay:true});
		div.style.display = 'none';
		if(editImage!= null)
				editImage.style.display = "none";
		control.alt = "show";
		control.title = "show";
		if (control.onmouseover)control.src = control.src.replace('hide_f2.png', 'show_f2.png'); else control.src = control.src.replace('hide_f2.png', 'show.png');
	} else {
		div.style.display = 'block';
			if(editImage!= null)
				editImage.style.display = "block";
		jcheckSlideIn(divId,'t',500,{duration:.5,useDisplay:true});
		control.alt = "hide";
		control.title = "hide";
		if (control.onmouseover)control.src = control.src.replace('show_f2.png', 'hide_f2.png'); else control.src = control.src.replace('show_f2.png', 'hide.png');
	}
}
function showHideUpadtes(divId, controlId, numberOfRecords, divCommonName, expandButtonId, collapseButtonId) {
	var div = document.getElementById(divId);
	var control = document.getElementById(controlId);
	var action;
	if (div.style.display != 'none') {
		action = 'hide';
		jcheckSlideOut(divId,'t',500,{duration:.5,useDisplay:true});
		div.style.display = 'none';
		control.alt = "expand";
		control.title = "expand";
		if (control.src.search('minus_f2.png') > 0)control.src = control.src.replace('minus_f2.png', 'plus_f2.png'); else if (control.src.search('minus.png') > 0)control.src = control.src.replace('minus.png', 'plus.png');
		if (numberOfRecords != null && divCommonName != null && expandButtonId != null && collapseButtonId != null)checkForExpandOrCollapseBuuton(numberOfRecords, divCommonName, expandButtonId, collapseButtonId, action);
	} else {
		action = 'show';
		if (control.src.search('plus_f2.png') > 0)control.src = control.src.replace('plus_f2.png', 'minus_f2.png'); else if (control.src.search('plus.png') > 0)control.src = control.src.replace('plus.png', 'minus.png');
		div.style.display = 'block';
		control.alt = "collapse";
		control.title = "collapse";
		if (numberOfRecords != null && divCommonName != null && expandButtonId != null && collapseButtonId != null)checkForExpandOrCollapseBuuton(numberOfRecords, divCommonName, expandButtonId, collapseButtonId, action);
		jcheckSlideIn(divId,'t',500,{duration:.5,useDisplay:true});
	}
}
function checkForExpandOrCollapseBuuton(numberOfRecords, divCommonName, expandButtonId, collapseButtonId, action) {
	var i = 0;
	var divId;
	var ifDivDisplayed;
	if (action == 'hide') {
		for (i = 0; i < numberOfRecords; i++) {
			divId = divCommonName + i;
			ifDivDisplayed = document.getElementById(divId).style.display != 'none';
			if (ifDivDisplayed)break;
		}
		if (i == numberOfRecords) {
			document.getElementById(collapseButtonId).style.display = 'none';
			document.getElementById(expandButtonId).style.display = 'inline';
		}
	} else {
		if (action == 'show') {
			for (i = 0; i < numberOfRecords; i++) {
				divId = divCommonName + i;
				ifDivDisplayed = document.getElementById(divId).style.display != 'none';
				if (!(ifDivDisplayed))break;
			}
			if (i == numberOfRecords) {
				document.getElementById(expandButtonId).style.display = 'none';
				document.getElementById(collapseButtonId).style.display = 'inline';
			}
		}
	}
}



function expCol(id, showid, divChange, imgChange, count, act) {
	var c = 0;
	var control;
	var iconIndex = 0;
	var commonText = "";
	var divHide = document.getElementById(id);
	var divShow = document.getElementById(showid);
	divHide.style.display = "none";
	divShow.style.display = "inline";
	var divChangeId;
	var imgChangeId;
	if (act == "expand") {
        for (c = 0; c < count; c++) {
			divChangeId = divChange + c;
			imgChangeId = imgChange + c;
			document.getElementById(divChangeId).style.display = "block";
			jcheckSlideIn(divChangeId,'t',600,{duration:.6,useDisplay:true});
			control = document.getElementById(imgChangeId);
			if (control.src.search('minus') < 0) {
				iconIndex = control.src.indexOf('plus.png');
				commonText = control.src.slice(0, iconIndex);
				control.src = commonText + "minus.png";
				control.alt = "collapse";
				control.title = "collapse";
			}
		}
    pageTracker._trackEvent('Layout Event', 'Expand Block',  id);

	} else if (act == "collapse") {
        for (c = 0; c < count; c++) {
			divChangeId = divChange + c;
			imgChangeId = imgChange + c;
			jcheckSlideOut(divChangeId,'t',600,{duration:.6,useDisplay:true});
			document.getElementById(divChangeId).style.display = "none";
			control = document.getElementById(imgChangeId);
			if (control.src.search('plus') < 0) {
				iconIndex = control.src.indexOf('minus.png');
				commonText = control.src.slice(0, iconIndex);
				control.src = commonText + "plus.png";
				control.alt = "expand ";
				control.title = "expand";
			}
		}
     pageTracker._trackEvent('Layout Event', 'Collapse Block', id);



    }

}
function action(aAction) {

    var doAction = true;
	if (arguments.length > 1)doAction = confirm(arguments[1]);
	if (doAction) {
		if (aAction.indexOf("changeEngWorksPeriod") != -1) {
			document.formEngWorks.action.value = aAction;
			var select = document.getElementsByName("realengperiod")[0];
			document.formEngWorks.period.value = select.options[select.selectedIndex].value;
			document.cookie = "enggWorkSelected=" + document.formEngWorks.period.value;
            pageTracker._trackEvent('Scope Change Event', aAction);
            document.formEngWorks.submit();
        } else {
			var widget = document.form[aAction];
            if (widget != null) {widget.value = aAction}
			document.form.action.value = aAction;
            pageTracker._trackEvent('Route Event', aAction);
			document.form.submit();
		}

	}

}
function changeTubeIncident(aType) {
	var doAction = true;
	if (arguments.length > 1)doAction = confirm(arguments[1]);
	if (doAction) {
		document.formTubeDisruption.action.value = "changeTubeIncident";
		var select = document.getElementsByName(aType + "TubeUpdateLocation")[0];
		document.formTubeDisruption.formTubeUpdateLocation.value = select.options[select.selectedIndex].value;
		select = document.getElementsByName(aType + "TubeUpdatePeriod")[0];
		document.formTubeDisruption.formTubeUpdatePeriod.value = select.options[select.selectedIndex].value;
  		document.formTubeDisruption.formTubeUpdateType.value = aType;
		document.formTubeDisruption.submit();
	}
}
function formSubmit(aForm, aAction, aElement, aValue)
{
	var form = getFormObject(aForm);
	if (form != null) {
		var element = getElement(form, aElement);
		if (element != null)element.value = aValue;
		form.action.value = aAction;
		form.submit();
	}
}
function genericFormSubmit(aForm, nameArr, valueArr) {
	var form = getFormObject(aForm);
	if (form != null) {
		for (var i = 0; i < nameArr.length; i++) {
			var element = getElement(form, nameArr[i]);
			if (element != null)element.value = valueArr[i]
		}
		form.submit();
	}
}
function getFormObject(aFormName) {
	var forms = document.forms;
	for (i = 0; i < forms.length; i++)if (forms[i].name == aFormName)return forms[i];
	return null;
}
function getElement(aForm, aElementName) {
	var elements = aForm.elements;
	for (i = 0; i < elements.length; i++)if (elements[i].name == aElementName)return elements[i];
	return null;
}
function showHideFI(divId, linkId, tocName) {
	var div = document.getElementById(divId);
	var link = document.getElementById(linkId);
	if (div.style.display != 'block') {
		div.style.display = 'block';
		jcheckSlideIn(divId,'t',500,{duration:.5,useDisplay:true});
		link.src = "/resources/" + tocName + "/web/images/btn_hide_further_info.png";
		link.alt = 'Hide Further Information';
		link.title = 'Hide Further Information';
	} else {
		jcheckSlideOut(divId,'t',500,{duration:.5,useDisplay:true});
		div.style.display = 'none';
		link.src = "/resources/" + tocName + "/web/images/btn_show_further_info.png";
		link.alt = 'Show Further Information';
		link.alt = 'Hide Further Information';
	}
}
function editDiv(divId, outerDivID) {
	var div_id = document.getElementById(divId);
	if (outerDivID != "") {
		var outer_div_id = document.getElementById(outerDivID);
		if (outer_div_id.style.display == "none") {
			alert("Click on Show button to view the Editing Section");
			return
		}
	}
	if (div_id.style.display == 'none')
	{
		div_id.style.display = 'block';
		jcheckSlideIn(divId,'t',500,{duration:.5,useDisplay:true});

	} else
	{
		jcheckSlideOut(divId,'t',500,{duration:.5,useDisplay:true});
		div_id.style.display = 'none';
	}
}
function editDivAlert(divId) {
	var div_id = document.getElementById(divId);
	if (div_id.style.display != 'block') {

		div_id.style.display = 'block';
		Ext.get(divId).slideIn('t',{duration:.5,useDisplay:true});
	} else {
		Ext.get(divId).slideOut('t',{duration:.5,useDisplay:true});
		div_id.style.display = 'none';
	}
}
function imageSwap(aImage) {if (aImage.src.search('.png') > 0)imageSwapPng(aImage); else if (aImage.src.search('.gif'))imageSwapPng(aImage);}
function imageSwapGif(aImage) {
	var imageSrc = "";
	imageSrc = aImage.src;
	if (imageSrc.indexOf("_f2") != -1) {aImage.src = imageSrc.replace("_f2", "");} else {aImage.src = imageSrc.replace(".gif", "_f2.gif");}
}
function imageSwapPng(aImage) {
	var imageSrc = aImage.src;
	if (imageSrc.indexOf("_f2") != -1) {aImage.src = imageSrc.replace("_f2", "");} else {aImage.src = imageSrc.replace(".png", "_f2.png");}
}
var distance = 0;
var distanceInMiles =0;
var defaultDisplayedLabels = 1;
var vehicles = new Array();
var minTreshholdDistance = 10 /*minimum distance in miles to display the co2 emission data*/
vehicles[0] = "emsn_train";
vehicles[1] = "emsn_coach";
vehicles[2] = "emsn_local_bus";
vehicles[3] = "emsn_london_bus";
vehicles[4] = "emsn_small_petrolcar";
vehicles[5] = "emsn_large_petrolcar";
vehicles[6] = "emsn_small_dieselcar";
vehicles[7] = "emsn_large_dieselcar";
vehicles[8] = "emsn_medium_lpgcar";
vehicles[9] = "emsn_large_lpgcar";
vehicles[10] = "emsn_plane";
function getDistance(fromStationEasting, fromStationNorthing, toStationEasting, toStationNorthing) {
	//check easting and northing values. Proceed only if all the values are correct
	if (
			(fromStationEasting == 0 || fromStationEasting == "" || fromStationEasting == 999999) ||
			(fromStationNorthing == 0 || fromStationNorthing == "" || fromStationNorthing == 999999) ||
			(toStationEasting == 0 || toStationEasting == "" || toStationEasting == 999999) ||
			(toStationNorthing == 0 || toStationNorthing == "" || toStationNorthing == 999999))
		return 0;
	else {
			var diff_easting = fromStationEasting - toStationEasting;
			var diff_northing = fromStationNorthing - toStationNorthing;
			var distance_meter = Math.sqrt((diff_easting * diff_easting) + (diff_northing * diff_northing));
			distance = distance_meter / 1000;	/* (in kms)*/
			distanceInMiles = distance * 0.6213711	/*in miles*/
			distanceInMiles =Math.round((distanceInMiles), 2);
			return Math.round(distance, 2);

	}

}
function getCO2Emission(occupants) {
	if (occupants == 1)document.getElementById("occupants").innerHTML = "per passenger"; else {if (occupants > 1)document.getElementById("occupants").innerHTML = " for " + occupants + " passengers in car(s) and per passenger in other modes"}
	var emsn_train = ((60.2 * distance) / 1000);
	var emsn_coach = ((29.0 * distance) / 1000);
	var emsn_localBus = ((115.8 * distance) / 1000);
	var emsn_londonBus = ((81.8 * distance) / 1000);
	var emsn_smallPetrolCar = ((180.9 * distance) / 1000) / occupants;
	var emsn_largePetrolCar = ((295.8 * distance) / 1000) / occupants;
	var emsn_smallDieselCar = ((151.3 * distance) / 1000) / occupants;
	var emsn_largeDieselCar = ((258.0 * distance) / 1000) / occupants;
	var emsn_mediumLpgCar = ((189.2 * distance) / 1000) / occupants;
	var emsn_largeLpgCar = ((259.4 * distance) / 1000) / occupants;
	var emission = new Array();
	var emissionPercentage = new Array();
	emission[0] = emsn_train.toFixed(2);
	emission[1] = emsn_coach.toFixed(2);
	emission[2] = emsn_localBus.toFixed(2);
	emission[3] = emsn_londonBus.toFixed(2);
	emission[4] = emsn_smallPetrolCar.toFixed(2);
	emission[5] = emsn_largePetrolCar.toFixed(2);
	emission[6] = emsn_smallDieselCar.toFixed(2);
	emission[7] = emsn_largeDieselCar.toFixed(2);
	emission[8] = emsn_mediumLpgCar.toFixed(2);
	emission[9] = emsn_largeLpgCar.toFixed(2);
	if (distanceInMiles >= 94) {//minimum threshold to display flights' Co2 emission data is 150kms of 94 miles approximately
		document.getElementById("planeSpan").style.display = "block";
		document.getElementById("emsn_plane_label").style.display = "block";
		var emsn_plane = ((175.3* distance)/1000);
		emission[10] = emsn_plane.toFixed(2)
	}
	var maxEmission = 0;
	var i = 0;
	var imagewidth = 0;
	for (i = 0; i < emission.length; i++) {maxEmission = Math.max(maxEmission, emission[i]);}
	document.getElementById("rangeEnd").innerHTML = maxEmission;
	for (i = 0; i < emission.length; i++) {
		imagewidth = (((parseFloat(emission[i])) / maxEmission) * 150).toFixed(2);
		emissionPercentage[i] = imagewidth;
	}
	var emissionLength = distanceInMiles >= 94 ? 11 : 10;
	for (i = 0; i < emissionLength; i++) {
		if (document.getElementById(vehicles[i]).style.display != 'none') {
			document.getElementById(vehicles[i]).innerHTML = emission[i];
			document.getElementById(vehicles[i] + "_image").style.width = emissionPercentage[i] + "px";
			document.getElementById(vehicles[i] + "_image").style.height = "10px";
		}
	}
}
function getOccupantNumber() {
		return document.getElementById('occupantNumberSelect').options.selectedIndex + 1;
}
function printGraph(occupants) {
	if (occupants == '' || occupants == null)occupants = getOccupantNumber();
	var i = 0;
	var countCheckedLabels = 0;
	for (i = 1; i <= 9; i++) {
		if (document.getElementById(vehicles[i] + "_checkbox").checked) {
			if (document.getElementById(vehicles[i] + "_bar").style.display != "block" || document.getElementById(vehicles[i] + "_label").style.display != "block") {
				document.getElementById(vehicles[i] + "_bar").style.display = "block";
				document.getElementById(vehicles[i] + "_label").style.display = "block";

			}
			countCheckedLabels++;
		} else {
			if (document.getElementById(vehicles[i] + "_bar").style.display != "none" || document.getElementById(vehicles[i] + "_label").style.display != "none") {

				document.getElementById(vehicles[i] + "_bar").style.display = "none";
				document.getElementById(vehicles[i] + "_label").style.display = "none";
			}
		}
	}

	document.getElementById(vehicles[0] + "_label").style.marginTop= "5px"
	getCO2Emission(occupants);
	if (distanceInMiles >= 94)defaultDisplayedLabels = 2;
	var yAxisDivHeight = (24.0 * (countCheckedLabels + defaultDisplayedLabels));
	var intensityDivHeight = (23.5 * (countCheckedLabels + defaultDisplayedLabels));
	document.getElementById("yAxis").style.height = yAxisDivHeight + "px";
	document.getElementById("intensity").style.height = intensityDivHeight + "px";
	document.getElementById("co2LowIntensityBackground").style.height = intensityDivHeight + "px";
	document.getElementById("co2MediumIntensityBackground").style.height = intensityDivHeight + "px";
	document.getElementById("co2HighIntensityBackground").style.height = intensityDivHeight + "px";
	document.getElementById("co2VeryHighIntensityBackground").style.height = intensityDivHeight + "px";

	if(mainPortal!= null)
		mainPortal.fireEvent("expandCollapse", mainPortal, .1);
}
var escapeOverlay = {
	fx:function(e) {
		var kC = (window.event) ? event.keyCode : e.keyCode;
		var Esc = (window.event) ? 27 : e.DOM_VK_ESCAPE;
		if (kC == Esc && ($F('newvalue') == '' || $F('newvalue') == null))	closeDialogue(); else if (kC == Esc && window.confirm('Are you sure you wish to close the dialogue box?'))	 closeDialogue();
	} }
var ifloadPopup = false;
function loadPopup() {
	document.getElementById("overlay").style.display = "block";
	if(document.getElementById("coverFrameForOverlay")!=null )
		document.getElementById("coverFrameForOverlay").style.display = "block";
	ifloadPopup = true;
	document.getElementsByTagName('body')[0].style.overflow = "hidden";
	document.getElementById('overlay').style.filter = "alpha(opacity = 80);";
	document.getElementById("dialogue").style.display = "block";
}
function closeDialogue() {
	document.getElementsByTagName('body')[0].style.overflow = "";
	document.getElementById('routeBox').style.display = "none";
	ifloadPopup = false;
	document.getElementById("overlay").style.display = "none";
	if(document.getElementById("coverFrameForOverlay")!=null )
		document.getElementById("coverFrameForOverlay").style.display = "none";
	document.getElementById("dialogue").style.display = "none";
	keepHoverOff();
}
var menuShown = false;
var theEvent = null;
var tableWidth = "";


function keepHoverOn() {
	document.getElementById("routeSelectPopupButton").src = "/resources/" + tocDir + "/web/images/mnu_save_f2.png";
}
function keepHoverOff() {document.getElementById("routeSelectPopupButton").src = "/resources/" + tocDir + "/web/images/mnu_save.png";}
function showRouteMenu() {
      keepHoverOn();
    if (theEvent != null)clearTimeout(theEvent);
		Ext.get("routeBox").stopFx();
	if (menuShown)return;
	menuShown = true;
	if (Ext.isIE) {
		setDivWidth();
		Ext.get("routeBox").slideIn('', {duration:.3,useDisplay:true,width:tableWidth,callback:keepHoverOn()});

		if (Ext.isIE6 && Ext.get("coverFrameForRouteBox")!=null)
		{
			Ext.get("coverFrameForRouteBox").dom.style.filter = "alpha(opacity=0);";
			Ext.get("coverFrameForRouteBox").dom.style.marginTop = (-1* Ext.get("routeBox").dom.clientHeight)+"px";
			Ext.get("coverFrameForRouteBox").dom.style.height = Ext.get("routeBox").dom.clientHeight+"px";
		}
	} else Ext.get("routeBox").slideIn('', {duration:.3,useDisplay:true,callback:keepHoverOn()});


}
function hideMenu() {
	if (!ifloadPopup) {
		Ext.get("routeBox").slideOut('t', {duration:.3,useDisplay:true,callback:keepHoverOff()});
		menuShown = false;
	}
}
function hideRouteMenu() {theEvent = setTimeout('hideMenu()', 100);}
function setDivWidth() {
//	if (Ext.get("savedRoutesTable")) {
//		tableWidth = (document.getElementById("savedRoutesTable").offsetWidth + 30) > 400 ? document.getElementById("savedRoutesTable").offsetWidth + 30 + "px" : "400px";
//		document.getElementById("savedRoutesList").style.width = tableWidth;
//	} else tableWidth = "400px";
////	document.getElementById("routeNew").style.width = tableWidth;
////	document.getElementById("routeSwap").style.width = tableWidth;
//	document.getElementById("routeSave").style.width = tableWidth;
}
function loadSaveRoute(aAction, index) {
	document.form.savedRoute.value = index;
	document.form.action.value = aAction;
	document.form.submit();
}
function showBox(type) {
	var showBoxId = document.getElementById('helpBox' + type);
	if (showBoxId.style.display == 'none') {showBoxId.style.display = 'block'}
	if (Ext.isIE6 && Ext.get(showBoxId).select('iframe').first()!=null)Ext.get(showBoxId).select('iframe').first().dom.style.filter = "alpha(opacity=0);"
}
function removeDiv(divId) {
	var div = document.getElementById(divId);
	div.style.display = 'none';
}
//encode uri
var encodedDocuemntURI = encodeURIComponent(document.URL);
var cssValidationURL = "http://jigsaw.w3.org/css-validator/validator?uri="+encodedDocuemntURI+"&profile=css3&usermedium=all&warning=1&lang=en";






