

var bubbleIndex;
var bubbleField =  new Array();  // Contains facility ID numeric value plus  exit ID numeric value
								 //	and serves as index of the namesArray sort by the Selection Sort method
var sortedBuble = new Array();
var resultBubbleArray = new Array();
var resultIndex = new Array();
var resultBubbleIDs = new Array();
			
var activeArea
var clickCounter=0;
var firstClickAt;
var firstSelection;
var secondSelection;
			
var comboEndingExitVisible = true;  
var theCurrent=2;
var calcMode;
var isReset1=true;
var isReset2=true;
var theLabel1="Select Starting Exit:"
var theIndex = 0;
var theIndex2 = 0;
var scrollingUp;
var scrollingDown;

// Variables to calculate toll
var outputText = "";
var tempToll = 0;
var CASH_tempToll = 0;
var tempMile = 0;
var tempFacID = "";

var theCurrentOption = 1;
var theNextStep="selectStartExit";
var theCurrentStep="selectFacilityType";

var startingFacilityName="";
var endingFacilityName="";

var theStartingFacility;
		
var indexArray = new Array();
var namesArray = new Array();
var idArray = new Array();
var sortedIDs = new Array();
var MPArray = new Array();
var exitIdArray = new Array();
var NB_OFF_Array = new Array();
var SB_OFF_Array = new Array();
var EB_OFF_Array = new Array();
var WB_OFF_Array = new Array();
var bridgesList = new Array();
var BeeLineMainlineExit;	// This variable stores the mainline exit that connects to Bee Line		
				
var sortCombosFlag=0;
var xmlDoc
var numFacilities
var numTollPlazas
var numExits
var numBridges
var exitFrom = "NOVALUE"
var exitTo = "NOVALUE"
var axle;
var axleFactor=1;
var axleFactorTicket=2;
var mileage=0;

// Toll variables
var isTransponder=false;	//	Variable to define type of toll payment, when true means sunpass and when false means cash
var totalToll=0;
var startToll=0;
var endToll=0;
var ticketToll = 0;            // ticket system toll with transponder
var inlineToll=0;
var transToll=0;			// transition toll paid when getting off of Bee line and getting on Mainline of viceversa
var CASH_transToll=0;		// transition toll paid when getting off of Bee line and getting on Mainline of viceversa paid cash
var CASH_totalToll=0;				// total toll paid cash
var CASH_startToll=0;				// toll pais cash at starting exit
var CASH_endToll=0;					// toll paid cash at ending exit
var CASH_ticketToll = 0;            // ticket system toll paid cash
var CASH_inlineToll=0;				// toll paid cash at in line toll plazas

// Variables to hold attributes of starting exit
var startExitName;
var startExitMile;
var startExitFacilityId;
var startExitNorthOn;
var startExitNorthOff;
var startExitSouthOn;
var startExitSouthOff;
var startExitEastOn;
var startExitEastOff;
var startExitWestOn;
var startExitWestOff;
var CASH_startExitNorthOn;
var CASH_startExitNorthOff;
var CASH_startExitSouthOn;
var CASH_startExitSouthOff;
var CASH_startExitEastOn;
var CASH_startExitEastOff;
var CASH_startExitWestOn;
var CASH_startExitWestOff;
//Variables to hold attributes of ending exit
var endExitName;
var endExitMile;
var endExitFacilityId;
var endExitNorthOn;
var endExitNorthOff;
var endExitSouthOn;
var endExitSouthOff;
var endExitEastOn;
var endExitEastOff;
var endExitWestOn;
var endExitWestOff;
var CASH_endExitNorthOn;
var CASH_endExitNorthOff;
var CASH_endExitSouthOn;
var CASH_endExitSouthOff;
var CASH_endExitEastOn;
var CASH_endExitEastOff;
var CASH_endExitWestOn;
var CASH_endExitWestOff;

//variables to hold bridge data
var isBridge=false;
var bridgeName;
var bridgeAxleFactor=0;
var extraAxleToll=0;
var bridgeTollNorth;
var bridgeTollSouth;
var bridgeTollEast;
var bridgeTollWest;
var CASH_bridgeTollNorth;
var CASH_bridgeTollSouth;
var CASH_bridgeTollEast;
var CASH_bridgeTollWest;

//
var theFacIDonList    // holds the facility id to be displayed on combo boxes
var theExitIDonList   // holds the facility id to be displayed on combo boxes
// Load xml document
var browser=navigator.appName;
var ua = navigator.userAgent.toLowerCase();
var xmlFile = 'touchScreentolls.xml'
if (ua.indexOf('safari/') != -1) {
    try{
    XmlHTTP = new XMLHttpRequest();
    XmlHTTP.open('get', xmlFile, false);
    XmlHTTP.send('');
    xmlDoc = XmlHTTP.responseXML;
    }
    catch(e){
        alert(e);
    }
}
else if (window.ActiveXObject) { // code for IE
    try{
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    xmlDoc.load(xmlFile);
    }
    catch(e){
        alert(e);
    }
}
else if(document.implementation && document.implementation.createDocument) {// code for FireFox
    try{
    xmlDoc = document.implementation.createDocument("","",null);
    xmlDoc.async=false;
    xmlDoc.load(xmlFile);
    }
    catch(e){
        alert(e);
    }
//xmlDoc.onreadystatechange=verify;
}
else{
    alert('Your browser is not compatible with this page, some functions may not display properly.');
}

//xmlObj=xmlDoc.documentElement
numFacilities = xmlDoc.getElementsByTagName("FACILITY")
numTollPlazas = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")
numExits = xmlDoc.getElementsByTagName("EXIT")
numBridges  = xmlDoc.getElementsByTagName("BRIDGE")

function setComboBoxes() {
	comboEndingExitVisible=false;
}

function reviewClick(a,s) {
	if (clickCounter==0) {
		//alert("HERE: " + clickCounter)
		clickCounter = clickCounter + 1
		firstClickAt=a
		firstSelection=s
		document.getElementById("fromExitMessage").innerHTML="From:  " + s
		document.getElementById("fromExitMessage").style.visibility = "visible";
		document.getElementById("selectStartingExitMessage").style.visibility = "visible";
		document.getElementById("selectEndingExitMessage").style.visibility = "visible";
		document.getElementById("selectFacilityMessage").style.color = "black";
		document.getElementById("selectStartingExitMessage").style.color = "black";
		document.getElementById("selectEndingExitMessage").style.color = "red";
		document.getElementById("selectNumberAxlesMessage").style.color = "black";
		document.getElementById("selectFacilityMessage").style.backgroundColor = "";
		document.getElementById("selectStartingExitMessage").style.backgroundColor = "";
		document.getElementById("selectEndingExitMessage").style.backgroundColor = "#C0C0C0";
		document.getElementById("selectNumberAxlesMessage").style.backgroundColor = "";
		getStartingExitData();
	} else {
		if (a!=firstClickAt) {
			clickCounter = 0
			secondSelection = s
			document.getElementById("toExitMessage").innerHTML="To:  " + s
			document.getElementById("toExitMessage").style.visibility = "visible";
			document.getElementById("selectEndingExitMessage").style.visibility = "visible";
			document.getElementById("selectFacilityMessage").style.color = "black";
			document.getElementById("selectStartingExitMessage").style.color = "black";
			document.getElementById("selectEndingExitMessage").style.color = "black";
			document.getElementById("selectNumberAxlesMessage").style.color = "red";
			document.getElementById("selectFacilityMessage").style.backgroundColor = "";
			document.getElementById("selectStartingExitMessage").style.backgroundColor = "";
			document.getElementById("selectEndingExitMessage").style.backgroundColor = "";
			document.getElementById("selectNumberAxlesMessage").style.backgroundColor = "#C0C0C0";
			hideMap(activeArea);
			getEndingExitData();
		} else {
			alert("Starting exit and ending exit cannot be the same")
		}
	}
}	

var bayway;
var bayway2;
function bayway_reviewClick(s) {

	//alert(activeArea)
	if (clickCounter==0) {
	  //alert("HERE: " + clickCounter)
	  //alert('Select an Ending Exit');
	  clickCounter = clickCounter + 1
	  bayway = s;
	}
	else{
	  bayway2 = s
	  clickCounter = clickCounter + 1
	  
	}

  if(clickCounter==2) {
  secondSelection = bayway + ' to ' + bayway2

  //alert(secondSelection);

  bridge_reviewClick(secondSelection);

  }

}	

function bridge_reviewClick(s) {

    bayway = ""
    bayway2= ""
    clickCounter = 0
	//alert(activeArea)
			secondSelection = s
			fromExitMessage.innerHTML= s
			document.getElementById("fromExitMessage").style.visibility = "visible";
			document.getElementById("selectEndingExitMessage").style.visibility = "visible";
			document.getElementById("selectFacilityMessage").style.color = "black";
			document.getElementById("selectStartingExitMessage").style.color = "black";
			document.getElementById("selectEndingExitMessage").style.color = "black";
			document.getElementById("selectNumberAxlesMessage").style.color = "red";
			document.getElementById("selectFacilityMessage").style.backgroundColor = "";
			document.getElementById("selectStartingExitMessage").style.backgroundColor = "";
			document.getElementById("selectEndingExitMessage").style.backgroundColor = "";
			document.getElementById("selectNumberAxlesMessage").style.backgroundColor = "#C0C0C0";
			hideMap(activeArea);
			//getBridgeToll(s);
}	

function resetTollCalculator() {
	isTransponder=false;
	totalToll=0;
	var startToll=0;
	endToll=0;
	ticketToll = 0;
	inlineToll=0;
	transToll=0;
	CASH_transToll=0;
	CASH_totalToll=0;
	CASH_startToll=0;
	CASH_endToll=0;
	CASH_ticketToll = 0;
	CASH_inlineToll=0;	
	outputText = "";
	tempToll = 0;
	CASH_tempToll = 0;
	tempMile = 0;
	tempFacID = "";
	inlineToll=0;
	CASH_inlineToll=0;
	activeArea="";
	clickCounter=0;
	firstClickAt="";
	firstSelection="";
	secondSelection="";
	ticketToll = 0;
	CASH_ticketToll = 0;

window.location.reload();

}
				
function getStartingExitData() {	// this function reads the element in the collection corresponding to the
									// position of the pointer set by the value of the selected item in the
									// combo box
		//alert("HERE!")
		for (var i=0;i<numExits.length;i++) {
			//alert(i + "     " + firstSelection + "     " + indexArray[i]);
			if (firstSelection==indexArray[i]) {
				exitFrom = i
				//alert(firstSelection + "     " + indexArray[i])
				//alert("The index is:  " + i)
			}
		}
		//startExitName=xmlObj.childNodes(0).childNodes(2).childNodes(exitFrom).text
		startExitName=xmlDoc.getElementsByTagName("EXIT")[exitFrom].childNodes[0].nodeValue;
		startExitMile=xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("MILE_POINT");
        startExitFacilityId=xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("FACILITY_ID");
		//alert(startExitName);
		//startExitMile=parseFloat(xmlObj.childNodes(0).childNodes(2).childNodes(exitFrom).getAttribute("MILE_POINT"))
		//startExitFacilityId=xmlObj.childNodes(0).childNodes(2).childNodes(exitFrom).getAttribute("FACILITY_ID")

		//alert("This is what it picks up first:  mile " + startExitMile + "  Name: " + startExitName +  " and ID: " + startExitFacilityId)
			
			// Reads SunPass toll rates
			startExitNorthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("NB_ON"))
			startExitNorthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("NB_OFF"))
			startExitSouthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("SB_ON"))
			startExitSouthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("SB_OFF"))
			startExitEastOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("EB_ON"))
			startExitEastOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("EB_OFF"))
			startExitWestOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("WB_ON"))
			startExitWestOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("WB_OFF"))

			// Reads cach toll rates
			CASH_startExitNorthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_NB_ON"))
			CASH_startExitNorthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_NB_OFF"))
			CASH_startExitSouthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_SB_ON"))
			CASH_startExitSouthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_SB_OFF"))
			CASH_startExitEastOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_EB_ON"))
			CASH_startExitEastOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_EB_OFF"))
			CASH_startExitWestOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_WB_ON"))
			CASH_startExitWestOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitFrom].getAttribute("CASH_WB_OFF"))
		isReset1=false;
}
		
function getEndingExitData() { // same as getStartging ExitData
	//alert(secondSelection)
	for (var k=0;k<numExits.length;k++) {
		//alert(i + "     " + secondSelection + "     " + indexArray[k])
		//if (document.form1.endingExits.options[document.form1.endingExits.selectedIndex].text==indexArray[k]) {
		if (secondSelection==indexArray[k]) {
			exitTo = "" + k
		}
	}
	endExitName=xmlDoc.getElementsByTagName("EXIT")[exitTo].childNodes[0].nodeValue
	endExitMile=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("MILE_POINT"))
	endExitFacilityId=xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("FACILITY_ID")
	// reads transponder tolls
		endExitNorthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("NB_ON"))
		endExitNorthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("NB_OFF"))
		endExitSouthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("SB_ON"))
		endExitSouthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("SB_OFF"))
		endExitEastOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("EB_ON"))
		endExitEastOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("EB_OFF"))
		endExitWestOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("WB_ON"))
		endExitWestOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("WB_OFF"))
	// Read cash tolls
		CASH_endExitNorthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_NB_ON"))
		CASH_endExitNorthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_NB_OFF"))
		CASH_endExitSouthOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_SB_ON"))
		CASH_endExitSouthOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_SB_OFF"))
		CASH_endExitEastOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_EB_ON"))
		CASH_endExitEastOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_EB_OFF"))
		CASH_endExitWestOn=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_WB_ON"))
		CASH_endExitWestOff=parseFloat(xmlDoc.getElementsByTagName("EXIT")[exitTo].getAttribute("CASH_WB_OFF"))
	isReset2=false;
}
		
