// Find buses between start and destination stop
// Parameters: s - startstopnameid to d - deststopnameid
//
var dBugLvl = 3;
var WALKDIST = 1000; // Find stops within 1 km radius
var NEARLATLON = 0.01;
var CHECKSTOPS = 40;
var SHOWMAXSTOPS = 5;
var MAXBUSESTOSHOW = 4;
var MAXRECENTBUSESFOUND = 7;
var stopLines;
var stopBusLines;
var busMaster;
var oStartStop, oDestStop; // The stopbus info for start and dest
var startStopArea, destStopArea;
var arBusesFound = [];
var sAr, dAr; // Array of stops near start and destination
/*
$(document).ready(function() {
// var XMLFileSupport = CheckXMLHttpFile();
busesfoundinit();
return;
});
*/
function busesfoundinit() {
scrollTo(0, 0);
s = gup('s');
d = gup('d');
if(s === "" && d === "") {
s = getCookie('cStartStopNameId');
d = getCookie('cDestStopNameId');
}
if(d === "") {
alert('No Buses Found as yet. Select from the Find Bus tab');
window.location.href = "index.html";
return;
}
startStopNameId = s;
destStopNameId = d;
dBug('', ' s = ' + s + ', d = ' + d, 5);
stopBusLines = getStopBusList();
busMaster = getbusmaster();
var sStopSs = findStopId(startStopNameId).stopsrchstr;
var dStopSs = findStopId(destStopNameId).stopsrchstr;
var htmlTitle = sStopSs.stopsrchstr + '
' + dStopSs;
var dirHdr = "
Stop name | Buses (frequency) |
---|
Direct Buses (" + // nDirectBuses + ") | " + sDirectBuses + " | |
Direct Buses (" + nDirectBuses + ") | " + sDirectBuses + " | |
To ' + destSearchStr + // ' (' + nNearBuses + ') | ' + sBuses + ' | |
From : ' + startSearchStr + // ' (' + nNearBuses + ') | ' + sBuses + ' | |
' + (arNearBuses[x][1] !== "" ? 'From: ' + arNearBuses[x][1] : ""); sNearBuses = sNearBuses + (arNearBuses[x][2] !== "" ? ' To: ' + arNearBuses[x][2] : "") + ' (' + arNearBuses[x][4] + ') - ' + distFormat(arNearBuses[x][0]) + ' | ' + arNearBuses[x][3] + ' |
Stop name | Buses | |
---|---|---|
From stops near you: | " + arBestDist[y][1] + " (" + distFormat(arBestDist[y][4]) + ") | " + arBestDist[y][2] + " | " + arBestDist[y][3] + " | ";
nStops++;
dBug('conxions', arBestDist[y][1] + " (" + distFormat(arBestDist[y][4]), 5);
if(nStops > MAXROUTES)
break;
}
}
if (!nStops) {
for(x=0; x" + commonStops[x][1] + ") | "
+ commonStops[x][2] + " | " + commonStops[x][3] + " | ";
}
}
htmHdr = " | Connecting Stop | Buses from start | Buses to Destination | ' + stopInfo.searchstr + ' (' + distFormat(sAr[x][0]) + ') | ';
rHTML = rHTML + sBus + ' | ' + recentBusesFound[i].busHtml + ' '; recentBusesFoundStr = recentBusesFoundStr + elm; } } recentBusesFoundStr = recentBusesFoundStr + ' |