var eB=null;var hS=null;var iW=null;var fy=true;var iG=null;function aZ(top,right){this.eG=document.createElement('div');this.eG.style.top=top;this.eG.style.right=right;jc=document.createElement('div');jc.style.color="black";jc.style.backgroundColor="white";jc.style.font="9px Arial";jc.style.border="1px solid black";jc.style.padding="2px";jc.style.marginBottom="3px";jc.style.textAlign="center";jc.style.width="9em";jc.style.cursor="pointer";jc.innerHTML="<nobr>Show Controls <img src='"+eY+"' align='middle'></nobr>";jc.onclick=ax;this.eG.appendChild(jc);};aZ.prototype.getContainer=function(){return this.eG;};function ax(){if(gC.style.display=="none"){if(supervisor&&fy){eB.innerHTML+="<br /><input type='checkbox' name='largeIcon' value='largeIcon' "+"onclick='ay()' checked>Details";ay();eB.innerHTML+="<br /><input type='checkbox' name='nonRevenue' value='nonRevenue' "+"onclick='return aJ();'><nobr>Other</nobr>";eB.innerHTML+="<br /><input type='checkbox' name='allBuses' value='allBuses' "+"onclick='az()'><nobr>All Buses</nobr>";fy=false;}gC.style.display="inline";jc.innerHTML="<nobr>Hide Controls <img src='"+eZ+"' align='middle'></nobr>";}else{gC.style.display="none";jc.innerHTML="<nobr>Show Controls <img src='"+eY+"' align='middle'></nobr>";}};function ba(top,right){gC=document.createElement('div');gC.style.top=top;gC.style.right=right;gC.style.display="none";hS=L();hS.innerHTML="Routes";hS.onclick=ce;iW=L();iW.innerHTML="Find Stop";iW.onclick=aW;eB=L();eB.style.textAlign="left";eB.innerHTML="<input type='checkbox' name='stops' value='stops' checked "+"onclick='return aK();'>Stops";eB.innerHTML+="<br /><input type='checkbox' name='buses' value='buses' checked "+"onclick='return aF();'>Buses";fd=L();fd.style.display="none";fd.innerHTML="";gC.appendChild(hS);gC.appendChild(iW);gC.appendChild(eB);gC.appendChild(fd);};function L(){var eO=document.createElement('div');eO.style.color="black";eO.style.backgroundColor="white";eO.style.font="12px Arial";eO.style.border="1px solid black";eO.style.padding="2px";eO.style.marginBottom="3px";eO.style.textAlign="center";eO.style.width="6em";eO.style.cursor="pointer";return eO;};ba.prototype.getContainer=function(){return gC;};function bc(top,left){var text="<b>Please select a route ("+gU+" maximum)</b>";iz=ag(this,50,200,300,320,text);iy=this.eG;};function aX(top,left){var text="<b>Please select a route</b>";iF=ag(this,50,200,300,320,text);iC=this.eG;};function bb(top,left){var text="<b>Please select a direction</b>";iE=ag(this,50,200,100,320,text);iB=this.eG;};function bd(top,left){var text="<b>Please select a stop</b>";iD=ag(this,50,200,300,320,text);iA=this.eG;};bc.prototype.getContainer=function(){return this.eG;};aX.prototype.getContainer=function(){return this.eG;};bb.prototype.getContainer=function(){return this.eG;};bd.prototype.getContainer=function(){return this.eG;};function ag(fu,top,left,height,width,text){fu.eG=document.createElement('div');fu.eG.style.border=2+"px "+"solid"+" "+"black";fu.eG.style.position="absolute";fu.eG.style.zIndex=200;fu.eG.style.backgroundColor="white";fu.eG.style.top=top+"px";fu.eG.style.left=left+"px";fu.eG.style.width=width+"px";if(BrowserDetect.browser=="Opera"){height+=10;}if(!aT()){fu.eG.style.height=height+"px";}fu.eG.style.display="none";var eC=document.createElement('div');eC.style.color="black";eC.style.backgroundColor="white";eC.style.display="none";eC.style.margin="5px";eC.innerHTML=text;return eC;};function aw(){fd.innerHTML="";var hY=0;if(!cY){hk=0;for(var i=0;i<er.length;i++){if(er[i].visible&&er[i].id!=0){if(er[i].eu[0]!=null){
//@1
var hf=parseInt((er[i].eu[0].length)/2);fd.innerHTML+="<div style='margin-top:1px; margin-bottom:1px;'><span onclick='setCenter("+er[i].eu[0][hf].fF.lat()+", "+er[i].eu[0][hf].fF.lng()+");'>"+"<div style='margin-top:1px; text-align:right; float:left; width:54%'>"+er[i].id+"&nbsp;&nbsp;</div>"+"<div style='margin-top:1px; text-align:left; float:left; width:12%; background-color: "+er[i].color+";'>"+"&nbsp;&nbsp;</div><div style='text-align:right; float:left; width:12%;')&nbsp;</div></span>"+"<div style='text-align:left; float:left; width:22%;'  onclick='"+"bZ(\""+er[i].id+"\");'>"+(er[i].cI.length==0?"&nbsp;":"&nbsp;*")+"</div></div><br/>";hY++;}}}}if(fd.innerHTML==""){fd.style.display="none";}else{fd.style.display="block";if(BrowserDetect.browser=="Safari"||(BrowserDetect.browser=="Opera"&&BrowserDetect.OS=="Mac")){fd.style.height=(hY*15)+"px";}else if(BrowserDetect.browser=="Opera"){fd.style.height=((hY*15)+5)+"px";}}};function setCenter(cG,cF){map.setCenter(new GLatLng(cG,cF));};function H(){if(gK==null){gK=document.createElement('div');gK.style.top="20px";gK.style.left="400px";var gI=document.createElement('div');gI.style.backgroundColor="white";gI.style.border="1px solid black";gI.style.padding="2px";gI.style.marginBottom="3px";gI.style.textAlign="center";gI.style.width="6em";gI.style.cursor="pointer";gI.innerHTML="<img src='"+gO+"'>";gK.appendChild(gI);}ez=new ah();map.addControl(ez);};function t(){if(gK!=null){map.removeControl(ez);gK=null;}};function A(fm){if(jl==null){jl=document.createElement('div');jl.style.top="20px";jl.style.left="150px";var jm=document.createElement('div');jm.style.backgroundColor="white";jm.style.border="1px solid black";jm.style.padding="2px";jm.style.marginBottom="3px";jm.style.textAlign="center";jm.style.width="10em";//@6
if(fh!=null){jm.innerHTML=fm+"<br>Last update time: "+fh;}jl.appendChild(jm);}ey=new ak();map.addControl(ey);};function I(){if(jl!=null){map.removeControl(ey);jl=null;}};function ay(){gu= !gu;if(!cY){g();for(var i=0;i<er.length;i++){if(er[i].dw){G(er[i]);er[i].dw=true;}}fv=0;jH=window.setTimeout("o()",500);}else{window.clearTimeout(da);H();O();}};function aJ(){if(!cY){gY= !gY;var ec=v("0");if(ec==null){ec=new B("0");ec.jy="0";ec.ea="0";ec.name="0";ec.description="0";ec.cI=new Array();ec.cN=0;ec.color="white";ec.lineWidth=0;ec.opacity=100.0;ec.ja=new Array();ec.et=new Array();ec.eu=new Array();ec.visible=true;ec.eh=false;ec.dw=true;ec.jt=null;ec.cQ=new Array();ec.fc=new Array();ec.googlePolylineArray=new Array();ec.fH=new Array();ec.fI=new Array();er.push(ec);}if(gY){ec.dw=true;hD.push("0");g();fv=0;jH=window.setTimeout("o()",500);}else{for(var i=0;i<hD.length;i++){if(hD[i]=="0"){hD.splice(i,1);break;}}ec.dw=false;G(ec);}return true;}else{return false;}};function az(){cY= !cY;if(cY){g();eB.innerHTML="<input type='checkbox' name='largeIcon' value='largeIcon' "+"onclick='ay()' "+(gu?"checked":"")+">Details";eB.innerHTML+="<br /><input type='checkbox' name='allBuses' value='allBuses' "+"onclick='az()' checked><nobr>All Buses</nobr>";hS.style.display="none";iW.style.display="none";for(var i=0;i<er.length;i++){if(er[i].visible==true){T(er[i].jy,false);er[i].visible=true;er[i].dw=true;}}H();O();}else{window.clearTimeout(da);eB.innerHTML="<input type='checkbox' name='stops' value='stops'  "+
//@5
"onclick='return aK();' "+(fb?"checked":"")+">Stops";eB.innerHTML+="<br /><input type='checkbox' name='buses' value='buses'  "+
//@5
"onclick='return aF();' "+(fe?"checked":"")+">Buses";eB.innerHTML+="<br /><input type='checkbox' name='largeIcon' value='largeIcon' "+"onclick='ay()' "+(gu?"checked":"")+">Details";eB.innerHTML+="<br /><input type='checkbox' name='nonRevenue' value='nonRevenue' "+"onclick='return aJ();' "+(gY?"checked":"")+"><nobr>Other</nobr>";eB.innerHTML+="<br /><input type='checkbox' name='allBuses' value='allBuses' "+"onclick='az()'><nobr>All Buses</nobr>";H();aD();hS.style.display="block";iW.style.display="block";for(var i=0;i<hD.length;i++){T(hD[i],true);}g();jH=window.setTimeout("o()",500);t();}};function aF(){if(!cY){if(!fe){fe=true;for(var i=0;i<er.length;i++){er[i].dw=true;}g();fv=0;jH=window.setTimeout("o()",500);}else{g();fe=false;map.closeInfoWindow();fl.totalBuses=null;for(var i=0;i<er.length;i++){G(er[i]);}}return true;}else{return false;}};function aK(){if(!cY){if(fb){fb=false;jd=0;al(0,-1);//@3
//@4
}else{fb=true;jd=ic;al(-1,map.getZoom());}return true;}else{return false;}};function al(fz,fw){if((aS<jd||fz== -1)&&fw>=jd){if(fb){for(var i=0;i<er.length;i++){if(er[i].visible==true&&(er[i].eh==false||fz== -1)){bl(er[i]);er[i].eh=true;}}}}else if(aS>=jd&&fw<jd){for(var i=0;i<er.length;i++){if(er[i].visible==true&&er[i].eh==true){cp(er[i]);er[i].eh=false;}}}if((aS<gS&&fw>=gS)||(aS>=gS&&fw<gS)){g();for(var i=0;i<er.length;i++){if(er[i].dw){G(er[i]);er[i].dw=true;}}fv=0;jH=window.setTimeout("o()",500);}else if(aS>fw){aI();}if(aS<dh&&fw>=dh){for(var i=0;i<er.length;i++){bx(er[i]);}}if(aS>=dh&&fw<dh){for(var i=0;i<er.length;i++){bF(er[i]);}}aS=fw;//@4
if(fw!= -1){ao(fo,aS,365);}};function aI(){H();var fG=map.getBounds();if(!cY){for(var i=0;i<er.length;i++){if(er[i].visible==true&&er[i].dw==true){for(var ga=0;ga<er[i].ja.length;ga++){var cB=er[i].ja[ga];if(cB.visible==false&&fG.containsLatLng(cB.fF)){if(cB.marker==null){cB.ft();}else{cB.redraw();cB.marker.show();cB.label.show();}}}}}}else{for(var i=0;i<cU.length;i++){var cB=cU[i];if(cB.visible==false&&fG.containsLatLng(cB.fF)){cB.ft();}}}t();};function at(text){var jD=document.createElement("div");var jE=document.createTextNode(text);jD.appendChild(jE);return jD;};function bz(){am(this,true);};function bs(){iG=this.route;for(var i=0;i<hD.length;i++){if(this.route==hD[i]){iG=null;break;}}if(iG!=null&&hD.length<gU){if(hJ!=null&&hJ.hasChildNodes()){var children=hJ.childNodes;for(var i=0;i<children.length;i++){if(children[i].route==this.route){children[i].style.backgroundColor="silver";}}}}am(this,false);};function aN(){if(iG!=null){var fu=null;if(hJ!=null&&hJ.hasChildNodes()){var children=hJ.childNodes;for(var i=0;i<children.length;i++){if(children[i].route==iG){fu=children[i];am(fu,true);break;}}}}iG=null;};function am(fu,gd){var text=fu.firstChild.data;var jx="";if(text.indexOf(" - ")== -1){jx=text;}else{jx=text.substring(0,text.indexOf(" - "));}var gp=false;for(var i=0;i<hD.length;i++){if(jx==hD[i]){gp=true;if(gd){fu.style.backgroundColor="white";hD.splice(i,1);}break;}}if(!gp){if(hD.length-(gY?1:0)>=gU){alert("You may only display "+gU+" bus routes at a time.\n\nIn order to display a new route, please remove a route currently displayed on the map.");iG=null;return;}hD.push(jx);if(gd){fu.style.backgroundColor="silver";}else{gc=true;}}else{if(!gd){R(jx);return;}}if(hD.length==0){au();}else{ao(fn,hD.join(","),365);}T(jx,!gp);g();fv=0;jH=window.setTimeout("o()",500);};function bv(){var direction=this.firstChild.data;bY(this.route,this.direction);};function by(){var es=v(this.route);ck(es,this.gL);iD.style.display="none";iA.style.display="none";jL=false;};function ce(){map.disableScrollWheelZoom();if(!cY){t();if(hJ==null){iy.appendChild(iz);hJ=bg(true);iy.appendChild(hJ);var eO=aa("Done");eO=jS(eO);iy.appendChild(eO);}iz.style.display="inline";iy.style.display="inline";jL=true;iF.style.display="none";iC.style.display="none";iE.style.display="none";iB.style.display="none";iD.style.display="none";iA.style.display="none";if(hH!=null){map.removeControl(ew);hH=null;eS=null;}}};function aW(){map.disableScrollWheelZoom();if(!cY){t();if(iL==null){iC.appendChild(iF);iL=bg(false);iC.appendChild(iL);iC.appendChild(aa("Cancel"));}iz.style.display="none";iy.style.display="none";iF.style.display="inline";iC.style.display="inline";iE.style.display="none";iB.style.display="none";iD.style.display="none";iA.style.display="none";jL=true;if(hH!=null){map.removeControl(ew);hH=null;eS=null;}}};function R(route){iE.innerHTML="<b>Please select a direction for route "+route+"</b>";if(iM!=null){while(iB.firstChild){iB.removeChild(iB.firstChild);}}iB.appendChild(iE);iM=cx(route);iB.appendChild(iM);var eO=aa("Cancel");eO=bi(eO,route," ");iB.appendChild(eO);iF.style.display="none";iC.style.display="none";iE.style.display="inline";iB.style.display="inline";iD.style.display="none";iA.style.display="none";};function bY(route,direction){iD.innerHTML="<b>Please select a stop for route "+route+"</b>";if(iK!=null){while(iA.firstChild){iA.removeChild(iA.firstChild);}}iA.appendChild(iD);iK=bk(route,direction);iA.appendChild(iK);var eO=aa("Cancel");eO=bi(eO,route,direction);iA.appendChild(eO);iF.style.display="none";iC.style.display="none";iE.style.display="none";iB.style.display="none";iD.style.display="inline";iA.style.display="inline";};function bg(gd){var eH=ar("300px","240px");for(var i=0;i<ei.length;i++){var textForNode=ei[i].av;if(ei[i].name!=""){textForNode+=" - "+ei[i].name}var ju=at(textForNode);ju.style.font="12px Arial";ju.route=ei[i].av;if(gd){ju.onclick=bz;var jx=ei[i].av;for(var ga=0;ga<hD.length;ga++){if(jx==hD[ga]){ju.style.backgroundColor="silver";break;}}}else{ju.onclick=bs;}eH.appendChild(ju);}return eH;};function cx(hC){var eH=ar("300px","40px");var es=v(hC);//@2 The display direction and the direction must be sorted together so that if the user picks a display direction
;var directionArray=new Array();for(var i=0;i<es.fc.length;i++){directionArray.push(new CDBusRouteDirection(es.fc[i],es.directionsDisplay[i]));}directionArray.sort(sortDirections);for(var i=0;i<directionArray.length;i++){
//@2
var ju=at(directionArray[i].directionDisplay);//@2
ju.style.font="12px Arial";ju.route=hC;ju.direction=directionArray[i].direction;//@2
eH.appendChild(ju);ju.onclick=bv;}return eH;}
//@2 Direction object used for sorting
function CDBusRouteDirection(direction,directionDisplay){this.direction=direction;this.directionDisplay=directionDisplay;}
//@2 The method used to sort the direction object
function sortDirections(arg1,arg2){if(arg1.directionDisplay<arg2.directionDisplay){return-1;}if(arg1.directionDisplay>arg2.directionDisplay){return+1;}return 0;};function bk(hC,fr){var eH=ar("300px","240px");var es=v(hC);for(var i=0;i<es.et.length;i++){if(es.et[i].direction==fr){var ju=at(es.et[i].cE);ju.style.font="12px Arial";ju.gL=i;ju.route=hC;eH.appendChild(ju);ju.onclick=by;}}return eH;};function aT(){bj=navigator.userAgent;if(null==bj.match(/Mobile/i)){return false;}else{return true;}};function ar(width,height){var eH=document.createElement("div");eH.style.cursor="pointer";eH.style.overflow="auto";eH.style.backgroundColor="white";eH.style.width=width;if(!aT()){eH.style.height=height;}eH.style.border="1px solid black";eH.style.margin="5px";return eH;};function aa(text){var eO=document.createElement('div');eO.style.color="black";eO.style.backgroundColor="white";eO.style.margin="5px";if(text=="Cancel"){eO.innerHTML="<input type='button' value='"+text+"' onClick='bB()'>";}else{eO.innerHTML="<input type='button' value='"+text+"' onClick='aV()'>";}return eO;};function aV(){iF.style.display="none";iC.style.display="none";iz.style.display="none";iy.style.display="none";iE.style.display="none";iB.style.display="none";iD.style.display="none";iA.style.display="none";jL=false;g();fv=0;jH=window.setTimeout("o()",2000);map.enableScrollWheelZoom();};function bB(){aV();aN();map.enableScrollWheelZoom();};function bi(eO,route,direction){var text=eO.innerHTML;text="<input type='button' value='Back' onClick='cy(\""+route+"\", \""+direction+"\")'>&nbsp;&nbsp;&nbsp;"+text;eO.innerHTML=text;return eO;};function jS(eO){var text=eO.innerHTML;text+="&nbsp;&nbsp;&nbsp;<input type='button' value='Remove All' onClick='jT()'>";eO.innerHTML=text;return eO;};function cy(route,direction){if(direction==" "){aN();aW();}else{R(route);}};function jT(){var childNodes=hJ.childNodes;for(var i=0;i<childNodes.length;i++){if(childNodes[i].style.backgroundColor=="silver"){am(childNodes[i],true);}}};function T(hC,gq){var ec=v(hC);if(gq){H();if(ec==null){bT(hC);}else{t();ec.dw=true;ec.show();g();fv=0;jH=window.setTimeout("o()",500);aw();fW.push(hC);if(fX&&fl.type=="stop"){M(hC);}K();if(gc){gc=false;R(ec.id);}}}else{if(ec!=null){ec.hide();ec.dw=false;G(ec);if(fX&&fY==ec.id){map.closeInfoWindow();fl.totalBuses=null;}else{for(var i=0;i<fW.length;i++){if(ec.id==fW[i]){if(fW.length==1){fW=new Array();fl.style.visibility="hidden";}else{M(ec.id);}i=fW.length;}}}aw();t();K();}}};function aj(top,right){this.top=top;this.right=right;};aj.prototype=new GControl(true,false);aj.prototype.initialize=function(map){this.gB=new ba(this.top+"px",this.right+"px");map.getContainer().appendChild(gC);return gC;};aj.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(this.right,this.top));};function ad(top,right){this.top=top;this.right=right;};ad.prototype=new GControl(true,false);ad.prototype.initialize=function(map){this.gB=new aZ(this.top+"px",this.right+"px");map.getContainer().appendChild(this.gB.eG);return this.gB.eG;};ad.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(this.right,this.top));};function ab(top,left){this.top=top;this.left=left;};ab.prototype=new GControl(true,false);ab.prototype.initialize=function(map){this.gB=new bc(this.top+"px",this.left+"px");map.getContainer().appendChild(this.gB.eG);return this.gB.eG;};ab.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(this.left,this.top));};function af(top,left){this.top=top;this.left=left;};af.prototype=new GControl(true,false);af.prototype.initialize=function(map){this.gB=new aX(this.top+"px",this.left+"px");map.getContainer().appendChild(this.gB.eG);return this.gB.eG;};af.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(this.left,this.top));};function ai(top,left){this.top=top;this.left=left;};ai.prototype=new GControl(true,false);ai.prototype.initialize=function(map){this.gB=new bb(this.top+"px",this.left+"px");map.getContainer().appendChild(this.gB.eG);return this.gB.eG;};ai.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(this.left,this.top));};function ac(top,left){this.top=top;this.left=left;};ac.prototype=new GControl(true,false);ac.prototype.initialize=function(map){this.gB=new bd(this.top+"px",this.left+"px");map.getContainer().appendChild(this.gB.eG);return this.gB.eG;};ac.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(this.left,this.top));};function ah(){};ah.prototype=new GControl(true,false);ah.prototype.initialize=function(map){map.getContainer().appendChild(gK);return gK;};ah.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(400,20));};function ak(){};ak.prototype=new GControl(true,false);ak.prototype.initialize=function(map){map.getContainer().appendChild(jl);return jl;};ak.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(150,20));};function ae(){};ae.prototype=new GControl(true,false);ae.prototype.initialize=function(map){map.getContainer().appendChild(hH);return hH;};ae.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(30,0));}