function calculateToll() {
			document.getElementById("messageDIV").style.visibility = "visible";
			//alert("calculateToll function")
			var formatMile = new NumberFormat();
			var formatTotalToll = new NumberFormat();
			var formatCASHTotalToll = new NumberFormat();
			outputText = "";
			tempToll = 0;
			CASH_tempToll = 0;
			tempMile = 0;
			tempFacID = "";
			inlineToll=0;
			CASH_inlineToll=0;
			
				// Verify if starting exit and ending exit are not the same
				//alert("start exit:  " + startExitFacilityId + "   " + startExitName + "    end exit:  " + endExitFacilityId + "   " + endExitName)
				if ((startExitFacilityId + startExitName)==(endExitFacilityId + endExitName)) {
					alert("Starting exit and ending exit must be different.  Please try again.");
				} else {  // Calculate toll
					mileage = startExitMile - endExitMile;
					//alert(startExitMile + "   " + endExitMile + "   " + mileage)
					// Determine direction of travel
					if (startExitFacilityId==endExitFacilityId) { // If both exits are in the same facility
						if ((startExitFacilityId!="M")&&(endExitFacilityId!="M")) { // Both exits are not along the mainline
							//Get Facility name
							var facilityName="";
							for (var c=0; c<numFacilities.length;c++) {
								if (xmlDoc.getElementsByTagName("EXIT")[c].getAttribute("ID")==endExitFacilityId) {
									facilityName = xmlDoc.getElementsByTagName("EXIT")[c].childNodes(0).nodeValue;
								}
							}
						
							var theDirection = "";
							if ((startExitFacilityId=="P")||(startExitFacilityId=="B")||(startExitFacilityId=="ALLIGATOR")||(startExitFacilityId=="CROSSTOWN")||(startExitFacilityId=="EW")) {
								theDirection="EastWest" 
							} else {
								theDirection="NorthSouth"
							}
							switch (theDirection) {

								case "EastWest":	
											// for Polk Parkway, Bee Line, and Alligator Alley
											if (startExitFacilityId=="ALLIGATOR") {  // Exception for Alligator Alley
												mileage = mileage * (-1)
			 								// Mile posts increases from east to west
											}
											if (mileage > 0) { // direction is west
												startToll= startExitWestOn;
												endToll= endExitWestOff;
												CASH_startToll= CASH_startExitWestOn;
												CASH_endToll = CASH_endExitWestOff;
												// Find In-line-Toll-Plazas
												inlineToll = getInlineToll_SunPass_West();
												CASH_inlineToll=getInlineToll_Cash_West();
											} else { // direction is east
												startToll= startExitEastOn;
												endToll = endExitEastOff;
												CASH_startToll= CASH_startExitEastOn;
												CASH_endToll = CASH_endExitEastOff;
												// Find In-line-Toll-Plazas
												inlineToll = getInlineToll_SunPass_East();
												CASH_inlineToll=getInlineToll_Cash_East();
											}
											break;
								case "NorthSouth":	
											// for Veterans Expressway, Suncoast Parkway, Mainline, Souther Connector, Greeneway, Seminole Expressway, Western Beltway
											if (mileage > 0) { // direction is South
                                                startToll= startExitSouthOn;
                                                endToll= endExitSouthOff;
                                                CASH_startToll= CASH_startExitSouthOn;
                                                CASH_endToll = CASH_endExitSouthOff;
	                                            inlineToll = getInlineToll_SunPass_South();
	                                            CASH_inlineToll=getInlineToll_Cash_South();
											} else { // direction is North
												startToll= startExitNorthOn;
												endToll = endExitNorthOff;
												CASH_startToll= CASH_startExitNorthOn;
												CASH_endToll = CASH_endExitNorthOff;
												
	                                            inlineToll = getInlineToll_SunPass_North();
	                                            CASH_inlineToll=getInlineToll_Cash_North()
											} 
											break;
							}
						
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)						
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
						//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							//alert("total " + CASH_totalToll + "    " + axleFactor + "   start:  " + CASH_startToll + "   end:  " + CASH_endToll + "   inline: " + CASH_inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK
							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}

							document.getElementById("messageDIV").innerHTML=outputText
						} else { // starting exit and exit ending, both are along the mainline
							//alert("Toll along Mainline")
							var exitsLoc = ""
							var sExitLoc = ""
							var eExitLoc = ""
							// Starting exit data
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								sExitLoc = "TS"
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									sExitLoc = "NC"
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									sExitLoc = "SC"								
								}
							}
							// Ending exit data
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Starting exit is in ticket system
								eExitLoc = "TS"						
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									eExitLoc = "NC"
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									eExitLoc = "SC"	
								}
							}
							exitsLoc = sExitLoc + eExitLoc
							var exitsLoc = ""
							var sExitLoc = ""
							var eExitLoc = ""
							// Starting exit data
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								sExitLoc = "TS"
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									sExitLoc = "NC"
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									sExitLoc = "SC"								
								}
							}
							// Ending exit data
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Starting exit is in ticket system
								eExitLoc = "TS"						
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									eExitLoc = "NC"
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									eExitLoc = "SC"	
								}
							}
							exitsLoc = sExitLoc + eExitLoc
							
							switch (exitsLoc) {
								case "TSTS":		// Starts at ticket system ends at ticket system
											ticketToll = calculateTicketToll(startExitName, endExitName);
											CASH_ticketToll = calculateTicketToll_CASH(startExitName, endExitName);
											
											break;
								case "TSNC":		// Starts at ticket system ends at north coin system
											ticketToll = calculateTicketToll(startExitName, "Three Lakes Plaza");
											CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Three Lakes Plaza");
											endToll= endExitNorthOff;
											CASH_endToll = CASH_endExitNorthOff;
											break;
								case "TSSC":		// Starts at ticket system ends at south coin system
											ticketToll = calculateTicketToll(startExitName, "Lantana Plaza");
											CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Lantana Plaza");
											endToll= endExitSouthOff;
											CASH_endToll = CASH_endExitSouthOff;
											break;
								case "NCNC":		// Starts at north coin system ends at north coin system
											if ((startExitMile-endExitMile)<0){ // going north
												startToll= startExitNorthOn;
												endToll= endExitNorthOff;
												CASH_startToll= CASH_startExitNorthOn;
												CASH_endToll = CASH_endExitNorthOff;
											} else {  // going south
												startToll= startExitSouthOn;
												endToll= endExitSouthOff;
												CASH_startToll= CASH_startExitSouthOn;
												CASH_endToll = CASH_endExitSouthOff;
											}
											break;
								case "NCTS":		// Starts at north coin system ends at ticket system
											startToll= startExitSouthOn;
											CASH_startToll= CASH_startExitSouthOn;
											ticketToll = calculateTicketToll("Three Lakes Plaza", endExitName);
											CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", endExitName);
											break;
								case "NCSC":		// Starts at north coin system ends at south coin system
											startToll= startExitSouthOn;
											CASH_startToll= CASH_startExitSouthOn;
											ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
											CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
											endToll= endExitSouthOff;
											CASH_endToll = CASH_endExitSouthOff;
											break;
								case "SCSC":		// Starts at south coin system ends at south coin system
											if ((startExitMile-endExitMile)<0){ // going north
												startToll= startExitNorthOn;
												endToll= endExitNorthOff;
												CASH_startToll= CASH_startExitNorthOn;
												CASH_endToll = CASH_endExitNorthOff;
											} else {  // going south
												startToll= startExitSouthOn;
												endToll= endExitSouthOff;
												CASH_startToll= CASH_startExitSouthOn;
												CASH_endToll = CASH_endExitSouthOff;
											}
											break;
								case "SCTS":		// Starts at south coin system ends at ticket system
											startToll= startExitNorthOn;
											CASH_startToll= CASH_startExitNorthOn;
											ticketToll = calculateTicketToll("Lantana Plaza", endExitName);
											CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", endExitName);
											break;
								case "SCNC":		// Starts at south coin system ends at north coin system
											startToll= startExitNorthOn;
											CASH_startToll= CASH_startExitNorthOn;
											ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
											CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
											endToll= endExitNorthOff;
											CASH_endToll = CASH_endExitNorthOff;
											break;
							
							}
		//alert("Ticket toll:  " + ticketToll)
							// In-line toll plazas
							for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
							//alert(w + ' ' + xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"));
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
								if (((startExitMile>tempMile)&&(endExitMile<tempMile)&&(startExitFacilityId==tempFacID))||((startExitMile<tempMile)&&(endExitMile>tempMile)&&(startExitFacilityId==tempFacID))) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
					
							}
							
							mileage = Math.abs(startExitMile-endExitMile);
							// Calculate Toll
							totalToll= (axleFactor * (startToll + endToll + inlineToll)) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							//alert(outputText)
							document.getElementById("messageDIV").innerHTML=outputText
						}
					} else { // When exits are not in the same facility
						// User selects exits on Polk Parkway and Veterans Expressway
						startingFacilityName="";
						endingFacilityName="";
						for (var c=0; c<numFacilities.length;c++) {
							if (xmlDoc.getElementsByTagName("FACILITY")[c].getAttribute("ID")==startExitFacilityId) {
								startingFacilityName = xmlDoc.getElementsByTagName("FACILITY")[c].nodeValue
							}
						}
						for (var c=0; c<numFacilities.length;c++) {
							if (xmlDoc.getElementsByTagName("FACILITY")[c].getAttribute("ID")==endExitFacilityId) {
								endingFacilityName = xmlDoc.getElementsByTagName("FACILITY")[c].nodeValue
							}
						}
						
						if ((startExitFacilityId == "P" && endExitFacilityId == "V")||(startExitFacilityId == "V" && endExitFacilityId == "P")) {
							alert("The exits you selected are at not interconnected facilities (Polk Parkway and Veterans Expressway are not interconnected.  Please, try again with a different selection.")
						}
// ******************************************************************************************************************************************************************************************************************************
// Mainline and HEFT
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline and Heft
						if (startExitFacilityId == "M" && endExitFacilityId == "H") { // From Mainline to Heft
							// Toll along mainline
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								startToll=0;
								CASH_startToll= 0;
								// Calculate Ticket toll
								ticketToll = calculateTicketToll(startExitName ,"Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Lantana Plaza");
								//alert("Ticket Toll = " + 2*ticketToll)
								// In-line toll plazas along mainline southern coin system south of the intersection with Sawgrass Expressway
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									if ((42.188>tempMile)&&(tempMile>0)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
									}
								}
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									startToll= startExitSouthOn;
									CASH_startToll= CASH_startExitSouthOn;
									// Calculate Ticket toll
									ticketToll = calculateTicketToll("Three Lakes Plaza","Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza","Lantana Plaza");
									// In line toll north coin system
									for (var w=0;w<numTollPlazas.length;w++) { 
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if ((startExitMile>tempMile)&&(tempMile>189.218)&&(startExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
										}
									}
									//alert("In-line toll along mainline:  " + inlineToll)
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									startToll= startExitSouthOn;
									CASH_startToll= CASH_startExitSouthOn;
								}
								// In-line toll plazas along mainline southern coin system south of the intersection with Sawgrass Expressway
								//alert(inlineToll)
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									if ((42.188>tempMile)&&(tempMile>0)&&(tempMile<startExitMile)&&(startExitFacilityId==tempFacID)) {
										//alert(xmlObj.childNodes(0).childNodes(1).childNodes(w).text)
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
									}
								}
							}
							// Toll along HEFT
								if (startExitName=="County Line Rd.") { // Exception for County Line Rd
									endToll= 999;
									CASH_endToll = 999;
								} else {
									endToll= endExitSouthOff;
									CASH_endToll = CASH_endExitSouthOff;
								}
							// In-line toll plazas along HEFT going south
								//alert("Toll along mainline:  " + inlineToll)
								var inlineHeft=0;
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									//alert(tempFacID + "   " + tempMile + "   " + tempToll)
									if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										inlineHeft = inlineHeft + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								//alert("In line toll heft: " + inlineHeft);
							// Mileage both facilities 
							// equation: mainline=0/HEFT=47.856
								mileage = parseFloat(startExitMile) + Math.abs(47.856 - endExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("In-line toll: " + inlineToll + "   Start toll: " + startToll + "   End toll: " + endToll + "   Ticket Toll:  " +  (ticketToll * axleFactorTicket))
							//alert(" ** total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						
// ******************************************************************************************************************************************************************************************************************************
//  HEFT and Mainline
// ******************************************************************************************************************************************************************************************************************************
						// From Heft to Mainline
						if (startExitFacilityId == "H" && endExitFacilityId == "M") { 
							// Toll along HEFT
								startToll= startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;
								// In-line toll plazas along HEFT going north
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									//alert(tempFacID + "   " + tempMile + "   " + tempToll)
									if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								//alert("in line toll along heft:  " + inlineToll)
							// Ending exit data
							// Ending exit is in ticket system
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { 
								endToll= 0;
								CASH_endToll = 0;
								ticketToll = calculateTicketToll("Lantana Plaza", endExitName);
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", endExitName);
								// In-line toll plazas along mainline southern coin system
									for (var w=0;w<numTollPlazas.length;w++) { 
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if ((endExitMile>tempMile)&&(tempMile<42.188)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
										}
									}
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
									endToll= endExitNorthOff;
									CASH_endToll = CASH_endExitNorthOff;
									// In-line toll plazas along mainline southern coin system
									var thisMainlineToll=0;
									for (var w=0;w<numTollPlazas.length;w++) { 
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if ((endExitMile>tempMile)&&(tempMile>0)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll
											thisMainlineToll=thisMainlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
										}
									}
									//alert(inlineToll + "   Mainline: " +  + thisMainlineToll)
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									endToll= endExitNorthOff;
									CASH_endToll = CASH_endExitNorthOff;
									//alert("ending toll: " + endToll)
									// In-line toll plazas along mainline southern coin system
									for (var w=0;w<numTollPlazas.length;w++) { 
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if ((endExitMile>tempMile)&&(tempMile<69)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
										}
									}
									//alert("in line toll along mainline:  " + inlineToll)		
								}
				// alert("Exit Toll:  " + tempToll)
							}
							// Mileage both facilities 
							// equation: mainline=0/HEFT=47.856
								mileage = Math.abs(47.856 - startExitMile) + endExitMile
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Mainline and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline and Sawgrass
						if (startExitFacilityId == "SG" && endExitFacilityId == "M") {  // From Sawgrass to Mainline
							// Toll along Sawgrass
								startToll= startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;
								// In-line toll plazas along Sawgrass south of the intersection with Mainline
								for (var w=0;w<numTollPlazas.length;w++) { 
								    tempMile = inLineMilePT(w);
								    tempToll = inLineTempToll(w); // Transponder payments
								    CASH_tempToll = inLineTempCashToll(w);// Cash payments
								    tempFacID = inLineTempID(w);
									//alert(tempFacID + "   " + tempMile + "   " + tempToll)
									if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll			
									}
								}
							// Ending exit data
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Ending exit is in ticket system
								endToll= 0;
								CASH_endToll = 0;
								ticketToll = calculateTicketToll("Lantana Plaza", endExitName); 
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", endExitName);
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
									endToll= endExitNorthOff;
									CASH_endToll = CASH_endExitNorthOff;
									// In-line toll plazas along mainline northern coin system 
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((endExitMile>tempMile)&&(tempMile>189.218)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									if (endExitMile > 24.401) {  // North of the intersection with Sawgrass Expressway
										endToll= endExitNorthOff;
										CASH_endToll = CASH_endExitNorthOff;
										// In-line toll plazas along mainline southern coin system north of the intersection with Sawgrass Expressway
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((endExitMile>tempMile)&&(tempMile>24.401)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									} else {			// South of the intersection with Sawgrass Expressway
										endToll= endExitSouthOff;
										CASH_endToll = CASH_endExitSouthOff;
										//alert("ending toll: " + endToll)
										// In-line toll plazas along mainline southern coin system south of the intersection with Sawgrass Expressway
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((endExitMile<tempMile)&&(tempMile<24.401)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}			
								}
							}
							// Mileage both facilities 
							// equation: mainline=24.401/sawgrass=20.76
								//alert(24.401 + "     " + startExitMile + "     " + 20.76 + "     " + endExitMile)
								mileage = Math.abs(20.76 - startExitMile) + Math.abs(endExitMile - 24.401)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						// From Mainline to Sawgrass
						if (startExitFacilityId == "M" && endExitFacilityId == "SG") { // From Mainline to Sawgrass
							// Toll along mainline
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								startToll= 0;
								CASH_startToll= 0;
								// Calculate Ticket toll
								ticketToll = calculateTicketToll(startExitName, "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Lantana Plaza");
								//alert(ticketToll)
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									startToll= startExitSouthOn;
									CASH_startToll= CASH_startExitSouthOn;
									// Calculate ticket toll
									ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
									// In-line toll plazas along mainline northern coin system 
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((startExitMile>tempMile)&&(tempMile>189.218)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									if (startExitMile > 24.401) {  // North of the intersection with Sawgrass Expressway
										startToll= startExitSouthOn;
										CASH_startToll= CASH_startExitSouthOn;
										// In-line toll plazas along mainline southern coin system north of the intersection with Sawgrass Expressway
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((startExitMile>tempMile)&&(tempMile>24.401)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									} else {			// South of the intersection with Sawgrass Expressway
										startToll= startExitNorthOn;
										CASH_startToll= CASH_startExitNorthOn;
										// In-line toll plazas along mainline southern coin system south of the intersection with Sawgrass Expressway
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((startExitMile<tempMile)&&(tempMile<24.401)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}					
								}
							}
							// Toll along Sawgrass
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
								// In-line toll plazas along Sawgrass south of the intersection with Mainline
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									//alert(tempFacID + "   " + tempMile + "   " + tempToll)
									if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
								}
							// Mileage both facilities 
							// equation: mainline=24.401/sawgrass=20.76
								mileage = Math.abs(startExitMile - 24.401) + Math.abs(20.76 - endExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Mainline and Bee Line
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline and Bee Line
						if (startExitFacilityId == "M" && endExitFacilityId == "B") {  // From Mainline to Bee Line
							// Starting exit data
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								ticketToll = calculateTicketToll(startExitName, "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									if ((189.218<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									if (startExitMile>208.302) { // North of Intersection with Bee Line
										startToll= startExitSouthOn;
										CASH_startToll= CASH_startExitSouthOn;
									} else {		// South of Intersection with Bee Line
										startToll= startExitNorthOn;
										CASH_startToll= CASH_startExitNorthOn;
									}
									for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if (startExitMile>208.302) {
											if ((startExitMile>tempMile)&&(tempMile>208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										} else {
											if ((startExitMile<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									startToll= startExitNorthOn;
									CASH_startToll= CASH_startExitNorthOn;
									for (var w=0;w<numTollPlazas.length;w++) { 
									    tempMile = inLineMilePT(w);
									    tempToll = inLineTempToll(w); // Transponder payments
									    CASH_tempToll = inLineTempCashToll(w);// Cash payments
									    tempFacID = inLineTempID(w);
										if ((startExitMile<tempMile)&&(tempMile<42.188)&&(startExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
									ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								}
							}
							// Ending exit data
							if (endExitMile<4.45) { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
							} else { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile>4.45)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll			
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
								mileage = Math.abs(208.302 - startExitMile) + Math.abs(4.45 - endExitMile)
							// Toll paid when getting off of mainline and getting on Bee Line
								if (startExitMile > 208.302) { // start exit is North of intersection with Bee Line, thus direction is south
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
								} else { // Start exit is south of Bee Line thus direction is north
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
								}							

							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll + transToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "B" && endExitFacilityId == "M") {  // From Bee Line to Mainline
							// Starting exit data
							if (startExitMile<4.45) { // going east
								startToll = startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
							} else { // going west
								startToll = startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
									tempMile = inLineMilePT(w);
									tempToll = inLineTempToll(w); // Transponder payments
									CASH_tempToll = inLineTempCashToll(w);// Cash payments
									tempFacID = inLineTempID(w);
									if ((startExitMile>tempMile)&&(tempMile>4.45)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
								}
							}
							// Ending exit data
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Ending exit is in ticket system
								ticketToll = calculateTicketToll("Three Lakes Plaza", endExitName);
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", endExitName);
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									if (endExitMile > 208.302) { // North of intersection with Bee Line
										endToll = endExitNorthOff;
										CASH_endToll = CASH_endExitNorthOff;
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((endExitMile>tempMile)&&(tempMile>208.302)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll		
											}
										}
									} else { // South of intersection with Bee Line
										endToll = endExitSouthOff;
										CASH_endToll = CASH_endExitSouthOff;
										for (var w=0;w<numTollPlazas.length;w++) { 
									        tempMile = inLineMilePT(w);
									        tempToll = inLineTempToll(w); // Transponder payments
									        CASH_tempToll = inLineTempCashToll(w);// Cash payments
									        tempFacID = inLineTempID(w);
											if ((endExitMile<tempMile)&&(tempMile<208.302)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
								
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									endToll = endExitSouthOff;
									CASH_endToll = CASH_endExitSouthOff;
									ticketToll = calculateTicketToll("Three Lakes Plaza" , "Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza" , "Lantana Plaza");
									for (var w=0;w<numTollPlazas.length;w++) { 
								        tempMile = inLineMilePT(w);
								        tempToll = inLineTempToll(w); // Transponder payments
								        CASH_tempToll = inLineTempCashToll(w);// Cash payments
								        tempFacID = inLineTempID(w);
										if ((endExitMile<tempMile)&&(tempMile<42.188)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
								mileage = Math.abs(208.302 - endExitMile) + Math.abs(4.45 - startExitMile)
								
							// Toll paid when getting off of Bee Line and getting on on Mainline
							if (endExitMile > 208.302) { // end exit is North of intersection with Bee Line, thus direction is North
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
							} else { // End exit is south of Bee Line thus direction is South
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
							}
								
							
							
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll + transToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Bee Line and HEFT
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Bee Line and Heft
						if (startExitFacilityId == "B" && endExitFacilityId == "H") { // From Bee Line to Heft
							// Toll along mainline
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile<208.302)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
						// Toll on Bee line
							if (startExitMile<4.45) { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
							} else { // going east
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile>4.45)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
						// Toll on Heft, direction South
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along HEFT going south
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
									//alert(xmlObj.childNodes(0).childNodes(1).childNodes(w).text)					
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           HEFT = 47.856/mainline = 0
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(47.856 - endExitMile) + Math.abs(4.45 - startExitMile) + (208.302)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "H" && endExitFacilityId == "B") { // From Heft to Bee Line
							// Mile and toll along mainline
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile<208.302)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							// Toll on Bee line
							// Ending exit data
							if (endExitMile<4.45) { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
							} else { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile>4.45)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// Toll on Heft, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along HEFT going north
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           HEFT = 47.856/mainline = 0
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(47.856 - startExitMile) + Math.abs(4.45 - endExitMile) + (208.302)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Bee Line and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Bee Line and Sawgrass
						if (startExitFacilityId == "SG" && endExitFacilityId == "B") { // From Sawgrass to Bee Line
							// Toll along mainline
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
								// South of the intersection with Bee Line Expressway
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile>24.401)&&(tempMile<208.302)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							// Toll on Sawgrass, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Bee line
							// Ending exit data
							if (endExitMile<4.45) { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
							} else { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile>4.45)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           Sawgrass = 20.76/mainline = 24.401
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(24.401 - startExitMile) + Math.abs(4.45 - endExitMile) + (208.302-24.401)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "B" && endExitFacilityId == "SG") { // From Bee Line to Sawgrass
							// Toll along mainline
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
								// South of the intersection with Bee Line Expressway
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile>24.401)&&(tempMile<208.302)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							// Toll on Bee line
							if (startExitMile<4.45) { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
							} else { // going east
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile>4.45)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Toll on Sawgrass, direction South
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           Sawgrass = 20.76/mainline = 24.401
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(24.401 - endExitMile) + Math.abs(4.45 - startExitMile) + (208.302-24.401)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Sawgrass and HEFT
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Sawgrass and Heft
						if (startExitFacilityId == "SG" && endExitFacilityId == "H") { // From Sawgrass To Heft 
							// Toll along mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((tempMile<47.586)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Toll on Sawgrass, direction north
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Heft, direction south
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along HEFT going south
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage all facilities 
								mileage = Math.abs(20.76 - startExitMile) + Math.abs(47.856 - endExitMile) + 24.401
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							//alert(" ** total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// HEFT and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
							if (startExitFacilityId == "H" && endExitFacilityId == "SG") { // From Heft to Sawgrass
							// Toll along mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((tempMile<47.586)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Sawgrass, direction south
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Heft, direction north
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along HEFT going north
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage all facilities 
								mileage = Math.abs(20.76 - endExitMile) + Math.abs(47.856 - startExitMile) + 24.401
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							//alert(" ** total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// MSPUR and HEFT
// ******************************************************************************************************************************************************************************************************************************
						// From Spur to HEFT
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "H") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Ending at Heft (Toll along HEFT)
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along HEFT going south
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mileage both facilities 
							// equation: HEFT=47.856/MSPUR = 3.342
								mileage = Math.abs(3.342 - startExitMile) + Math.abs(47.856 - endExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						// From HEFT to Spur
						if (startExitFacilityId == "H" && endExitFacilityId == "MSPUR") {
							// Start at HEFT (Toll along HEFT)
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along HEFT going north
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mileage both facilities 
							// equation: HEFT=47.856/MSPUR = 3.342
								mileage = Math.abs(47.856 - startExitMile) + Math.abs(3.342 - endExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// MSPUR and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline Spur and Sawgrass Expressway
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "SG") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll along mainline
							// In-line toll plazas along mainline south of the intersection with Sawgrass Expressway 
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<24.401)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Sawgrass, direction south
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
							//			 Mainline = 24.49 / Sawgrass = 20.76
								mileage = Math.abs(3.342 - startExitMile) + Math.abs(20.76 - endExitMile) + 24.49
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "SG" && endExitFacilityId == "MSPUR") {
							// Start at Sawgrass
							// Toll on Sawgrass, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll along mainline
							// In-line toll plazas along mainline south of the intersection with Sawgrass Expressway 
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<24.401)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
							//			 Mainline = 24.401 / Sawgrass = 20.76
								mileage = Math.abs(3.342 - endExitMile) + Math.abs(20.76 - startExitMile) + 24.401
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// MSPUR and Bee Line
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline Spur and Bee Line Expressway
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "B") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<208.302)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on Bee line
							// Ending exit data
							if (endExitMile<4.45) { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
							} else { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile>4.45)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
							//			 Mainline = 208.302 / Bee Line = 4.445
								mileage = Math.abs(3.342 - startExitMile) + Math.abs(4.45 - endExitMile) + 208.302
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "B" && endExitFacilityId == "MSPUR") {
							// Toll on Bee line
							if (startExitMile<4.45) { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
							} else { // going east
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile>4.45)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<208.302)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
								mileage = Math.abs(3.342 - endExitMile) + Math.abs(4.45 - startExitMile) + 208.302
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// MSPUR and Mainline
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline Spur and  Mainline
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "M") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							//alert("Start Toll:  Sunpass= " + startToll + "   cash= " + CASH_startToll)
							// In-line toll plazas along MSPUR
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
									//alert("StartExitMile:  " + startExitMile + "   TEMP MILE: " + tempMile + "    Start Exit Fac ID: " + tempFacID + "  ******  " + inlineToll)			
								}
							}
							//alert("In-line toll SPUR: " + inlineToll)
							//alert("Inline Toll:  " + CASH_inlineToll)
							// Ending at Mainline
							if (endExitMile < 42.188) { // Ends in South Coin System
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								// In-line toll plazas along mainline south coin system
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile>0)&&(tempMile<endExitMile)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Ends in Ticket System
								// In-line toll plazas along mainline south coin system
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile>0)&&(tempMile<48.188)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								ticketToll = calculateTicketToll("Lantana Plaza", endExitName);
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", endExitName);
							}
							if (endExitMile > 189.218) { // Ends in North Coin System
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								// Toll plazas along mainline south ticket system
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									if ((tempMile>0)&&(tempMile<48.188)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								// Toll plazas along mainline north ticket system
								for (var w=0;w<numTollPlazas.length;w++) { 
							        tempMile = inLineMilePT(w);
							        tempToll = inLineTempToll(w); // Transponder payments
							        CASH_tempToll = inLineTempCashToll(w);// Cash payments
							        tempFacID = inLineTempID(w);
									//alert(tempFacID + "   " + tempMile + "   " + tempToll)
									if ((tempMile<endExitMile)&&(tempMile>189.218)&&(endExitFacilityId==tempFacID)) {
										//alert(tempFacID + "   " + tempMile + "   " + tempToll)
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								//alert("Cash Inline Toll= $" + CASH_inlineToll)
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
								mileage = endExitMile + Math.abs(3.342 - startExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Mainline and MSPUR
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline and Mainline Spur
						if (startExitFacilityId == "M" && endExitFacilityId == "MSPUR") {
							// Start at Mainline
							if (startExitMile < 42.188) { // Starts at South Coin System
								startToll= startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;
							}
							if ((startExitMile > 42.188)&&(startExitMile < 189.218)) { // Starts at Ticket System
								ticketToll = calculateTicketToll(startExitName, "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Lantana Plaza");
							}
							if (startExitMile > 189.218) { // Starts at North Coin System
								startToll= startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								
							}
							// Toll plazas along mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((tempMile<startExitMile)&&(tempMile>0)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
								mileage = Math.abs(startExitMile) + Math.abs(3.342 - endExitMile)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Suncoast and Veterans
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Suncoast and Veterans
						if (startExitFacilityId == "SC" && endExitFacilityId == "V") {
							// Mile and toll on Veterans, direction south
							startToll= startExitSouthOn;
							CASH_startToll= CASH_startExitSouthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile>tempMile)&&(tempMile>12.268)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mile and toll on Suncoast, Direction south
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<12.268)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mileage all facilities 
								mileage = Math.abs(12.268 - endExitMile) + Math.abs(12.268 - startExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "V" && endExitFacilityId == "SC") {
							// Mile and toll on Suncoast, direction north
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<12.268)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							
							// Mile and toll on Veterans, Direction north
							endToll= endExitNorthOff;
							CASH_endToll = CASH_endExitNorthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile>tempMile)&&(tempMile>12.268)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage all facilities 
								mileage = Math.abs(12.268 - endExitMile) + Math.abs(12.268 - startExitMile)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)
							//alert(" ** total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
					}
				}
			
			//alert("Mileage:  " + mileage)

// ******************************************************************************************************************************************************************************************************************************
// Bee Line To/From Western Beltway
// ******************************************************************************************************************************************************************************************************************************
						//************************* From Bee Line to Western Beltway
						if (startExitFacilityId == "B" && endExitFacilityId == "WB") { 
							// Toll along mainline

								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
								}
						
						// Toll on Bee line
							if (startExitMile<4.45) { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
							} else { // going west
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((tempMile<startExitMile)&&(tempMile>4.45)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// add toll rate for the interchange on the Bee Line going North on the Mainline
							inlineToll = inlineToll + parseFloat(.50) //SunPass rate
							CASH_inlineToll = CASH_inlineToll + parseFloat(.75) //Cash rate
						
						var wbDir;
						// Toll on Western Beltway, direction South
							if(endExitMile > 19.440){
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								wbDir = "North";
							}
							else{
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
								wbDir = "South";
							}
							

							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if(wbDir=='South'){
									// In-line toll plazas along Western Beltway going south
									if ((endExitMile<tempMile)&&(tempMile!='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
	
									}
								}
								else if(wbDir=='North'){
									if ((endExitMile>tempMile)&&(tempMile=='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
										//alert(wbDir);
									}


								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302;Bee Line=4.45; Western Beltway=22.4
							//           Miles from Western Beltway interchange to Bee Line interchange = 12.38

								mileage = Math.abs(22.4 - endExitMile) + Math.abs(4.45 - startExitMile) + (12.38)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						
						var fnd;
						var s_direction;
						fnd = false;
							if (startExitFacilityId == "WB" && startExitMile <= 19.440) { //start traveling north on Western Beltway (429)
								s_direction = "NORT";
							
								startToll= startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;

							fnd = true;
							}
							else if (startExitFacilityId == "WB" && startExitMile > 19.440) { //start traveling south on Western Beltway (429)
								s_direction = "SOUT";
							
								startToll= startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;

							fnd = true;
							}
						
				
						if (fnd){
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								//get the mainline toll for the Western Beltway
								if ((s_direction == "NORT")&&(startExitFacilityId==tempFacID)){
										 
										 //going to Bee Line from the Western Beltway Northbound
										 if ((startExitMile<=tempMile) && (tempMile!='27')){
											inlineToll = inlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll
											
										}
								}
								
								// ******************************************************************************************
								// As of 6.20.2006 the calculator does not calculate traffic from the Western Beltway southbound
								// south of the Turnpike to other facilities because non-toll facilities are not used in the calculation of miles.
								// The only way this program is used is assuming the traveler is on toll roads only.
								// L Barber 6.20.2006
								// *******************************************************************************************
								else if ((s_direction == "SOUT")&&(startExitFacilityId==tempFacID)){
									if((startExitMile>tempMile) && (tempMile=='27')){
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll
										
									}
								}
							}
								var newToll_SP = beeLine(startExitFacilityId,inlineToll,CASH_inlineToll,'0');
								var newToll_CA = beeLine(startExitFacilityId,inlineToll,CASH_inlineToll,'1');
								inlineToll = newToll_SP;
								CASH_inlineToll = newToll_CA;
														
							if(fnd && endExitFacilityId == "B"){
							
							// Mileage all facilities 
								mileage = Math.abs(4.45 - endExitMile) + Math.abs(22.4 - startExitMile) + (12.38)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {

								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							}
							document.getElementById("messageDIV").innerHTML=outputText
							}//end start and end facility check
						}
// ******************************************************************************************************************************************************************************************************************************
// Mainline and Western Beltway
// ******************************************************************************************************************************************************************************************************************************
						//************************ From Mainline to Western Beltway *********************************************************
						if (startExitFacilityId == "M" && endExitFacilityId == "WB") {
							// Starting exit data
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								ticketToll = calculateTicketToll(startExitName, "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((189.218<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System

									if (startExitMile>221.108) { // North of Intersection with Western Beltway
										startToll= startExitSouthOn;
										CASH_startToll= CASH_startExitSouthOn;
									} else {		// South of Intersection with Bee Line
										startToll= startExitNorthOn;
										CASH_startToll= CASH_startExitNorthOn;
									}
									for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										
										if (startExitMile>208.302) {
											if ((startExitMile>tempMile)&&(tempMile>208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										} else {
											if ((startExitMile<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									startToll= startExitNorthOn;
									CASH_startToll= CASH_startExitNorthOn;
									for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										
										if ((startExitMile<tempMile)&&(tempMile<42.188)&&(startExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
									
									ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								}
							}
							// Ending exit data
							if (endExitMile<=19.440) { // going south
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
								e_direction = "South";

							} else { // going north
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								e_direction = "North";
							}								
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((e_direction=="South") && (endExitMile<tempMile)&&(tempMile!='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll
										
													
									}
									else if ((e_direction=="North") && (endExitMile>tempMile)&&(tempMile=='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll			
									}
									
								}
							
							// Mileage both facilities 
							// equation: mainline=261.701;Western Beltway=22.4
							// Miles from Western Beltway interchange to beginning of mainline = 221.108
								mileage = Math.abs(221.108 - startExitMile) + Math.abs(22.4 - endExitMile)						
								
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll + transToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)
														
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);

							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						//***************** From Western Beltway to Mainline ******************************************
  						if (startExitFacilityId == "WB" && endExitFacilityId == "M") {
							
							//reset inline toll rates to zero
							inlineToll = 0;
							CASH_inlineToll = 0;
							
							// Starting exit data
							if (startExitMile<= 19.440) { // going north
								startToll = startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;
								s_direction="North";
							} else { // going south
								startToll = startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;
								s_direction="South";
							}
								
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((s_direction=="South") && (tempMile=='27') && (startExitMile>=27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
									else if ((s_direction=="North") && (startExitMile<tempMile)&& (tempMile!=27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
								}

							// Ending exit data
							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Ending exit is in ticket system
								ticketToll = calculateTicketToll("Three Lakes Plaza", endExitName);
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", endExitName);
								endToll = 0;
								CASH_endToll = 0;
							} else { 
								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System
									if (endExitMile > 221.108) { // North of intersection with Western Beltway
										endToll = endExitNorthOff;
										CASH_endToll = CASH_endExitNorthOff;
										for (var w=0;w<numTollPlazas.length;w++) { 
						                    tempMile = inLineMilePT(w);
						                    tempToll = inLineTempToll(w); // Transponder payments
						                    CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                    tempFacID = inLineTempID(w);
											
											if ((endExitMile>tempMile)&&(tempMile>221.108)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll		
											}
										}
									} else { // South of intersection with Western Beltway
										endToll = endExitSouthOff;
										CASH_endToll = CASH_endExitSouthOff;
										
										for (var w=0;w<numTollPlazas.length;w++) { 
						                    tempMile = inLineMilePT(w);
						                    tempToll = inLineTempToll(w); // Transponder payments
						                    CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                    tempFacID = inLineTempID(w);
											
											if ((endExitMile<tempMile)&&(tempMile<221.108)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
								
								}
								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									endToll = endExitSouthOff;
									CASH_endToll = CASH_endExitSouthOff;
									ticketToll = calculateTicketToll("Three Lakes Plaza" , "Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza" , "Lantana Plaza");
									
									for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										
										if ((endExitMile<tempMile)&&(tempMile<42.188)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=261.701;Western Beltway=22.4
							// Miles from Western Beltway interchange to beginning of mainline = 221.108
								mileage = Math.abs(221.108 - endExitMile) + Math.abs(22.4 - startExitMile)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);

							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
// ******************************************************************************************************************************************************************************************************************************
// Western Beltway and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
							//************ From Western Beltway to Sawgrass *************************************************************
							if (startExitFacilityId == "WB" && endExitFacilityId == "SG") { 
							
							inlineToll = 0;
							CASH_inlineToll = 0;
									
									// get the toll for traveling through the Ticket System's mainline plaza's
									ticketToll = calculateTicketToll("Three Lakes Plaza" , "Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza" , "Lantana Plaza");

							// Toll on Sawgrass, direction north

							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);

								if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}

							// Toll on Western Beltway
							if(startExitMile <= 19.440){
							s_direction = "North";
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							}
							else{
							s_direction = "South";
							startToll= startExitSouthOn;
							CASH_startToll= CASH_startExitSouthOn;
							}
							
							// In-line toll plazas along Western Beltway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if ((s_direction=="North" )&&(startExitMile<tempMile)&&(tempMile!='27')&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll
								}
								else if ((s_direction=="South" )&&(startExitMile>tempMile)&&(tempMile=='27')&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
								
							}

							// Mileage all facilities 
								mileage = Math.abs(20.760 - endExitMile) + Math.abs(22.4 - startExitMile) + 200.348 //mainline miles
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						// ************* From Sawgrass to Western Beltway *******************************************************************
							if (startExitFacilityId == "SG" && endExitFacilityId == "WB") {
							
							inlineToll = 0;
							CASH_inlineToll = 0;
									
									// get the toll for traveling through the Ticket System's mainline plaza's
									ticketToll = calculateTicketToll("Three Lakes Plaza" , "Lantana Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza" , "Lantana Plaza");

							// Toll on Sawgrass, direction south

							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);

								if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}

							// Toll on Western Beltway
							if(endExitMile <= 19.440){
							e_direction = "South";
							endToll= endExitSouthOff;
							CASH_endToll= CASH_endExitSouthOff;
							}
							else{
							e_direction = "North";
							endToll= endExitNorthOff;
							CASH_endToll= CASH_endExitNorthOff;
							}
							
							// In-line toll plazas along Western Beltway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if ((e_direction=="North" )&&(endExitMile>tempMile)&&(tempMile=='27')&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll
									alert(inlineToll);
								}
								else if ((e_direction=="South" )&&(endExitMile<tempMile)&&(tempMile!='27')&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
								
							}
							// Mileage all facilities 
								mileage = Math.abs(20.760 - startExitMile) + Math.abs(22.4 - endExitMile) + 200.348 //mainline miles
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						// ********* end Sawgrass/Western Beltway ********************************************************************************************************
// ******************************************************************************************************************************************************************************************************************************
// MSPUR and Western Beltway
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline Spur and Bee Line Expressway
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "WB") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);

								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if ((tempMile>0)&&(tempMile<208.302)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							
							// Toll on Western Beltway
							// Ending exit data
							if (endExitMile<=19.440) { // going south
								e_direction = "South";
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
							} else { // going east
								e_direction= "North";
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((e_direction=="North") && (endExitMile>tempMile)&&(tempMile==27)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
									else if ((e_direction=="South") && (endExitMile<tempMile)&&(tempMile!=27)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342
							//			 Mainline = 261.701
							//			 Western Beltway = 22.4
							//			 Miles from Western Beltway interchange to end of SPUR = 217.766
							
								mileage = Math.abs(3.342 - startExitMile) + Math.abs(22.4 - endExitMile) + 217.766
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "WB" && endExitFacilityId == "MSPUR") {
							
							// reset inline tolls	
							inlineToll = 0;
							CASH_inlineToll = 0;

							// Toll on Western Beltway
							if (startExitMile<=19.440) { // going north
								s_direction = "North";
								startToll= startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;
							} else { // going south
								s_direction = "South";
								startToll= startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((s_direction=="North") && (tempMile<startExitMile)&&(tempMile!=27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll
									}
									else if ((s_direction=="South") && (tempMile<startExitMile)&&(tempMile==27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if ((tempMile>0)&&(tempMile<208.302)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);

								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342; mainline miles from Western Beltway to SPUR = 217.766; Western Beltway = 22.4
							
								mileage = Math.abs(3.342 - endExitMile) + Math.abs(22.4 - startExitMile) + 217.766
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}

// ******************************************************************************************************************************************************************************************************************************
// Western Beltway and HEFT
// ******************************************************************************************************************************************************************************************************************************
						 
						 //******************** From Western Beltway to Heft *****************************************************************
						 if (startExitFacilityId == "WB" && endExitFacilityId == "H") {
								// reset inline toll rates
								inlineToll = 0;	
								CASH_inlineToll = 0;
								
								// Toll along mainline
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((tempMile<220.821)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
								
								// Toll on Western Beltway
								if (startExitMile<=19.440) { // going north
									s_direction = "North";
									startToll= startExitNorthOn;
									CASH_startToll= CASH_startExitNorthOn;
								} else { // going south
									s_direction = "South";
									startToll= startExitSouthOn;
									CASH_startToll= CASH_startExitSouthOn;
									for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									
									if ((s_direction=="South") && (tempMile<startExitMile)&&(tempMile==27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll
									}
									else if ((s_direction=="North") && (tempMile<startExitMile)&&(tempMile!=27)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// Toll on Heft, direction South
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							
							// In-line toll plazas along HEFT going south
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);

								if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll	

								}
							}

							// Mileage	 equation: mainline=261.701
							//           HEFT = 47.493
							//           Western Beltway = 22.4
							//			 From mainline (I-75) to Western Beltway interchange = 261.701 - 221.108 = 40.593
							//			 Mainline miles from Western Beltway to HEFT/Turnpike interchange = 221.108
							
								mileage = Math.abs(47.493 - endExitMile) + Math.abs(22.4 - startExitMile) + (221.108)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
													
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						//************************** From Heft to Western Beltway ******************************************************
						if (startExitFacilityId == "H" && endExitFacilityId == "WB") { 
							
							// Mile and toll along mainline
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((tempMile<220.821)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							
							// Ending exit Toll on Western Beltway
							if (endExitMile<=19.440) { // going south
								e_direction = "South";
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
							} else { // going north
								e_direction = "North";
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									
									if ((e_direction=="South")&&(endExitMile<tempMile)&&(tempMile!=27)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
									else if ((e_direction=="North")&&(endExitMile>tempMile)&&(tempMile==27)&&(endExitFacilityId==tempFacID)) {
										//alert(inlineToll);				
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// Toll on Heft, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along HEFT going north
							for (var w=0;w<numTollPlazas.length;w++) { 
						        tempMile = inLineMilePT(w);
						        tempToll = inLineTempToll(w); // Transponder payments
						        CASH_tempToll = inLineTempCashToll(w);// Cash payments
						        tempFacID = inLineTempID(w);
								
								if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: mainline=261.701
							//           HEFT = 47.493
							//           Western Beltway = 22.4 
							//			 From mainline (I-75) to Western Beltway interchange = 261.701 - 221.108 = 40.593
							//			 Mainline miles from Western Beltway to HEFT/Turnpike interchange = 221.108
								mileage = Math.abs(47.493 - startExitMile) + Math.abs(22.4 - endExitMile) + (221.108)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}

	document.getElementById("printButton").style.visibility = "visible";

// ******************************************************************************************************************************************************************************************************************************
// Mainline and 408
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline and East West
						if (startExitFacilityId == "M" && endExitFacilityId == "EW") {  // From Mainline to 408
							// Starting exit data
							if ((startExitMile > 42.188)&&(startExitMile <189.218)) { // Starting exit is in ticket system
								ticketToll = calculateTicketToll(startExitName, "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH(startExitName, "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						            tempMile = inLineMilePT(w);
						            tempToll = inLineTempToll(w); // Transponder payments
						            CASH_tempToll = inLineTempCashToll(w);// Cash payments
						            tempFacID = inLineTempID(w);
									if ((189.218<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { 
								if (startExitMile > 189.218) {  // Starting Exit is in North Coin System
									
									startToll= startExitSouthOn;
									CASH_startToll= CASH_startExitSouthOn;
									for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										if (startExitMile>208.302) {
											if ((startExitMile>tempMile)&&(tempMile>208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										} else {
											if ((startExitMile<tempMile)&&(tempMile<208.302)&&(startExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
								}
								if (startExitMile < 42.188) {  // Starting Exit is in South Coin System
									startToll= startExitNorthOn;
									CASH_startToll= CASH_startExitNorthOn;
									for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										if ((startExitMile<tempMile)&&(tempMile<42.188)&&(startExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
									ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
									CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								}
							}
							// Ending exit data
							if (endExitMile<=9.68) { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll			
									}
								}
							} else { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile>=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll		
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll			
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
								mileage = Math.abs(startExitMile - 218.92) + Math.abs(endExitMile)
												
								
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll + transToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "EW" && endExitFacilityId == "M") {  // From East West to Mainline
							// Starting exit data
							if (startExitMile<=9.68) { // going west
								startToll = startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((startExitMile>tempMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
								}
							} else { // going east
								startToll = startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((startExitMile>tempMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
									}
								}
							}
							// Ending exit data

							if ((endExitMile > 42.188)&&(endExitMile < 189.218)) { // Ending exit is in ticket system

								ticketToll = calculateTicketToll("Three Lakes Plaza", endExitName);
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", endExitName);
							} else { 

								if (endExitMile > 189.218) {  // Ending Exit is in North Coin System

									if (endExitMile > 218.92) { // North of intersection with East West Expressway
										endToll = endExitNorthOff;
										CASH_endToll = CASH_endExitNorthOff;
										for (var w=0;w<numTollPlazas.length;w++) { 
						                    tempMile = inLineMilePT(w);
						                    tempToll = inLineTempToll(w); // Transponder payments
						                    CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                    tempFacID = inLineTempID(w);
											
											if ((endExitMile>tempMile)&&(tempMile>218.92)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll		
											}
										}
									} else { // South of intersection with East West Expressway
										endToll = endExitSouthOff;
										CASH_endToll = CASH_endExitSouthOff;
										
										for (var w=0;w<numTollPlazas.length;w++) { 
						                    tempMile = inLineMilePT(w);
						                    tempToll = inLineTempToll(w); // Transponder payments
						                    CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                    tempFacID = inLineTempID(w);
											
											if ((endExitMile<tempMile)&&(tempMile<218.92)&&(endExitFacilityId==tempFacID)) {
												inlineToll = inlineToll + tempToll	
												CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
											}
										}
									}
							}

								if (endExitMile < 42.188) {  // Ending Exit is in South Coin System
									endToll = endExitSouthOff;
									CASH_endToll = CASH_endExitSouthOff;
									ticketToll = calculateTicketToll("Three Lakes Plaza" , "Lantana Plaza");

									CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza" , "Lantana Plaza");
									for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
										if ((endExitMile<tempMile)&&(tempMile<42.188)&&(endExitFacilityId==tempFacID)) {
											inlineToll = inlineToll + tempToll	
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
										}
									}
								}
							
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
								mileage = Math.abs(218.92 - endExitMile) + Math.abs(startExitMile)

							// Toll paid when getting off of East West Expwy and onto mainline
								if (startExitMile > 218.92) { // start exit is North of intersection with East West Expwy, thus direction is south
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
								} else { // Start exit is south of East West Expwy thus direction is north
									transToll = beeLineTrans_SP(BeeLineMainlineExit);
									CASH_transToll = beeLineTrans_CA(BeeLineMainlineExit);
								}
							}
							
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll + transToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll + CASH_transToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}

// ******************************************************************************************************************************************************************************************************************************
// 408 and HEFT
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on 408 and Heft
						if (startExitFacilityId == "EW" && endExitFacilityId == "H") { // From Bee Line to Heft
							// Toll along mainline
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<218.92)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
						// Toll on 408
							if (startExitMile<=9.68) { // going west
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
						// Toll on Heft, direction South
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along HEFT going south
							for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<47.586)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
									//alert(xmlObj.childNodes(0).childNodes(1).childNodes(w).text)					
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           HEFT = 47.856/mainline = 0
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(47.856 - endExitMile) + Math.abs(startExitMile) + (218.92)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
							}
							if (startExitFacilityId == "H" && endExitFacilityId == "EW") { // From HEFT to 408
							// Mile and toll along mainline
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<218.92)&&(tempMile>0)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}

							// Toll on 408
							// Ending exit data
							if (endExitMile<=9.68) { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							
							// Toll on Heft, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along HEFT going north
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<47.856)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           HEFT = 47.856/mainline = 0
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(47.856 - startExitMile) + Math.abs(endExitMile) + (218.92)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}			
// ******************************************************************************************************************************************************************************************************************************
// 408 and Sawgrass
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on 408 and Sawgrass
						if (startExitFacilityId == "SG" && endExitFacilityId == "EW") { // From Sawgrass to 408
							// Toll along mainline
								ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
								// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
								// South of the intersection with Bee Line Expressway
								for (var w=0;w<numTollPlazas.length;w++) { 
					                tempMile = inLineMilePT(w);
					                tempToll = inLineTempToll(w); // Transponder payments
					                CASH_tempToll = inLineTempCashToll(w);// Cash payments
					                tempFacID = inLineTempID(w);
									if ((tempMile>24.401)&&(tempMile<218.92)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							// Toll on Sawgrass, direction North
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<20.76)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on 408
							// Ending exit data
							if (endExitMile<=9.68) { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           Sawgrass = 20.76/mainline = 24.401
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(20.76 - startExitMile) + Math.abs(endExitMile) + (218.92-24.401)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "EW" && endExitFacilityId == "SG") { // From 408 to Sawgrass
							// Toll along mainline
								ticketToll = calculateTicketToll("Three Lakes Plaza", "Lantana Plaza");
								CASH_ticketToll = calculateTicketToll_CASH("Three Lakes Plaza", "Lantana Plaza");
								// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
								// South of the intersection with Bee Line Expressway
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile>24.401)&&(tempMile<218.92)&&(tempFacID=="M")) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							// Toll on Bee line
							if (startExitMile<=9.68) { // going west
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Toll on Sawgrass, direction South
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							// In-line toll plazas along Sawgrass south of the intersection with Mainline
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<20.76)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302/Bee Line=4.45
							//           Sawgrass = 20.76/mainline = 24.401
							//           Bee Line = 4.45/Mainline = 208.302 
								mileage = Math.abs(20.76 - endExitMile) + Math.abs(startExitMile) + (218.92-24.401)
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}	

// ******************************************************************************************************************************************************************************************************************************
// MSPUR and 408
// ******************************************************************************************************************************************************************************************************************************
						// User selects exits on Mainline Spur and East West Expressway
						if (startExitFacilityId == "MSPUR" && endExitFacilityId == "EW") {
							// Start at SPUR
							startToll= startExitNorthOn;
							CASH_startToll= CASH_startExitNorthOn;
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((startExitMile<tempMile)&&(tempMile<3.342)&&(startExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<218.92)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Toll on 408
							// Ending exit data
							if (endExitMile<=9.68) { // going east
								endToll= endExitEastOff;
								CASH_endToll = CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going west
								endToll= endExitWestOff;
								CASH_endToll = CASH_endExitWestOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((endExitMile>tempMile)&&(tempMile<=9.68)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
							//			 Mainline = 208.302 / Bee Line = 4.445
								mileage = Math.abs(3.342 - startExitMile) + Math.abs(endExitMile) + 218.92
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						if (startExitFacilityId == "EW" && endExitFacilityId == "MSPUR") {
							// Toll on 408
							if (startExitMile<=9.98) { // going West
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							} else { // going east
								startToll= startExitEastOn;
								CASH_startToll= CASH_startExitEastOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=9.68)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
							// Toll along mainline
							ticketToll = calculateTicketToll("Lantana Plaza", "Three Lakes Plaza");
							CASH_ticketToll = calculateTicketToll_CASH("Lantana Plaza", "Three Lakes Plaza");
							// In-line toll plazas along mainline north of the intersection with Sawgrass Expressway and
							// South of the intersection with Bee Line Expressway
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								if ((tempMile>0)&&(tempMile<218.92)&&(tempFacID=="M")) {
									inlineToll = inlineToll + tempToll
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
								}
							}
							// Ending at SPUR
							endToll= endExitSouthOff;
							CASH_endToll = CASH_endExitSouthOff;
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								//alert(tempFacID + "   " + tempMile + "   " + tempToll)
								if ((endExitMile<tempMile)&&(tempMile<3.342)&&(endExitFacilityId==tempFacID)) {
									inlineToll = inlineToll + tempToll	
									CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
								}
							}
							// Mileage both facilities 
							// equation: SPUR = 3.342/mainline = 0
								mileage = Math.abs(3.342 - endExitMile) + Math.abs(startExitMile) + 218.92
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll) + (ticketToll * axleFactorTicket)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll) + (CASH_ticketToll * axleFactorTicket)
							//alert("   total toll: " + totalToll + "   axle factor: " + axleFactor + "   start toll:  " + startToll + "   end toll:  " + endToll + "   inline toll: " + inlineToll)
							// Display results when both exit belong to same facility
							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}

// ******************************************************************************************************************************************************************************************************************************
// 408 To/From Western Beltway
// ******************************************************************************************************************************************************************************************************************************
						//************************* From 408 to Western Beltway
						if (startExitFacilityId == "EW" && endExitFacilityId == "WB") { 
							// Toll along mainline

								for (var w=0;w<numTollPlazas.length;w++) { 
					                tempMile = inLineMilePT(w);
					                tempToll = inLineTempToll(w); // Transponder payments
					                CASH_tempToll = inLineTempCashToll(w);// Cash payments
					                tempFacID = inLineTempID(w);
								}
						
						// Toll on 408
							if (startExitMile<=22.49) { // going West
								startToll= startExitWestOn;
								CASH_startToll= CASH_startExitWestOn;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<startExitMile)&&(tempMile<=22.49)&&(startExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
						// Toll on Western Beltway, direction South
							if(endExitMile > 19.440){
								endToll= endExitNorthOff;
								CASH_endToll = CASH_endExitNorthOff;
								wbDir = "North";
							}
							else{
								endToll= endExitSouthOff;
								CASH_endToll = CASH_endExitSouthOff;
								wbDir = "South";
							}
							

							for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
								
								if(wbDir=='South'){
									// In-line toll plazas along Western Beltway going south
									if ((endExitMile<tempMile)&&(tempMile!='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
	
									}
								}
								else if(wbDir=='North'){
									if ((endExitMile>tempMile)&&(tempMile=='27')&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll	
										//alert(wbDir);
									}


								}
							}
							// Mileage both facilities 
							// equation: mainline=208.302;Bee Line=4.45; Western Beltway=22.4
							//           Miles from Western Beltway interchange to 408 interchange = 2.188

								mileage = Math.abs(22.4 - endExitMile) + Math.abs(startExitMile) + (2.188)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							
							var spOnly;
							spOnly = electronicOnly(formatCASHTotalToll);//ELECTRONIC TOLLS ONLY CHECK

							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {
								//outputText += "Toll along " + facilityName + " from " + startExitName + " to " + endExitName + " for a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							//alert (endExitName);	
								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> " + spOnly
							}
							document.getElementById("messageDIV").innerHTML=outputText
						}
						
						var fnd;
						var s_direction;
						fnd = false;
							if (startExitFacilityId == "WB" && startExitMile <= 19.440) { //start traveling north on Western Beltway (429)
								s_direction = "NORT";
							
								startToll= startExitNorthOn;
								CASH_startToll= CASH_startExitNorthOn;

							fnd = true;
							}
							else if (startExitFacilityId == "WB" && startExitMile > 19.440) { //start traveling south on Western Beltway (429)
								s_direction = "SOUT";
							
								startToll= startExitSouthOn;
								CASH_startToll= CASH_startExitSouthOn;

							fnd = true;
							}
						
				
						if (fnd){
							for (var w=0;w<numTollPlazas.length;w++) { 
				                tempMile = inLineMilePT(w);
				                tempToll = inLineTempToll(w); // Transponder payments
				                CASH_tempToll = inLineTempCashToll(w);// Cash payments
				                tempFacID = inLineTempID(w);
								
								//get the mainline toll for the Western Beltway
								if ((s_direction == "NORT")&&(startExitFacilityId==tempFacID)){
										 
										 //going to 408 from the Western Beltway Northbound
										 if ((startExitMile<=tempMile) && (tempMile!='27')){
											inlineToll = inlineToll + tempToll
											CASH_inlineToll = CASH_inlineToll + CASH_tempToll
											
										}
								}
								
								// ******************************************************************************************
								// As of 6.20.2006 the calculator does not calculate traffic from the Western Beltway southbound
								// south of the Turnpike to other facilities because non-toll facilities are not used in the calculation of miles.
								// The only way this program is used is assuming the traveler is on toll roads only.
								// L Barber 6.20.2006
								// *******************************************************************************************
								else if ((s_direction == "SOUT")&&(startExitFacilityId==tempFacID)){
									if((startExitMile>tempMile) && (tempMile=='27')){
										inlineToll = inlineToll + tempToll
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll
										
									}
								}
							}
							
						// Toll on 408
							if (endExitMile<=22.49) { // going east
								endToll= endExitEastOff;
								CASH_endToll= CASH_endExitEastOff;
								for (var w=0;w<numTollPlazas.length;w++) { 
						                tempMile = inLineMilePT(w);
						                tempToll = inLineTempToll(w); // Transponder payments
						                CASH_tempToll = inLineTempCashToll(w);// Cash payments
						                tempFacID = inLineTempID(w);
									if ((tempMile<endExitMile)&&(tempMile<=22.49)&&(endExitFacilityId==tempFacID)) {
										inlineToll = inlineToll + tempToll	
										CASH_inlineToll = CASH_inlineToll + CASH_tempToll				
									}
								}
							}
														
							if(fnd && endExitFacilityId == "EW"){
							
							// Mileage all facilities 
								mileage = Math.abs(endExitMile) + Math.abs(22.4 - startExitMile) + (2.188)
							
							// Calculate Toll
							totalToll= axleFactor * (startToll + endToll + inlineToll)
							CASH_totalToll= axleFactor * (CASH_startToll + CASH_endToll + CASH_inlineToll)

							formatMile.setNumber(Math.abs(mileage));
							formatMile.setCurrency(false);
							formatTotalToll.setNumber(totalToll);
							formatCASHTotalToll.setNumber(CASH_totalToll);
							if (totalToll > 900) {
								outputText += "You cannot get on or off in the exits you selected.  Please, try again"
							} else {

								outputText +=  "For a " + axle + " axle vehicle to travel " + formatMile.toFormatted() + " miles<BR>Toll with SunPass is " + formatTotalToll.toFormatted() + "<BR> Toll with cash is " + formatCASHTotalToll.toFormatted()
							}
							document.getElementById("messageDIV").innerHTML=outputText
							}//end start and end facility check
						}
	

}// end function

function getInlineToll_SunPass_South(){
	// alert(startToll + "    " + endToll);
	// Find In-line-Toll-Plazas
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Transponder payments
		tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("SUNPASS_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile>tempMile)&&(endExitMile<tempMile)&&(startExitFacilityId==tempFacID)) {
			inlineToll = inlineToll + tempToll
		}
	}
return inlineToll;
}

function getInlineToll_Cash_South(){
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Cash payments
		CASH_tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("CASH_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile>tempMile)&&(endExitMile<tempMile)&&(startExitFacilityId==tempFacID)) {
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
		}
	}
return CASH_inlineToll;
}

function getInlineToll_SunPass_North(){
	// alert(startToll + "    " + endToll);
	// Find In-line-Toll-Plazas
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Transponder payments
		tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("SUNPASS_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile<tempMile)&&(endExitMile>tempMile)&&(startExitFacilityId==tempFacID)) {
			inlineToll = inlineToll + tempToll
		}
	}
return inlineToll;
}

function getInlineToll_Cash_North(){
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Cash payments
		CASH_tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("CASH_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile<tempMile)&&(endExitMile>tempMile)&&(startExitFacilityId==tempFacID)) {
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
		}
	}
return CASH_inlineToll;
}
function getInlineToll_SunPass_West(){
	// alert(startToll + "    " + endToll);
	// Find In-line-Toll-Plazas
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Transponder payments
		tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("SUNPASS_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile>tempMile)&&(endExitMile<tempMile)&&(startExitFacilityId==tempFacID)) {
			inlineToll = inlineToll + tempToll
		}
	}
return inlineToll;
}

function getInlineToll_Cash_West(){
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
		// Cash payments
		CASH_tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("CASH_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile>tempMile)&&(endExitMile<tempMile)&&(startExitFacilityId==tempFacID)) {
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
		}
	}
return CASH_inlineToll;
}
function getInlineToll_SunPass_East(){
	// alert(startToll + "    " + endToll);
	// Find In-line-Toll-Plazas
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
	// Transponder payments
		tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("SUNPASS_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile<tempMile)&&(endExitMile>tempMile)&&(startExitFacilityId==tempFacID)) {
			inlineToll = inlineToll + tempToll
		}
	}
return inlineToll;
}

function getInlineToll_Cash_East(){
	for (var w=0;w<numTollPlazas.length;w++) { // finds in-line toll plazas for this facility between the selected exits
		tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
		// Cash payments
		CASH_tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("CASH_TOLL"))
		tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
		if ((startExitMile<tempMile)&&(endExitMile>tempMile)&&(startExitFacilityId==tempFacID)) {
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
		}
	}
return CASH_inlineToll;
}

function inLineMilePT(w){
    tempMile = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("MILE_POINT"))
    return tempMile;
}
function inLineTempToll(w){
    // Transponder payments
	tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("SUNPASS_TOLL"))
	return tempToll;
}
function inLineTempCashToll(w){
    // Cash payments
    CASH_tempToll = parseFloat(xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("CASH_TOLL"))
    return CASH_tempToll;
}
function inLineTempID(w){
    tempFacID = xmlDoc.getElementsByTagName("IN_LINE_TOLL_PLAZA")[w].getAttribute("FACID")
    return tempFacID;
}
function beeLineTrans_SP(BeeLineMainlineExit){
	transToll = parseFloat(xmlDoc.getElementsByTagName("EXIT")[BeeLineMainlineExit].getAttribute("SB_OFF"))
	return transToll;
}
function beeLineTrans_CA(BeeLineMainlineExit){
	CASH_transToll = parseFloat(xmlDoc.getElementsByTagName("EXIT")[BeeLineMainlineExit].getAttribute("CASH_SB_OFF"))
	return CASH_transToll;
}
function beeLine(startExitFacilityId,inlineToll,CASH_inlineToll,cnt){
var e_direction;

//get the mainline toll for the ending facility
						
//****************************************************************
// add the toll for entry onto the Bee Line from the North.
if(startExitFacilityId=='WB'){
	inlineToll = inlineToll + parseFloat(.50)
	CASH_inlineToll = CASH_inlineToll + parseFloat(.75)
}
//****************************************************************

if(endExitMile >= 4.665){ //end traveling east on Bee Line
	e_direction = "EAST";
					
	endToll= endExitEastOff;
	CASH_endToll = CASH_endExitEastOff;
							
}
else if(endExitMile < 4.665){ //end traveling west on Bee Line
	e_direction = "WEST";
							
	endToll= endExitWestOff;
	CASH_endToll = CASH_endExitWestOff;
							
}

for (var w=0;w<numTollPlazas.length;w++) { 
	tempMile = inLineMilePT(w);
	tempToll = inLineTempToll(w); // Transponder payments
	CASH_tempToll = inLineTempCashToll(w);// Cash payments
	tempFacID = inLineTempID(w);
	if(tempFacID=='B'){
		if ((e_direction == "WEST")&& (endExitMile<tempMile)){
			inlineToll = inlineToll + tempToll
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll					
		//alert(tempFacID);
		}
		else if ((e_direction == "EAST") && (endExitMile>tempMile)){
			inlineToll = inlineToll + tempToll
			CASH_inlineToll = CASH_inlineToll + CASH_tempToll
			//alert(CASH_inlineToll);					
		//alert(s_direction + " " + tempFacID + "   " + tempMile + "   " + tempToll + " " + e_direction)
		}
	}
}
if (cnt == 0){
return inlineToll;
}
else if(cnt == 1){
return CASH_inlineToll;
//alert(CASH_inlineToll);
}

}//end beeLine function


	
function updateAxleData(bx) {
	CASH_inlineToll=0
	CASH_tempToll=0
	inlineToll=0
	tempToll=0
	axle = ""
	axle = "" + bx;
	switch (axle) {
		case "2":
					axleFactor=1;
					axleFactorTicket=2;
					bridgeAxleFactor=0;
					break;
		case "3":
					axleFactor=2;
					axleFactorTicket=3;
					bridgeAxleFactor=1;
					break;
		case "4":
					axleFactor=3;
					axleFactorTicket=4;
					bridgeAxleFactor=2;
					break;
		case "5":
					axleFactor=4;
					axleFactorTicket=5;
					bridgeAxleFactor=3;
					break;
		case "6":
					axleFactor=5;
					axleFactorTicket=6;
					bridgeAxleFactor=4;
					break;
		case "7":
					axleFactor=6;
					axleFactorTicket=7;
					bridgeAxleFactor=5;
					break;
		case "8":
					axleFactor=7;
					axleFactorTicket=8;
					bridgeAxleFactor=6;
					break;
	}
	//alert("   axle:   " + axle + "   axleFactor: " + axleFactor + "   axleFactorTicket:   " + axleFactorTicket + "  bridgeAxleFactor:    " + bridgeAxleFactor)
	setAxleParams(axle);
}
		
		
function verify() {
	// 0 Object is not initialized
	// 1 Loading object is loading data
	// 2 Loaded object has loaded data
	// 3 Data from object can be worked with
	// 4 Object completely initialized
	if (xmlDoc.readyState!=4) {
		return false;
	}
}
		

		
function populatesStartingExit() { // when selection is made on ending exits combo box
	theIndex2=document.form1.endingExits.selectedIndex;
	getEndingExitData();
}
		
function resetAll() {
	theIndex=0;
	theIndex2=0;
	document.getElementById("messageDIV").style.visibility = "hidden";
	isReset1=true;
	isReset2=true;
	document.getElementById("messageDIV").innerHTML=""
	resetVehicleImage();
}

function calculateTicketToll(eFrom, eTo) {
	var tToll=0;
	var eFromIndex;

	switch (eFrom) {
		case "Lantana Plaza":
				eFromIndex = 0;
				break;
		case "Lake Worth (Lake Worth Rd.)":
				eFromIndex = 1;
				break;
		case "SR 80":
				eFromIndex = 2;
				break;
		case "Jog Road.":
				eFromIndex = 3;
				break;
		case "W. Palm Beach (Okeechobee Blvd.)":
				eFromIndex = 4;
				break;
		case "SR 710":
				eFromIndex = 5;
				break;
		case "Palm Beach Gardens (PGA Blvd.)":
				eFromIndex = 6;
				break;
		case "Jupiter (Indiantown Rd.)":
				eFromIndex = 7;
				break;
		case "Stuart (Martin Downs Blvd./SR 714)":
				eFromIndex = 8;
				break;
		case "Becker Rd.":
				eFromIndex = 9;
				break;
		case "Port St. Lucie (Port St. Lucie Blvd.)":
				eFromIndex = 10;
				break;
		case "Fort Pierce (SR 70)":
				eFromIndex = 11;
				break;
		case "Yeehaw Junction (SR 60)":
				eFromIndex = 12;
				break;
		case "Three Lakes Plaza":
				eFromIndex = 13;	
				break;				
	}
	switch (eTo) {
		case "Lantana Plaza":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_88"))
				break;
		case "Lake Worth (Lake Worth Rd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_93"))
				break;
		case "SR 80":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_97"))
				break;
		case "Jog Road.":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_98"))
				break;
		case "W. Palm Beach (Okeechobee Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_99"))
				break;
		case "SR 710":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_107"))
				break;
		case "Palm Beach Gardens (PGA Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_109"))
				break;
		case "Jupiter (Indiantown Rd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_116"))
				break;
		case "Stuart (Martin Downs Blvd./SR 714)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_133"))
				break;
		case "Becker Rd.":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_138"))
				break;
		case "Port St. Lucie (Port St. Lucie Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_142"))
				break;
		case "Fort Pierce (SR 70)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_152"))
				break;
		case "Yeehaw Junction (SR 60)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_193"))
				break;
		case "Three Lakes Plaza":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("E_236"))	
				break;				
	}
	return tToll;
}
		
function calculateTicketToll_CASH(eFrom, eTo) {
	var tToll=0;
	var eFromIndex;
	switch (eFrom) {
		case "Lantana Plaza":
				eFromIndex = 0;
				break;
		case "Lake Worth (Lake Worth Rd.)":
				eFromIndex = 1;
				break;
		case "SR 80":
				eFromIndex = 2;
				break;
		case "Jog Road.":
				eFromIndex = 3;
				break;
		case "W. Palm Beach (Okeechobee Blvd.)":
				eFromIndex = 4;
				break;
		case "SR 710":
				eFromIndex = 5;
				break;
		case "Palm Beach Gardens (PGA Blvd.)":
				eFromIndex = 6;
				break;
		case "Jupiter (Indiantown Rd.)":
				eFromIndex = 7;
				break;
		case "Stuart (Martin Downs Blvd./SR 714)":
				eFromIndex = 8;
				break;
		case "Becker Rd.":
				eFromIndex = 9;
				break;
		case "Port St. Lucie (Port St. Lucie Blvd.)":
				eFromIndex = 10;
				break;
		case "Fort Pierce (SR 70)":
				eFromIndex = 11;
				break;
		case "Yeehaw Junction (SR 60)":
				eFromIndex = 12;
				break;
		case "Three Lakes Plaza":
				eFromIndex = 13;	
				break;				
	}
	switch (eTo) {
		case "Lantana Plaza":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_88"))
				break;
		case "Lake Worth (Lake Worth Rd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_93"))
				break;
		case "SR 80":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_97"))
				break;
		case "Jog Road.":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_98"))
				break;
		case "W. Palm Beach (Okeechobee Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_99"))
				break;
		case "SR 710":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_107"))
				break;
		case "Palm Beach Gardens (PGA Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_109"))
				break;
		case "Jupiter (Indiantown Rd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_116"))
				break;
		case "Stuart (Martin Downs Blvd./SR 714)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_133"))
				break;
		case "Becker Rd.":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_138"))
				break;
		case "Port St. Lucie (Port St. Lucie Blvd.)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_142"))
				break;
		case "Fort Pierce (SR 70)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_152"))
				break;
		case "Yeehaw Junction (SR 60)":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_193"))
				break;
		case "Three Lakes Plaza":
				tToll=parseFloat(xmlDoc.getElementsByTagName("TS_EXIT")[eFromIndex].getAttribute("CASH_E_236"))	
				break;				
	}
	return tToll;
}

function electronicOnly(formatCASHTotalToll){
	var spOnly;
	var plza;
	//var formatCASHTotalToll = new NumberFormat();
	if(endExitName == 'SR 710' || startExitName == "SR 710"){
		plza = "SR 710";
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at SR 710</font></b>"
	}
	else if(endExitName == 'Consulate Dr.' || startExitName == "Consulate Dr."){
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at Consulate Dr.</font></b>"
	}
	else if(endExitName == 'Becker Rd.' || startExitName == "Becker Rd."){
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at Becker Rd.</font></b>"
	}
	else if(endExitName == 'Jog Road.' || startExitName == "Jog Road."){
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at Jog Rd.</font></b>"
	}
	else if(endExitName == 'NW 106th St.' || startExitName == "NW 106th St."){
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at NW 106th St.</font></b>"
	}
	else if(endExitName == 'Kissimmee Park Rd.' || startExitName == "Kissimmee Park Rd."){
		spOnly ="<b><font color='blue'>Prepaid Electronic Tolls Only at Kissimmee Pk Rd.</font></b>"
	}
	else {
		spOnly = "Toll with Cash is " + formatCASHTotalToll.toFormatted()
	}
	return spOnly;
}
		
function getBridgeToll(bridge) {


	var outputBridgeToll="";
	var totalBridgeToll=0;
	var CASH_totalBridgeToll=0;
			
	var thisTotal = new NumberFormat();
	var thisTollA = new NumberFormat();
	var thisTollB = new NumberFormat();
	
	var CASH_thisTotal = new NumberFormat();
	var CASH_thisTollA = new NumberFormat();
	var CASH_thisTollB = new NumberFormat();
		isReset1 = false;	
	// Verifies selection of starting and ending exits

	if (isReset1==true) {
		alert("Select Bridge Name");
	} else {
		for ( var p=0;p<numBridges.length;p++) {
//alert (numBridges.length);


			//if (document.form1.startingExits.options[document.form1.startingExits.selectedIndex].text== numBridges.item(p).text) {
			if (bridge == numBridges.item(p).text) {

				// Payment is done with transponder
					bridgeTollNorth=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("NB"))
					bridgeTollSouth=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("SB"))
					bridgeTollEast=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("EB"))
					bridgeTollWest=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("WB"))
//alert(bridgeTollNorth + '  ' + bridgeTollSouth);
				// Payment is done with cash
					CASH_bridgeTollNorth=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("CASH_NB"))
					CASH_bridgeTollSouth=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("CASH_SB"))
					CASH_bridgeTollEast=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("CASH_EB"))
					CASH_bridgeTollWest=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("CASH_WB"))
				extraAxleToll=parseFloat(xmlDoc.getElementsByTagName("BRIDGE")[p].getAttribute("ADD_AXLE"))
				if ((bridgeTollNorth==999)||(bridgeTollSouth==999)) {
					if (bridgeTollEast>0) {
						bridgeTollEast = bridgeTollEast + (bridgeAxleFactor*extraAxleToll)
						CASH_bridgeTollEast = CASH_bridgeTollEast + (bridgeAxleFactor*extraAxleToll)
					}
					if (bridgeTollWest>0) {
						bridgeTollWest = bridgeTollWest + (bridgeAxleFactor*extraAxleToll)
						CASH_bridgeTollWest = CASH_bridgeTollWest + (bridgeAxleFactor*extraAxleToll)
					}
					totalBridgeToll = bridgeTollEast + bridgeTollWest
					CASH_totalBridgeToll = CASH_bridgeTollEast + CASH_bridgeTollWest
					thisTotal.setNumber(totalBridgeToll)
					thisTollA.setNumber(bridgeTollEast)
					thisTollB.setNumber(bridgeTollWest)
					CASH_thisTotal.setNumber(CASH_totalBridgeToll)
					CASH_thisTollA.setNumber(CASH_bridgeTollEast)
					CASH_thisTollB.setNumber(CASH_bridgeTollWest)
					//outputBridgeToll += "For a " + theCurrent + " axle vehicle, Toll along " + numBridges.item(p).text + " going East-West using SunPass is " + thisTollA.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollA.toFormatted() + ".  Going West-East, toll using SunPass is " + thisTollB.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollB.toFormatted() + ".";
					outputBridgeToll += "For a " + theCurrent + " axle vehicle, going East-West: <BR>Toll using SunPass is " + thisTollA.toFormatted() + "<BR>Toll with cash is " + CASH_thisTollA.toFormatted() + ". <BR>Going West-East: <BR>Toll using SunPass is " + thisTollB.toFormatted() + "<BR>Toll with cash is " + CASH_thisTollB.toFormatted() + ".";
				} else {
					if (bridgeTollNorth>0) {
						bridgeTollNorth = bridgeTollNorth + (bridgeAxleFactor*extraAxleToll)
						CASH_bridgeTollNorth = CASH_bridgeTollNorth + (bridgeAxleFactor*extraAxleToll)
					}
					if (bridgeTollSouth>0) {
						bridgeTollSouth = bridgeTollSouth + (bridgeAxleFactor*extraAxleToll)
						CASH_bridgeTollSouth = CASH_bridgeTollSouth + (bridgeAxleFactor*extraAxleToll)
					}
					totalBridgeToll = bridgeTollNorth + bridgeTollSouth
					CASH_totalBridgeToll = CASH_bridgeTollNorth + CASH_bridgeTollSouth
					thisTotal.setNumber(totalBridgeToll)
					thisTollA.setNumber(bridgeTollNorth)
					thisTollB.setNumber(bridgeTollSouth)
					CASH_thisTotal.setNumber(CASH_totalBridgeToll)
					CASH_thisTollA.setNumber(CASH_bridgeTollNorth)
					CASH_thisTollB.setNumber(CASH_bridgeTollSouth)
					//outputBridgeToll += "For a " + axle + " axle vehicle, Toll along " + numBridges.item(p).text + " going North-South using SunPass is " + thisTollA.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollA.toFormatted() + ".  Going South-North, toll using SunPass is " + thisTollB.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollB.toFormatted() + ".";
					outputBridgeToll += "For a " + axle + " axle vehicle, going North-South: <BR>Toll using SunPass is " + thisTollA.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollA.toFormatted() + ".  <BR> Going South-North: <BR> Toll using SunPass is " + thisTollB.toFormatted() + "<BR> Toll with cash is " + CASH_thisTollB.toFormatted() + ".";
					}
			}
		}
		document.getElementById("toExitMessage").innerHTML=outputBridgeToll
		document.getElementById("toExitMessage").style.visibility = "visible";
	document.getElementById("printButton").style.visibility = "visible";
	}
}
		
function setBridgesList() {
	// populates startingExits combo box with bridges data
	document.form1.startingExits.length = 0;
	for (var i=0; i< numBridges.length; i++) { // Re-populates combo box
		document.form1.startingExits.options[i] = new Option(bridgesList[i],i);	 
	}
	//Makes first option selected by default
	//document.form1.startingExits.options[0].selected=true
}
		
function setExitsComboBoxes() {
	isBridge=false;
	calcMode=9;
	theIndex=0;
	document.getElementById('label1').innerHTML='Select Starting Exit:';
	document.form1.exitsToll.src = "./images/exits_on.gif"
	document.form1.bridgesToll.src = "./images/bridges_off.gif"
	resetAll();
	processSequence(theNextStep);
}
function setBridgesComboBoxes() {
	theIndex=0;
	document.getElementById('label1').innerHTML='Select Bridge Name:';
	isBridge=true;
	calcMode=10;
	document.form1.exitsToll.src = "./images/exits_off.gif"
	document.form1.bridgesToll.src = "./images/bridges_on.gif"
	setBridgesList();
	processSequence(theNextStep);
}
		
function getToll(tollPayment) {
	
		isTransponder=true
//alert(secondSelection);

	switch (secondSelection) {
		case "Mid-Bay Bridge":
		  getBridgeToll(secondSelection);
		  break;
		case "Garcon Point Bridge":
		  getBridgeToll(secondSelection);
		  break;
		case "I-275 to St. Pete Beach":
		  getBridgeToll(secondSelection);
		  break;
		case "St. Pete Beach to I-275":
		  getBridgeToll(secondSelection);
		  break;
		case "I-275 to Fort Desoto":
		  getBridgeToll(secondSelection);
		  break;
		case "Fort Desoto to I-275":
		  getBridgeToll(secondSelection);
		  break;
		case "Fort Desoto to St. Pete Beach":
		  getBridgeToll(secondSelection);
		  break;
		case "St. Pete Beach to Fort Desoto":
		  getBridgeToll(secondSelection);
		  break;
		case "St. Pete Beach to 682W":
		  getBridgeToll(secondSelection);
		  break;
		case "682W to St. Pete Beach":
		  getBridgeToll(secondSelection);
		  break;
		case "St. Pete Beach to 682E":
		  getBridgeToll(secondSelection);
		  break;
		case "682E to St. Pete Beach":
		  getBridgeToll(secondSelection);
		  break;
		case "St. Pete Beach to Tierra Verde":
		  getBridgeToll(secondSelection);
		  break;
		case "Tierra Verde to St. Pete Beach":
		  getBridgeToll(secondSelection);
		  break;
		case "682E to I-275":
		  getBridgeToll(secondSelection);
		  break;
		case "I-275 to 682E":
		  getBridgeToll(secondSelection);
		  break;
		case "Tierra Verde to I-275":
		  getBridgeToll(secondSelection);
		  break;
		case "I-275 to Tierra Verde":
		  getBridgeToll(secondSelection);
		  break;
		case "Tierra Verde to Fort Desoto":
		  getBridgeToll(secondSelection);
		  break;
		case "Fort Desoto to Tierra Verde":
		  getBridgeToll(secondSelection);
		  break;
		case "682W to Fort Desoto":
		  getBridgeToll(secondSelection);
		  break;
		case "Fort Desoto to 682W":
		  getBridgeToll(secondSelection);
		  break;
		case "682E to Fort Desoto":
		  getBridgeToll(secondSelection);
		  break;
		case "Fort Desoto to 682E":
		  getBridgeToll(secondSelection);
		  break;
		case "682E to 682W":
		  getBridgeToll(secondSelection);
		  break;
		case "682W to 682E":
		  getBridgeToll(secondSelection);
		  break;
		case "Tierra Verde to 682W":
		  getBridgeToll(secondSelection);
		  break;
		case "Tierra Verde to 682E":
		  getBridgeToll(secondSelection);
		  break;
		case "682E to Tierra Verde":
		  getBridgeToll(secondSelection);
		  break;
		case "682W to Tierra Verde":
		  getBridgeToll(secondSelection);
		  break;
		case "Sunshine Skyway Bridge":
		  getBridgeToll(secondSelection);
		  break;

	default:
	 calculateToll();
	}		

}
		

function toggleButton(axles) {	
	switch (axles) {
		case 2: 
				document.form1.vehicle2axle.src = "./images/button2axle_on.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/twoAxleVehicles.gif"
				break;
		case 3: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_on.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/threeAxleVehicles.gif"
				break;
		case 4: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_on.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/fourAxleVehicles.gif"
				break;
		case 5: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_on.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/fiveAxleVehicles.gif"
				break;
		case 6: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_on.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/sixAxleVehicles.gif"
				break;
		case 7: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_on.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/sevenAxleVehicles.gif"
				break;
		case 8: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_on.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/eightAxleVehicles.gif"
				break;
		case 10: 
				document.form1.calculateToll.src = "./images/calculate_on.gif"
				break;
		case 11: 
				document.form1.resetSession.src = "./images/reset_on.gif"
				break;
		case 12: 
				document.form1.calculateToll.src = "./images/calculate_off.gif"
				break;
		case 13: 
				document.form1.resetSession.src = "./images/reset_off.gif"
				break;
		case 14: 
				document.form1.mainline.src = "./images/mainline_on.gif"
				document.form1.beeline.src = "./images/beeline_off.gif"
				document.form1.sawgrass.src = "./images/sawgrass_off.gif"
				document.form1.heft.src = "./images/heft_off.gif"
				document.form1.spur.src = "./images/spur_off.gif"
				document.form1.polk.src = "./images/polk_off.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 15:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_on.gif"
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif"
				document.form1.spur.src = "./images/spur_off.gif"
				document.form1.polk.src = "./images/polk_off.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 16:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_on.gif"
				document.form1.heft.src = "./images/heft_off.gif"
				document.form1.spur.src = "./images/spur_off.gif"
				document.form1.polk.src = "./images/polk_off.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 17:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_on.gif"
				document.form1.spur.src = "./images/spur_off.gif"
				document.form1.polk.src = "./images/polk_off.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 18:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_on.gif"
				document.form1.polk.src = "./images/polk_off.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 19:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_on.gif"
				document.form1.seminole.src = "./images/seminole_off.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 20:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_on.gif"
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 21:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_off.gif" 
				document.form1.veterans.src = "./images/veterans_on.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 22:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_off.gif" 
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_on.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 23:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_off.gif" 
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_on.gif"
				document.form1.alligator.src = "./images/alligator_off.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 24:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_off.gif" 
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif" 
				document.form1.alligator.src = "./images/alligator_on.gif"
				document.form1.crosstown.src = "./images/crosstown_off.gif"
				break;
		case 25:
				document.form1.mainline.src = "./images/mainline_off.gif" 
				document.form1.beeline.src = "./images/beeline_off.gif" 
				document.form1.sawgrass.src = "./images/sawgrass_off.gif" 
				document.form1.heft.src = "./images/heft_off.gif" 
				document.form1.spur.src = "./images/spur_off.gif" 
				document.form1.polk.src = "./images/polk_off.gif" 
				document.form1.seminole.src = "./images/seminole_off.gif" 
				document.form1.veterans.src = "./images/veterans_off.gif"
				document.form1.suncoast.src = "./images/suncoast_off.gif"
				document.form1.sconn.src = "./images/southernConn_off.gif" 
				document.form1.alligator.src = "./images/alligator_off.gif" 
				document.form1.crosstown.src = "./images/crosstown_on.gif"
				break;
		case 26:
				document.form1.exitsToll.src = "./images/exits_on.gif"
				document.form1.bridgesToll.src = "./images/bridges_off.gif"
				break;
		case 27: 
				document.form1.exitsToll.src = "./images/exits_off.gif"
				document.form1.bridgesToll.src = "./images/bridges_on.gif"
				break;
		case 28: 
				document.form1.startExitUp.src = "./images/arrow_up_on.gif"
				document.form1.startExitDown.src = "./images/arrow_down.gif"
				break;
		case 29: 
				document.form1.startExitUp.src = "./images/arrow_up.gif"
				document.form1.startExitDown.src = "./images/arrow_down_on.gif"
				break;
		case 30: 
				document.form1.endExitUp.src = "./images/arrow_up_on.gif"
				document.form1.endExitDown.src = "./images/arrow_down.gif"
				break;
		case 31: 
				document.form1.endExitUp.src = "./images/arrow_up.gif"
				document.form1.endExitDown.src = "./images/arrow_down_on.gif"
				break;
		case 32: 
				document.form1.endExitUp.src = "./images/arrow_up.gif"
				document.form1.endExitDown.src = "./images/arrow_down.gif"
				document.form1.startExitUp.src = "./images/arrow_up.gif"
				document.form1.startExitDown.src = "./images/arrow_down.gif"
				break;
		case 33: 
				document.form1.sunpassToll.src = "./images/SunPass_Toll_on.gif"
				break;
		case 34: 
				document.form1.cashToll.src = "./images/Cash_Toll_on.gif"
				break;
		case 35: 
				document.form1.resetSession.src = "./images/Reset_Toll_on.gif"
				break;
		case 36: 
				document.form1.sunpassToll.src = "./images/SunPass_Toll_off.gif"
				break;
		case 37: 
				document.form1.cashToll.src = "./images/Cash_Toll_off.gif"
				break;
		case 38: 
				document.form1.resetSession.src = "./images/Reset_Toll_off.gif"
				break;
	}
	//calculateToll();
}
	
function setAxleParams(axles) {
	switch (axles) {
		case 2: 
				document.form1.vehicle2axle.src = "./images/button2axle_on.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/twoAxleVehicles.gif"
				break;
		case 3: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_on.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/threeAxleVehicles.gif"
				break;
		case 4: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_on.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/fourAxleVehicles.gif"
				break;
		case 5: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_on.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/fiveAxleVehicles.gif"
				break;
		case 6: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_on.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/sixAxleVehicles.gif"
				break;
		case 7: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_on.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_off.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/sevenAxleVehicles.gif"
				break;
		case 8: 
				document.form1.vehicle2axle.src = "./images/button2axle_off.gif"
				document.form1.vehicle3axle.src = "./images/button3axle_off.gif"
				document.form1.vehicle4axle.src = "./images/button4axle_off.gif"
				document.form1.vehicle5axle.src = "./images/button5axle_off.gif"
				document.form1.vehicle6axle.src = "./images/button6axle_off.gif"
				document.form1.vehicle7axle.src = "./images/button7axle_off.gif"
				document.form1.vehicle8axle.src = "./images/button8axle_on.gif"
				
				document.form1.vehicleSample.src = "./images/Transportation jpegs/eightAxleVehicles.gif"
				break;
	}

}