if(window.console==undefined||window.console.log==undefined){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i){window.console[names[i]]=function(){}}}var trimet={namespace:function(D,C){D=(typeof D=="string")?[D]:D;C=C||window;var A=D.length;for(var B=0;B<A;++B){var F=D[B].split(".");var E=F.shift();if(typeof C[E]=="undefined"){C[E]={}}if(F.length>0){trimet.namespace([F.join(".")],C[E])}}},defaultMethod:function(){console.log("NOTE: you're calling a trimet.defaultMethod() - please make sure all logic is implemented.")},CLASS_NAME:"trimet"};trimet.Class=function(){var D=function(){this.initialize.apply(this,arguments)};var C={};var F;var B;var A=arguments.length;for(var E=0;E<A;++E){if(typeof arguments[E]=="function"){if(E==0&&A>1){B=arguments[E].prototype.initialize;arguments[E].prototype.initialize=function(){};C=new arguments[E];arguments[E].prototype.initialize=B}F=arguments[E].prototype}else{F=arguments[E]}trimet.extend(C,F)}D.prototype=C;return D};trimet.extend=function(A,E){A=A||{};if(E){for(var D in E){var C=E[D];if(C!==undefined){A[D]=C}}var B=typeof window.Event=="function"&&E instanceof window.Event;if(!B&&E.hasOwnProperty&&E.hasOwnProperty("toString")){A.toString=E.toString}}return A};trimet.override=function(A,C){A=A||{};if(C){for(var B in C){var E=C[B];var D=A[B];if(E!==undefined&&D!==undefined){this._copyProp(B,A,E)}}}return A};trimet.inherit=function(A,D){A=A||{};if(D){for(var C in D){var F=D[C];var E=A[C];if(F!==undefined&&E==null){this._copyProp(C,A,F)}}var B=typeof window.Event=="function"&&D instanceof window.Event;if(!B&&D.hasOwnProperty&&D.hasOwnProperty("toString")){A.toString=D.toString}}return A};trimet.configure=function(A,G,C){A=A||{};if(G){for(var F in G){if(F=="CLASS_NAME"){continue}var E=G[F];var D=A[F];if(E!=null&&E.call==null&&E.apply==null&&(D!==undefined||C==true)){A[F]=E}if(E==null&&C==true){A[F]=E}}var B=typeof window.Event=="function"&&G instanceof window.Event;if(!B&&G.hasOwnProperty&&G.hasOwnProperty("toString")){A.toString=G.toString}}return A};trimet.clone=function(D){if(D==null||typeof (D)!="object"){return D}var B=B||{};var A=new D.constructor();B[D]=A;for(var C in D){if(B[D[C]]){A[C]=B[D[C]]}else{A[C]=trimet.clone(D[C],B);B[D[C]]=A[C]}}return A};trimet._copyProp=function(C,A,B){if(C=="CLASS_NAME"||C=="CLAZZ_NAME"){var D="";if(A.CLASS_INHERITANCE==null){A.CLASS_INHERITANCE=""}else{D=";"}A.CLASS_INHERITANCE+=D+B}else{A[C]=B}};trimet.namespace("trimet.utils");trimet.utils.URL={solrSelect:"/solr/select",solrRoutes:"/solr/select?q=type:Route&sort=sort_order%20asc&rows=200&wt=json",solrTC:"/solr/select?q=type:Transit*Center&sort=city%20asc&rows=200&wt=json",solrPR:"/solr/select?q=type:Park*Ride&sort=city%20asc&rows=200&wt=json",solrZipcar:"/solr/select?q=type:Zipcar&sort=city%20asc&rows=500&wt=json",landmark:"/eapi/ws/V1/landmark/format/json",vehicles:"/rt/ws/V1/vehicles/appID/8EB2B259743166EF7569C6C78/",configure:"/trimet.org/map/configure.json",planner:"/maps/tpws/V1/tripplanner/appID/8EB2B259743166EF7569C6C78/format/xml",plannerPrint:"/maps/print/V1/tripplanner/appID/8EB2B259743166EF7569C6C78/format/xml",plannerGEO:"/ttws/transweb/ws/V1/BlockGeoWS/appID/8EB2B259743166EF7569C6C78/",maps:"http://maps.trimet.org/tilecache/tilecache.py?",eAPI:"http://maps.trimet.org/eAPI/",wfs:"/wfs",localWMS:"/wms",cachedWMS:"/wms/reflect",wms:"http://maps.trimet.org/wms",wmsCached:"http://maps.trimet.org/wms/reflect",wmsTest:"http://maps5.trimet.org/wms",wmsCacheTest:"http://maps5.trimet.org/wms/reflect",tcLocal:"/tilecache/tilecache.py?",tcTest:"http://maps5.trimet.org/tilecache/tilecache.py?",tileA:"http://tilea.trimet.org/tilecache/tilecache.py?",tileB:"http://tileb.trimet.org/tilecache/tilecache.py?",tileC:"http://tilec.trimet.org/tilecache/tilecache.py?",tileD:"http://tiled.trimet.org/tilecache/tilecache.py?",wmsA:"http://wmsa.trimet.org/wms/reflect",wmsB:"http://wmsb.trimet.org/wms/reflect",wmsC:"http://wmsc.trimet.org/wms/reflect",wmsD:"http://wmsd.trimet.org/wms/reflect",CLASS_NAME:"trimet.utils.URL"};trimet.namespace("trimet.utils");trimet.utils.Constants={VERSION:"3.5",SRS_NAME:"EPSG:2913",TP_COOKIE_NAME:"tripplanner",TP_COOKIE_VALUE:"map",birdsEyeView:function(B){var A="Birds Eye View";try{A=B.locale.labels.birdsEyeViewText}catch(D){A=trimet.locale.English.labels.birdsEyeViewText}var C='<a target="_blank" href="/maps/ve.html?lat={lat}&lon={lon}&title={[escape(values.name)]}&description={[escape(values.city)]}">'+A+"</a>";return C},tileServers:[trimet.utils.URL.tileA,trimet.utils.URL.tileB,trimet.utils.URL.tileC,trimet.utils.URL.tileD],wmsServers:[trimet.utils.URL.wmsA,trimet.utils.URL.wmsB,trimet.utils.URL.wmsC,trimet.utils.URL.wmsD],tileTestServers:[trimet.utils.URL.tcTest],wmsTestServers:[trimet.utils.URL.wmsTest],CLASS_NAME:"trimet.utils.Constants"};trimet.namespace("trimet.utils");trimet.utils.StringUtils={format:function(template,context,args){var retVal="";if(!context){context=window}var tokens=template.split("${");var item,last,replacement;for(var i=1,len=tokens.length;i<len;i++){item=tokens[i];last=item.indexOf("}");if(last>0){replacement=context[item.substring(0,last)];if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement()}tokens[i]=replacement+item.substring(++last)}else{tokens[i]="${"+item}}retVal=tokens.join("");if(retVal.contains("$[")){tokens=retVal.split("$[");for(var i=1,len=tokens.length;i<len;i++){item=tokens[i];last=item.indexOf("]");try{var meth=item.substring(0,last);tokens[i]=eval(meth)}catch(e){}tokens[i]+=item.substring(++last)}retVal=tokens.join("")}if(retVal.contains("#[")){tokens=retVal.split("#[");for(var i=1,len=tokens.length;i<len;i++){item=tokens[i];last=item.indexOf("]");try{var clause=item.substring(0,last);var tks=clause.split(";;");tokens[i]=trimet.utils.StringUtils.returnStringIfExists(tks[0],tks[1])}catch(e){}tokens[i]+=item.substring(++last)}retVal=tokens.join("")}if(retVal.contains("%[")){tokens=retVal.split("%[");for(var i=1,len=tokens.length;i<len;i++){item=tokens[i];last=item.indexOf("]");try{var clause=item.substring(0,last);var tks=clause.split(";;");var tmp=tks[0].replace(tks[1],tks[2]);tokens[i]=tmp}catch(e){}tokens[i]+=item.substring(++last)}retVal=tokens.join("")}return retVal},startsWith:function(B,A){return((B.substring(0,A.length)==A)?true:false)},endsWith:function(B,A){return((B.substring(B.length-A.length)==A)?true:false)},returnStringIfExists:function(A,B){var C="";if(A!=null&&A!="null"&&A!=""){C=B}return C},getStringFromObject:function(C,F,B){var E="";for(var A in C){var D=C[A];if(D==null){continue}if(A.match(F)){E+=D;if(B!==null){E+=B}}}return E},getSubString:function(G,A,C){var F=G;var A=(A==null)?1:A;var C=(C==null)?" ":C;try{var E=G.split(C);for(var B=A-1;B>=0;B--){F=E[B];if(F!=null&&F.length>0){break}}if(F==null){F=G}}catch(D){}return F},arraysToStrings:function(E,D,A){var G=[];var C=0;if(D!=null&&D>=0&&D<=100){C=D}for(var F in E){var B=E[F][C];if(B==""&&A){B=A}G[F]=B}return G},stripNonPrints:function(A){return A.replace(/[^a-zA-Z0-9&@()*_\-\', ]/g,"")},stripCurseWords:function(B){var A=B;return A},maxLen:function(A,B){if(!B){B=100}if(!A.length>B){A=A.substr(0,B)}return A},clean:function(C,D,E){var B=C;try{if(!D){D=C}C=trimet.utils.StringUtils.stripNonPrints(C);C=trimet.utils.StringUtils.stripCurseWords(C);C=trimet.utils.StringUtils.maxLen(C,E);B=C}catch(A){B=D}return B},CLASS_NAME:"trimet.utils.StringUtils"};trimet.namespace("trimet.utils");try{if(window.OpenLayers==undefined){OpenLayers={};var names=["Size","Pixel","Layer","Layer.WMS","Control","Control.SelectFeature","Popup","Popup.FramedCloud"];for(var i=0;i<names.length;++i){window.OpenLayers[names[i]]=function(){}}}trimet.utils.OLD_EXTENT=new OpenLayers.Bounds(7435781,447887,7904954,877395);trimet.utils.MAX_EXTENT=new OpenLayers.Bounds(7495000,430000,7788000,760000);OpenLayers.IMAGE_RELOAD_ATTEMPTS=5;OpenLayers.Util.onImageLoadErrorColor="";
OpenLayers.ImgPath="/images/map/controls/classic/";OpenLayers.Layer.Vector.prototype.reportError=false;OpenLayers.Layer.Vector.prototype.isSupported=function(){if(this==null||this.renderer==null){return false}return this.renderer.supported()};OpenLayers.Util.alphaHack=function(){return false}}catch(e){console.log("no worries if this exception is thrown...just means that OpenLayers is not included in your html file (eg: maybe this is not an OL project)")}trimet.utils.OpenLayersUtils={MAP_PANEL:"map-panel",MARKERS:"markers",VECTORS:"vectors",makeTestMap:function(C,A){if(!C){C="http://maps5.trimet.org/tilecache/tilecache.py?"}if(!A){A="currentOSPN"}var B=trimet.utils.OpenLayersUtils.makeMap([],new OpenLayers.Bounds(7435781,447887,7904954,877395),"EPSG:2913","map",10);trimet.utils.OpenLayersUtils.makeMapBaseLayer(B,C,A,1,"none",null);trimet.utils.OpenLayersUtils.makeAerialBaseLayer(B,C,1,"none",null);trimet.utils.OpenLayersUtils.defaultControls(B,true,true,true,false);return B},makeMap:function(C,A,B,G,E){var F=null;var D={controls:C,maxExtent:A,projection:B,units:"ft",theme:null,maxResolution:256};F=new OpenLayers.Map(G,D);F.numZoomLevels=E;return F},makeMapBaseLayer:function(F,E,D,C,A,B){var D=new OpenLayers.Layer.WMS("Map",E,{layers:D,format:"image/png",EXCEPTIONS:""},{buffer:C,isBaseLayer:true,transitionEffect:A,attribution:B});F.addLayer(D);return D},makeAerialBaseLayer:function(F,E,C,A,B){var D=new trimet.map.layer.Hybrid("Hybrid",E,{layers:"hTopo",format:"image/jpeg",EXCEPTIONS:""},{buffer:C,isBaseLayer:true,transitionEffect:A,attribution:B});F.addLayer(D);return D},defaultControls:function(A,E,B,I,J,G){var D={pan:new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true}),mouse:new OpenLayers.Control.MousePosition({numDigits:0}),scale:new OpenLayers.Control.ScaleLine(),arg:new OpenLayers.Control.ArgParser(),nav:new OpenLayers.Control.Navigation({zoomWheelEnabled:E,handleRightClicks:B,documentDrag:true})};A.addControl(D.pan);A.addControl(D.mouse);A.addControl(D.scale);A.addControl(D.arg);A.addControl(D.nav);if(I){var C=new OpenLayers.Control.Permalink();D.perma=C;A.addControl(C)}if(J){var H=new OpenLayers.Control.Attribution();D.attrib=H;A.addControl(H)}if(G){var F=new OpenLayers.Control.NavigationHistory();D.hist=F;A.addControl(F)}return D},ORANGE:"#f54c00",ORANGE_STYLE:{strokeColor:"#f54c00",strokeOpacity:0.7,strokeWidth:6,pointRadius:6,pointerEvents:"visiblePainted"},ORANGE_DASH_STYLE:{strokeColor:"#f54c00",strokeOpacity:0.7,strokeWidth:6,pointRadius:6,strokeDashstyle:"dash",pointerEvents:"visiblePainted"},BLACK_STYLE:{strokeColor:"#111111",strokeOpacity:0.5,strokeWidth:5,pointRadius:6,pointerEvents:"visiblePainted"},BLACK_DASH_STYLE:{strokeColor:"#111111",strokeOpacity:0.8,strokeWidth:3,pointRadius:6,strokeDashstyle:"dash",pointerEvents:"visiblePainted"},YELLOW_STYLE:{strokeWidth:4,strokeOpacity:1,strokeColor:"#FFFF00",pointerEvents:"visiblePainted"},YELLOW_DASH_STYLE:{strokeWidth:4,strokeOpacity:1,strokeColor:"#FFFF00",strokeDashstyle:"dash",pointerEvents:"visiblePainted"},RED_STYLE:{strokeColor:"#FF0000",strokeOpacity:0.7,strokeWidth:6,pointRadius:6,pointerEvents:"visiblePainted"},RED_DASH_STYLE:{strokeColor:"#FF0000",strokeOpacity:0.7,strokeWidth:6,pointRadius:6,strokeDashstyle:"dash",pointerEvents:"visiblePainted"},makeDefaultPointFeatureStyle:function(){return new OpenLayers.StyleMap({"default":new OpenLayers.Style({pointRadius:"6",fillColor:"#ffcc66",strokeColor:"#66ccDD",strokeWidth:2}),select:new OpenLayers.Style({fillColor:"#FE7202",strokeColor:"#3B5A95",strokeWidth:2})})},makeZoomLink:function(A,B){if(A==null||A.length<1){A="Zoom in"}if(B==null||B.length<1){B="Zoom out"}return'<ul class=”links”><li><a href="#zoomIn" onclick="trimet.map.StaticMap.zoomIn();"   title="'+A+'">'+A+'</a>   | <a href="#zoomOut" onclick="trimet.map.StaticMap.zoomOut();" title="'+B+'">'+B+"</a></li></ul>"},makeStraightLine:function(E,D,A){var C=null;try{if(A==null){A=this.BLACK_DASH_STYLE}C=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(E.get("x"),E.get("y")),new OpenLayers.Geometry.Point(D.get("x"),D.get("y"))]),null,A)}catch(B){}return C},clearVectorLayer:function(C){for(var B=0;B<5;B++){try{if(C.features&&C.features.length>0){C.removeFeatures(C.features);C.destroyFeatures(C.features)}}catch(A){}}C.redraw()},makeLineFromPoints:function(A,B){var D=null;try{if(B==null){B=this.RED_STYLE}var J=[];for(var G in A){var I=A[G].x;var H=A[G].y;if(I==null||H==null||I<=0||H<=0){continue}var C=new OpenLayers.Geometry.Point(I,H);if(C!=null){J.push(C)}}if(J!=null&&J.length>1){var F=new OpenLayers.Geometry.LineString(J);D=new OpenLayers.Feature.Vector(F,null,B)}}catch(E){}return D},drawLinesViaAjax:function(url,vLayer,style,itin){try{OpenLayers.Request.GET({url:url,success:function(xhr){var vectors=new Array();var resp=eval("("+xhr.responseText+")");for(var i in resp.results){try{var points=resp.results[i].points;var line=trimet.utils.OpenLayersUtils.makeLineFromPoints(points,style);if(line!=null){vectors.push(line)}}catch(Exe){}}if(vectors.length>0){if(itin){itin.concatVectors(vectors)}if(vLayer){vLayer.addFeatures(vectors)}}},failure:function(xhr){}})}catch(Exe){}},RTE_ICON_SIZE:new OpenLayers.Size(105,34),RTE_ICON_OFFSET:new OpenLayers.Pixel(0,-34),FROM_WALK_ICON:"/images/map/trip/start-walk.png",FROM_ICON:"/images/map/trip/start.png",TO_ICON:"/images/map/trip/end.png",DISK_ICON:"/images/map/trip/xferdisk.png",WALK_ICON:"/images/map/trip/mode/walk.png",ROUTE_DIR:"/images/map/trip/rte/",ST_END_SIZE:new OpenLayers.Size(20,34),ST_END_OFFSET:new OpenLayers.Pixel(-10,-34),DISK_SIZE:new OpenLayers.Size(10,10),DISK_OFFSET:new OpenLayers.Pixel(-5,-5),makeFromWalkingMarker:function(A,E,D){var C=new OpenLayers.Icon(this.FROM_WALK_ICON,this.ST_END_SIZE,this.ST_END_OFFSET);var B=this.makeMarker(A,E,C);if(D){D.push(B)}return B},makeFromMarker:function(A,E,D){var C=new OpenLayers.Icon(this.FROM_ICON,this.ST_END_SIZE,this.ST_END_OFFSET);var B=this.makeMarker(A,E,C);if(D){D.push(B)}return B},makeToMarker:function(A,E,D){var C=new OpenLayers.Icon(this.TO_ICON,this.ST_END_SIZE,this.ST_END_OFFSET);var B=this.makeMarker(A,E,C);if(D){D.push(B)}return B},makeWalkMarker:function(A,E,D){var C=new OpenLayers.Icon(this.WALK_ICON,this.RTE_ICON_SIZE,this.RTE_ICON_OFFSET);var B=this.makeMarker(A,E,C);if(D){D.push(B)}return B},makeDiskMarker:function(A,E,D){var B=new OpenLayers.Icon(this.DISK_ICON,this.DISK_SIZE,this.DISK_OFFSET);var C=this.makeMarker(A,E,B);if(D){D.push(C)}return C},makeRouteMarker:function(A,F,D,E){var B=null;if(D!=null&&D.length>=1){var C=new OpenLayers.Icon(this.ROUTE_DIR+D+".png",this.RTE_ICON_SIZE,this.RTE_ICON_OFFSET);B=this.makeMarker(A,F,C);if(E){E.push(B)}}return B},makeMarker:function(A,E,B){var C=new OpenLayers.LonLat(A,E);var D=new OpenLayers.Marker(C,B);return D},clearMarkerLayer:function(B,E){for(var A=0;A<5;A++){try{for(var D=0;D<E.length;D++){B.removeMarker(E[D])}}catch(C){}}B.redraw()},clearMarkerLayerZ:function(C){try{for(var B in C.markers){var A=C.markers[B];A.destory()}C.clearMarkers()}catch(D){}},drawMarkers:function(A,C){for(var B=0;B<C.length;B++){A.addMarker(C[B])}},getMarkerLayerDataExtent:function(D){var B=D.maxExtent;var F=D.markers;var E=D.markers.length;if(F!=null&&E>0){var A=F[0];B=new OpenLayers.Bounds(A.lonlat.lon,A.lonlat.lat,A.lonlat.lon,A.lonlat.lat);for(var C=0;C<E;C++){B.extend(F[C].lonlat)}}return B},zoomToBBox:function(D,E){if(E==null||D==null){return }try{var C=E.split(",");var A=new OpenLayers.Bounds(C[0].trim(),C[1].trim(),C[2].trim(),C[3].trim());D.zoomToExtent(A)}catch(B){console.log("zoomToBBox exception: "+B)}},growBBox:function(E,B){if(E==null){return B}var D=E;try{var F=E.split(",");var A=B.split(",");if(F&&F.length>=4&&A&&A.length>=4){D=(F[0]*1)<(A[0]*1)?F[0]:A[0];D+=",";D+=(F[1]*1)<(A[1]*1)?F[1]:A[1];D+=",";D+=(F[2]*1)>(A[2]*1)?F[2]:A[2];D+=",";D+=(F[3]*1)>(A[3]*1)?F[3]:A[3]}console.log("growBBox destBBox: "+B);console.log("growBBox srcBBox:  "+E);console.log("growBBox retVal: "+D)}catch(C){console.log("growBBox exception: "+C)
}return D},zoomToMarkerLayerExtent:function(C,A){try{var B=this.getMarkerLayerDataExtent(A);C.zoomToExtent(B)}catch(D){}},zoomToGeometry:function(C,F,H,A){try{var E=undefined;if(H||A){var D=C.getZoom();if(H&&H>D){E=H}else{if(A&&A<D){E=A}}}var G=F.getCentroid();C.setCenter(new OpenLayers.LonLat(G.x,G.y),E)}catch(B){}},panZoomWithLimits:function(D,A,G,F,E,C){try{if(F&&F>=E&&F<=C){D.zoomTo(F)}else{if(D.getZoom()>C){D.zoomTo(C)}else{if(D.getZoom()<E){D.zoomTo(E)}}}if(A&&G){D.setCenter(new OpenLayers.LonLat(A,G))}}catch(B){}},roundCoord:function(C){var B=C;try{if(B.lon&&B.lon>180){B.lon=Math.round(B.lon)}if(B.lat&&B.lat>180){B.lat=Math.round(B.lat)}}catch(A){console.log("OpenLayersUtils.getLatLonOfPixel exception "+A)}return B},getLatLonOfPixel:function(F,D,B){try{var C=new OpenLayers.Pixel(D,B);var A=F.getLonLatFromPixel(C);return this.roundCoord(A)}catch(E){console.log("OpenLayersUtils.getLatLonOfPixel exception "+E)}},setCenterByPixel:function(A){var B=new OpenLayers.Pixel(A.x,A.y);var C=this.map.getLonLatFromPixel(B);this.map.setCenter(C)},setCenter:function(D,A,E,B){try{if(B&&(B<0||B>9)){B=2}if(A&&E){D.setCenter(new OpenLayers.LonLat(A,E),B)}else{if(B){D.zoomTo(B)}}}catch(C){}},wmsFilter:function(C,A){if(A==null){A="id"}var B="<PropertyIsEqualTo><PropertyName>${name}</PropertyName><Literal>${value}</Literal></PropertyIsEqualTo>";return trimet.utils.StringUtils.format(B,{name:A,value:C})},wmsOrFilter:function(D,B){var A="<Filter><Or>";if(D&&D.length>0){for(var C=0;C<D.length;C++){A+=this.wmsFilter(D[C],B)}}else{console.log("info: OpenLayersUtils.wmsOrFilter bogus filter to prevent anything from showing up on the wms overlay");this.wmsFilter(2112,"BOGUS_FILTER")}A+="</Or></Filter>";return A},wmsOrRoutesFilter:function(A){return this.wmsOrFilter(A)},vectorHighlightControl:function(A,C){var B=new OpenLayers.Control.SelectFeature(A,{hover:true,highlightOnly:true});if(C){C.addControl(B);B.activate()}return B},simpleVectorLayers:function(B,E,G,J,I,F,D,H){if(B==null){B="simpleVectorLayer"}if(E==null){E=""}if(G==null){G=""}if(I==null){I=(F!=null?F:20)}if(F==null){F=I}if(D==null){D=(F/2)*-1}var A={externalGraphic:E,cursor:"pointer",graphicWidth:I,graphicHeight:F,graphicYOffset:D};if(J){A.rotation=J}if(H){A.fillOpacity=H}var C=new OpenLayers.Layer.Vector(B,{styleMap:new OpenLayers.StyleMap({"default":A,select:{externalGraphic:G}})});return C},hideAllLayers:function(C){try{for(var B in C){if(C[B]!=null&&!C[B].isBaseLayer){C[B].display(false);C[B].setVisibility(false)}}}catch(A){}},clearPopups:function(D){try{for(var A=0;A<D.popups.length;A++){var C=D.popups[A];if(C){C.hide();D.removePopup(C)}}}catch(B){}},findFeatureFromRecord:function(G,B){var F=null;try{var A=B.length;for(var C=0;C<A;C++){var D=B[C];if(D.m_record==G){F=D;break}}}catch(E){}return F},CLASS_NAME:"trimet.utils.OpenLayersUtils"};trimet.namespace("trimet.utils");try{Ext.BLANK_IMAGE_URL="/images/ui/s.gif";Ext.form.Field.prototype.msgTarget="side";Ext.QuickTips.init();Ext.lib.Event.resolveTextNode=Ext.isGecko?function(B){var D=null;try{if(!B){return }var A=HTMLElement.prototype.toString.call(B);if(A=="[xpconnect wrapped native prototype]"||A=="[object XULElement]"){return }D=B.nodeType==3?B.parentNode:B}catch(C){console.log("ExtUtils exception in Ext.lib.Event.resolveTextNode override for isGecko: "+C)}return D}:function(A){var C=null;try{C=A&&A.nodeType==3?A.parentNode:A}catch(B){console.log("ExtUtils exception in Ext.lib.Event.resolveTextNode override: "+B)}return C};Ext.form.XmlErrorReader=function(){Ext.form.XmlErrorReader.superclass.constructor.call(this,{record:"field",success:"@success"},["id","msg"])};Ext.extend(Ext.form.XmlErrorReader,Ext.data.XmlReader);trimet.utils.OPT_ARRAY=["opt","text"];trimet.utils.OPT_RECORD=new Ext.data.Record.create(trimet.utils.OPT_ARRAY)}catch(e){console.log("Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.utils.ExtUtils={MAP_ATTRIBUTION:'<a href="#" onclick="trimet.utils.ExtUtils.toggleAboutMap();">Powered by OpenGeo</a>',ABOUT_MAP_WINDOW:null,makeJsonStore:function(D,H,E,B,A,C){var G={proxy:new Ext.data.HttpProxy({method:"GET",url:D}),autoDestroy:true,autoSave:false,autoLoad:false,restful:false,idProperty:H,totalProperty:E,root:B,fields:A};trimet.extend(G,C);var F=new Ext.data.JsonStore(G);F.proxy.on("exception",function(K,I,J){console.log("EXCEPTION: ExtUtils.makeJsonStore error type:",I,", action:",J)});return F},setCookie:function(B,D,A,F,C){try{if(A==null){A=trimet.utils.DateUtils.addDays(365)}if(F==null){F="/"}if(C==null){C="trimet.org"}Ext.util.Cookies.set(B,D,A,F,C)}catch(E){console.log("ExtUtils.setCookie() "+E)}},setTripPlannerCookie:function(A){trimet.utils.ExtUtils.setCookie(trimet.utils.Constants.TP_COOKIE_NAME,trimet.utils.Constants.TP_COOKIE_VALUE,A)},clearSplashScreen:function(D,B,A){try{if(D==null){D=500}if(B==null){B="loading"}if(A==null){A=B+"-mask"}setTimeout(function(){try{Ext.get(B).remove()}catch(E){}try{Ext.get(A).fadeOut({remove:true})}catch(E){}},D)}catch(C){console.log("ExtUtils.clearSplashScreen() "+C)}},makePopup:function(A,H,D,C,J,B,E,I,G,K){var F={title:H!=null?H:"About",layout:"auto",closeable:B==true?true:false,closeAction:K!=null?K:"hide",width:C!=null?C:600,height:J!=null?J:370,plain:true,x:I,y:G,buttonAlign:"center"};trimet.extend(F,A);trimet.configure(F,A);return trimet.utils.ExtUtils.makePopupWithConfig(F,D,B,E)},makePopupWithConfig:function(C,B,F,D){var E=new Ext.Window(C);if(F==true&&D!=true){var A=new Ext.Button({text:"Close",scope:E,handler:function(H,G){this.close()}});E.addButton(A)}if(B===true){E.show(this)}return E},makeHtmlPopup:function(A,G,D,C,H,B,E,I){var F={autoLoad:A,y:100,width:(C!=null?C:600),layout:"auto",buttonAlign:"center",closeAction:I!=null?I:"hide"};if(G){F.title=G}if(H){F.height=H}return trimet.utils.ExtUtils.makePopupWithConfig(F,D,B,E)},makeFormPopup:function(C,E,B,D,A){return trimet.utils.ExtUtils.makePopup({items:C},E,B,D,A)},makeBorderLayoutWindow:function(B,E,C,A){var D=new Ext.Window({title:E!=null?E:"Window",width:C!=null?C:300,height:A!=null?A:520,closable:true,closeAction:"hide",constrainHeader:true,plain:true,layout:"border",items:B});return D},toggleAboutMap:function(){if(this.ABOUT_MAP_WINDOW==null){this.ABOUT_MAP_WINDOW=trimet.utils.ExtUtils.makeHtmlPopup("/html/map/footer.html","About this map")}this.togglePopup(this.ABOUT_MAP_WINDOW)},togglePopup:function(A){if(A&&A.show&&A.hide){if(A.isVisible()){A.hide()}else{A.show()}}},makeTextPanel:function(B){if(B==null){B="..."}var A=new Ext.Panel({title:"Information",xtype:"panel",autoScroll:true,html:B});return A},makeToolButton:function(A,C,B){if(C==null){C="refresh"}if(B==null){B="<b>Clear</b><br/>Clears the map of all selections and feature detail windows."}if(A==null){A=function(F,E,D){D.m_control.clear()}}return{id:C,qtip:B,handler:A}},setClickCallback:function(C,D,B){try{if(D){if(B){C.on({click:D,scope:B})}else{C.on("click",D)}}}catch(A){}},makeMockPanel:function(){var C=["collapse","expand","doLayout","on","isMock"];var B={};for(var A=0;A<C.length;++A){B[C[A]]=function(){}}return B},getPixelXY:function(C,F){var D=C.getXY();if(F==null){F=Ext.get(trimet.utils.OpenLayersUtils.MAP_PANEL)}var B=F.getOffsetsTo(document.body);var A=D[0]-B[0];var E=D[1]-B[1];return{x:A,y:E}},gridClick:function(C,G,D){if(D==null){D={description:"",x:"",y:""}}try{this.m_lastRowIndex=G;var A=C.getStore().getAt(G);for(var F in D){var B=A.get(F);D[F]=B}}catch(E){}return D},makeListView:function(B,D,C){if(D==null){D=[{header:"Description",width:0.9,dataIndex:"description"}]}var E={layout:"auto",store:B,stripeRows:true,autoShow:true,columns:D};trimet.extend(E,C);trimet.configure(E,C);var A=new Ext.ListView(E);return A},makeGridView:function(A,E,B,C){if(E==null){E=[{header:"Description",width:0.9,dataIndex:"description"}]}var F={layout:"fit",height:150,store:A,stripeRows:true,bodyBorder:false,autoShow:true,autoDestroy:true,sortable:true,sm:new Ext.grid.RowSelectionModel({singleSelect:C==true?false:true}),deferRowRender:true,forceLayout:true,viewConfig:{forceFit:true,enableRowBody:true},columns:E};
trimet.extend(F,B);trimet.configure(F,B);if(F.height==null){F.autoHeight=true}if(F.width==null){F.autoWidth=true}var D=new Ext.grid.GridPanel(F);return D},makeLayerGrid:function(H,E,G,I,C,J,A){var K=new Ext.grid.RowExpander({tpl:new Ext.XTemplate(I)});var D=true;if(A){D=false}var F=new Ext.grid.RowSelectionModel({singleSelect:D});var B=new Ext.grid.GridPanel({store:H,plugins:K,columns:[K,{header:G,dataIndex:E,width:C,sortable:true}],sm:F,viewConfig:{forceFit:true,enableRowBody:true},width:C,height:J,hideHeaders:false,autoShow:true,bodyBorder:false,stripeRows:true});F.on("rowselect",function(M,N,L){this.expandRow(N)},K);F.on("rowdeselect",function(M,N,L){this.collapseRow(N)},K);return B},makeTreeNode:function(B,H,A,F,D,G,I,E){var C=new Ext.tree.TreeNode({id:B,text:H,cls:A,iconCls:F,leaf:D,href:"#",margins:"0 0 0 0",cmargins:"0 2 0 0",expanded:true,collapsible:true});if(I&&G){this.setClickCallback(C,G,I)}return C},clearTreeNode:function(B){try{B.remove()}catch(A){}try{B.destroy()}catch(A){}},clearNodes:function(B){try{for(var E=B.length-1;E>=0;E--){var F=B[E].childNodes;if(F){for(var C=F.length-1;C>=0;C--){var D=F[C].childNodes;if(D){for(var A=D.length-1;A>=0;A--){this.clearTreeNode(D[A])}}this.clearTreeNode(F[C])}}this.clearTreeNode(B[E])}}catch(G){}},clearTreeNodes:function(A){try{var B=A.root.childNodes;this.clearNodes(B)}catch(C){}},copyTreeNodes:function(A,H,J){var B=new Array();try{var I=A.length;for(var G=0;G<I;G++){B[G]=new Ext.tree.TreeNode(Ext.apply({},A[G].attributes));this.setClickCallback(B[G],H,J)}var D=new Array();var C=A[1].childNodes;var I=C.length;for(var F=0;F<I;F++){D[F]=new Ext.tree.TreeNode(Ext.apply({},C[F].attributes));this.setClickCallback(D[F],H,J)}B[1].appendChild(D)}catch(E){}return B},makeStaticPullDownStore:function(A){return new Ext.data.SimpleStore({fields:trimet.utils.OPT_ARRAY,data:A})},getCoordinateByString:function(C,A,F,E){var B=A.find("description",C);var D=A.getAt(B);return trimet.utils.ExtUtils.getCoordinate(D,F,E)},getCoordinateByIndex:function(A,B,E,D){var C=A.getAt(B);return trimet.utils.ExtUtils.getCoordinate(C,E,D)},getCoordinate:function(B,F,E){var D=F;var A="x";var G="y";if(E){A="lon";G="lat"}try{var A=B.get(A);var G=B.get(G);D=A+","+G}catch(C){D=F}return D},makePointRecord:function(A){if(A==null||A==""){A=""}else{A=A+"/"}var B=new Ext.data.Record.create([{name:"id",mapping:"@id"},{name:"mode",mapping:"@mode"},{name:"order",mapping:"@order"},{name:"routeID",mapping:"route/internalNumber"},{name:"x",mapping:A+"pos/x"},{name:"y",mapping:A+"pos/y"},{name:"lat",mapping:A+"pos/lat"},{name:"lon",mapping:A+"pos/lon"},{name:"description",mapping:A+"description"},{name:"stopId",mapping:A+"stopId"},{name:"areaKey",mapping:A+"@areaKey"},{name:"areaValue",mapping:A+"@areaValue"}]);return B},makePointStore:function(B,A){if(B==null){B="leg"}var C=this.makePointRecord(A);return new Ext.data.Store({fields:C,data:Ext.state.Manager.get("PointStore",[]),reader:new Ext.data.XmlReader({record:B},C)})},makeLocationStore:function(A){if(A&&A.removeAll){A.removeAll();return A}return this.makePointStore("location","")},loadPointRecord:function(F,C){var E=null;try{var B=this.makePointStore(F,"");var A=Ext.DomQuery.select("response",C);B.loadData(A);E=B.getAt(0)}catch(D){console.log("EXCEPTION: ExtUtils.loadPointRecord "+D);E=this.makePointRecord(typeID)}return E},CLASS_NAME:"trimet.utils.ExtUtils"};trimet.namespace("trimet.widget.planner");try{trimet.widget.planner.Utils={TRIPDETAILS_TREE:"tripdetails-tree-",ITINERARIES_TREE:"itineraries-tree-",TRIP_TAB:"trip-tab-",DETAILS_CLS:"itinys-node",ITIN_CLS:"itinys-node",FROM_ID:"from",TRIP_ID:"trip",TO_ID:"to",ITIN_RECORD:new Ext.data.Record.create(["id","description",{name:"viaRoute",mapping:"@viaRoute"},{name:"regularFare",mapping:"fare/regular"},{name:"honoredFare",mapping:"fare/special[@id=honored]"},{name:"youthFare",mapping:"fare/special[@id=youth]"},{name:"tramFare",mapping:"fare/special[@id=tram]"},{name:"date",mapping:"time-distance/date"},{name:"duration",mapping:"time-distance/duration"},{name:"startTime",mapping:"time-distance/startTime"},{name:"endTime",mapping:"time-distance/endTime"},{name:"numTransfers",mapping:"time-distance/numberOfTransfers"},{name:"numLegs",mapping:"time-distance/numberOfTripLegs"},{name:"walkTime",mapping:"time-distance/walkingTime"},{name:"walkDistance",mapping:"time-distance/distance"},{name:"transitTime",mapping:"time-distance/transitTime"},{name:"waitingTime",mapping:"time-distance/waitingTime"}]),LEG_RECORD:new Ext.data.Record.create([{name:"id",mapping:"@id"},{name:"mode",mapping:"@mode"},{name:"order",mapping:"@order"},{name:"startTime",mapping:"time-distance/startTime"},{name:"endTime",mapping:"time-distance/endTime"},{name:"duration",mapping:"time-distance/duration"},{name:"distance",mapping:"time-distance/distance"},{name:"direction",mapping:"direction"},{name:"key",mapping:"key"},{name:"alerts",mapping:"route",convert:function(G,E){var B=Ext.DomQuery.select("route/alert",E);var F=[];for(var C=0;C<B.length;C++){var D=B[C];var A=Ext.DomQuery.selectValue("description",D);if(A){F.push(A)}}return F}},{name:"routeName",mapping:"route/name"},{name:"routeNumber",mapping:"route/number"},{name:"urlParam",mapping:"lineURL/@param"},{name:"fromDescription",mapping:"from/description"},{name:"fromStopId",mapping:"from/stopId"},{name:"fromCity",mapping:"from/@areaValue"},{name:"toDescription",mapping:"to/description"},{name:"toStopId",mapping:"to/stopId"},{name:"toCity",mapping:"to/@areaValue"}]),domSelect:function(B,A){return Ext.DomQuery.select(B,A)},makeItinerariesTree:function(E,B,A){var D=this.ITINERARIES_TREE+E;var C=new Ext.tree.TreePanel({root:trimet.utils.ExtUtils.makeTreeNode("root-"+D,"<B>"+E+"</B>",this.ITIN_CLS,this.ITIN_CLS,false,B,A),id:D,lines:false,collapsible:false,rootVisible:false,margins:"0 0 0 0",cmargins:"0 0 0 0"});return C},makeTripDetailsTree:function(E,B,A){var D=this.TRIPDETAILS_TREE+E;var C=new Ext.tree.TreePanel({root:trimet.utils.ExtUtils.makeTreeNode("root-"+D,"<B>"+E+"</B>",this.DETAIL_CLS,this.DETAIL_CLS,false,B,A),id:D,lines:false,collapsible:false,rootVisible:false,collapseFirst:false,margins:"0 0 0 0",cmargins:"0 0 0 0"});return C},makeTripTab:function(E,D,B,A){var C=new Ext.Panel({id:this.TRIP_TAB+E,title:D,tabTip:D,headerAsText:false,cls:"preview single-preview",closable:true,autoScroll:true,border:false,buttonAlign:"center",buttons:A,footerCfg:{cls:"button_bg"},singleExpand:true,items:[B]});return C},makeFromStore:function(){return trimet.utils.ExtUtils.makePointStore("leg","from")},makeToStore:function(){return trimet.utils.ExtUtils.makePointStore("leg","to")},makeLegStore:function(){return new Ext.data.Store({fields:this.LEG_RECORD,reader:new Ext.data.XmlReader({record:"leg"},this.LEG_RECORD)})},makeItinerariesStore:function(){return new Ext.data.Store({fields:this.ITIN_RECORD,reader:new Ext.data.XmlReader({record:"itinerary"},this.ITIN_RECORD)})},CLASS_NAME:"trimet.widget.planner.Utils"}}catch(e){console.log("planner.Utils Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.widget.configure");trimet.widget.configure.ConfigureStore={id:"id",root:"configure",total:null,fields:[{name:"snow"},{name:"routes"},{name:"vehicles"},{name:"dialog"},],CLASS_NAME:"trimet.widget.configure.ConfigureStore"};trimet.namespace("trimet.applications.embedmap");trimet.applications.embedmap.StaticControl={map:null,tileURLs:trimet.utils.Constants.tileServers,overlayURL:trimet.utils.URL.wmsCached,layers:[],selections:[],cities:[],zips:[],providers:[],placeTemplate:"<label>${n}</label>",providerPrefix:"<ul>",providerTemplate:'<li><input type="checkbox" name="provider" class="provider" onclick="obj.showProvider(${id}, this.checked);"/><label>${n}</label></li>',providerSuffix:"</ul>",initialize:function(A){console.log("enter applications.embedmap.Control constructor");trimet.configure(this,A);this.load();console.log("exit applications.embedmap.Control constructor")},load:function(){try{OpenLayers.ImgPath="http://maps.trimet.org/images/map/controls/classic/";
this.map=new trimet.map.SimpleMap({tileURLs:this.tileURLs,styleUrlPrefix:"http://maps.trimet.org"})}catch(A){console.log("EXCEPTION load(): "+A)}},clear:function(){try{this.selections=[];this.layers.provider.hide()}catch(A){console.log("EXCEPTION clear(): "+A)}},addLayer:function(E,C,B){if(E==null){return }try{if(C==null){C="trimet:"+E}if(B==null){B=0.5}var A=new trimet.widget.overlay.Layer({wmsURL:this.overlayURL,wmsLayer:C,opacity:B,map:this.map.getMap()});this.layers[E]=A}catch(D){console.log("EXCEPTION addLayer(): "+D)}},toggle:function(C,A){try{if(A){this.layers[C].show()}else{this.layers[C].hide()}}catch(B){console.log("EXCEPTION toggle(): "+B)}return true},toggleProvider:function(D,A){try{if(A){this.selections.push(D.id)}else{this.selections=trimet.utils.ObjUtils.deleteFromArray(this.selections,D.id,true)}if(this.selections.length>0){var B=trimet.utils.OpenLayersUtils.wmsOrFilter(this.selections,"id");console.log("info showRoutes filter: "+B);this.layers.provider.wmsLayer.mergeNewParams({filter:B});this.layers.provider.show()}else{this.layers.provider.hide()}}catch(C){console.log("EXCEPTION toggleProvider(): "+C)}return true},findProvider:function(D){var C=null;try{for(var A in this.providers){if(this.providers[A].id==D){C=this.providers[A];break}}}catch(B){console.log("EXCEPTION findProvider(): "+B)}return C},showProvider:function(B,A,D){var C=B;if(C.id==null){C=this.findProvider(B)}if(A&&D){trimet.utils.OpenLayersUtils.zoomToBBox(this.map.getMap(),C.bbox)}this.toggleProvider(C,A);return C},showPlace:function(A,G){console.log("enter showPlace()");var E=A;try{var F="";if(A.p&&A.output==null){F=trimet.utils.StringUtils.format(this.placeTemplate,A);F+=this.providerPrefix;for(var B in A.p){var D=this.findProvider(A.p[B]);if(D!=null){console.log("attach provider to place = "+D);F+=trimet.utils.StringUtils.format(this.providerTemplate,D)}}F+=this.providerSuffix;A.output=F}if(G){trimet.utils.OpenLayersUtils.zoomToBBox(this.map.getMap(),A.bbox)}}catch(C){console.log("EXCEPTION showPlace(): "+C)}console.log("exit showPlace()");return E},populateCity:function(A){console.log("ENTER populateCity()");trimet.utils.HtmlUtils.populateSelectViaArray(A,this.cities);return true},populateZip:function(A){trimet.utils.HtmlUtils.populateSelectViaArray(A,this.zips);return true},populateProviders:function(A){trimet.utils.HtmlUtils.populateSelectViaArray(A,this.providers);return true},CLASS_NAME:"trimet.applications.embedmap.Control"};trimet.applications.embedmap.Control=new trimet.Class(trimet.applications.embedmap.StaticControl);trimet.namespace("trimet.applications.map");trimet.applications.map.StaticControl={params:null,profile:null,map:null,ui:null,tbar:null,poi:null,tileURLs:trimet.utils.Constants.tileServers,routes:null,tc:null,pr:null,planner:null,vehicles:null,overlay:null,snow:null,configure:null,initialize:function(S){console.log("enter applications.map.Control constructor");trimet.configure(this,S);var K=this;this.params=new trimet.utils.ParseUrlParams();this.profile=this.params.makeProfile();this.map=new trimet.map.SimpleMap({tileURLs:this.tileURLs,attribution:trimet.utils.ExtUtils.MAP_ATTRIBUTION});this.ui=new trimet.widget.ui.UI({map:this.map});this.tbar=new trimet.widget.ui.Buttons({ui:this.ui,profile:this.profile});this.poi=new trimet.map.poi.Control({map:this.map.getMap()});var Q=this.map.getMap();var D={map:Q};var A,I,F,B,G,M,C,H,P;var N=this.params.isDebug();if(N){A="/js/trimet/widget/configure/test/test.json";H="http://maps5.trimet.org/wms/reflect";I="/js/trimet/widget/search/test.json";B="/js/trimet/widget/feature/test/routes.json";M="/js/trimet/widget/feature/test/tc.json";G="/js/trimet/widget/feature/test/pr.json";C="/js/trimet/widget/feature/test/zipcar.json";F="/js/trimet/map/wfs/test/testStop.json";D.url="/js/trimet/widget/vehicles/test/vehicles.json";D.maxUpdates=200;D.updateInterval=5000,trimet.utils.URL.plannerGEO="/js/trimet/widget/planner/test/test.json";trimet.utils.URL.planner="/js/trimet/widget/planner/test/multiAlertsPerRoute.xml";trimet.utils.URL.cachedWMS=trimet.utils.URL.wmsCacheTest;trimet.utils.URL.wfs="/js/trimet/widget/overlay/test/wfs-portland.json";trimet.map.wfs.MapDecorator.url="/js/trimet/map/wfs/test/test.xml";P={landmarkURL:"/js/trimet/map/wfs/test/testStop.json"};this.map.getMap().setCenter(new OpenLayers.LonLat(7645095,646550),5);var L=this.tbar.getShareThis();this.doSnowOverlay({wmsURL:H},true,false)}this.routes=new trimet.widget.feature.RouteGrid({map:Q,url:B,controller:this,wmsURL:H,autoLoad:true});this.search=new trimet.widget.search.Search({profile:this.profile,url:I,poi:this.poi});this.tc=new trimet.widget.feature.TransitCenterGrid({profile:this.profile,map:Q,url:M});this.pr=new trimet.widget.feature.ParkRideGrid({profile:this.profile,map:Q,url:G});this.planner=new trimet.widget.planner.Planner({profile:this.profile,map:this.map,poi:this.poi});var J=new trimet.widget.ui.ContextMenu({profile:this.profile,map:this.map,forms:this.planner.getForms()});this.measure=new trimet.widget.measure.Measure({profile:this.profile,map:Q});this.measure.button=this.tbar.getMeasure();this.measure.button.show();this.measure.button.on("toggle",this.measure.toggle,this.measure);if(this.profile.isPowerUser()){this.overlay=trimet.widget.overlay.Factory.create(this.ui,this.map,this.tbar.getOverlay());trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.MOBILITY)}this.wfs=trimet.map.wfs.GxControlStatic.createWfsLayer(Q,P);this.wfs.prClick=function(T){K.pr.wfsLandmarkClick(T)};this.wfs.tcClick=function(T){K.tc.wfsLandmarkClick(T)};this.vehicles=new trimet.widget.vehicles.Grid(D);this.vehicles.button=this.tbar.getVehicles();this.vehicles.button.on("toggle",this.vehicleButtonCB,this);this.ui.south.on("collapse",this.southCollapse,this);if(this.planner){this.ui.accordion.add(this.planner.getPanel())}if(this.search){this.ui.accordion.add(this.search.getPanel())}if(this.routes){this.ui.accordion.add(this.routes.getPanel())}if(this.tc){this.ui.accordion.add(this.tc.getPanel())}if(this.pr){this.ui.accordion.add(this.pr.getPanel())}if(this.overlay){this.ui.accordion.add(this.overlay.getPanel())}if(this.vehicles){this.ui.south.add(this.vehicles.getPanel())}this.ui.doLayout();this.configure=new trimet.widget.configure.Configure({url:A,loadCallback:this.configCB,loadCallbackTHIS:this});var R=new OpenLayers.Control.SelectFeature([this.wfs.getLayer(),this.pr.getLayer(),this.tc.getLayer(),this.vehicles.getLayer(),this.poi.getLayer()],{clickout:true,toggle:true,multiple:false,hover:false,toggleKey:"ctrlKey",multipleKey:"shiftKey"});Q.addControl(R);R.activate();var O=this.tbar.getClear();O.setHandler(this.clear,this);var E=this.tbar.getFeedback();E.setHandler(trimet.utils.TrimetUtils.tpFeedback,this);setTimeout(function(){K.load(K.params,Q)},1000);trimet.utils.ExtUtils.clearSplashScreen();console.log("exit applications.map.Control constructor")},configCB:function(A,B,D){try{var F=A.getAt(0);F=F.data;if(F.dialog&&F.dialog.show===true){var E=new trimet.widget.dialog.Dialog({messages:F.dialog.content});E.show()}if(F.snow){this.doSnowOverlay(null,F.snow.button,F.snow.pressed,F.snow.stops)}if(F.vehicles){if(F.vehicles.button===false){this.vehicles.setDisabled(true)}else{if(this.params&&F.vehicles.pressed===true){this.params.setVehicles(true)}}}}catch(C){console.log("map.Control.load "+C)}},doSnowOverlay:function(A,B,D,C){if(B===true){if(A==null){A={}}A.map=this.map.getMap();this.snow=new trimet.widget.feature.SnowRoute(A);this.snow.button=this.tbar.getSnow();this.snow.button.show();this.snow.button.on("toggle",this.snow.toggle,this.snow);if(D){this.snow.button.toggle()}}if(C===true||(C==undefined&&B===true)){if(this.wfs!=null){this.wfs.snow=true}}},load:function(G,C){try{var E=this.poi;var B=this.pr;var H=this.tc;var J=this.routes;var A=this.planner.getForms();var F=this;var D=G.getPoi(E,C);G.openTool(F,D.exists);A.populate(G.m_params);if(G.hasSubmit()){A.submit()}if(G.isFullScreen()){this.fullScreen(true)}if(G.showSatelliteView()){this.map.showSatelliteView()
}}catch(I){console.log("map.Control.load "+I)}},clear:function(){if(this.planner){this.planner.clear()}if(this.search){this.search.clear()}if(this.routes){this.routes.clear()}if(this.tc){this.tc.clear()}if(this.pr){this.pr.clear()}if(this.overlay){this.overlay.clear()}if(this.vehicles){this.vehicles.buttonOff()}if(this.measure){this.measure.button.toggle(false)}if(this.snow){this.snow.button.toggle(false)}this.fullScreen(false);if(trimet.utils.ExtUtils.ABOUT_MAP_WINDOW){trimet.utils.ExtUtils.ABOUT_MAP_WINDOW.hide()}this.poi.clear();this.map.clear();this.ui.clear()},fullScreen:function(B){var A=this.tbar.getFullScreen();A.toggle(B);this.ui.fullScreen(B)},activate:function(){var A=this.getSelectedRoutes();if(A==null||A.length<1){this.vehicles.button.hide();this.vehicles.clear()}else{this.vehicles.buttonShow();if(this.params.isVehicles()){this.vehicles.buttonOn()}if(this.vehicles.button.pressed){this.toggleVehicles(this.vehicles.button,true)}}},deactivate:function(A){this.activate(A)},southCollapse:function(){if(!this.ui.isFullScreen&&!this.params.isVehicles()){this.vehicles.buttonOff()}},getSelectedRoutes:function(){if(this.vehicles.isDisabled()){return null}var D="";try{this.routes.filter=this.filter;var A=this.routes.getSelectedRoutes(10);if(A!=null&&A.length>0){var B=A.join(",");console.log("Control.getSelectedRoutes RouteGrid "+B);if(D.length>0){D+=","}D+=B}}catch(C){console.log("exception Planner.getSelectedRoutes "+C)}return D},filter:function(D){if(D==null){return true}var C=[100,200,190,90,150,203,208,193,93];for(var A in C){var B=C[A];if(D==B||D==(B+"")){return true}}return false},vehicleButtonCB:function(A,B){this.toggleVehicles(A,B);this.params.clearVehicles()},toggleVehicles:function(A,C){if(C){var B=this.getSelectedRoutes();if(B){console.log("Control.toggleVehicles routes: "+B);this.vehicles.show(B,this.ui.south);this.ui.doLayout()}else{Ext.Msg.show({title:this.profile.locale.vehicles.tool,msg:this.profile.locale.vehicles.error,buttons:Ext.Msg.OK,animEl:"elId",icon:Ext.MessageBox.WARNING});this.vehiclesOff()}}else{this.vehiclesOff()}},vehiclesOff:function(){this.ui.south.collapse();this.ui.south.hide();this.ui.doLayout();this.vehicles.hideLayerCB()},CLASS_NAME:"trimet.applications.map.Control"};trimet.applications.map.Control=new trimet.Class(trimet.applications.map.StaticControl);trimet.namespace("trimet.applications.mmis");trimet.applications.mmis.StaticControl={initialize:function(C){console.log("enter applications.mmis.Control constructor");trimet.configure(this,C);this.params=new trimet.utils.ParseUrlParams();this.ui=new trimet.widget.ui.UI();var B,E,F;if(this.params.isDebug()){var D="/js/trimet/applications/mmis/test/";B=D+"smytom_code.json";E=D+"pendingworks.json";F=D+"shop.json"}var A=new trimet.applications.mmis.pending.Panel({symcURL:B,shopURL:F,rlcURL:E});trimet.utils.ExtUtils.clearSplashScreen();console.log("exit applications.mmis.Control constructor")},CLASS_NAME:"trimet.applications.mmis.Control"};trimet.applications.mmis.Control=new trimet.Class(trimet.applications.mmis.StaticControl);trimet.namespace("trimet.applications.mmis.pending");try{trimet.applications.mmis.pending.Form=Ext.extend(Ext.form.FormPanel,{record:null,renderTo:"pending-form",border:false,frame:true,defaultType:"textfield",columnHeight:0.4,xtype:"fieldset",labelWidth:200,defaults:{width:300,border:false},initComponent:function(){console.log("enter trimet.applications.mmis.pending.Form constructor");this.items=[{fieldLabel:"RO #",name:"repair_order_number"},{fieldLabel:"EComp Number",name:"equipment_component_number"},{fieldLabel:"Symptom Code",name:"symptom_code",xtype:"combo",store:this.storeSymc,typeAhead:true,displayField:"description",valueField:"code",mode:"local",emptyText:"Select Symptom Code...",selectOnFocus:true},{fieldLabel:"Remarks",name:"remarks"},{xtype:"datefield",fieldLabel:"Log Date",format:"Y/m/d",name:"log_date"},{fieldLabel:"Shop",name:"shop",xtype:"combo",store:this.storeShop,typeAhead:true,displayField:"description",valueField:"shop",mode:"local",emptyText:"Select Shop...",selectOnFocus:true},{fieldLabel:"Badge",name:"badge"},{fieldLabel:"Status",name:"status"},{fieldLabel:"Repair Order Source",name:"repair_order_source"},{fieldLabel:"Test?",name:"test_flag"},{fieldLabel:"Under Warranty?",name:"warranty_flag"}];this.tbar=[{text:"Add",scope:this,iconCls:"silk-add",formBind:true,handler:this.onCreate},"-",{text:"Save",scope:this,iconCls:"icon-save",formBind:true,handler:this.onUpdate},"-",{text:"Ignore Changes",scope:this,iconCls:"silk-arrow-undo",handler:this.onIgnore},"-",{text:"Print",scope:this,iconCls:"silk-printer"},"-",{text:"New",scope:this,iconCls:"silk-page-white",handler:function(C,A,B){this.getForm().reset()}},"-"];this.addEvents({create:true,update:true,reload:true});trimet.applications.mmis.pending.Form.superclass.initComponent.call(this)},loadRecord:function(A){this.record=A;this.getForm().loadRecord(A)},onCreate:function(A,B){if(!this.getForm().isValid()){Ext.Msg.alert("Form is invalid.","Form is invalid.");console.log("Form is invalid.");return false}this.fireEvent("create",this,this.getForm().getValues())},onUpdate:function(A,B){if(this.record==null){return }if(!this.getForm().isValid()){Ext.Msg.alert("Form is invalid.","Form is invalid.");console.log("Form is invalid.");return false}this.getForm().updateRecord(this.record)},onIgnore:function(A,B){this.getForm().reset()}})}catch(e){console.log("Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.applications.mmis.pending");try{trimet.applications.mmis.pending.chkbox=new Ext.grid.CheckboxSelectionModel();trimet.applications.mmis.pending.gridColumns=[trimet.applications.mmis.pending.chkbox,{header:"EComp No",dataIndex:"equipment_component_number",sortable:true,width:90},{header:"Symptom Code",dataIndex:"symc_desc",sortable:true,width:90},{header:"Remarks",dataIndex:"remarks",sortable:true,width:240},{header:"Log Date",dataIndex:"log_date",sortable:true,width:90,renderer:Ext.util.Format.dateRenderer("Y/m/d")},{header:"Shop",dataIndex:"shop",sortable:true,width:60},{header:"Badge",dataIndex:"badge",sortable:true,width:60},{header:"Status",dataIndex:"status",sortable:true,width:60}];trimet.applications.mmis.pending.Grid=Ext.extend(Ext.grid.GridPanel,{columns:trimet.applications.mmis.pending.gridColumns,frame:true,renderTo:"pending-grid",initComponent:function(){this.relayEvents(this.store,["destroy","save","update"]);this.tbar=[{text:"Assign Badge",scope:this,iconCls:"silk-user-add",handler:function(){this.getSelectionModel().clearSelections();this.fireEvent("clearform",this)}},"-",{text:"Delete",scope:this,iconCls:"silk-delete",handler:this.onDelete},"-",{text:"Print Work List",scope:this,iconCls:"silk-application-view-list",handler:function(){this.getSelectionModel().clearSelections();this.fireEvent("clearform",this)}},"-",{text:"Print Work Tickets",scope:this,iconCls:"silk-printer",handler:function(){this.getSelectionModel().clearSelections();this.fireEvent("clearform",this)}},"-",{text:"Transfer Work",scope:this,id:"transfershop",iconCls:"silk-application-go",xtype:"combo",store:storeShop,typeAhead:true,width:200,displayField:"description",valueField:"shop",emptyText:"Transfer Work to:",mode:"local",selectOnFocus:true,listeners:{select:function(C,B,A){}}},{text:"Go",scope:this,handler:this.onSelectShop},"-"];this.viewConfig={forceFit:true};this.addEvents({clearform:true});Pending.Grid.superclass.initComponent.call(this)},onDelete:function(B,D){var C=this.getSelectionModel().getSelections();var E=C.length;if(E>0){for(var A=0;A<E;A++){this.store.remove(C[A])}}else{return false}this.fireEvent("clearform",this)},onSelectShop:function(B,D){var C=this.getSelectionModel().getSelections();var G=C.length;var F=this.getId("transfershop");Ext.Msg.alert("new shop",F);if(G>0){for(var A=0;A<G;A++){var E=C[A];Ext.Msg.alert("old shop",E.data.shop);if(E.data.shop!=F){E.data.shop=F;this.store.save(E)}}}else{return false
}this.fireEvent("clearform",this)}})}catch(e){console.log("Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.applications.mmis.pending");trimet.applications.mmis.pending.Panel={symcURL:"http://pc23339:5000/symptom_code",shopURL:"http://pc23339:5000/shop",rlcURL:"http://pc23339:5000/repair_login_code",storePendList:null,storeSymc:null,initialize:function(C){console.log("enter mmis.pending.Panel constructor");trimet.configure(this,C);var B=trimet.applications.mmis.pending.Utils;this.storePendList=new Ext.data.Store({proxy:B.proxy,reader:B.reader,writer:B.writer,autoSave:true,listeners:{write:function(I,H,E,G,F){Pending.setAlert(G.success,G.message)},exception:function(H,I,J,F,G,E){if(I==="remote"){Ext.Msg.show({title:"REMOTE EXCEPTION",msg:G.message,icon:Ext.MessageBox.ERROR,buttons:Ext.Msg.OK})}}}});this.storeSymc=new Ext.data.JsonStore({url:this.symcURL,root:"symc",idProperty:"code",fields:[{name:"code"},{name:"description"}],autoload:true,restful:true});this.storeShop=new Ext.data.JsonStore({url:this.shopURL,root:"shop",idProperty:"shop",fields:[{name:"shop"},{name:"description"},{name:"garage"}],autoload:true,restful:true});this.storeRlc=new Ext.data.JsonStore({url:this.rlcURL,fields:[{name:"code_type"}],autoload:true,restful:true});var D=trimet.applications.mmis.pending.Grid;var A=trimet.applications.mmis.pending.Form;this.panel=new Ext.Panel({frame:true,title:"Work Order List",layout:"fit",items:[D,A]});this.storeSymc.load();this.storePendList.load();this.storeShop.load();this.pendingForm=new trimet.applications.mmis.pending.Form({title:"Work Item Details",region:"south",split:true,height:350,width:700,storeShop:this.storeShop,storeSymc:this.storeSymc,listeners:{create:function(E,F){var G=new D.store.recordType(F);D.store.insert(0,G)}}});this.pendingGrid=new trimet.applications.mmis.pending.Grid({store:storePendList,renderTo:"pending-grid",region:"center",height:300,width:700,layout:"fit",split:true,listeners:{rowclick:function(G,E,F){var H=G.store.getAt(E);A.loadRecord(H)},clearform:function(){A.getForm().reset();D.getSelectionModel().clearSelections()}}})},CLASS_NAME:"trimet.applications.mmis.pending.Panel"};trimet.applications.mmis.pending.Panel=new trimet.Class(trimet.applications.mmis.pending.Panel);trimet.namespace("trimet.applications.mmis.pending");try{trimet.applications.mmis.pending.Utils={proxy:new Ext.data.HttpProxy({api:{read:"/pendingworks",create:"/pendingworks/create",update:"/pendingworks/update",destroy:"/pendingworks/delete"}}),reader:new Ext.data.JsonReader({totalProperty:"total",successProperty:"success",idProperty:"id",root:"data",fields:[{name:"id"},{name:"maintenance_category"},{name:"equipment_class"},{name:"remarks",allowBlank:false},{name:"equipment_component_number",allowBlank:false},{name:"symptom_code",allowBlank:false},{name:"repair_order_number"},{name:"log_date",dateFormat:"Y/m/d",allowBlank:false},{name:"shop",allowBlank:false},{name:"garage"},{name:"badge",allowBlank:false},{name:"status",allowBlank:false},{name:"repair_order_source",allowBlank:false},{name:"test_flag",allowBlank:false},{name:"warranty_flag",allowBlank:false},{name:"operator_reported"},{name:"date_reported"},{name:"time_reported"},{name:"symc_desc"}]}),writer:new Ext.data.JsonWriter({encode:true,writeAllFields:true}),CLASS_NAME:"trimet.applications.mmis.pending.Utils"}}catch(e){console.log("Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.locale");trimet.locale.English={tools:{tripPlanner:"Trip Planner",search:"Location Search",routes:"TriMet Routes",tc:"Transit Center Locations",pr:"Park & Ride Locations",zipcar:"Zipcar Locations",prToolTip:"See all of TriMet's Park & Ride Locations"},frequent:{first:"During the weekday morning and afternoon rush hour, ",last:"run every 15 minutes or better."},contextMenu:{fromHere:"Start a trip here",toHere:"End a trip here",centerHere:"Center map here",zoomInHere:"Zoom in here",zoomOutHere:"Zoom out of here",previous:"Last map position",next:"Next map position"},labels:{routeName:"Route Name",tcName:"Transit Center",tcLink:"Click for more information on this Transit Center",prName:"Park & Ride",prLink:"Click for more information on this Park & Ride (including driving directions)",stationName:"Station Name",stopID:"Stop ID",farelessString:"Free Rail Zone",fareZoneString:"Fare Zone",transitTracker:"TransitTracker arrivals",transitTrackerName:" TransitTracker (Next Arrivals)",drivingDirections:'<h5>Driving directions <span class="subh5">from Google</span></h5><p>Enter a starting address and click "Go."</p>',servedBy:"Served by",pr24Hours:'24-hour limit (<a target="#" href="http://www.trimet.org/parkandride">unless otherwise posted</a>)',birdsEyeViewText:'<h5>Bird\'s Eye View <span class="subh5">from Bing</span></h5>',isA:"is a",stopIn:"stop in",viewOn:"View on"},service:{weekdays:"Weekdays",saturday:"Saturday",sunday:"Sunday",schedule:"Schedule"},indicators:{ok:"OK",date:"Date",loading:"Loading",searching:"Searching...",qEmptyText:"Address, intersection, landmark or Stop ID..."},buttons:{reverse:"Reverse",reverseTip:"<b>Reverse directions</b><br/>Plan a return trip by reversing this trip's start and end points, and adjusting the time forward.",reverseMiniTip:"Reverse directions",edit:"Edit",editTip:"<b>Edit trip</b><br/>Return to the main trip planner input form with the details of this trip.",clear:"Clear",clearTip:"<b>Clear</b><br/>Clear the map and all active tools.",snow:"Snow Routes",snowTip:"<b>Snow Routes</b><br/>Overlay the snow routes atop the existing bus routes.<br/><br/>IMPORTANT: this layer might be showing <b>ALL</b> TriMet routes that are on snow route, when only a handful of routes are actually running their snow route.  Please check http://trimet.org/alerts for the most up to date list of detoured routes.",fullScreen:"Full Screen",fullScreenTip:"<b>Full Screen</b><br/>Show -or- hide tool panels",print:"Print",printTip:"<b>Print</b><br/>Print this trip plan with stop maps.",feedback:"Feedback",feedbackTip:"<b>Feedback</b><br/>Send your thoughts or experiences with the map",shareThis:"Share",shareThisTip:"<b>ShareThis</b><br/>Share this map via email, IM, social bookmarking and networking sites, etc...",satellite:"Satellite",satelliteTip:"<b>Satellite</b><br/>Show satellite imagery",map:"Map",mapTip:"<b>Map</b><br/>Show cartographic map",identify:"Identify",identifyTip:"<b>Identify features</b><br/>The map 'overlays' contain a lot of information. Turn this control on, activate some overlays, then select features from the map with the mouse.",measure:"Measure",measureTip:"<b>Measure distance</b><br/>Find distances in feet (or miles) by clicking around the map.  Double click to stop measuring.",measureInfo:"Measure distance<br/><i>Click mouse to start, and double click to stop.</i>",altLang:"Espa&ntilde;ol",altLangURL:"../../mapES.html",submit:"Submit",clear:"Clear",ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"},directions:{southEast:"south east",southWest:"south west",northEast:"north east",northWest:"north west",north:"north",west:"west",south:"south",east:"east",bound:"bound"},vehicles:{tool:"Bus locations",button:"Buses",tip:"<b>Bus locations</b><br/>Plot the most recent bus locations (MAX, WES and Streetcar currently not available).  Bus query is made by selecting one or more routes from the left (up to 10 routes maximum; using the Control or Shift keys allows selection of multiple routes).",timeOut:"<b>Time out </b>  Do you want to continue monitoring live bus positions?",error:"At least one route must be selected before vehicles will show up on the map.",route:"Route",number:"Vehicle #",destination:"Destination",lastUpdate:"Last update",endService:"<b>Note</b> it looks like vehicle #{num} may have ended it's route, as position updates have stopped coming in for this vehicle on this route.",lastPositionLink:"Last position update"},tripPlanner:{labels:{panelTitle:"Trip Planner",tabTitle:"Plan a Trip",inputTitle:"Trip details",tripOnTrimet:"Plan a trip on TriMet",submitMsg:"Planning your trip...",optionalTitle:"",date:"Date",time:"Time",when:"When",from:"From",fromHere:"From here",planFromHere:"Plan a trip from here",to:"To",toHere:"To here",planToHere:"Plan a trip to here",minimize:"Show me the",walk:"Maximum walk",mode:"Travel by",go:"Go",planTrip:"Plan Trip",newTrip:"New trip"},error:{title:"Trip Planner Error",deadMsg:"Map Trip Planner is currently not responding. Please wait a few minutes to try again, or try the text trip planner (see link below).",geoFromMsg:"Please select the 'From' location for your trip: ",geoToMsg:"Please select the 'To' location for your trip: "},options:[["X","Fewest transfers"],["T","Quickest trip"]],arriveDepart:[["D","Depart"],["A","Arrive"]],walkDistance:[["0.10","1/10 mile"],["0.25","1/4 mile"],["0.50","1/2 mile"],["0.75","3/4 mile"],["0.9999","1 mile"]],mode:[["A","Buses and trains"],["B","Buses only"],["T","Trains only"]]},boundary:{placeNotesText:"Notes: ",placeIsText:" <b> IS </b>",placeIsNotText:" <b> IS NOT </b> ",placeNotesAdaText:" within the ADA boundary. ",placeNotesTriMetText:" within TriMet's service boundary. "},CLASS_NAME:"trimet.locale.English"};
trimet.namespace("trimet.locale");trimet.locale.Spanish={indicators:{ok:"OK",date:"Fecha",loading:"Cargando",searching:"Searching...",qEmptyText:"Address, intersection, landmark or Stop ID..."},CLASS_NAME:"trimet.locale.Spanish"};trimet.namespace("trimet.locale");trimet.locale.Templates={dotted:'<hr class="dotted"/>',spacer:"<p>&nbsp;</p>",placeTypeTpl:'<tpl if="type != null && type.length &gt; 0"> ({type}<tpl if="stop_id != null && stop_id.length &gt; 0"> {stop_id}</tpl>)</tpl>',cityTpl:'<tpl if="city != undefined && city.length &gt; 0"> {city}</tpl>',streetView:'<iframe width="100%" height="180" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"  src="http://maps.google.com/maps?output=svembed&layer=c&cbp=0,0,0,0,&cbll={lat},{lon}&ll={lat},{lon}&z=17"></iframe>',birdsEyeView:"",tripToOnClick:'trimet.widget.planner.StaticForms.setTo(   "{[values.name.replace(/\'/g,"")]}", "{x}", "{y}");',tripFromOnClick:'trimet.widget.planner.StaticForms.setFrom( "{[values.name.replace(/\'/g,"")]}", "{x}", "{y}");',ttPopupString:"",nameHTML:"",nameCityType:"",nameCityStopHTML:"",stopIdTpl:"",tripLinksHTML:"",fareZoneTpl:"",directionHTML:"",placeNotes:"",directionHTML:"",initialize:function(A,C){console.log("enter Templates constructor - with params: ",A,C);trimet.configure(this,C);var F=1;console.log("Templates constructor: step ",F++);if(this.ttPopupString==null||this.ttPopupString==""){this.ttPopupString=' <tpl if="stop_id">&nbsp;<br/><br/><a href=\'javascript: window.open("http://trimet.org/arrivals/trackerpopup.html?locationID={stop_id}&x=13&y=13","TransitTracker","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=442,left=10,top=10,height=330").focus()\'><img align="absmiddle" src="/images/ui/trimet.org/nextarrivalsicon-16.gif"/>'+A.labels.transitTrackerName+"</a><br/></tpl>"}console.log("Templates constructor: step ",F++);if(this.fareZoneTpl==null||this.fareZoneTpl==""){this.fareZoneTpl='<tpl if="zone_id"> <tpl if="zone_id &gt; 0"> '+A.labels.fareZoneString+' {zone_id}, </tpl><tpl if="zone_id.length &gt; 0 && zone_id == 0"> '+A.labels.farelessString+", </tpl></tpl>"}console.log("Templates constructor: step ",F++);if(this.nameCityType==null||this.nameCityType==""){this.nameCityType="{name}"+this.cityTpl+this.placeTypeTpl}console.log("Templates constructor: step ",F++);if(this.stopIdTpl==null||this.stopIdTpl==""){this.stopIdTpl='<tpl if="stop_id != null && stop_id.length &gt; 0"><span class="subh5"><br/>'+A.labels.stopID+" {stop_id}</span></tpl>"}console.log("Templates constructor: step ",F++);if(this.nameHTML==null||this.nameHTML==""){this.nameHTML="<h3>{name} "+this.stopIdTpl+"</h3>"}console.log("Templates constructor: step ",F++);if(this.directionHTML==null||this.directionHTML==""){this.directionHTML="{[trimet.utils.StringFormattingUtils.getDirectionString(values.street_direction, "+A.CLASS_NAME+'.directions, " '+A.labels.isA+' ", "'+A.directions.bound+" "+A.labels.stopIn+' ", true)]}'}console.log("Templates constructor: step ",F++);if(this.nameCityStopHTML==null||this.nameCityStopHTML==""){this.nameCityStopHTML=""+this.nameHTML+"<p>"+this.directionHTML+this.fareZoneTpl+this.cityTpl+this.ttPopupString+"</p>"}console.log("Templates constructor: step ",F++);if(this.tripLinksHTML==null||this.tripLinksHTML==""){var B="<li><a target='' href='#set-to'   onClick='"+this.tripToOnClick+"'>"+A.tripPlanner.labels.planToHere+"</a></li>";var E="<li><a target='' href='#set-from' onClick='"+this.tripFromOnClick+"'>"+A.tripPlanner.labels.planFromHere+"</a></li>";var D='<li><a target="_blank" href="http://bycycle.org/regions/portlandor/geocodes/find?q={lon}%2C{lat}">'+A.labels.viewOn+" byCycle.org</a></li>";this.tripLinksHTML='<ul class="links">'+E+B+D+"</ul>"}console.log("Templates constructor: step ",F++);if(this.birdsEyeView==null||this.birdsEyeView==""){this.birdsEyeView='<a target="_blank" href="/html/map/ve.html?lat={lat}&lon={lon}&title={[escape(values.name)]}&description={[escape(values.city)]}">'+A.labels.birdsEyeViewText+"</a>"}console.log("exit Templates constructor")},makePlaceNotesString:function(C,A){var B="{[trimet.locale.TemplateGlobals.doPlaceNotes(values.trimet_boundary, values.ada_boundary,"+C.CLASS_NAME+".boundary)]}";if(A||this.placeNotes==""){this.placeNotes=B}return B},CLASS_NAME:"trimet.locale.Templates"};trimet.locale.Templates=new trimet.Class(trimet.locale.Templates);trimet.locale.TemplateGlobals={doPlaceNotes:function(C,B,D){var A="";if(C!=null){if(C==true){A+="<li>"+D.placeIsText+D.placeNotesTriMetText+"</li>"}if(C==false&&C.length==undefined){A+="<li>"+D.placeIsNotText+D.placeNotesTriMetText+"</li>"}}if(B!=null){if(B==true){A+="<li>"+D.placeIsText+D.placeNotesAdaText+"</li>"}if(B==false&&B.length==undefined){A+="<li>"+D.placeIsNotText+D.placeNotesAdaText+"</li>"}}if(A.length>0){A="<h5>"+D.placeNotesText+"</h5>"+A}return A},parseStringArgs:function(D,E){var C="";try{for(var A=D;A<E.length;A++){if(E[A]&&E[A].concat){C+=E[A]}}}catch(B){}return C},makeTemplate:function(A,D){var B=this.parseStringArgs(1,arguments);var C=new Ext.XTemplate('<div class="'+A+'" >',B,"</div>");return C},makeLoopingTemplate:function(A,D){var B=this.parseStringArgs(1,arguments);var C=new Ext.XTemplate('<tpl for=".">','<div class="'+A+'" >',B,"</div>","</tpl>");return C},minutes:function(C,A){var E="";var D="minute";var B=null;if(A&&A.minute){D=A.minute+""}if(A&&A.minutes){B=A.minutes+""}else{B=D+"s"}if(C&&C>1){E=B}else{if(C&&C>0){E=D}}return E},CLASS_NAME:"trimet.locale.TemplateGlobals"};trimet.namespace("trimet.locale.profile");trimet.locale.profile.Barrier={initialize:function(A){console.log("entering Barrier's constructor",this,A);trimet.inherit(this,trimet.locale.profile.BaseStatic);trimet.configure(this,A);trimet.locale.profile.Base.prototype.initialize.apply(this,[A]);this.powerUser=true;this.templates.makePlaceNotesString(this.locale);this.powerUser=true;console.log("leaving Barrier's constructor",this)},CLASS_NAME:"trimet.locale.profile.Barrier"};trimet.locale.profile.Barrier=new trimet.Class(trimet.locale.profile.Base,trimet.locale.profile.Barrier);trimet.namespace("trimet.locale.profile");trimet.locale.profile.BaseStatic={locale:trimet.locale.English,templates:null,powerUser:false,initialize:function(A){console.log("entering Base's constructor",this,A);trimet.extend(this,A);if(this.locale==null){this.locale=trimet.locale.English;console.log("Base's constructor is creating a default Locale with this locale",this.locale)}if(this.templates==null){console.log("Base's constructor is creating a default Template with this locale",this.locale);this.templates=new trimet.locale.Templates(this.locale)}},isPowerUser:function(A){return this.powerUser},CLASS_NAME:"trimet.locale.profile.Base"};trimet.locale.profile.Base=new trimet.Class(trimet.locale.profile.BaseStatic);trimet.namespace("trimet.map");trimet.map.StaticMap=null;trimet.map.SimpleMapStatic={profile:trimet.locale.profile.BaseStatic,MAX_EXTENT:"",map:null,el:null,mapDivName:"map",mapDIV:"map",contextMenu:null,srsName:trimet.utils.Constants.SRS_NAME,mapLAYER:"currentOSPN",center:{x:7643672,y:683029},numZoomLevels:10,attribution:null,mapAttribution:null,aerialAttribution:null,transitionEffect:"resize",zoomWheelEnabled:true,handleRightClicks:false,permaLinkEnabled:false,historyEnabled:true,controls:[],geoJsonFormatter:null,tileBuffer:0,tileURLs:trimet.utils.Constants.tileServers,m_mapTiles:null,m_hybridTiles:null,initialize:function(A){console.log("enter SimpleMap constructor");this.MAX_EXTENT=trimet.utils.MAX_EXTENT;this.geoJsonFormatter=new OpenLayers.Format.GeoJSON();trimet.configure(this,A);trimet.map.StaticMap=this;if(this.attribution){if(this.mapAttribution==null){this.mapAttribution=this.attribution}if(this.aerialAttribution==null){this.aerialAttribution=this.attribution}}this.makeTriMetMap();this.clear()},makeTriMetMap:function(){this.map=trimet.utils.OpenLayersUtils.makeMap(this.controls,this.MAX_EXTENT,this.srsName,this.mapDIV,this.numZoomLevels);this.m_mapTiles=trimet.utils.OpenLayersUtils.makeMapBaseLayer(this.map,this.tileURLs,this.mapLAYER,this.tileBuffer,this.transitionEffect,this.mapAttribution);
this.m_hybridTiles=trimet.utils.OpenLayersUtils.makeAerialBaseLayer(this.map,this.tileURLs,this.tileBuffer,this.transitionEffect,this.aerialAttribution);try{this.el=Ext.get(this.mapDivName)}catch(A){}if(this.controls!=null&&this.controls.length==0){this.controls=trimet.utils.OpenLayersUtils.defaultControls(this.map,this.zoomWheelEnabled,this.handleRightClicks,this.permaLinkEnabled,this.mapAttribution,this.historyEnabled)}},showSatelliteView:function(){this.map.setBaseLayer(this.m_hybridTiles,true)},showMapView:function(){this.map.setBaseLayer(this.m_mapTiles,true)},getContextMenu:function(A){if(A!=null){this.contextMenu=A}var B=[{text:this.profile.locale.contextMenu.centerHere,iconCls:"cCenterMap",scope:this,handler:function(){this.contextMenu.centerMapFromContextMenuXY()}},{text:this.profile.locale.contextMenu.zoomInHere,iconCls:"cZoomIn",scope:this,handler:function(){this.contextMenu.centerMapFromContextMenuXY();this.map.zoomIn()}},{text:this.profile.locale.contextMenu.zoomOutHere,iconCls:"cZoomOut",scope:this,handler:function(){this.contextMenu.centerMapFromContextMenuXY();this.map.zoomOut()}}];if(this.controls&&this.controls.hist){B.push({text:this.profile.locale.contextMenu.previous,iconCls:"cPrevious",handler:this.controls.hist.previous.trigger});B.push({text:this.profile.locale.contextMenu.next,iconCls:"cNext",handler:this.controls.hist.next.trigger})}return B},getMap:function(){return this.map},updateSize:function(){this.map.updateSize()},clear:function(){this.showMapView();this.updateSize();this.map.setCenter(new OpenLayers.LonLat(this.center.x,this.center.y),2)},centerMapAtPixel:function(A,D){var B=new OpenLayers.Pixel(A,D);var C=this.map.getLonLatFromPixel(B);this.map.panTo(C)},zoomIn:function(){var A=this.map.getZoom();A++;this.map.zoomTo(A)},zoomOut:function(){this.map.zoomOut()},zoom:function(A,E,C,D,B){if(D==null){D=4}if(B==null){B=D+3}trimet.utils.OpenLayersUtils.panZoomWithLimits(this.map,A,E,C,D,B)},zoomToExtent:function(A){try{this.map.zoomToExtent(A)}catch(B){console.log("exception SimpleMap.zoomToExtent"+B)}},CLASS_NAME:"trimet.map.SimpleMap"};trimet.map.SimpleMap=new trimet.Class(trimet.map.SimpleMapStatic);trimet.namespace("trimet.map.layer");trimet.map.layer.Hybrid={LAYER_NAMES:{0:"hTopo",1:"hTopo",2:"hTopo",3:"hHigh",4:"hHigh",5:"hHigh",6:"hHigh",7:"hHigh",8:"h1",9:"h",10:"h",11:"h"},getFullRequestString:function(B,A){B.LAYERS=this.LAYER_NAMES[this.map.getZoom()];return OpenLayers.Layer.WMS.prototype.getFullRequestString.apply(this,[B,A])},CLASS_NAME:"trimet.map.layer.Hybrid"};try{trimet.map.layer.Hybrid=new trimet.Class(OpenLayers.Layer.WMS,trimet.map.layer.Hybrid)}catch(e){console.log("trimet.map.layer.Hybrid: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.layer");trimet.map.layer.RouteHighlightStatic={map:null,layer:null,routes:null,urls:trimet.utils.URL.cachedWMS,name:"current:route",visibility:true,opacity:1,ratio:1.65,format:"image/gif",pallet:"tm8png",styles:"linRouteHighLight",initialize:function(A){console.log("enter map.RouteHighlight constructor");trimet.configure(this,A);this.layer=new OpenLayers.Layer.WMS("Route Highlight Layer",this.urls,{layers:this.name,styles:this.styles,transparent:true,format:this.format,pallet:this.pallet},{isBaseLayer:false,singleTile:true,ratio:this.ratio,visibility:this.visibility});this.layer.setOpacity(this.opacity);if(this.routes){this.highlight(this.routes)}if(this.map){this.map.addLayer(this.layer)}console.log("exit map.RouteHighlight constructor")},getLayer:function(){return this.layer},highlight:function(A){var D=false;console.log("enter highlight");try{if(A==null||A.length<1){this.layer.setVisibility(false);console.log("exit highlight (early, no routes defined)");return D}var B=trimet.utils.OpenLayersUtils.wmsOrRoutesFilter(A);console.log("info showRoutes filter: "+B);this.layer.mergeNewParams({filter:B});this.layer.redraw();this.layer.setVisibility(true);D=true}catch(C){console.log("EXCETION: highlight "+C)}console.log("exit highlight");return D},blank:function(){var A=trimet.utils.OpenLayersUtils.wmsOrRoutesFilter();this.layer.mergeNewParams({filter:A})},visible:function(A){this.layer.setVisibility(A)},CLASS_NAME:"trimet.map.layer.RouteHighlight"};trimet.map.layer.RouteHighlight=new trimet.Class(trimet.map.layer.RouteHighlightStatic);trimet.namespace("trimet.map.layer");trimet.map.layer.RouteStops={route:null,stops:null,wfsLayer:null,wfsControl:null,wmsLayer:null,url:null,mapCtl:null,map:null,showStops:null,routeURL:null,urlParams:null,styleUrlPrefix:"",styleMap:null,featureType:"stop_ext",maxResolution:256,propertyNames:["id","type","geom","name"],initialize:function(A){this.url=trimet.utils.URL.wfs;this.routeURL=trimet.utils.Constants.wmsServers;trimet.configure(this,A);console.log("RouteStops options:");console.log(A);if(this.urlParams==null){this.urlParams=new trimet.utils.ParseUrlParams()}if(this.showStops==null){this.showStops=this.urlParams.isShowStops()}if(this.map==null&&this.mapCtl==null){this.mapCtl=new trimet.map.SimpleMap(A)}if(this.map==null){this.map=this.mapCtl.getMap()}if(this.styleMap==null){this.styleMap=new trimet.map.wfs.Style({opacity:"1.0",urlPrefix:this.styleUrlPrefix})}this.wfsLayer=new trimet.map.wfs.Layer("RouteStopsWFS",this,this.stops);this.map.addLayer(this.wfsLayer);this.wfsControl=new trimet.map.wfs.Control(this.wfsLayer);this.map.addControl(this.wfsControl);this.wfsLayer.events.register("featuresadded",this,this.loadCB);if(this.mapCtl!=null){trimet.map.wfs.MapDecorator.decorate(this.mapCtl,trimet.map.wfs.Control,this,{featureType:this.featureType,propertyNames:this.propertyNames})}new trimet.map.layer.RouteHighlight({urls:this.routeURL,map:this.map,routes:[this.route]})},panToStop:function(A){var D=null;var C=this.wfsLayer.features;for(var B=0;B<C.length;B++){if(C[B].attributes.id==A){D=C[B].attributes;C=C[B];break}}if(D!==null&&C!==null){this.map.setCenter(new OpenLayers.LonLat(C.geometry.x,C.geometry.y),4);this.wfsControl.clickFeature(C)}},loadCB:function(A){this.map.zoomToExtent(this.wfsLayer.getDataExtent())},CLASS_NAME:"trimet.map.layer.RouteStops"};trimet.map.layer.RouteStops=new trimet.Class(trimet.map.layer.RouteStops);trimet.namespace("trimet.map.poi");trimet.map.poi.Control={name:"POI Layer",layer:null,drag:null,map:null,styleMap:null,visibility:false,width:250,m_control:null,m_popup:null,m_highlight:null,m_fromTrip:null,m_toTrip:null,m_features:[],initialize:function(A){console.log("enter poi.Control");try{this.styleMap=trimet.utils.OpenLayersUtils.makeDefaultPointFeatureStyle();trimet.configure(this,A);this.layer=new OpenLayers.Layer.Vector(this.name);this.drag=new OpenLayers.Control.DragFeature(this.layer);this.map.addLayer(this.layer);this.map.addControl(this.drag);this.layer.events.on({featuresremoved:this.destroyPopup,featureselected:this.clickFeature,featureunselected:this.clickoutFeature,scope:this});this.drag.onComplete=this.onComplete}catch(B){console.log("EXCEPTION poi.Control.initialize(): "+B)}console.log("exit wfs.Control")},getLayer:function(){return this.layer},clickoutFeature:function(A){this.destroyPopup()},clickFeature:function(A){try{this.m_highlight=A.feature;this.popup(A.feature.attributes.m_text)}catch(B){console.log("EXCEPTION clickFeature: "+B)}},destroyPopup:function(){try{if(this.m_popup){this.m_popup.destroy()}this.m_popup=null}catch(A){console.log("EXCEPTION destoryPopup: "+A)}},onComplete:function(B,A){try{var D=trimet.utils.OpenLayersUtils.getLatLonOfPixel(this.map,A.x,A.y);B.attributes.m_text=D.lon+","+D.lat;if(B.attributes.m_to){trimet.widget.planner.StaticForms.setTo(B.attributes.m_text,D.lon,D.lat,true,true)}if(B.attributes.m_from){trimet.widget.planner.StaticForms.setFrom(B.attributes.m_text,D.lon,D.lat,true,true)}}catch(C){console.log("EXCEPTION onComplete: "+C)}},highlight:function(A,E,C,D,B){if(A==null||E==null){return }if(B==null){B=""}this.drag.deactivate();this._destroyFeature(this.m_highlight);this.m_highlight=this.makeFeature(A,E,{index:0});
this.popup(D,B+trimet.utils.OpenLayersUtils.makeZoomLink());this.show();trimet.utils.OpenLayersUtils.setCenter(this.map,A,E,C)},setFrom:function(A,D,C,B){if(A==null||D==null){return }this._destroyFeature(this.m_fromTrip);this.m_fromTrip=this.makeFeature(A,D,{m_from:true,m_text:C},trimet.map.poi.Style.fromTrip);this.show();if(B){trimet.utils.OpenLayersUtils.setCenter(this.map,A,D)}this.drag.activate()},setTo:function(A,D,C,B){if(A==null||D==null){return }this._destroyFeature(this.m_toTrip);this.m_toTrip=this.makeFeature(A,D,{m_to:true,m_text:C},trimet.map.poi.Style.toTrip);this.show();if(B){trimet.utils.OpenLayersUtils.setCenter(this.map,A,D)}this.drag.activate()},clearTrip:function(){this._destroyFeature(this.m_toTrip);this._destroyFeature(this.m_fromTrip)},clear:function(){this._destroyFeatures(this.m_features);this.m_features=new Array();this.hide();this.drag.deactivate()},hide:function(){this.layer.setVisibility(false)},show:function(){this.layer.setVisibility(true)},popup:function(B,A){this.destroyPopup();this.m_popup=this.makePopup(this.m_highlight,{},B,A)},makeFeature:function(A,E,D,B){var C=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(A,E),D,B);this.layer.addFeatures([C]);this.m_features.push(C);this.show();return C},makePopup:function(D,C,E,B){if(B==null){B="";if(D.attributes.m_trustedText){B=D.attributes.m_trustedText}}if(E==null){E="";if(D.attributes.m_text){E=D.attributes.m_text}}E=trimet.utils.StringUtils.clean(E);D.attributes.m_text=E;D.attributes.m_trustedText=B;var A=new GeoExt.Popup({title:E,ctCls:"stop-pop",feature:D,width:this.width,height:this.height,html:'<div class="poi-popup">'+E+" "+B+"</div>",collapsible:false,autoDestory:false,autoScroll:true,unpinnable:false,shadow:true});if(A.draw==undefined){A.draw=function(H,G,F){var I=H}}A.show();A.doLayout();A.doLayout();return A},_destroyFeature:function(C){if(C==null){return }var B=new Array();var D=this.m_features;for(var A in D){if(C!=D[A]){B.push(this.m_features[A])}}this.m_features=B;this._destroyFeatures([C])},_destroyFeatures:function(A){try{this.destroyPopup()}catch(B){}try{if(A){this.layer.destroyFeatures(A)}}catch(B){}},CLASS_NAME:"trimet.map.poi.Control"};trimet.map.poi.Control=new trimet.Class(trimet.map.poi.Control);trimet.namespace("trimet.map.poi");trimet.map.poi.Popup={autoSize:true,minSize:null,size:null,maxSize:null,anchor:{},closeBox:true,overflow:"auto",initialize:function(C,B,D){this.minSize=new OpenLayers.Size(120,70);this.maxSize=new OpenLayers.Size(350,140);this.anchor={size:new OpenLayers.Size(8,8),offset:new OpenLayers.Pixel(-4,-4)};var E=C.id+"_popup";var A=C.geometry.getBounds().getCenterLonLat();OpenLayers.Popup.FramedCloud.prototype.initialize.apply(this,[E,A,this.size,D,this.anchor,this.closeBox]);this.contentDiv.style.overflow=this.overflow},edit:function(C,A,D,B){if(C){C=trimet.utils.StringUtils.clean(C);if(C&&C.length>0){this.contentHTML=C}}if(A&&D){this.lonlat.lon=A;this.lonlat.lat=D}if(B){this.show()}},CLASS_NAME:"trimet.map.poi.Popup"};try{trimet.map.poi.Popup=new trimet.Class(OpenLayers.Popup.FramedCloud,trimet.map.poi.Popup)}catch(e){console.log("trimet.map.poi.Layer: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.poi");trimet.map.poi.Style={green:{strokeColor:"#00FF00",strokeWidth:3,strokeDashstyle:"dashdot",pointRadius:6,pointerEvents:"visiblePainted"},fromTrip:{graphicWidth:20,graphicHeight:34,graphicXOffset:-10,graphicYOffset:-34,externalGraphic:"/images/map/trip/start.png",cursor:"pointer",fillOpacity:"1.0"},toTrip:{graphicWidth:20,graphicHeight:34,graphicXOffset:-10,graphicYOffset:-34,externalGraphic:"/images/map/trip/end.png",cursor:"pointer",fillOpacity:"1.0"},CLASS_NAME:"trimet.map.poi.Style"};trimet.namespace("trimet.map.wfs");trimet.map.wfs.Control={hover:true,singlePopup:true,autoActivate:true,popups:null,popupContentMethod:null,initialize:function(B,A){this.popups={};OpenLayers.Control.SelectFeature.prototype.initialize.apply(this,[B,A]);this.layer.events.on({featuresremoved:this.destroyPopups,scope:this});this.layer.map.events.on({zoomend:this.hidePopups,scope:this})},destroy:function(){this.destroyPopups();this.layer.events.un({featuresremoved:this.destroyPopups,scope:this});this.layer.map.events.un({zoomend:this.hidePopups,scope:this});OpenLayers.Control.SelectFeature.prototype.destroy.apply(this,arguments)},destroyPopups:function(){var B=(this.layer)?this.layer.map:null;var A;for(var C in this.popups){A=this.popups[C];if(B){B.removePopup(A)}A.destroy()}this.popups={}},hidePopups:function(){for(var A in this.popups){this.popups[A].hide()}},setMap:function(A){OpenLayers.Control.SelectFeature.prototype.setMap.apply(this,arguments);if(this.autoActivate){this.activate()}},clickFeature:function(B){var A=this.popups[B.id];if(this.singlePopup){this.hidePopups()}if(A){A.show()}else{A=this.makePopup(B);this.popups[B.id]=A;this.layer.map.addPopup(A);A.show()}},makePopup:function(A){return new trimet.map.wfs.Popup(A,this.popupContentMethod)},clickoutFeature:function(A){this.hidePopups()},CLASS_NAME:"trimet.map.wfs.Control"};try{trimet.map.wfs.Control=new trimet.Class(OpenLayers.Control.SelectFeature,trimet.map.wfs.Control)}catch(e){console.log("trimet.map.wfs.Control: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.wfs");trimet.map.wfs.GxControlStatic={map:null,layer:null,popup:null,popupCache:[],dataCache:[],jsonParser:null,singleton:null,snow:false,width:320,height:237,landmarkURL:trimet.utils.URL.landmark,initialize:function(B,A){this.jsonParser=new OpenLayers.Format.JSON();this.layer=B;trimet.configure(this,A);this.layer.events.on({featuresremoved:this.destroyPopups,featureselected:this.clickFeature,featureunselected:this.clickoutFeature,scope:this});this.layer.map.events.on({zoomend:this.hidePopups,scope:this})},getLayer:function(){return this.layer},destroyPopups:function(){},destoryPopup:function(){try{this.popup.close();this.popup.destroy();this.popup=null}catch(A){console.log("EXCEPTION GxControl.destroyPopup "+A)}},hidePopups:function(A){if(A===true||(this.popup&&!this.popup.draggable)){this.destoryPopup()}},clickFeature:function(B){try{var A=B.feature;switch(A.attributes.type){case 1:case"1":case 2:case"2":case 3:case"3":case 4:case"4":case 5:case"5":this._stopClick(A);break;case 10:case"10":this.prClick(A);break;case 14:case"14":this.tcClick(A);break;default:console.log("WFS clickFeature - unknown feature type "+A.attributes.type)}}catch(C){console.log("EXCEPTION in wfs clickFeature: "+C)}},_stopClick:function(A){console.log("GxControl.stopClick");this.hidePopups();this.makePopup(A)},prClick:function(A){console.log("GxControl.prClick")},tcClick:function(A){console.log("GxControl.tcClick")},makePopup:function(B){var C=B.attributes.id;var A=new GeoExt.Popup({title:C,ctCls:"stop-pop",feature:B,width:this.width,height:this.height,collapsible:false,autoDestory:false,autoScroll:true,shadow:true});this.popup=A;this.populatePopup(C);return A},populatePopup:function(A){if(this.dataCache[A]){this.makeTabs(A)}else{this.ajaxCallToGetData(A)}},makeTabs:function(E){try{var A=this.dataCache[E].name;var C=this.dataCache[E].details;var B=new Ext.TabPanel({activeTab:0,autoScroll:true,items:C});this.popup.setTitle(A);this.popup.add(B);this.popup.doLayout();this.popup.show();B.doLayout();this.popup.doLayout()}catch(D){console.log("EXCEPTION GxControl.makeTabs "+D)}},ajaxCB:function(B){try{var A=this.jsonParser.read(B.responseText);var D=A.id;this.dataCache[D]=A;this.makeTabs(D)}catch(C){console.log("EXCEPTION GxControl.ajaxCB "+C)}},ajaxCallToGetData:function(B){var A={id:B};if(this.snow){A.snow=true}OpenLayers.Request.GET({url:this.landmarkURL,params:A,scope:this,callback:this.ajaxCB})},clickoutFeature:function(A){this.hidePopups()},CLASS_NAME:"trimet.map.wfs.GxControl"};try{trimet.map.wfs.GxControl=new trimet.Class(trimet.map.wfs.GxControlStatic);trimet.map.wfs.GxControlStatic.createWfsLayer=function(B,A){if(Ext.isIE){if(A==null){A={}
}A.maxResolution=4}this.layer=new trimet.map.wfs.Layer("GeoEXT Landmark WFS",A);this.layer.setVisibility(true);this.layer.display(true);this.map=B;this.map.addLayer(this.layer,A);this.singleton=new trimet.map.wfs.GxControl(this.layer,A);return this.singleton}}catch(e){console.log("trimet.map.wfs.GxControl: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.wfs");trimet.map.wfs.Layer={visibility:true,maxResolution:8,minResolution:0.5,url:null,srsName:trimet.utils.Constants.SRS_NAME,wfsVersion:"1.1.0",styleMap:null,featurePrefix:"current",featureType:"t",propertyNames:["id","type","geom"],featureNS:"http://trimet.org",geometryName:"geom",fixedFeaturesMAX:100,initialize:function(A,D,H){console.log("enter wfs.Layer");this.url=trimet.utils.URL.wfs;trimet.configure(this,D);if(this.styleMap==null){this.styleMap=new trimet.map.wfs.Style()}var E=null;var B=null;if(H==null){E=new OpenLayers.Strategy.BBOX()}else{E=new OpenLayers.Strategy.Fixed({maxfeatures:this.fixedFeaturesMAX});var C=[];for(var F=0;F<H.length;F++){C.push(new OpenLayers.Filter.Comparison({type:OpenLayers.Filter.Comparison.EQUAL_TO,property:"id",value:H[F]+""}))}B=new OpenLayers.Filter.Logical({type:OpenLayers.Filter.Logical.OR,filters:C})}var G={version:this.wfsVersion,srsName:this.srsName,url:this.url,filter:B,featurePrefix:this.featurePrefix,featureType:this.featureType,featureNS:this.featureNS,geometryName:this.geometryName,propertyNames:this.propertyNames};console.log("wfs.Layer protocolConfig = "+G);var I=OpenLayers.Util.applyDefaults(this,{strategies:[E],protocol:new OpenLayers.Protocol.WFS(G)});OpenLayers.Layer.Vector.prototype.initialize.apply(this,[A,I]);console.log("exit wfs.Layer")},CLASS_NAME:"trimet.map.wfs.Layer"};try{trimet.map.wfs.Layer=new trimet.Class(OpenLayers.Layer.Vector,trimet.map.wfs.Layer)}catch(e){console.log("trimet.map.wfs.Layer error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.wfs");trimet.map.wfs.MapDecorator={stopWfsLayer:null,wfsController:null,decorate:function(B,D,A,C){console.log("enter wfs.MapDecorator.decorate");trimet.extend(B,this);trimet.inherit(this,C);B.addStopsToMap(this,D,A);console.log("exit wfs.MapDecorator.decorate");return B.wfsController},getStopLayer:function(){return this.stopWfsLayer},addStopsToMap:function(B,C,A){console.log("enter "+this.CLASS_NAME+" (was MapDecorator) addStopsToMap");if(C==null){C=trimet.map.wfs.Control}if(A==null){A={}}if(this.stopWfsLayer==null){this.stopWfsLayer=new trimet.map.wfs.Layer("MapDecorator WFS",B);this.map.addLayer(this.stopWfsLayer);this.wfsController=new C(this.stopWfsLayer,A);this.map.addControl(this.wfsController)}console.log("exit "+this.CLASS_NAME+" (was wfs.MapDecorator).addStopsToMap")},showStopsLayer:function(A){console.log("enter "+this.CLASS_NAME+" (wfs.MapDecorator) showStopsLayer");if(A==null){A=true}if(this.stopWfsLayer==null){this.addStopsToMap(A)}this.stopWfsLayer.setVisibility(A);console.log("exit "+this.CLASS_NAME+" (wfs.MapDecorator) showStopsLayer")},CLAZZ_NAME:"trimet.map.wfs.MapDecorator"};trimet.namespace("trimet.map.wfs");trimet.map.wfs.Popup={autoSize:true,minSize:new OpenLayers.Size(227,90),maxSize:new OpenLayers.Size(380,350),anchor:{size:new OpenLayers.Size(14,14),offset:new OpenLayers.Pixel(-7,-7)},closeBox:true,overflow:"auto",initialize:function(B,C){var E=B.id+"_popup";var A=B.geometry.getBounds().getCenterLonLat();var D;if(C!=null){D=C(B)}else{D=this.defaultContentMethod(B)}OpenLayers.Popup.FramedCloud.prototype.initialize.apply(this,[E,A,this.size,D,this.anchor,this.closeBox]);this.contentDiv.style.overflow=this.overflow},defaultContentMethod:function(A){var C='&nbsp;<a href=\'javascript: window.open("http://trimet.org/arrivals/trackerpopup.html?locationID=${id}&x=13&y=13","TransitTracker","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=442,left=10,top=10,height=330").focus()\'><img align="absmiddle" src="http://maps.trimet.org/images/ui/trimet.org/nextarrivalsicon-16.gif"/>   TransitTracker (Next Arrivals)</a>';var B='<p><h3>${name} <span class="subh5"><br/> Stop ID ${id}</span></h3>'+C+"</p>";var D=trimet.utils.StringUtils.format(B,A.attributes);return D},CLASS_NAME:"trimet.map.wfs.Popup"};try{trimet.map.wfs.Popup=new trimet.Class(OpenLayers.Popup.FramedCloud,trimet.map.wfs.Popup)}catch(e){console.log("trimet.map.wfs.Popup: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.map.wfs");trimet.map.wfs.Style={urlPrefix:"",opacity:"1.00",initialize:function(A){console.log("enter wfs.Style");trimet.configure(this,A);console.log("wfs.Style options: "+(A==null?" empty ":A));var B={graphicWidth:20,graphicHeight:20,cursor:"pointer",fillOpacity:this.opacity};OpenLayers.StyleMap.prototype.initialize.apply(this,[B,A]);this.addUniqueValueRules("default","type",{"1":{externalGraphic:this.urlPrefix+"/images/map/stop/bus20.png"},"2":{externalGraphic:this.urlPrefix+"/images/map/stop/tram20.png"},"3":{externalGraphic:this.urlPrefix+"/images/map/stop/cr20.png"},"4":{externalGraphic:this.urlPrefix+"/images/map/stop/streetcar20.png"},"5":{externalGraphic:this.urlPrefix+"/images/map/stop/rail20.png"},"10":{externalGraphic:this.urlPrefix+"/images/map/stop/pr20.png",fillOpacity:"1.0"},"14":{externalGraphic:this.urlPrefix+"/images/map/stop/tc20.png",fillOpacity:"1.0"}});this.addUniqueValueRules("select","type",{"1":{externalGraphic:this.urlPrefix+"/images/map/stop/bus20ON.png"},"2":{externalGraphic:this.urlPrefix+"/images/map/stop/tram20ON.png"},"3":{externalGraphic:this.urlPrefix+"/images/map/stop/cr20ON.png"},"4":{externalGraphic:this.urlPrefix+"/images/map/stop/streetcar20ON.png"},"5":{externalGraphic:this.urlPrefix+"/images/map/stop/rail20ON.png"},"10":{externalGraphic:this.urlPrefix+"/images/map/stop/pr20ON.png",fillOpacity:"1.0"},"14":{externalGraphic:this.urlPrefix+"/images/map/stop/tc20ON.png",fillOpacity:"1.0"}});console.log("exit wfs.Style")},CLASS_NAME:"trimet.map.wfs.Style"};try{trimet.map.wfs.Style=new trimet.Class(OpenLayers.StyleMap,trimet.map.wfs.Style)}catch(e){console.log("trimet.map.wfs.Style error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.utils");trimet.utils.AnalyticsUtils={TRIP_SUBMIT:"/imap/planner/submit",TRIP_SUCCESS:"/imap/planner/success",TRIP_GEO_ERROR:"/imap/planner/error/geocoder",TRIP_ERROR:"/imap/planner/error/other",TRIP_PRINT:"/imap/planner/print",TRIP_EDIT:"/imap/planner/edit",TRIP_REVERSE:"/imap/planner/reverse",TRIP_FORM_REVERSE:"/imap/planner/form-reverse",VEHICLES:"/imap/vehicles",SEARCH:"/imap/search",TC:"/imap/tc",PR:"/imap/pr",ZIPCAR:"/imap/zipcar",ROUTES:"/imap/routes",SNOW_ROUTES:"/imap/snow_routes",MEASURE:"/imap/measure",DIALOG:"/imap/dialog",MOBILITY:"/imap/mobility/start",MOBILITY_LAYER:"/imap/mobility/layer",gaJsHost:(("https:"==document.location.protocol)?"https://ssl.":"http://www."),pageTracker:null,defaultDomain:"trimet.org",defaultEventName:"unknown event",defaultGoogleId:"UA-688646-3",trinetGoogleId:"UA-688646-4",importGoogleAnalytics:function(A,C){console.log("enter AnalyticsUtils.importGoogleAnalytics");try{document.write(unescape("%3Cscript src='"+this.gaJsHost+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"))}catch(B){console.log("GA EXCEPTION: AnalyticsUtils.importGoogleAnalytics threw exception "+B)}console.log("exit AnalyticsUtils.importGoogleAnalytics")},initGoogleAnalytics:function(A,C){console.log("enter AnalyticsUtils.initGoogleAnalytics");try{if(A==null){A=this.defaultDomain}if(C==null){C=this.defaultGoogleId}this.pageTracker=_gat._getTracker(C);this.pageTracker._setDomainName(A);this.pageTracker._trackPageview()}catch(B){console.log("GA EXCEPTION: AnalyticsUtils.initGoogleAnalytics threw exception "+B)}console.log("exit initGoogleAnalytics")},initGoogleAnalyticsExtOnReady:function(A,B){Ext.onReady(function(){trimet.utils.AnalyticsUtils.initGoogleAnalytics(A,B)
})},gaEvent:function(A){try{if(A==null){A=this.defaultEventName}this.pageTracker._trackPageview(A)}catch(B){console.log("GA EXCEPTION: AnalyticsUtils.gaEvent for "+A+", threw this exception:"+B)}},CLASS_NAME:"trimet.utls.AnalyticsUtils"};trimet.namespace("trimet.utils");trimet.utils.BatchCall={methods:null,initialize:function(){this.methods=new Array()},add:function(C,A,B){if(A!=null&&C!=null){this.methods.push({obj:C,meth:A,args:B})}},batch:function(){for(var B in this.methods){try{if(B==null||B=="remove"){continue}var A=this.methods[B];A.meth.apply(A.obj,A.args)}catch(C){console.log(this.CLASS_NAME+" exception: "+C)}}},CLASS_NAME:"trimet.utils.BatchCall"};trimet.utils.BatchCall=new trimet.Class(trimet.utils.BatchCall);trimet.namespace("trimet.utils");trimet.utils.DateUtils={getPrettyDate:function(E,B,A){var D="";try{if(A==null){A=new Date()}if(E==null){E=""}if(B==null){B=""}D=E+A.toDateString()+" @ "+A.toLocaleTimeString()+B}catch(C){}return D},getMinutesAndSeconds:function(A,D,F,C,B){var E="";if(F==":"){C=":";B=""}if(F=="."){C=".";B=""}if(F==null){F=" min, "}if(C==null){C=" mins, "}if(B==null){B=" secs "}if(A&&A>0){E+=A+(A==1?F:C)}E+=(D<10?"0"+D:D)+B;return E},getMonthAsInt:function(E,D){var C=E;var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];for(var B=0;B<A.length;B++){if(E==A[B]){B++;C="";if(D&&B<10){C="0"}C+=B;break}}return C},getElapsedTime:function(C,A,B){if(A==null){A=0}if(B==null){B=0}var F={};try{var D=Math.round(((new Date().getTime()-C.getTime())/1000)+B);F.min=Math.floor(D/60)+A;F.sec=D%60}catch(E){F={min:A,sec:B}}return F},addDays:function(B,A){if(A==null){A=new Date()}if(B==null){B=365}return new Date(A.getTime()+(1000*60*60*24*B))},fixAmPm:function(C){var B=C;try{C=C.replace(" AM","am");C=C.replace(" PM","pm");B=C}catch(A){}return B},CLASS_NAME:"trimet.utls.DateUtils"};trimet.namespace("trimet.utils");trimet.utils.ExtMessageBox=function(){var B;function A(C,D){return['<div class="msg">','<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>','<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>',C,"</h3>",D,"</div></div></div>",'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',"</div>"].join("")}return{msg:function(F,E){if(!B){B=Ext.DomHelper.insertAfter(document.body,{id:"msg-div",style:"position: absolute; right: 0px; top: 0px;"},true)}var D=String.format.apply(String,Array.prototype.slice.call(arguments,1));var C=Ext.DomHelper.append(B,{html:A(F,D)},true);C.slideIn("t").pause(1).ghost("t",{remove:true})}}}();trimet.namespace("trimet.utils");trimet.utils.ExtStoreReLoader={loader:null,store:null,loadParams:null,maxUpdates:1000,updateInterval:600000,updateTimer:null,loadTime:null,isRunning:function(){return this.loader!=null},load:function(B){console.log("enter load()");try{this.loadParams=B;this.store.load(B)}catch(A){console.log("ERROR: in dialog.Grid.load "+A)}console.log("exit load()")},loader:function(D){console.log("enter loader()");try{if(this.clear){this.clear()}var B=this;var A=1;console.log("dialog.Grid.loader setInterval callback (count 1 of "+B.maxUpdates+") - initial load");D.params.reqTime=new Date().getTime();D.params.reqCount=1;this.store.load(D);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.DIALOG);this.updateTimer=setInterval(function(){if(B.updateInterval<10000){B.updateInterval=20000}if(B.maxUpdates>2000){B.maxInterval=2000}try{A++;if(A>B.maxUpdates){B.stopLoader();Ext.Msg.confirm(B.profile.locale.dialog.tool,B.profile.locale.dialog.timeOut,function(F,G){if(F=="yes"){this.loader(D)}else{if(this.close){this.close()}}},B)}else{console.log("dialog.Grid.loader setInterval callback (count "+A+" of "+B.maxUpdates+")");D.params.reqTime=new Date().getTime();D.params.reqCount=A;B.store.load(D)}}catch(E){B.stopLoader();console.log(E)}},B.updateInterval)}catch(C){console.log("ERROR: in dialog.Grid.loader "+C)}console.log("exit dialog.Grid.loader")},stopLoader:function(){if(this.updateTimer){var A=this.updateTimer;this.updateTimer=null;clearInterval(A)}},CLAZZ_NAME:"trimet.utils.ExtStoreReLoader"};trimet.namespace("trimet.utils");trimet.utils.HtmlUtils={resetSelects:function(C){try{for(var A=0;A<C.length;A++){C[A].selectedIndex=C[A].getAttribute("default")}}catch(B){console.log("EXCEPTION resetSelects(): "+B)}},addOptionToSelect:function(A,D,C){var B=document.createElement("OPTION");B.text=D;B.value=C;console.log("addOptionToSelect %s=%s",B.text,B.value);A.options.add(B)},populateSelectViaArray:function(B,G,A){try{if(!B.valArray||A){B.valArray=G;for(var D in G){var C=G[D];var E=D;if(G[D]!=null){if(G[D].n!=null){C=G[D].n}if(G[D].name!=null){C=G[D].name}if(G[D].v!=null){E=G[D].v}if(G[D].value!=null){E=G[D].value}}this.addOptionToSelect(B,C,E)}}}catch(F){console.log("EXCEPTION HtmlUtils.populateSelectViaArray %s",F)}return true},CLASS_NAME:"trimet.utils.HtmlUtils"};trimet.namespace("trimet.utils");trimet.utils.ObjUtils={m_includeNameAlways:false,m_includeNameForSmalls:true,m_smallStringLength:4,m_fixNameSpacing:true,m_capitolize:true,isArray:function(C){var B=false;try{if(C.constructor.toString().indexOf("Array")==-1){B=false}else{B=true}}catch(A){}return B},deleteFromArray:function(A,F,C){var E=A;try{if(this.isArray(A)){E=new Array();var G=true;for(var B=0;B<A.length;B++){if(A[B]==F&&G){if(!C){G=false}continue}E.push(A[B])}}}catch(D){}return E},getBottomArray:function(A,G){var E=null;var F=10;if(G){F=G}try{var C=A;for(var B=0;B<F;B++){if(!this.isArray(C[0])){E=C;break}C=C[0]}}catch(D){}return E},defaultController:function(A){if(A==null){A={}}if(A.activate==null){A.activate=function(){}}if(A.deactivate==null){A.deactivate=function(){}}return A},fixWord:function(A){var D=A;try{var D=D.trim();if(this.m_fixNameSpacing){D=D.replace("_"," ")}if(this.m_capitolize){var B=D.charAt(0).toUpperCase();if(D.length>1){B+=D.slice(1).toLowerCase()}D=B}}catch(C){}return D},getCoordinate:function(G,D){var B="0.0,0.0";if(D!=null){B=D}try{var F=G.split(",");var E=F[0].trim();var C=F[1].trim();if(E>=0&&E<100000000&&C>=0&&C<100000000){B=E+","+C}}catch(A){console.log("trimet.utils.getCoordinate error for "+G+"; exception "+A)}return B},fixNameValue:function(A){var C=A.v+"";if(this.m_includeNameAlways||(this.m_includeNameForSmalls&&C.length<=this.m_smallStringLength)){var B=this.fixWord(A.n);C=B+" = "+C}return C},getFirstAttribute:function(C,D){var B=D;for(var A in C){B=this.fixNameValue({n:A,v:C[A]});if(B!=null&&B.length>0){break}}return B},getNamedAttribute:function(E,D,F){var C=F;for(var A in E){if(A!=null&&A==D){var B=E[A];if(B!=null&&B.length>0){B=this.fixNameValue({n:A,v:B});if(B!=null&&B.length>0){C=B}}break}}return C},numProperties:function(C,D){var B=0;for(var A in properties){B++}return B},CLASS_NAME:"trimet.utls.ObjUtils"};trimet.namespace("trimet.utils");trimet.utils.ParseUrlParams={staticControl:null,m_params:null,m_arrays:null,m_profile:null,m_vehicles:false,MOBILITY:"mobility",HIDE_STOPS:"hideStops",initialize:function(B){try{trimet.configure(this,B);var A=this.getUrl();this.m_arrays=this.parseQueryStrToArrays(A);this.m_params=trimet.utils.StringUtils.arraysToStrings(this.m_arrays,null,true)}catch(C){console.log("ParseUrlParams constructor "+C)}},makeProfile:function(){var B=null;try{var A=document.domain;if(A==null){A="XXX"}A=A.toLowerCase();if(this.m_params.barrier||this.m_params.mobility||A.contains(this.MOBILITY)){console.log("barrier object",this);B=new trimet.locale.profile.Barrier()}else{console.log("not in barrier",this)}}catch(C){console.log("exception",C,this)}if(B==null){console.log("default to Base profile");B=new trimet.locale.profile.Base()}return B},getProfile:function(){if(this.m_profile==null){this.m_profile=this.makeProfile()}return this.m_profile},getParamValue:function(A,D){var C=D;try{if(this.m_params[A]){C=this.m_params[A]}else{if(this.m_params[A.toLowerCase()]){C=this.m_params[A.toLowerCase()]}}}catch(B){console.log("exception: ",B,this)}return C},setParamValue:function(A,B){this.m_params[A]=B
},isDebug:function(){return this.getParamValue("debug",false)},isVehicles:function(){return this.getParamValue("vehicles",this.m_vehicles)},setVehicles:function(A){this.m_vehicles=A},clearVehicles:function(){this.m_vehicles=false;return this.setParamValue("vehicles",false)},isFullScreen:function(A,B){return this.getParamValue("fullScreen",B)},hasSubmit:function(A,B){return this.getParamValue("submit",B)},showSatelliteView:function(A,B){return this.getParamValue("satellite",B)},isShowStops:function(){var B=true;var A=this.getParamValue(this.HIDE_STOPS);if(A==true){B=false}return B},openTool:function(C,D){try{var B=this.m_arrays.tool;if(B&&B.length>1){B=B[0]}var A=C[B];if(this.m_arrays.routeId){A=C.routes;this.m_arrays.find=this.m_arrays.routeId}if(A&&A.expand){if(!this.isFullScreen()){A.expand(A)}var E=this.getSingleValue(this.m_arrays.id);if(E==null){E=this.getSingleValue(this.m_arrays.find)}if(E&&A.find){A.find(E,A,D)}}}catch(F){console.log("EXCEPTION ParseUrlParams.openTool() "+F)}},getSingleValue:function(B){var A=B;if(B&&B.length&&B[0]){A=B[0]}return A},getPoi:function(F,D){var C={};try{var E=this.m_params;C.x=E.pLon;C.y=E.pLat;C.z=E.zoom;C.t=E.pText;if(C.x==null){C.x=E.lon}if(C.y==null){C.y=E.lat}var A=C;if(F&&A.t){F.highlight(A.x,A.y,A.z,A.t);A.exists=(A.t!=null&&A.x!=null&&A.y!=null)}else{if(D){trimet.utils.OpenLayersUtils.setCenter(D,A.x,A.y,A.z)}}}catch(B){console.log("EXCEPTION: ParseUrlParams.getPoi "+B)}return C},parseQueryStrToStrings:function(A){var B=this.parseQueryStrToArrays(A);return trimet.utils.StringUtils.arraysToStrings(B)},parseQueryStrToArrays:function(E){var D;var B;var C;var A=E.replace(/;/g,"&").split("&");for(E={},D=0;D<A.length;D++){C=A[D].split("=",2);B=unescape(C[0]);if(!E[B]){E[B]=[]}if(C.length>1){E[B][E[B].length]=unescape(C[1])}else{E[B][E[B].length]=true}}return E},getUrl:function(){try{return location.search.substring(1).replace(/\+/g," ")}catch(A){}return null},CLASS_NAME:"trimet.utils.ParseUrlParams"};trimet.utils.ParseUrlParams=new trimet.Class(trimet.utils.ParseUrlParams);trimet.namespace("trimet.utils");trimet.utils.SolrUtils={id:"id",total:"response.numFound",root:"response.docs",fields:[{name:"name"},{name:"address"},{name:"city"},{name:"url"},{name:"lat"},{name:"lon"},{name:"x"},{name:"y"},{name:"bbox"},{name:"type"},{name:"vtype"},{name:"number",type:"string"},{name:"pad_number"},{name:"weekday"},{name:"saturday"},{name:"sunday"},{name:"inbound_name"},{name:"outbound_name"},{name:"frequent"},{name:"zone_id"},{name:"stop_id"},{name:"landmark_id"},{name:"amenities"},{name:"street_direction"},{name:"providers"},{name:"ada_boundary"},{name:"trimet_boundary"},{name:"spaces"},{name:"routes"},{name:"notes"},{name:"use"}],solrDataToVectors:function(B){var E=[];for(var C=0;C<B.length;C++){var F=B[C].data;var D=new OpenLayers.Geometry.Point(F.x,F.y);var A=new OpenLayers.Feature.Vector(D);F.feature=A;E.push(A)}return E},makeSolrStore:function(B,A){return trimet.utils.ExtUtils.makeJsonStore(B,this.id,this.total,this.root,this.fields,A)},CLASS_NAME:"trimet.utils.SolrUtils"};trimet.namespace("trimet.utils");trimet.utils.StringFormattingUtils={tableTemplate:function(B){var A='<table class="${cls}"><tbody>${rows}</tbody></table>';return trimet.utils.StringUtils.format(A,B)},rowTemplate:function(B){var A='<tr class="${cls}"><td class="${nameCls}">${name}</td><td class="${valueCls}">${value}</td></tr>';return trimet.utils.StringUtils.format(A,B)},currency:function(E){var C=E.toString().replace(/\$|\,/g,"");if(isNaN(C)){C="0"}var B=(C==(C=Math.abs(C)));C=Math.floor(C*100+0.50000000001);var A=C%100;C=Math.floor(C/100).toString();if(A<10){A="0"+A}for(var D=0;D<Math.floor((C.length-(1+D))/3);D++){C=C.substring(0,C.length-(4*D+3))+","+C.substring(C.length-(4*D+3))}return(((B)?"":"-")+"$"+C+"."+A)},percent:function(D,A){var C=D;try{if(D<=1){C=Math.round(D*100)}if(A==true){A="%"}if(A!=null){C+=A}}catch(B){}return C},formatDate:function(B){var A=B;if(B.length==6){A=B.substr(4)+" / "+B.substr(0,4)}return A},isEmptyValue:function(C,E){if(C===null){return true}if(C===""){return true}var A=["price","year","date"];for(var B in A){var D=A[B];if(E.contains(D)){if(C===0||C==="0"){return true}break}}return false},formatTaxlotDetails:function(G){var B="";var F='<TR VALIGN="TOP" class="${cls}"><TD WIDTH="3%" class="taxText"><P><BR/></P></TD><TD WIDTH="47%">${name}</TD><TD WIDTH="50%" >${value}</TD></TR>';var D=["taxOdd","taxEven"];var H=["taxlot_id","landuse","year_built","sale_date","sale_price","trimet_boundary","ada_boundary"];for(var E in H){var C=H[E];if(G.hasOwnProperty(C)&&G[C]!==null){var A=G[C];if(this.isEmptyValue(A,C)){continue}if(C=="landuse"){A='<a href="/data/overlay/landuse.html#'+A+'" target="_blank">'+A+"</a>"}if(C=="taxlot_id"){A=this.formatTaxlotID(G)}if(C.contains("date")){A=this.formatDate(A)}if(C.contains("price")){A=this.currency(A)}var J=J=="taxOdd"?"taxEven":"taxOdd";var I={cls:J,name:C.replace("_"," "),value:A};B+=trimet.utils.StringUtils.format(F,I)}}return B},formatTaxlotID:function(A){var B='<a href="http://gis.co.multnomah.or.us/mcormaptif/$[trimet.utils.StringUtils.getSubString(\'${taxlot_id}\')].tif" target="_blank">${taxlot_id}</a>.';return trimet.utils.StringUtils.format(B,A)},propertiesToTable:function(C){var E=[];for(var G in C){if(C.hasOwnProperty(G)){var B=(B=="a"?"b":"a");var A={cls:"feature_field "+B,name:G.replace("_"," "),nameCls:"feature_name",value:C[G],valueCls:"feature_value"};var F=trimet.utils.StringFormattingUtils.rowTemplate(A);E.push(F)}}E=E.join("");var D=trimet.utils.StringFormattingUtils.tableTemplate({cls:"feature_data",rows:E});return D},getStateCode:function(A){var B="04000US41";if(A=="Washington"){B="04000US53"}return B},getCounty:function(C,B){var A=C;if(C==null){return""}if(B==null){B=true}C=C.toUpperCase();if(C=="M"||C=="MULT"){A="Multnomah"}if(C=="C"||C=="CLACK"){A="Clackamas"}if(C=="W"||C=="WASH"){A="Washington"}if(C=="CLRK"){A="Clark"}var D=" County";if(B&&A.indexOf(D)<0){A+=D}return A},getState:function(B){var A="Oregon";if(B=="Clark"||B=="Vancouver"||B=="Camas"||B=="Yacolt"||B=="Washougal"||B=="La Center"||B=="Ridgefield"||B=="Battle Ground"){A="Washington"}return A},getDirectionString:function(D,H,I,C,E,G,B){var A="";var F=this.getDirection(D,H,E,G);if(F&&F.length>1){if(I&&I.length>0){A+=I}A=F;if(C&&C.length>0){A+=C}if(B&&B.length>0){A="<"+B+">"+A+"</"+B+">"}}return A},getDirection:function(C,H,A,G){if(H==null||H.split!=null){H=trimet.locale.English.directions}if(G==null){G=C}var F=G;try{switch(C.toLowerCase()){case"n":F=H.north;break;case"s":F=H.south;break;case"e":F=H.east;break;case"w":F=H.west;break;case"se":F=H.southEast;break;case"ne":F=H.northEast;break;case"sw":F=H.southWest;break;case"nw":F=H.northWest;break;default:return G}if(A&&F&&F.length>1){var D=F.substring(0,1).toUpperCase();var B=F.substring(1);F=D+B}}catch(E){}return F},padRouteID:function(A){var B=A;if(A.length==1){B="00"+A}else{if(A.length==2){B="0"+A}}return B},getRouteURL:function(E,A,B){var D="";var C='<a href="http://trimet.org/schedules/r${id}.htm" target="_blank">#[${public_id};;${public_id}-]${name}</a>';D=trimet.utils.StringUtils.format(C,{id:this.padRouteID(E),public_id:A,name:B});return D},parseRailCodes:function(A){var C="";try{if(A=="SC"){C+=this.getRouteURL("193",null,"Portland Streetcar")}else{if(A=="CR"){C+=this.getRouteURL("203",null,"WES Commuter Rail")}else{if(A.match("B")){C+=this.getRouteURL("100",null,"MAX Blue Line");C+="<br/>"}if(A.match("R")){C+=this.getRouteURL("90",null,"MAX Red Line");C+="<br/>"}if(A.match("Y")){C+=this.getRouteURL("190",null,"MAX Yellow Line");C+="<br/>"}if(A.match("G")){C+=this.getRouteURL("200",null,"MAX Green Line");C+="<br/>"}if(A.match("K")){C+=this.getRouteURL("150",null,"Portland Mall Route");C+="<br/>"}}}}catch(B){}return C},routeCSVtoHtmlTable:function(B){var H=false;var D='<p style="display:inline"><table><tr><th>'+trimet.locale.English.labels.servedBy+"</th></tr>";var F=B.split(";");for(var C=0;C<F.length;C++){var E=F[C].split(":");var A=E[0];var G=E[2];
if(E[1]&&E[1].length>0){G=E[1]+"-"+G}D+="<tr><td>"+G+"</td></tr>";H=true}D+="</table>";D+="</p>";return H?D:""},serviceDayString:function(A){var B="";if(A.weekday&&A.saturday&&A.sunday){B="All Days"}else{if(A.weekday){B="Weekdays"}if(A.saturday){if(B.length>0){B+=" / "}B+="Saturday"}if(A.sunday){if(B.length>0){B+=" / "}B+="Sunday"}}if(B.length>0){B="<b>Service Days: </b>"+B}else{B="<b>Service Note: </b> this route <B>lacks</B> a fixed schedule (it could be a future service preview or a shuttle lacking a formal schedule)."}return B},CLASS_NAME:"trimet.utils.StringFormattingUtils"};trimet.namespace("trimet.utils");trimet.utils.TrimetUtils={tpFeedback:function(){try{var F=this.planner.getTripInfo();var C="mapfeedback@trimet.org";var D="iMap v"+trimet.utils.Constants.VERSION+" Feedback";var A="My comments on the map (v"+trimet.utils.Constants.VERSION+") on "+trimet.utils.DateUtils.getPrettyDate()+"\n\n";var B="";var G="";if(F.valid&&F.url&&F.txtUrl){B=encodeURIComponent(F.url).replace(/%20/g,"+");A+=F.txt+"\n";G+='<br/><br/><b>Map Link </b> to the <a target="_blank" href="'+F.url+'">map with the current trip inputs</a>.<br/><br/>';G+='<b>Trip Planner Problems?</b><br/>You might want to see <a target="_blank" href="'+F.txtUrl+'">what the text trip planner says</a>.<br/>(And please send us feedback where differences exist between the two systems).'}Ext.Msg.alert("Feedback",'Please send your thoughts on our map to <a href="mailto:'+C+"?Subject="+encodeURIComponent(D)+"&Body="+encodeURIComponent(A)+B+'">'+C+"</a>."+G)}catch(E){console.log("exception Planner.clear "+E)}},CLASS_NAME:"trimet.utils.TrimetUtils"};trimet.namespace("trimet.widget.configure");trimet.widget.configure.ConfigureStatic={url:trimet.utils.URL.configure,store:null,storeConfig:trimet.widget.configure.ConfigureStore,loadCallback:null,loadCallbackTHIS:null,initialize:function(A){console.log("enter Configure constructor");try{this.loadCallbackTHIS=this;trimet.configure(this,A);if(A.loadCallback){this.loadCallback=A.loadCallback}this.makeStore(A);this.loadTime=new Date();this.store.load()}catch(B){console.log("ERROR: in Configure.initialize "+B)}console.log("exit Configure constructor")},get:function(A){if(A==null){A=0}return this.store.getAt(A)},getStore:function(){return this.store},clear:function(){try{this.store.removeAll()}catch(A){console.log("ERROR: in Configure.clear "+A)}},makeStore:function(A){try{this.store=trimet.utils.ExtUtils.makeJsonStore(this.url,this.storeConfig.id,this.storeConfig.total,this.storeConfig.root,this.storeConfig.fields,A);this.store.on("load",this.loadCallback,this.loadCallbackTHIS)}catch(B){console.log("ERROR: in Configure.makeStore "+B)}},loadStoreCB:function(){console.log("enter Configure.loadStoreCB");try{this.loadTime=new Date()}catch(A){console.log("ERROR: in Configure.loadStoreCB "+A)}console.log("exit Configure.loadStoreCB")},CLASS_NAME:"trimet.widget.configure.Configure"};trimet.widget.configure.Configure=new trimet.Class(trimet.widget.configure.ConfigureStatic);trimet.namespace("trimet.widget.dialog");trimet.widget.dialog.DialogStatic={profile:trimet.locale.profile.BaseStatic,makeDialog:trimet.utils.ExtUtils.makeHtmlPopup,messages:[],dialog:null,initialize:function(A){console.log("enter dialog.Dialog constructor");trimet.configure(this,A);console.log("exit dialog.Dialog constructor")},getDialog:function(){return this.dialog},close:function(){try{this.dialog.close()}catch(A){console.log("ERROR: in dialog.close "+A)}},rotate:function(D){try{var A=this.messages[i];var C=A.timeout>0&&A.timeout<1000000?A.timeout:20;var A=this.getMessage(D);if(A==null){A=this.getMessage(0)}if(A!=null){this.updateDialog(A.url,A.title)}}catch(B){console.log("ERROR: Dialog.show "+B)}},show:function(C){try{var A=this.getMessage(C);if(A==null){A=this.getMessage(0)}if(A!=null){this.updateDialog(A.url,A.title)}}catch(B){console.log("ERROR: Dialog.show "+B)}},getMessage:function(C){var B=null;try{B=this.messages[C]}catch(A){console.log("ERROR: Dialog.getMessage "+A)}return B},updateDialog:function(A,C){try{if(this.dialog==null){this.dialog=this.makeDialog(A,C,true,null,null,true)}else{if(A!=null){if(C!=null){this.dialog.setTitle(C)}this.dialog.show()}else{this.dialog.show()}}}catch(B){this.dialog=null;console.log("ERROR: Dialog.updateDialog "+B)}},CLASS_NAME:"trimet.widget.dialog.Dialog"};trimet.widget.dialog.Dialog=new trimet.Class(trimet.widget.dialog.DialogStatic);trimet.namespace("trimet.widget.feature");trimet.widget.feature.AbstractFeatureGrid={profile:trimet.locale.profile.BaseStatic,controller:null,singleton:null,map:null,layer:null,isVectorLayer:false,popup:null,template:null,cls:null,autoLoad:true,grid:null,store:null,sm:null,columns:null,expander:null,findQuery:null,suspendPan:false,POPUP_CONFIG:{width:300,unpinnable:false,collapsible:false,autoDestory:false,shadow:true},creator:function(A){console.log("enter feature creator constructor");this.controller=trimet.utils.ObjUtils.defaultController(this.controller);this.singleton=this;trimet.widget.feature.Templates.profile=this.profile;if(this.layer==null){this.makeVectorLayer(A)}this.store=trimet.utils.SolrUtils.makeSolrStore(this.url,{layer:this.layer,autoLoad:this.autoLoad});this.makeGrid(A.panelName);if(this.template==null){this.template=trimet.widget.feature.Templates.DEFAULT_TEMPLATE}this.makeEvents();this.sm=this.grid.getSelectionModel();console.log("exit feature creator constructor")},getPanel:function(){return this.grid},getGrid:function(){return this.grid},getLayer:function(){return this.layer},clear:function(){try{this.hidePopup();this.sm.clearSelections();this.findQuery=null;this.clearCB()}catch(A){console.log("ERROR: in feature.clear "+A)}},clearCB:function(){},expand:function(A){if(A==null){A=this}if(A&&A.grid){A.grid.bubble(A.grid.expand)}},showCB:function(){},selectCB:function(B,C,A){this.expand();this.select(A)},select:function(A){if(A==null){return }var B=A.data;console.log("selectCB "+B.name);this.checkLayer();this.focus(B);this.showPopup(B)},deselectCB:function(B,D,A){console.log("deSelectCB "+A.data.name);this.hidePopup();var C=this.sm.getSelected();this.select(C)},showLayerCB:function(){console.log("feature.showLayerCB");this.checkLayer();this.layer.setVisibility(true);this.layer.redraw();this.controller.activate(this.CLASS_NAME);this.showCB()},hideLayerCB:function(){console.log("feature.hideLayerCB");this.clear();this.layer.setVisibility(false);this.controller.deactivate(this.CLASS_NAME)},loadStoreCB:function(B,A,C){if(this.isVectorLayer){var E=trimet.utils.SolrUtils.solrDataToVectors(A);this.layer.addFeatures(E)}if(this.findQuery!=null){var D=this.findQuery;this.findQuery=null;this.find(D,this,this.suspendPan);this.suspendPan=false}},isLoading:0,checkLayer:function(){if(this.isLoading>0&&this.isLoading<10){this.isLoading++;return }this.isLoading=0;if(this.store&&this.store.getCount()<1){console.log("feature.checkLayer - loading the empty store.");this.isLoading=1;this.store.load({params:{start:0}})}},findInGridAndClick:function(G,D,C){var F=false;try{this.expand();this.checkLayer();var A=this.findInStore(G,D,C);if(A<0){console.log("warning: feature findInGridAndClick() couldn't actually find element "+G+" with value of "+D)}else{this.sm.selectRow(A);F=true;var B=this;setTimeout(function(){try{B.grid.getView().focusRow(A);B.grid.getView().focusRow(A-1);B.grid.getView().focusRow(A);B.grid.getView().focusCell(A,0);B.grid.getView().focusRow(A+1)}catch(H){}},1500)}}catch(E){console.log("EXCPETION: feature findInGridAndClick "+E)}return F},findInStore:function(E,B,A){var D=-111;try{if(A){D=this.store.findExact(E,B);if(D<0){D=this.store.findExact(E,B+"")}}else{D=this.store.find(E,B)}}catch(C){console.log("EXCPETION: feature.findInStore "+C)}return D},wfsLandmarkClick:function(A){try{this.checkLayer();var C=A.attributes.id;this.findInGridAndClick("landmark_id",C,true)}catch(B){console.log("EXCPETION: feature wfsLandmarkClick "+B)}},find:function(F,A,C){if(F==null){return }try{if(A==null){A=this}A.suspendPan=(C?true:false);
if(A.singleton){A.singleton.suspendPan=(C?true:false)}var E=false;var D=["number","landmark_id","stop_id"];for(var B=0;B<D.length;B++){E=this.findInGridAndClick(D[B],F,true);if(E){break}}if(!E){E=this.findInGridAndClick("name",F,false)}if(E==false){A.findQuery=F}else{A.suspendPan=false;A.singleton.suspendPan=false}}catch(G){console.log("EXCPETION: feature.find() "+G)}},focus:function(A){try{trimet.utils.OpenLayersUtils.zoomToGeometry(this.map,A.feature.geometry)}catch(B){console.log("ERROR: in feature.focus "+B)}},getPopupConfig:function(B){var D={};try{var A=this.template.apply(B);D={title:B.name,feature:B.feature,html:A};trimet.inherit(D,this.POPUP_CONFIG)}catch(C){console.log("ERROR: in feature.getPopupContent "+C)}return D},showPopup:function(B){try{this.hidePopup();var A=this.getPopupConfig(B);this.popup=new GeoExt.Popup(A);this.popup.show()}catch(C){console.log("ERROR: in feature.showPopup "+C)}},hidePopup:function(){try{if(this.popup&&this.popup.anc){this.popup.close();this.popup.destroy();this.popup=null}}catch(A){console.log("ERROR: in feature.hidePopup "+A)}},makeVectorLayer:function(A){try{this.isVectorLayer=true;this.sm=new GeoExt.grid.FeatureSelectionModel();this.layer=trimet.utils.OpenLayersUtils.simpleVectorLayers(A.layerName,A.icon,A.onIcon);this.map.addLayer(this.layer)}catch(B){console.log("ERROR: in feature.makeVecortLayer "+B)}},makeEvents:function(){this.grid.on("expand",this.showLayerCB,this);this.grid.on("collapse",this.hideLayerCB,this);this.grid.store.on("load",this.loadStoreCB,this);this.grid.getSelectionModel().on("rowselect",this.selectCB,this);this.grid.getSelectionModel().on("rowdeselect",this.deselectCB,this)},makeGrid:function(C){if(this.columns==null){this.columns=[{header:"Name",dataIndex:"name",width:300,sortable:true,id:"name"},{header:"Address",dataIndex:"address",width:90,sortable:true,hidden:true,id:"address"},{header:"City",dataIndex:"city",width:90,sortable:true,hidden:true,id:"city"}]}var B={title:C,iconCls:this.cls,store:this.store,layer:this.layer,columns:this.columns,stripeRows:true,autoScroll:true,autoWidth:true,autoExpandColumn:"name",sm:this.sm};if(this.expander){console.log("feature.makeGrid: doing expander stuff");var A=[this.expander];B.plugins=A;this.columns=A.concat(this.columns);B.columns=this.columns}this.grid=new Ext.grid.GridPanel(B)},hideColumn:function(D,B){try{var A=this.grid.getColumnModel();A.setHidden(D,B)}catch(C){console.log("ERROR: in feature.showColumn id:"+D+" show:"+B+" error:"+C)}},CLAZZ_NAME:"trimet.widget.feature.AbstractFeatureGrid"};trimet.namespace("trimet.widget.feature");trimet.widget.feature.ParkRideGrid={url:trimet.utils.URL.solrPR,cls:"pr-panel",initialize:function(A){console.log("enter feature.ParkRideGrid constructor");trimet.inherit(this,trimet.widget.feature.AbstractFeatureGrid);trimet.configure(this,A);if(this.template==null){trimet.widget.feature.Templates.profile=this.profile;this.template=trimet.widget.feature.Templates.getPrTcPopupTemplate()}this.creator({panelName:this.profile.locale.tools.pr,layerName:this.profile.locale.tools.pr,icon:"/images/map/stop/pr20.png",onIcon:"/images/map/stop/pr20ON.png"});this.hideColumn(2,false);console.log("exit feature.ParkRideGrid constructor")},showCB:function(){trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.PR)},CLASS_NAME:"trimet.widget.feature.ParkRideGrid"};trimet.widget.feature.ParkRideGrid=new trimet.Class(trimet.widget.feature.ParkRideGrid);trimet.namespace("trimet.widget.feature");trimet.widget.feature.RouteGridStatic={url:trimet.utils.URL.solrRoutes,wmsURL:trimet.utils.URL.cachedWMS,routeHighlight:null,maxSelections:50,cachedSelections:null,cls:"routes-panel",initialize:function(A){console.log("enter feature.RouteGrid constructor");trimet.inherit(this,trimet.widget.feature.AbstractFeatureGrid);trimet.configure(this,A);trimet.widget.feature.RouteGridStatic.singleton=this;this.singleton=this;this.controller=trimet.utils.ObjUtils.defaultController(this.controller);this.routeHighlight=new trimet.map.layer.RouteHighlight({urls:this.wmsURL,map:this.map,visibility:false});this.expander=new Ext.grid.RowExpander({tpl:new Ext.XTemplate("{[trimet.widget.feature.Templates.frequentService(values.name, values.vtype, values.frequent)]}","{[trimet.widget.feature.Templates.getScheduleLinks(values)]}")});this.creator({panelName:this.profile.locale.tools.routes,layerName:this.profile.locale.tools.routes});this.grid.on("beforeexpand",this.beforeShowCB,this);this.grid.store.on("load",this.loadStoreCB,this);console.log("exit feature.RouteGrid constructor")},beforeShowCB:function(){this.routeHighlight.blank();this.cachedSelections=null;if(this.controller&&this.controller.vehiclesOff){this.controller.vehiclesOff()}},showCB:function(){trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.ROUTES)},filter:function(A){},isCollapsed:function(){return this.grid.collapsed},hasSelections:function(){return this.sm.hasSelection()},getSelectedRoutes:function(B){if(this.grid.collapsed&&this.cachedSelections!=null){return this.cachedSelections}var A=new Array();if(B==null){B=this.maxSelections}try{var E=this.sm.getSelections();for(var C=0;C<E.length&&C<B;C++){var G=E[C];var D=G.get("number");if(!this.filter(D)){A.push(D)}}this.cachedSelections=A}catch(F){console.log("exception: routes.getSelectedRoutes "+F)}return A},selectListOfRoutes:function(B){try{for(var A in B){this.findInGridAndClick("number",B[A])}}catch(C){console.log("exception: routes.selectRoutes "+C)}},selectCB:function(A,C,B){console.log("RouteGrid select "+C);this.showRoutes();this.controller.activate(this.CLASS_NAME);this.expander.expandRow(C)},deselectCB:function(A,C,B){console.log("RouteGrid deselect "+C);this.showRoutes();this.controller.deactivate(this.CLASS_NAME);this.expander.collapseRow(C)},showRoutes:function(){console.log("enter showRoutes ");try{var H;var B=new Array();var F=this.sm.getSelections();for(var C=0;C<F.length&&C<this.maxSelections;C++){var G=F[C];var D=G.get("pad_number");B.push(D);var A=G.get("bbox");H=trimet.utils.OpenLayersUtils.growBBox(H,A)}if(this.routeHighlight.highlight(B)){if(!this.suspendPan){trimet.utils.OpenLayersUtils.zoomToBBox(this.map,H)}}}catch(E){console.log("exception: showRoutes "+E)}console.log("exit showRoutes ");return true},CLASS_NAME:"trimet.widget.feature.RouteGrid"};trimet.widget.feature.RouteGrid=new trimet.Class(trimet.widget.feature.RouteGridStatic);trimet.namespace("trimet.widget.feature");trimet.widget.feature.SnowRouteStatic={map:null,wmsURL:trimet.utils.URL.cachedWMS,name:"current:snow_route",styles:"linBusSnow",visibility:false,routeHighlight:null,maxSelections:50,cachedSelections:null,initialize:function(A){console.log("enter feature.SnowRoute constructor");trimet.configure(this,A);trimet.widget.feature.SnowRouteStatic.singleton=this;this.singleton=this;this.routeHighlight=new trimet.map.layer.RouteHighlight({name:this.name,styles:this.styles,urls:this.wmsURL,map:this.map,visibility:this.visibility});console.log("exit feature.SnowRoute constructor")},showCB:function(){trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.SNOW_ROUTES);this.routeHighlight.visible(true)},hideCB:function(){this.routeHighlight.visible(false)},toggle:function(A,B){console.log("enter feature.SnowRoute.toggle");if(B==true){this.showCB()}else{this.hideCB()}console.log("exit feature.SnowRoute.toggle")},CLASS_NAME:"trimet.widget.feature.SnowRoute"};trimet.widget.feature.SnowRoute=new trimet.Class(trimet.widget.feature.SnowRouteStatic);trimet.namespace("trimet.widget.feature");try{trimet.widget.feature.Templates={profile:trimet.locale.profile.Base,DEFAULT_TEMPLATE:new Ext.XTemplate("<p>{name}</p>","<p>{address}</p>").compile(),TTRACK:new Ext.XTemplate('<a target="_blank" href="http://trimet.org/arrivals/routeStopsList.html?routeNumber={num}">TransitTracker</a>').compile(),ROUTE_MAP:new Ext.XTemplate('<a target="_blank" href="http://trimet.org/schedules/r{num}pop.htm">','<img style="max-width:310px" alt="route schematic map" src="http://trimet.org/images/schedulemaps/{num}-Simple.gif"></img>',"</a><BR/>",'<a target="_blank" href="http://trimet.org/pdfs/maps/{num}.pdf">Download route map PDF</a>').compile(),TTPUB:new Ext.XTemplate('<li> <a href="http://trimet.org/schedules/{key}/t1{num}_{dir}.htm"   target="_blank">{name}</a> </li>').compile(),getTimeTableString:function(C,B,A,E,D,G){var F="";
if(C){F+="<h4>"+C+":</h4>";F+="<ul>";if(E){F+=this.TTPUB.applyTemplate({key:"w",dir:A,name:this.profile.locale.service.weekdays,num:B})}if(D){F+=this.TTPUB.applyTemplate({key:"s",dir:A,name:this.profile.locale.service.saturday,num:B})}if(G){F+=this.TTPUB.applyTemplate({key:"h",dir:A,name:this.profile.locale.service.sunday,num:B})}F+="</ul>"}return F},getScheduleLinks:function(A){var B="";B+='<div style="width: 47%; float: left; margin-right: 10px; clear: left; padding-top: 5px; padding-bottom: 10px;">';B+=this.getTimeTableString(A.inbound_name,A.pad_number,"1",A.weekday,A.saturday,A.sunday);B+="</div>";B+='<div style="width: 47%; float: left; padding-top: 5px; padding-bottom: 10px;">';B+=this.getTimeTableString(A.outbound_name,A.pad_number,"0",A.weekday,A.saturday,A.sunday);B+="</div>";return B},getModeType:function(B){var A=B;if(B=="5"){A="trains"}if(B=="4"){A="vehicles"}if(B=="3"){A="trains"}if(B=="2"){A="vehicles"}if(B=="1"){A="buses"}return A},frequentService:function(A,B,D){var C="";if(D){C='<br/><div class="fs_body"><a target="_blank" href="http://trimet.org/bus/frequentservice.htm"><img width="45" hspace="0" border="0" align="left" style="padding-right: 10px;" src="/images/ui/trimet.org/frequent.png" alt="Frequent Service"></a><p>'+this.profile.locale.frequent.first+A+" "+this.getModeType(B)+" "+this.profile.locale.frequent.last+"</p></div><br/>"}return C},getTransitTrackerString:function(A){var B="";if(A){B=this.TTRACK.applyTemplate({num:A})+"<br/><br/>"}return B},getPrTcPopupTemplate:function(){var A="<h3>{name}</h3>";var K="<p>{address}<br/>{city}</p>";var J='<tpl if="use && use.length &gt; 0"><p>&nbsp;</p><p>&#149; {use}</p></tpl>';var H='<tpl if="spaces"><p>&#149; {spaces} parking spaces</p></tpl>';var G='<tpl if="notes && notes.length &gt; 0"><p>&nbsp;</p><p>NOTE: {notes}</p></tpl>';var D='<h5>Driving directions from Google</h5>Enter a starting address and click "Go."'+this.getDriveForm();var F="";for(var E=0;E<arguments.length;E++){if(arguments[E]!=null&&arguments[E].length>0){F+="&#149; "+arguments[E]+" <br/>"}}var C=this.profile.templates!=null?this.profile.templates.birdsEyeView:"";var I='<div class="x-tab-panel-body">'+A+K+J+H+F+G+D+"</div>";var B=new Ext.XTemplate(I);B.compile();return B},getDriveForm:function(A){if(A==null){A=30}return'<p><form target="_blank" method="get" action="http://www.google.com/maps"><input type="hidden" value="{lat},{lon}" name="daddr"/><b><input id="saddr" type="text" value="" name="saddr" maxlength="45" size="'+A+'"/></b> <input type="submit" value="Go"/></form></p>'},CLAZZ_NAME:"trimet.widget.feature.Templates"}}catch(e){console.log("feature.Templates Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.widget.feature");trimet.widget.feature.TransitCenterGrid={url:trimet.utils.URL.solrTC,cls:"tc-panel",initialize:function(A){console.log("enter feature.TransitCenterGrid constructor");trimet.inherit(this,trimet.widget.feature.AbstractFeatureGrid);trimet.configure(this,A);if(this.template==null){this.template=trimet.widget.feature.Templates.getPrTcPopupTemplate()}this.creator({panelName:this.profile.locale.tools.tc,layerName:this.profile.locale.tools.tc,icon:"/images/map/stop/tc20.png",onIcon:"/images/map/stop/tc20ON.png"});this.hideColumn(2,false);console.log("exit feature.TransitCenterGrid constructor")},showCB:function(){trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TC)},CLASS_NAME:"trimet.widget.feature.TransitCenterGrid"};trimet.widget.feature.TransitCenterGrid=new trimet.Class(trimet.widget.feature.TransitCenterGrid);trimet.namespace("trimet.widget.feature");trimet.widget.feature.ZipcarGrid={url:trimet.utils.URL.solrZipcar,zipURL:"http://www.zipcar.com/portland/meet-location?name=find_loc&location_id=",zipURL:"http://www.zipcar.com/portland/car-profile?popup_p=t&vehicle_id=68898801",cls:"zipcar-panel",initialize:function(A){console.log("enter feature.ZipcarGrid constructor");trimet.inherit(this,trimet.widget.feature.AbstractFeatureGrid);trimet.configure(this,A);this.creator({panelName:this.profile.locale.tools.zipcar,layerName:this.profile.locale.tools.zipcar,icon:"/images/map/stop/zipcar20.png",onIcon:"/images/map/stop/zipcar20ON.png"});console.log("exit feature.ZipcarGrid constructor")},showCB:function(){trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.ZIPCAR)},getPopupConfig:function(A){var C={};try{C={title:A.name,feature:A.feature,autoLoad:this.zipURL+A.name};trimet.inherit(C,this.STATIC_POPUP_CONFIG)}catch(B){console.log("ERROR: in Zipcar.getPopupContent "+B)}return C},CLASS_NAME:"trimet.widget.feature.ZipcarGrid"};trimet.widget.feature.ZipcarGrid=new trimet.Class(trimet.widget.feature.ZipcarGrid);trimet.namespace("trimet.widget.feature");trimet.widget.feature.Grid={createPopupFromFeature:function(C,E){var D=null;try{var F=C.id+"_popup";var B=(C.marker)?C.marker.icon:null;C.popup=new C.popupClass(F,C.lonlat,C.data.popupSize,C.data.popupContentHTML,B,true);if(C.data.overflow!=null){C.popup.contentDiv.style.overflow=C.data.overflow}C.popup.feature=C;if(E){E.addPopup(C.popup,true)}D=C.popup}catch(A){}return D},highlightFeature:function(C,A){if(C&&A){var B=C.marker.icon;B.url=A;B.draw()}},mousePointer:function(B,C){try{B.style.cursor=C}catch(A){}},m_template:null,m_grid:null,m_store:null,m_gridView:null,m_activeFeature:null,m_lastRowIndex:null,m_gridSelectionModel:null,m_offPointer:"",m_onPointer:"pointer",icon:null,iconURL:null,highlightIconURL:null,popup:null,popupClass:null,features:null,selectedFeature:null,initialize:function(B,A){popupClass=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{minSize:new OpenLayers.Size(280,265),maxSize:new OpenLayers.Size(350,320)});OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array();if(this.icon==null){this.icon=OpenLayers.Marker.defaultIcon()}this.iconURL=this.icon.url;if(this.m_grid!=null){this.m_grid.on("rowclick",this.gridClickCB,this);this.m_store=this.m_grid.getStore();this.m_gridView=this.m_grid.getView();this.m_gridSelectionModel=this.m_grid.getSelectionModel();this.parseData()}},createPopupFromGridRow:function(B){var A=findFeatureFromRecord(B,this.features);if(A){createPopupFromFeature(A,this.map)}},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments)},parseData:function(){var L=this.m_store.getCount();if(L<1){this.m_store.load({params:{start:0}});L=this.m_store.getCount()}for(var E=0;E<L;E++){var B=this.m_store.getAt(E);var F=null;if(this.m_template){F=this.m_template.applyTemplate(B.data)}else{F=B.get("name")}var H=B.get("x");var G=B.get("y");var J=new OpenLayers.LonLat(H,G);var A;var I=true;if(I){var D={};if(this.icon!=null){D.icon=this.icon.clone()}else{D.icon=OpenLayers.Marker.defaultIcon()}if(F){D.popupContentHTML=F}D.overflow=A||"auto";var K=new OpenLayers.Feature(this,J,D);K.m_record=B;K.popupClass=this.popupClass;this.features.push(K);var C=K.createMarker();if(F!=null){C.events.register("click",K,this.markerClickCB);C.events.register("mouseover",K,this.mouseOverCB);C.events.register("mouseout",K,this.mouseOutCB)}this.addMarker(C)}}},mouseOverCB:function(A){mousePointer(A.element,this.layer.m_onPointer);highlightFeature(this,this.layer.highlightIconURL)},mouseOutCB:function(A){mousePointer(A.element,this.layer.m_offPointer);if(this.layer.highlightIconURL){highlightFeature(this,this.layer.iconURL)}},markerClickCB:function(A){var D=true;if(this!=this.layer.selectedFeature){D=false}this.layer.selectedFeature=this;if(this.popup==null){this.popup=this.createPopup(true)}this.layer.map.addPopup(this.popup,true);if(D){this.popup.toggle()}else{this.popup.show()}var E=this.m_record;if(E){var B=new Array();B.push(E);this.layer.m_gridSelectionModel.selectRecords(B,false);var C=this.layer.m_gridSelectionModel;var F=C.lastActive;this.layer.m_gridView.focusRow(F);this.layer.m_lastRowIndex=F}OpenLayers.Event.stop(A)},gridClickCB:function(C,G,E){if(this.m_lastRowIndex==G){return 
}this.m_lastRowIndex=G;var B=C.getStore().getAt(G);var A=B.get("x");var F=B.get("y");var D=this.map;this.createPopupFromGridRow(B,D);if(E!=null){OpenLayers.Event.stop(E)}return true},gridHighlightCB:function(A,E,C){if(this.m_activeFeature){highlightFeature(m_activeFeature,iconURL)}var D=A.getStore().getAt(E);var B=findFeatureFromRecord(D,this.features);if(B&&url){this.m_activeFeature=B;highlightFeature(B,iconURL)}},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var A=this.features[0];OpenLayers.Util.removeItem(this.features,A);A.destroy()}}},showLayer:function(){if(this.features==null||this.features.length<1){this.parseData()}this.setVisibility(true);this.redraw()},hideLayer:function(){if(this.map){this.map.raiseLayer(this,-100);clearPopups(this.map)}this.setVisibility(false)},CLASS_NAME:"trimet.widget.feature.Grid"};try{trimet.widget.feature.Grid=new trimet.Class(OpenLayers.Layer.Markers,trimet.widget.feature.Grid)}catch(e){console.log("trimet.widget.feature.Grid: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.widget.feature");trimet.widget.feature.Store={m_template:null,m_store:null,m_gridView:null,m_activeFeature:null,m_offPointer:"",m_onPointer:"pointer",icon:null,iconURL:null,highlightIconURL:null,features:null,selectedFeature:null,initialize:function(B,A){OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments);this.features=new Array();if(this.icon==null){this.icon=OpenLayers.Marker.defaultIcon()}this.iconURL=this.icon.url;if(this.m_store!=null){this.m_store.on("datachanged",this.parseData,this)}},createPopupFromGridRow:function(C){var B=this.map;var A=findFeatureFromRecord(C,this.features);if(A){createPopupFromFeature(A,B)}},destroy:function(){this.clearFeatures();this.features=null;OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments)},parseData:function(){var L=this.m_store.getCount();if(L>0){this.clearFeatures();for(var E=0;E<L;E++){var B=this.m_store.getAt(E);var F=null;if(this.m_template){F=this.m_template.applyTemplate(B.data)}else{F=B.get("name")}var H=B.get("x");var G=B.get("y");var J=new OpenLayers.LonLat(H,G);var A;var I=true;if(I){var D={};D.icon=this.icon.clone();if(F){D.popupContentHTML=F}D.overflow=A||"auto";var K=new OpenLayers.Feature(this,J,D);K.m_record=B;this.features.push(K);var C=K.createMarker();if(F!=null){C.events.register("click",K,this.markerClickCB);C.events.register("mouseover",K,this.mouseOverCB);C.events.register("mouseout",K,this.mouseOutCB)}this.addMarker(C)}}}},mouseOverCB:function(A){mousePointer(A.element,this.layer.m_onPointer);highlightFeature(this,this.layer.highlightIconURL)},mouseOutCB:function(A){mousePointer(A.element,this.layer.m_offPointer);if(this.layer.highlightIconURL){highlightFeature(this,this.layer.iconURL)}},markerClickCB:function(A){this.layer.selectedFeature=this;clearPopups(this.layer.map);var B=this.createPopup(true);this.layer.map.addPopup(B);OpenLayers.Event.stop(A)},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var A=this.features[0];OpenLayers.Util.removeItem(this.features,A);A.destroy()}}},showLayer:function(){if(this.features==null||this.features.length<1){this.parseData()}this.setVisibility(true)},hideLayer:function(){clearPopups(this.map);this.setVisibility(false)},CLASS_NAME:"trimet.widget.feature.Store"};try{trimet.widget.feature.Store=new trimet.Class(OpenLayers.Layer.Markers,trimet.widget.feature.Store)}catch(e){console.log("trimet.widget.feature.Store: error creating this type...please ignore this error if you are not using OpenLayers")}trimet.namespace("trimet.widget.measure");trimet.widget.measure.Measure={map:null,locale:trimet.locale.English,outputPanel:null,outputParentDiv:trimet.utils.OpenLayersUtils.MAP_PANEL,outputMethod:console.log,m_control:null,m_onOff:false,units:"english",sketchSymbolizers:{Point:{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},Line:{strokeWidth:2,strokeOpacity:1,strokeColor:trimet.utils.OpenLayersUtils.ORANGE,strokeDashstyle:"dash"},Polygon:{strokeWidth:2,strokeOpacity:1,strokeColor:"#666666",fillColor:"white",fillOpacity:0.3}},initialize:function(A){console.log("enter measure.Measure constructor");trimet.configure(this,A);var B=new OpenLayers.Style();B.addRules([new OpenLayers.Rule({symbolizer:this.sketchSymbolizers})]);var D=new OpenLayers.StyleMap({"default":B});this.m_control=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{persist:true,handlerOptions:{layerOptions:{styleMap:D}},callbacks:{modify:function(E,F){this.measurePartial(E,F.geometry)}},persist:true});this.m_control.events.on({measure:this.measureCB,measurepartial:this.measureCB,activate:function(){this.map.div.style.cursor="crosshair"},deactivate:function(){this.map.div.style.cursor="default";this.off();var E=this;window.setTimeout(function(){E.off()},500)},scope:this});if(this.outputPanel==null){this.makeExtToolTip()}try{this.map.addControl(this.m_control);this.m_control.displaySystem=this.units}catch(C){}console.log("exit measure.Measure constructor")},measureCB:function(E){var A=E.units;var D=E.measure;var C=3;if(A=="in"||A=="ft"){C=0}var B="measure: "+D.toFixed(C)+" "+A;this.write(B)},geodesic:function(A){if(A==true){}else{}},on:function(){try{this.m_control.activate();this.toggleOutput(true);this.m_onOff=true;trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.MEASURE)}catch(A){}},off:function(){try{this.m_control.deactivate();this.toggleOutput(false);this.m_onOff=false}catch(A){}},toggle:function(){if(this.m_onOff==false){this.on();this.m_onOff=true}else{this.off();this.m_onOff=false}},write:function(B){try{this.outputMethod.call(this.outputPanel,B);this.outputPanel.show()}catch(A){}},makeButton:function(C){var B={};try{B={id:"measure-button",iconCls:"measure-button",text:this.locale.buttons.measure,tooltip:this.locale.buttons.measureTip,enableToggle:true,scope:this,handler:this.toggle};if(C!=null){C.addButton(B)}}catch(A){}return B},toggleOutput:function(A){try{if(A==false){this.outputPanel.hide();this.outputPanel.disable()}else{this.outputPanel.enable();this.clearOutput();this.outputPanel.show()}}catch(B){}},clearOutput:function(A){this.write(this.locale.buttons.measureInfo)},makeExtToolTip:function(){try{this.outputPanel=new Ext.ToolTip({target:this.outputParentDiv,title:this.locale.buttons.measureInfo,width:175,dismissDelay:0,showDelay:0,disabled:true,hidden:true,trackMouse:true});this.outputMethod=this.outputPanel.setTitle}catch(A){}console.log("exit measure.Measure constructor")},CLASS_NAME:"trimet.widget.measure.Measure"};try{trimet.widget.measure.Measure=new trimet.Class(trimet.widget.measure.Measure)}catch(e){console.log("trimet.widget.ui.ContextMenu: error creating this type...please ignore this error if you are not using Ext")}trimet.namespace("trimet.widget.measure");trimet.widget.measure.MeasurePanel={m_offText:"tool off",m_onText:"tool on",m_emptyText:"<<- click button...",m_activeEmptyText:"draw to measure ...",toolGroup:null,persistSketch:true,measureControl:null,map:null,measurementOutput:null,defaultDisplaySystem:"english",defaultGeometryType:"line",numDec:1,sketchGeometry:null,sketchHandlerOptions:null,m_button:null,sketchSymbolizers:{Point:{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#FF3300"},Line:{strokeWidth:3,strokeOpacity:1,strokeColor:"#FE3402",strokeDashstyle:"dash"},Polygon:{strokeWidth:2,strokeOpacity:1,strokeColor:"#FE3402",fillColor:"white",fillOpacity:0.3}},initComponent:function(){var A=new OpenLayers.Style();A.addRules([new OpenLayers.Rule({symbolizer:this.sketchSymbolizers})]);var B=new OpenLayers.StyleMap({"default":A});this.sketchHandlerOptions={style:"default",persist:this.persistSketch,layerOptions:{styleMap:B}};this.measurementOutput=new Ext.form.TextField({name:"output",emptyText:this.m_emptyText,width:140});this.m_button=new Ext.Button({xtype:"button",text:this.m_onText,enableToggle:true,enableToggle:true,pressed:false,toggleGroup:this.toolGroup,listeners:{toggle:function(C,D){this.clearOutput();
if(D){this.measureControl.activate();this.measurementOutput.setValue(this.m_activeEmptyText);C.setText(this.m_offText)}else{this.deactivate(this)}},scope:this}});this.items=[{xtype:"fieldset",title:"Options",autoHeight:true,collapsible:true,collapsed:true,width:280,items:[{layout:"column",border:false,defaults:{layout:"form",width:125,labelWidth:30,border:false},items:[{items:[{xtype:"radio",name:"geomtype",fieldLabel:"Type",boxLabel:"distance",inputValue:"line",checked:(this.defaultGeometryType=="line"),listeners:{check:this.updateGeometryType,scope:this}},{xtype:"radio",name:"geomtype",fieldLabel:"",labelSeparator:"",boxLabel:"area",inputValue:"polygon",checked:(this.defaultGeometryType=="polygon"),listeners:{check:this.updateGeometryType,scope:this}}]},{items:[{xtype:"radio",name:"displayunits",fieldLabel:"Units",boxLabel:"English",inputValue:"english",checked:(this.defaultDisplaySystem=="english"),listeners:{check:this.updateDisplaySystem,scope:this}},{xtype:"radio",name:"displayunits",fieldLabel:"",labelSeparator:"",boxLabel:"metric",inputValue:"metric",checked:(this.defaultDisplaySystem=="metric"),listeners:{check:this.updateDisplaySystem,scope:this}}]}]}]},{xtype:"panel",layout:"column",height:40,border:false,defaults:{border:false},items:[{xtype:"panel",width:75,items:[this.m_button]},this.measurementOutput]}];trimet.widget.measure.MeasurePanel.superclass.initComponent.call(this);this.on("beforecollapse",this.deactivate,this);this.constructControl()},clearOutput:function(){this.measurementOutput.setValue("");this.sketchGeometry=null},clear:function(A){this.deactivate(this)},deactivate:function(A){A.measureControl.deactivate();A.clearOutput();A.m_button.setText(A.m_onText);A.m_button.pressed=false;return true},constructControl:function(){this.measureControl=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{eventListeners:{measure:this.handleMeasurement,measurepartial:this.handleMeasurement,scope:this},handlerOptions:this.sketchHandlerOptions});this.map.addControl(this.measureControl);this.measureControl.displaySystem=this.defaultDisplaySystem},handleMeasurement:function(C){if(C.measure>0){this.sketchGeometry=C.geometry;var D=(C.measure>100)?0:this.numDec;var B=OpenLayers.Number.format(C.measure,D);var A=(C.order==2)?"sq. "+C.units:C.units;this.measurementOutput.setValue(B+" "+A)}},updateDisplaySystem:function(A,B){if(B){this.measureControl.displaySystem=A.getGroupValue();if(this.sketchGeometry){this.measureControl.measure(this.sketchGeometry,"measure")}}},updateGeometryType:function(A,C){if(C){var B=A.getGroupValue()=="line"?OpenLayers.Handler.Path:OpenLayers.Handler.Polygon;this.clearOutput();this.measureControl.updateHandler(B,this.sketchHandlerOptions)}},CLASS_NAME:"trimet.widget.measure.MeasurePanel"};try{trimet.widget.measure.MeasurePanel=Ext.extend(Ext.menu.Menu,trimet.widget.measure.MeasurePanel)}catch(e){console.log("trimet.widget.ui.ContextMenu: error creating this type...please ignore this error if you are not using Ext")}trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.Control={fadeAll:false,zoomExtent:false,maxZIndex:0,ui:null,map:null,select:null,initialize:function(A){console.log("enter overlay.Control constructor");trimet.configure(this,A)},error:function(A){Ext.Msg.alert("Error",A)},status:function(A){this.ui.setText(A)},start:function(A){A!=null?this.ui.setText(A):this.ui.setText("<blink>Select is Working!</blink>");this.map.hideOverlayLayer()},finish:function(A){A!=null?this.ui.setText(A):this.ui.clearTextPanel()},clear:function(){this.map.hideOverlayLayer();this.ui.clear();this.toggleCtlKey(true)},wfsAjaxCB:function(B,A){this.ui.showListOfFeatures(B,A)},renderFeature:function(A){this.ui.showFeature(A);this.map.drawFeatureOnOverlayLayer(A);if(this.zoomExtent){this.map.zoomToExtentOfOverlayLayer()}},setUI:function(A){this.ui=A},setMap:function(A){this.map=A},setSelectFeature:function(A){this.select=A;this.map.getMap().addControl(this.select);this.select.activate();trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.MOBILITY_LAYER)},elevationInfoHandler:function(A){},toggleCtlKey:function(A){if(A==true||this.selectON){this.select.selectViaCTL();this.selectON=false}else{this.select.selectON();this.selectON=true;this.ui.show()}},selectActivate:function(A){this.select.activate()},selectDeActivate:function(A){this.select.deactivate()},setMaxFeatures:function(A){},selectLayer:function(A){A.show()},deSelectLayer:function(A){A.hide()},fade:function(G,F){var D=[];try{for(var B=0;B<G.length;B++){var E=G[B];var A=E.attributes;if(E.ui.isChecked()&&(this.fadeAll||E.isSelected())){A.opacity=F*0.01;A.layer.changeOpacity(A.opacity)}D.push(A.id+" : "+trimet.utils.StringFormattingUtils.percent(A.opacity,true)+" opaque<br/>")}this.ui.setText(D)}catch(C){console.log("Exception in Control.fade() layer adjustment routine")}},reorder:function(D){var C=this.maxZIndex;for(var B=0;B<D.length;B++){console.log("setting z to "+C);var A=D[B].attributes.layer;A.setZIndex(C);C--}},nodeAdded:function(D){try{var B=D.attributes;B.wmsLayer=B.id;B.map=this.map.getMap();var A=new trimet.widget.overlay.Layer(B);B.layer=A;this.maxZIndex=A.getZIndex()}catch(C){}},getActiveLayers:function(){var A=[];this.ui.getRoot().cascade(function(D){if(D.ui.isChecked()){var C=D.id.replace(/.*:/,"");var B=D.attributes.defName;if(B==null){B=C}A.push({name:C,defName:B,id:D.id,template:D.attributes.template,style:D.style||"",pk:D.attributes.pk,filter:D.filter||"INCLUDE"})}});return A},CLASS_NAME:"trimet.widget.overlay.Control"};trimet.widget.overlay.Control=new trimet.Class(trimet.widget.overlay.Control);trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.Factory={control:null,panel:null,button:null,create:function(D,E,C,B){trimet.widget.overlay.MapDecorator.decorate(E);this.control=new trimet.widget.overlay.Control({map:E,ui:D});trimet.widget.overlay.SelectFeatureFactory(this.control);B=trimet.extend(B,{toolButtonControl:false,toolButtonClear:false,control:this.control});var A=new trimet.widget.overlay.MainPanel(B);this.panel=A.getPanel();this.button=C;this.button.on("toggle",this.control.toggleCtlKey,this.control);this.panel.on("expand",this.button.show,this.button);this.panel.on("collapse",this.clear,this);return this},getPanel:function(){return this.panel},clear:function(A){if(A){this.button.hide()}this.button.toggle(false);this.control.clear()},CLAZZ_NAME:"trimet.widget.overlay.Factory"};trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.FeatureInfoPanel={m_defaultText:"Select a feature to view its info here...",m_root:null,m_treePanel:null,m_infoPanel:null,m_window:null,m_windowShown:false,control:null,initialize:function(A){console.log("enter overlay.FeatureInfoPanel constructor");trimet.configure(this,A);this.m_root=new Ext.tree.TreeNode({expanded:true});this.m_treePanel=new Ext.tree.TreePanel({title:"Features",region:"north",height:150,width:160,autoScroll:true,collapsible:true,split:true,useArrows:true,rootVisible:false,root:this.m_root,tools:[{id:"search",qtip:"<b>Extent Zoom <i>is Off</i></b><br/>Click to  <i>Turn On</i> &nbsp; Extent Zoom.  When a feature is clicked, the map will zoom to that extent.",handler:function(D,C,B){if(this.selected){C.replaceClass("x-tool-save","x-tool-search");this.dom.qtip=this.qtipOFF;this.selected=false;B.m_control.zoomExtent=false}else{if(this.qtipOFF==null){this.qtipOFF=this.dom.qtip;this.qtipON="<b>Extent Zoom <i>is On</i></b><br/>Click to  <i> Turn Off</i> &nbsp; Extent Zoom.  The map will no longer zoom when features are clicked."}C.replaceClass("x-tool-search","x-tool-save");this.dom.qtip=this.qtipON;this.selected=true;B.m_control.zoomExtent=true}}}]});this.m_treePanel.m_control=this.control;this.m_infoPanel=new Ext.Panel({title:"Feature Info",xtype:"panel",region:"center",autoScroll:true,height:270,html:this.m_defaultText});this.m_window=trimet.utils.ExtUtils.makeBorderLayoutWindow([this.m_treePanel,this.m_infoPanel])},hideWindow:function(){if(this.m_windowShown){this.m_window.hide()
}this.m_windowShown=false},showWindow:function(A){if(A!=null){this.m_window.setTitle(A)}this.m_windowShown=true;this.m_window.show()},makeNode:function(B,A){B.metaData=this.findMetaData(B,A);var C=new Ext.tree.TreeNode({text:this.getName(B,"pk"),feature:B,listeners:{click:{scope:this,fn:function(F,E){var D=F.attributes.feature;this.control.renderFeature(D)}}}});return C},clearFeaturesTree:function(){var A=this.m_root.firstChild;while(A){this.m_root.removeChild(A);A.destroy();A=this.m_root.firstChild}},showFeature:function(B){var A=this.getFeatureInfoAsHTML(B);this.updateInfoPanel(A)},updateInfoPanel:function(A){try{if(this.m_infoPanel.body==null){this.m_infoPanel.html=A}else{this.m_infoPanel.body.update(A)}}catch(B){}},showListOfFeatures:function(C,A){this.clearFeaturesTree();for(var B=0;B<C.length;++B){this.m_root.appendChild(this.makeNode(C[B],A))}this.m_treePanel.setTitle(C.length+" Features");if(this.m_root.childNodes.length>1){this.updateInfoPanel(this.m_defaultText)}else{var D=this.m_root.firstChild;D.fireEvent("click",D)}this.showWindow("Feature Info ("+C.length+")")},getFeatureInfoAsHTML:function(B){if(typeof B.info==="undefined"){var A=B.metaData;if(A!=null){if(A.id.indexOf("trimet:taxlot")>=0){B.info=this.getTaxlotAsHTML(B)}else{if(A.template!=null){B.info=trimet.utils.StringUtils.format(A.template,B.properties)}}}if(typeof B.info==="undefined"){B.info=trimet.utils.StringFormattingUtils.propertiesToTable(B.properties)}}return B.info},getTaxlotAsHTML:function(K){var E=K.properties;var I='<TABLE class="taxText" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0"><COL WIDTH="5%"><COL WIDTH="40%"><COL WIDTH="55%">${rows}</TABLE>';var J='<TR><TD COLSPAN="3" WIDTH="100%" class="taxTitle">${type}</TD></TR><TR VALIGN=TOP><TD></TD><TD COLSPAN=2 WIDTH=95%>${name}${address}${city}</TD></TR>';var B={type:"Owner",name:trimet.utils.StringUtils.getStringFromObject(E,"owner_[0-9]"," ")+"<br/>",address:trimet.utils.StringUtils.getStringFromObject(E,"owner_address","<br/>"),city:trimet.utils.StringUtils.getStringFromObject(E,"owner_city",", ")+trimet.utils.StringUtils.getStringFromObject(E,"owner_zip"," ")+"<br/>"};var D=trimet.utils.StringUtils.getStringFromObject(E,"county","");D=trimet.utils.StringFormattingUtils.getCounty(D);var G={type:"Property",name:"",address:trimet.utils.StringUtils.getStringFromObject(E,"site_address","<br/>"),city:trimet.utils.StringUtils.getStringFromObject(E,"site_city",", ")+trimet.utils.StringUtils.getStringFromObject(E,"site_zip","<br/>")+D};var A=trimet.utils.StringUtils.format(J,B);var F=trimet.utils.StringUtils.format(J,G);var H=trimet.utils.StringFormattingUtils.formatTaxlotDetails(E);var C=trimet.utils.StringUtils.format(I,{rows:A+"<br/>"+F+"<br/>"+H+"<br/>"});return C},getName:function(B,F){var E=F;try{var C=B.metaData.pk;if(C==null){C="id"}var A=B.metaData.defName;if(A==null){B.id}E=trimet.utils.ObjUtils.getNamedAttribute(B.properties,C,A)}catch(D){}return E},findMetaData:function(D,A,B){var E=null;if(A.length==1){E=A[0]}else{if(A.length>1){E=A[0];B=B!=null?B:"id";var F=D[B];for(var C in A){if(F.contains(A[C].name)){E=A[C];break}}}}return E},CLASS_NAME:"trimet.widget.overlay.FeatureInfoPanel"};trimet.widget.overlay.FeatureInfoPanel=new trimet.Class(trimet.widget.overlay.FeatureInfoPanel);trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.Layer={wmsLayer:"",styles:null,wfsURL:null,wmsURL:null,map:null,maxOpacity:1,minOpacity:0,opacity:0.65,visible:false,autoZoom:true,minZoom:0,initialize:function(A){console.log("enter overlay.Layer constructor");this.wfsURL=trimet.utils.URL.wfs;this.wmsURL=trimet.utils.URL.cachedWMS;trimet.configure(this,A);var B={layers:this.wmsLayer,transparent:true,format:"image/png",pallet:"tm8png",minZoomLevel:this.minZoom};if(this.styles!=null){B.styles=this.styles}this.wmsLayer=new OpenLayers.Layer.WMS("haloLayer-"+this.wmsLayer,[this.wmsURL],B,{isBaseLayer:false,singleTile:true,ratio:1.725,visibility:false,minZoomLevel:this.minZoom});this.map.addLayer(this.wmsLayer);this.changeOpacity(this.opacity);console.log("exit overlay.Layer constructor")},show:function(){this.visible=true;this.wmsLayer.setVisibility(true);this.wmsLayer.redraw()},hide:function(){this.visible=false;this.wmsLayer.setVisibility(false)},changeOpacity:function(A){this.opacity=Math.min(this.maxOpacity,Math.max(this.minOpacity,A));this.wmsLayer.setOpacity(this.opacity);this.wmsLayer.redraw()},getZIndex:function(){return this.map.getLayerIndex(this.wmsLayer)},setZIndex:function(A){this.map.setLayerIndex(this.wmsLayer,A)},CLASS_NAME:"trimet.widget.overlay.Layer"};trimet.widget.overlay.Layer=new trimet.Class(trimet.widget.overlay.Layer);trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.MainPanel={m_mainPanel:null,text:null,textHTML:null,root:null,tree:null,slider:null,infoUI:null,control:null,semaphore:false,toolButtonControl:true,toolButtonClear:true,toolButtonOpacity:true,dataURL:"/data/overlay/layers.json",helpURL:"/data/overlay/help.html",initialize:function(A){console.log("enter overlay.MainPanel constructor");trimet.configure(this,A);this.makeTree();this.slider=this.makeSlider(0.5);this.text=trimet.utils.ExtUtils.makeTextPanel();this.infoUI=new trimet.widget.overlay.FeatureInfoPanel({control:this.control});this.showListOfFeatures=function(C,B){this.infoUI.showListOfFeatures(C,B)};this.showFeature=function(B){this.infoUI.showFeature(B)};this.m_mainPanel=this.makeMainPanel();this.control.setUI(this);this.clearTextPanel();console.log("exit overlay.MainPanel constructor")},clear:function(){this.infoUI.hideWindow();this.clearTree();this.clearTextPanel()},show:function(){this.m_mainPanel},getRoot:function(){return this.root},getPanel:function(){return this.m_mainPanel},setText:function(B){if(B===null){B=""}try{if(this.textHTML===null&&this.text.body.dom.innerHTML!=null){this.textHTML=this.text.body.dom.innerHTML}}catch(A){}this.text.body.update(B)},makeNameIdStore:function(){var A=new Ext.data.SimpleStore({fields:[{name:"name"},{name:"id"}],sortInfo:{field:"name",direction:"ASC"}});return A},clearTextPanel:function(A){try{if(this.textHTML!==null){this.text.body.update(this.textHTML)}else{this.text.load({url:A!=null?A:this.helpURL,discardUrl:false,nocache:false,text:"Loading...",timeout:30,scripts:false})}}catch(B){}},makeMainPanel:function(){var A=new Ext.Panel({title:"Overlays",iconCls:"layers-panel",titleCollapse:false,tools:this.makeButtons4MainPanel(),items:[this.tree,this.slider,this.text]});A.m_control=this.control;return A},makeButtons4MainPanel:function(){var A=[];if(this.toolButtonControl){A.push({id:"restore",qtip:"<b>Feature Selection w/<i>Control Key</i></b><br/> Click here and you no longer have to hold the control key to select features.  Problem is that you won't be able to move the map (just click here again to turn me off).",handler:function(D,C,B){if(this.selected){C.replaceClass("x-tool-down","x-tool-restore");this.dom.qtip=this.qtipOFF;this.selected=false;B.m_control.toggleCtlKey()}else{if(this.qtipOFF==null){this.qtipOFF=this.dom.qtip;this.qtipON="<b>Feature Selection with <i>just</i> the mouse</b><br/>Want to be able to scroll the  map with the mouse again?  OK, click me (and don't forget that you'll need to hold down the <i>Control</i> button to select)."}C.replaceClass("x-tool-restore","x-tool-down");this.dom.qtip=this.qtipON;this.selected=true;B.m_control.toggleCtlKey()}}})}if(this.toolButtonOpacity){A.push({id:"pin",qtip:"<b>Opacity Control</b>  <i>Single Layer</i><br/>Opacity slider will fade a single layer.  BTW: the layer must be both checked and selected--with a blue highlight--to be faded.",handler:function(D,C,B){if(this.selected){C.replaceClass("x-tool-unpin","x-tool-pin");this.dom.qtip=this.qtipOFF;this.selected=false;B.m_control.fadeAll=false}else{if(this.qtipOFF==null){this.qtipOFF=this.dom.qtip;this.qtipON="<b>Opacity Control</b>  <i>All Checked Layers</i><br/>Opacity slider will now fade all of the checked layers."}C.replaceClass("x-tool-pin","x-tool-unpin");this.dom.qtip=this.qtipON;
this.selected=true;B.m_control.fadeAll=true}}})}if(this.toolButtonClear){A.push(trimet.utils.ExtUtils.makeToolButton())}return A},setSliderValue:function(A){if(A==null){return }if(A<=1){A=A*100}this.semaphore=true;this.slider.setValue(A,true);this.semaphore=false},sliderCB:function(A,B){if(this.semaphore){return }var C=this.root.childNodes;this.control.fade(C,B)},makeSlider:function(A){var C=new Ext.ux.SliderTip({getText:function(D){return String.format("<b>{0}%</b> opaque",D.getValue())}});var B=new Ext.Slider({width:214,increment:5,value:A*100,minValue:0,maxValue:100,plugins:C});B.on("change",this.sliderCB,this);return B},clearTree:function(){var D=this.root.childNodes;for(var A=0;A<D.length;A++){var B=D[A];B.unselect();var C=B.getUI();C.toggleCheck(false)}},nodeClickCB:function(B,A){if(this.semaphore){return }try{this.semaphore=true;var D=B.getUI();D.toggleCheck(true);this.setSliderValue(B.attributes.opacity);this.semaphore=false}catch(C){}},nodeCheckboxCB:function(B,C){var A=B.attributes.layer;if(C){console.log("checkbox checked");this.control.selectLayer(A);B.select();this.nodeClickCB(B,null)}else{console.log("checkbox un-checked");this.control.deSelectLayer(A);B.unselect()}},nodeMoveCB:function(B,G,D,F,C){var A="";try{this.control.reorder(F.childNodes);this.nodeClickCB(G)}catch(E){}},makeNodeLayerCB:function(A){try{var E=A.childNodes;for(var B=0;B<E.length;B++){var D=E[B];D.on("checkchange",this.nodeCheckboxCB,this);D.on("click",this.nodeClickCB,this);D.on("move",this.nodeMoveCB,this);this.control.nodeAdded(D)}this.control.reorder(E)}catch(C){}},makeTree:function(){this.tree=new Ext.tree.TreePanel({id:"LayerTree",animate:true,autoScroll:true,loader:new Ext.tree.TreeLoader({dataUrl:this.dataURL}),enableDD:true,rootVisible:false,containerScroll:true});this.root=new Ext.tree.AsyncTreeNode({id:"LayerTreeRoot",text:"Map Layers",draggable:false});this.tree.setRootNode(this.root);this.root.on("load",this.makeNodeLayerCB,this)},CLASS_NAME:"trimet.widget.overlay.MainPanel"};trimet.widget.overlay.MainPanel=new trimet.Class(trimet.widget.overlay.MainPanel);trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.MapDecorator={decorate:function(A){A.overlayLayer=null;trimet.extend(A,this);if(typeof A.geoJsonFormatter==="undefined"){A.geoJsonFormatter=new OpenLayers.Format.GeoJSON()}},hideOverlayLayer:function(){try{this.overlayLayer.display(false);this.overlayLayer.destroyFeatures()}catch(A){}},drawFeatureOnOverlayLayer:function(B){if(this.overlayLayer==null){this.overlayLayer=new OpenLayers.Layer.Vector();this.map.addLayer(this.overlayLayer)}if(typeof B.vector==="undefined"){var A=this.geoJsonFormatter.read(B)[0];B.vector=A}this.overlayLayer.destroyFeatures();this.overlayLayer.addFeatures(B.vector);this.overlayLayer.display(true)},zoomToExtentOfOverlayLayer:function(){try{var A=this.overlayLayer.getDataExtent();this.map.zoomToExtent(A,true);if(this.map.getZoom()>7){this.map.zoomOut()}}catch(B){}},CLAZZ_NAME:"trimet.widget.overlay.MapDecorator"};trimet.namespace("trimet.widget.overlay");trimet.widget.overlay.SelectFeature={start:trimet.defaultMethod,finish:trimet.defaultMethod,status:trimet.defaultMethod,wfsCB:trimet.defaultMethod,selectOnCB:trimet.defaultMethod,selectOffCB:trimet.defaultMethod,getActiveLayers:trimet.defaultMethod,map:null,wfsURL:null,maxFeatures:200,buffer:5,box:null,cqlTemplate:"${filter} AND INTERSECT(geom, ${wkt})",initialize:function(A){this.wfsURL=trimet.utils.URL.wfs;OpenLayers.Control.prototype.initialize.apply(this,arguments);this.buffer=this.buffer||0.1},draw:function(){this.box=new OpenLayers.Handler.Box(this,{done:this.notice},{keyMask:OpenLayers.Handler.MOD_CTRL});this.box.activate()},getActiveLayersAsString:function(){var F=this.getActiveLayers();if(F==null){return""}F.reverse();var B,C=[],E=[],D=[];for(var A=0;A<F.length;++A){B=F[A];C.push(B.id);D.push(B.filter)}C=C.join(",");E=E.join(",");D=D.join(";");F={layers:C,styles:E,filters:D};return F},notice:function(E){if(this.map==null){this.deactivate();console.log("Error: mis-configured SelectFeature controller.");return }var U=this.getActiveLayersAsString();var F=U.layers;if(F==null||F.length<1){var B='One or more "available layers" need to be activated.';console.log(B);this.status(B);return }this.start();var T,R;if(E instanceof OpenLayers.Pixel){T=this.map.getLonLatFromPixel(E);var J=T.lon;var H=T.lat;var G=this.map.getNumZoomLevels();var A=this.map.getZoom();var O=this.buffer*(G-A);var D=new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(J-O,H-O),new OpenLayers.Geometry.Point(J-O,H+O),new OpenLayers.Geometry.Point(J+O,H+O),new OpenLayers.Geometry.Point(J+O,H-O)]);R=new OpenLayers.Geometry.Polygon([D])}else{if(E instanceof OpenLayers.Bounds){T=this.map.getLonLatFromPixel(E.getCenterPixel());var N=this.map.getLonLatFromPixel(new OpenLayers.Pixel(E.left,E.bottom));var C=this.map.getLonLatFromPixel(new OpenLayers.Pixel(E.right,E.top));var E=new OpenLayers.Bounds(N.lon,N.lat,C.lon,C.lat);R=E.toGeometry()}else{console.log("SelectFeature bounds type must be Point or Bounds.")}}var Q=R.toString();var I=U.filters.split(";");var L=[];for(var P=0;P<I.length;++P){var K=I[P];var M=trimet.utils.StringUtils.format(this.cqlTemplate,{filter:K,wkt:Q});L.push(M)}L=L.join(";");var S={maxFeatures:this.maxFeatures,request:"GetFeature",outputFormat:"JSON",typeName:F,cql_filter:L};Ext.Ajax.request({method:"GET",url:this.wfsURL,params:S,scope:this,success:function(V){try{var X=Ext.decode(V.responseText);if(X.features.length){this.wfsCB(X.features,this.getActiveLayers())}else{this.status("No features were found near where you clicked.")}}catch(W){console.log("WFS ajax call error: "+this.wfsURL)}this.finish()},failure:function(){this.status("Error: Could not select a feature (not sure why?).  Please try again.");this.finish("Error: Could not select a feature (not sure why?).  Please try again.")}})},deactivate:function(){OpenLayers.Control.prototype.deactivate.apply(this,arguments);console.log("deactivate the control");this.finish()},selectON:function(){this.box.keyMask=OpenLayers.Handler.MOD_NONE;this.box.dragHandler.keyMask=OpenLayers.Handler.MOD_NONE;this.selectOnCB()},selectViaCTL:function(){this.box.keyMask=OpenLayers.Handler.MOD_CTRL;this.box.dragHandler.keyMask=OpenLayers.Handler.MOD_CTRL;this.selectOffCB()},CLASS_NAME:"trimet.widget.overlay.SelectFeature"};try{trimet.widget.overlay.SelectFeature=OpenLayers.Class(OpenLayers.Control,trimet.widget.overlay.SelectFeature)}catch(e){console.log("no worries if this exception is thrown...just means that OpenLayers is not included in your html file (eg: maybe this is not an OL project)")}trimet.widget.overlay.SelectFeatureFactory=function(E,B){var D=null;try{var A={};A.map=E.map.getMap();A.wfsURL=E.map.wfsURL;A.getActiveLayers=function(){return E.getActiveLayers()};A.wfsCB=function(G,F){return E.wfsAjaxCB(G,F)};A.error=function(F){return E.error(F)};A.status=function(F){return E.status(F)};A.start=function(F){return E.start(F)};A.finish=function(F){return E.finish(F)};if(B!=null&&B.on&&B.off){A.selectOffCB=function(){B.off()};A.selectOnCB=function(){B.on()}}D=new trimet.widget.overlay.SelectFeature(A);E.setSelectFeature(D)}catch(C){console.log("EXCEPTION in SelectFeatureFactory: problem creating the SelectFeature object...."+C)}return D};trimet.namespace("trimet.widget.planner");trimet.widget.planner.StaticForms={profile:trimet.locale.profile.BaseStatic,planner:null,contextMenu:null,poi:null,url:null,m_panel:null,m_fromErrorStore:null,m_toErrorStore:null,m_geoErrorPopup:null,m_fromForm:null,m_toForm:null,m_date:null,m_time:null,m_arrStore:null,m_arrForm:null,m_walkStore:null,m_walkForm:null,m_optimizeStore:null,m_optimizeForm:null,m_modeStore:null,m_modeForm:null,m_submitButton:null,m_fromCoord:"0.0,0.0",m_toCoord:"0.0,0.0",m_xmlRespRecord:null,initialize:function(A){console.log("enter Forms() constructor");try{this.url=trimet.utils.URL.planner;trimet.configure(this,A);if(this.m_xmlRespRecord==null){this.m_xmlRespRecord=new Ext.data.XmlReader({record:"response",success:"@success"},["date","time","from","to","locations","fromList","toList"])
}this.makeMainPanel();trimet.widget.planner.StaticForms=this}catch(B){console.log("EXCEPTION planner.Forms.initialize() "+B)}console.log("exit Forms() constructor")},getPanel:function(){return this.m_panel},submit:function(){console.log("enter planner.Forms.submit()");try{this.collapseComboBoxes();this.hideErrorDialogs();trimet.utils.ExtUtils.setTripPlannerCookie();this.m_panel.form.submit({method:"GET",url:this.url,waitMsg:this.profile.locale.tripPlanner.labels.submitMsg});trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_SUBMIT)}catch(A){console.log("exception Forms.submit exception "+A)}console.log("exit planner.Forms.submit()")},preSubmit:function(C,D){console.log("enter planner.Forms.preSubmit()");this.m_fromForm.persist();this.m_toForm.persist();this.collapseComboBoxes();this.hideErrorDialogs();var F=this.m_toForm.getRawValue();var B=this.m_fromForm.getRawValue();var A=trimet.utils.ObjUtils.getCoordinate(this.m_toCoord);var E=trimet.utils.ObjUtils.getCoordinate(this.m_fromCoord);C.setValues({fromCoord:E,fromPlace:B,toCoord:A,toPlace:F});console.log("exit planner.Forms.preSubmit()")},submitSuccess:function(A,B){console.log("enter Forms.submitSuccess");try{this.planner.newTripPlan(B.response.responseXML,this.getFormData());if(this.poi){this.poi.clearTrip()}trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_SUCCESS)}catch(C){console.log("EXCEPTION planner.Forms.submitSuccess() "+C)}console.log("exit Forms.submitSuccess")},submitFailure:function(A,B){console.log("enter Forms.submitFailure");try{this.m_submitButton.focus();if(B&&B.response&&B.response.responseXML){this.tripRequestError(B.response.responseXML)}}catch(C){console.log("EXCEPTION planner.Forms.submitFailure() "+C)}console.log("exit Forms.submitFailure")},tripRequestError:function(F){var N=null;var B=-111;var O=null;var G=null;var D=null;try{var A=[{header:"Name",width:0.75,sortable:true,dataIndex:"description"},{header:"City",width:0.25,sortable:true,dataIndex:"areaValue"}];var K=Ext.DomQuery.selectNode("toList",F);if(K!=null){var I=trimet.utils.ExtUtils.makeLocationStore();I.loadData(K);D=trimet.utils.ExtUtils.makeGridView(I,A,{title:this.profile.locale.tripPlanner.error.geoToMsg,iconCls:"end-icon"});D.on("rowclick",function(Q,P,R){var S=trimet.utils.ExtUtils.gridClick(Q,P,{description:"",x:"",y:""});this.setTo(S.description,S.x,S.y,true)},this);D.on("rowdblclick",function(Q,P,R){var S=trimet.utils.ExtUtils.gridClick(Q,P,{description:"",x:"",y:""});this.setTo(S.description,S.x,S.y,true);this.m_geoErrorPopup.close()},this);O=true}var J=Ext.DomQuery.selectNode("fromList",F);if(J!=null){var L=trimet.utils.ExtUtils.makeLocationStore();L.loadData(J);G=trimet.utils.ExtUtils.makeGridView(L,A,{title:this.profile.locale.tripPlanner.error.geoFromMsg,iconCls:"start-icon"});G.on("rowclick",function(Q,P,R){var S=trimet.utils.ExtUtils.gridClick(Q,P,{description:"",x:"",y:""});this.setFrom(S.description,S.x,S.y,true)},this);G.on("rowdblclick",function(Q,P,R){var S=trimet.utils.ExtUtils.gridClick(Q,P,{description:"",x:"",y:""});this.setFrom(S.description,S.x,S.y,true);this.m_geoErrorPopup.close()},this);O=true}if(O){var M=0;var H=new Array();if(G){M+=185;H.push(G)}if(D){M+=185;H.push(D)}if(M<200){M=220}var C=new Ext.Panel({layout:"anchor",items:H});this.m_geoErrorPopup=trimet.utils.ExtUtils.makePopup({layout:"anchor",items:[C]},this.profile.locale.tripPlanner.error.title,true,360,M,true,false,50,170);N=null;trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_GEO_ERROR+"/from/"+(J!=null)+"/to/"+(K!=null))}else{var E=Ext.DomQuery.selectNode("error",F);N=Ext.DomQuery.selectValue("message",E);B=Ext.DomQuery.selectValue("@id",E);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_ERROR+"/"+B)}}catch(H){if(N==null||N==""){N=this.profile.locale.tripPlanner.error.deadMsg}}if(N!=null&&N.length>0){Ext.MessageBox.show({title:this.profile.locale.tripPlanner.error.title,msg:N,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,animEl:"tp-error-message",minWidth:170,maxWidth:270});setTimeout(function(){try{Ext.MessageBox.hide()}catch(P){}},5000)}},clear:function(){this.collapseComboBoxes();this.hideErrorDialogs();this.clearFrom(true);this.clearTo(true);this.m_submitButton.enable();this.m_submitButton.focus()},collapseComboBoxes:function(){try{this.m_fromForm.collapse();this.m_toForm.collapse()}catch(A){console.log("Forms.collapseComboBox "+A)}},hideErrorDialogs:function(){try{Ext.MessageBox.hide()}catch(A){}try{this.m_geoErrorPopup.close()}catch(A){}},focus:function(){try{this.planner.focus()}catch(A){console.log("exception Forms.forms "+A)}},setFrom:function(D,A,E,C,B){this.focus();this.m_fromForm.setRawValue(D);if(A&&A>-180.1&&E&&E>-90.1){this.m_fromCoord=A+","+E;if(this.poi&&!B){this.poi.setFrom(A,E,D,C)}}},setTo:function(B,A,E,D,C){this.focus();this.m_toForm.setRawValue(B);if(A&&A>-180.1&&E&&E>-90.1){this.m_toCoord=A+","+E;if(this.poi&&!C){this.poi.setTo(A,E,B,D)}}},setRawInput:function(C,A){var B=false;if(C!=null&&C!==true&&C!="true"&&C.match("Address, .*Stop ID")==null){A.setRawValue(C);B=true}return B},populate:function(F){var B=this;if(F){this.clearFrom();this.clearTo();this.setRawInput(F.Orig,B.m_fromForm);this.setRawInput(F.Dest,B.m_toForm);this.setRawInput(F.from,B.m_fromForm);this.setRawInput(F.to,B.m_toForm);this.setRawInput(F.fromPlace,B.m_fromForm);this.setRawInput(F.toPlace,B.m_toForm);if(F.fromCoord&&F.fromCoord.indexOf("0.0")!=0){this.m_fromCoord=F.fromCoord}if(F.toCoord&&F.toCoord.indexOf("0.0")!=0){this.m_toCoord=F.toCoord}var D=false;var C=false;if(F.date){B.m_date.setRawValue(F.date);C=true}else{if(F.on){B.m_date.setRawValue(F.on);C=true}}if(F.arrParam&&(F.arrParam.indexOf("rive")>0||F.arrParam=="A")){B.m_arrForm.setValue("A")}if(F.arr&&(F.arr.indexOf("rive")>0||F.arr=="A")){B.m_arrForm.setValue("A")}if(F.Arr&&(F.Arr.indexOf("rive")>0||F.Arr=="A")){B.m_arrForm.setValue("A")}if(F.arrParam&&(F.arrParam.indexOf("part")>0||F.arrParam=="D")){B.m_arrForm.setValue("D")}if(F.arr&&(F.arr.indexOf("part")>0||F.arr=="D")){B.m_arrForm.setValue("D")}if(F.Arr&&(F.Arr.indexOf("part")>0||F.Arr=="D")){B.m_arrForm.setValue("D")}if(F.after){D=F.after.replace(/\./g,"");B.m_time.setRawValue(D);B.m_arrForm.setValue("D");D=true}else{if(F.by){D=F.by.replace(/\./g,"");B.m_time.setRawValue(D);B.m_arrForm.setValue("A");D=true}}if(F.time){D=F.time.replace(/\./g,"");B.m_time.setRawValue(D);D=true}if(F.opt){B.m_optimizeForm.setValue(F.opt)}if(F.optParam){B.m_optimizeForm.setValue(F.optParam)}if(F.min){B.m_optimizeForm.setValue(F.min)}if(F.minParam){B.m_optimizeForm.setValue(F.minParam)}if(F.walk){B.m_walkForm.setValue(F.walk)}if(F.Walk){B.m_walkForm.setValue(F.Walk)}if(F.walkParam){B.m_walkForm.setValue(F.walkParam)}if(F.mode){B.m_modeForm.setValue(F.mode)}if(F.modeParam){B.m_modeForm.setValue(F.modeParam)}if(!D&&F.Hour&&F.Minute&&F.AmPm){D=F.Hour+":"+F.Minute+" "+F.AmPm.toLowerCase();D=D.replace(/\./g,"");B.m_time.setRawValue(D);D=true}if(!C&&F.month&&F.day){var E=new Date();var H=E.getFullYear();var G=E.getMonth();var A=trimet.utils.DateUtils.getMonthAsInt(F.month);if(A<G){H++}if(F.day.length==1){F.day="0"+F.day}C=A+"/"+F.day+"/"+H;B.m_date.setRawValue(C);C=true}}},getFormData:function(A){var C={};C.url=A;C.itinID="1";C.from=this.m_fromForm.getRawValue();C.fromPlace=this.m_fromForm.getRawValue();C.fromCoord=this.m_fromCoord;C.to=this.m_toForm.getRawValue();C.toPlace=this.m_toForm.getRawValue();C.toCoord=this.m_toCoord;C.date=this.m_date.getRawValue();C.time=this.m_time.getRawValue();C.arr=this.m_arrForm.getRawValue();C.arrParam=this.m_arrForm.getValue();C.opt=this.m_optimizeForm.getRawValue();C.optParam=this.m_optimizeForm.getValue();C.walk=this.m_walkForm.getRawValue();C.walkParam=this.m_walkForm.getValue();C.mode=this.m_modeForm.getRawValue();C.modeParam=this.m_modeForm.getValue();try{C.time=C.time.replace(/\./g,"")}catch(B){}return C},clearFrom:function(A){this.m_fromCoord="0.0,0.0";if(A&&A===true){this.m_fromForm.clear()}},clearTo:function(A){this.m_toCoord="0.0,0.0";
if(A&&A===true){this.m_toForm.clear()}},selectFrom:function(C,A,B){this.m_fromCoord=trimet.utils.ExtUtils.getCoordinate(A)},selectTo:function(C,A,B){this.m_toCoord=trimet.utils.ExtUtils.getCoordinate(A)},getContextMenu:function(A){if(A!=null){this.contextMenu=A}var B=[{text:this.profile.locale.contextMenu.fromHere,iconCls:"cFromHere",scope:this,handler:function(){var C=this.contextMenu.getMapCoordinate();this.setFrom(C.lon+","+C.lat,C.lon,C.lat)}},{text:this.profile.locale.contextMenu.toHere,iconCls:"cToHere",scope:this,handler:function(){var C=this.contextMenu.getMapCoordinate();this.setTo(C.lon+","+C.lat,C.lon,C.lat)}}];return B},makeRequestRecord4XML:function(){var A=new Ext.data.Record.create([{name:"url"},{name:"from",mapping:"param[name='fromPlace']"},{name:"to",mapping:"param[name='toPlace']"},{name:"fromCoord",mapping:"param[name='fromCoord']"},{name:"toCoord",mapping:"param[name='toCoord']"},{name:"arr",mapping:"param[name='Arr']"},{name:"time",mapping:"param[name='time']"},{name:"min",mapping:"param[name='Min']"},{name:"mode",mapping:"param[name='Mode']"},{name:"walk",mapping:"param[name='Walk']"}]);return A},makeMainPanel:function(){console.log("enter Forms.makeMainPanel()");var A=this.makeFromToForms();var E=new Ext.form.FieldSet({labelWidth:40,border:false,items:A});var D=this.makeOptionForms();var B=new Ext.form.FieldSet({labelWidth:110,border:false,items:D});this.m_submitButton=new Ext.Toolbar.Button({text:this.profile.locale.tripPlanner.labels.planTrip,id:"trip-submit",cls:"blueButton",scope:this,handler:this.submit});console.log("make the m_panel FormPanel");var C={title:this.profile.locale.tripPlanner.labels.tabTitle,id:"form-tab",border:false,keys:{key:[10,13],scope:this,handler:this.submit},items:[E,{autoEl:{tag:"hr",width:"95%"}},B,new Ext.form.Hidden({name:"toCoord",value:""}),new Ext.form.Hidden({name:"fromCoord",value:""})],buttons:[this.m_submitButton],buttonAlign:"center",reader:this.m_xmlRespRecord,errorReader:new Ext.form.XmlErrorReader()};this.m_panel=new Ext.FormPanel(C);console.log("set callbacks on the m_panel FormPanel");this.m_panel.on({scope:this,beforeaction:this.preSubmit,actionfailed:this.submitFailure,actioncomplete:this.submitSuccess});console.log("exit Forms.makeMainPanel()")},makeFromToForms:function(){console.log("enter Forms.makeFromToForms()");Ext.state.Manager.setProvider(new Ext.state.CookieProvider());Ext.state.Manager.getProvider();this.m_fromForm=new trimet.widget.ui.form.ComboBox({layout:"anchor",id:"from.id",name:"fromPlace",label:this.profile.locale.tripPlanner.labels.from});this.m_toForm=new trimet.widget.ui.form.ComboBox({layout:"anchor",id:"to.id",name:"toPlace",label:this.profile.locale.tripPlanner.labels.to});var A=new Ext.Button({tooltip:this.profile.locale.buttons.reverseMiniTip,iconCls:"reverse-button",hideLabel:true,tabIndex:-1,scope:this,handler:function(D){this.m_fromForm.reverse(this.m_toForm);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_FORM_REVERSE)}});this.m_fromForm.getComboBox().on({scope:this,focus:this.clearFrom});this.m_fromForm.getComboBox().on({scope:this,select:this.selectFrom});this.m_toForm.getComboBox().on({scope:this,focus:this.clearTo});this.m_toForm.getComboBox().on({scope:this,select:this.selectTo});this.m_date=new Ext.form.DateField({id:"trip-date-form",fieldLabel:this.profile.locale.tripPlanner.labels.date,name:"date",format:"m/d/Y",allowBlank:false,msgTarget:"qtip",anchor:"88%",value:new Date().format("m/d/Y")});this.m_arrStore=trimet.utils.ExtUtils.makeStaticPullDownStore(this.profile.locale.tripPlanner.arriveDepart);this.m_arrForm=new Ext.form.ComboBox({id:"trip-arrive-form",name:"Arr",hiddenName:"Arr",fieldLabel:this.profile.locale.tripPlanner.labels.when,store:this.m_arrStore,value:this.m_arrStore.getAt(0).get("opt"),displayField:"text",valueField:"opt",anchor:"90%",mode:"local",triggerAction:"all",editable:false,allowBlank:false,lazyRender:false,typeAhead:true,forceSelection:true,selectOnFocus:true});this.m_time=new Ext.ux.form.Spinner({id:"trip-time-form",fieldLabel:this.profile.locale.tripPlanner.labels.when,accelerate:true,width:85,anchor:"92%",msgTarget:"qtip",value:new Date().format("g:i a"),strategy:new Ext.ux.form.Spinner.TimeStrategy({format:"g:i a"}),name:"time"});var B={xtype:"panel",border:false,layout:"column",items:[{columnWidth:0.93,layout:"form",border:false,items:[this.m_fromForm.getComboBox(),this.m_toForm.getComboBox()]},{bodyStyle:"padding-top:15px",columnWidth:0.07,layout:"anchor",border:false,items:[A]}]};var C={xtype:"panel",border:false,layout:"column",autoWidth:true,items:[{columnWidth:0.38,layout:"form",border:false,items:[this.m_arrForm]},{columnWidth:0.28,layout:"anchor",border:false,items:[this.m_time]},{columnWidth:0.34,layout:"anchor",border:false,items:[this.m_date]}]};console.log("exit Forms.makeFromToForms()");return[B,C]},makeOptionForms:function(){console.log("enter Forms.makeOptionsForms()");var A="88%";this.m_walkStore=trimet.utils.ExtUtils.makeStaticPullDownStore(this.profile.locale.tripPlanner.walkDistance);this.m_optimizeStore=trimet.utils.ExtUtils.makeStaticPullDownStore(this.profile.locale.tripPlanner.options);this.m_modeStore=trimet.utils.ExtUtils.makeStaticPullDownStore(this.profile.locale.tripPlanner.mode);this.m_optimizeForm=new Ext.form.ComboBox({id:"trip-optimize-form",name:"Min",hiddenName:"Min",fieldLabel:this.profile.locale.tripPlanner.labels.minimize,store:this.m_optimizeStore,value:this.m_optimizeStore.getAt(1).get("opt"),displayField:"text",valueField:"opt",anchor:A,mode:"local",triggerAction:"all",editable:false,allowBlank:false,lazyRender:false,typeAhead:true,forceSelection:true,selectOnFocus:true});this.m_walkForm=new Ext.form.ComboBox({id:"trip-walking-form",name:"Walk",hiddenName:"Walk",fieldLabel:this.profile.locale.tripPlanner.labels.walk,store:this.m_walkStore,value:this.m_walkStore.getAt(2).get("opt"),displayField:"text",valueField:"opt",anchor:A,mode:"local",triggerAction:"all",editable:false,allowBlank:false,lazyRender:false,typeAhead:true,forceSelection:true,selectOnFocus:true});this.m_modeForm=new Ext.form.ComboBox({id:"trip-mode-form",name:"Mode",hiddenName:"Mode",fieldLabel:this.profile.locale.tripPlanner.labels.mode,store:this.m_modeStore,value:this.m_modeStore.getAt(0).get("opt"),displayField:"text",valueField:"opt",anchor:A,mode:"local",triggerAction:"all",editable:false,allowBlank:false,lazyRender:false,typeAhead:true,forceSelection:true,selectOnFocus:true});console.log("exit Forms.makeOptionsForms()");return[this.m_optimizeForm,this.m_walkForm,this.m_modeForm]},CLASS_NAME:"trimet.widget.planner.Forms"};trimet.widget.planner.Forms=new trimet.Class(trimet.widget.planner.StaticForms);trimet.namespace("trimet.widget.planner");trimet.widget.planner.Itinerary={xml:null,from:null,to:null,id:null,geoURL:null,tree:null,renderer:null,lineStyle:trimet.utils.OpenLayersUtils.ORANGE_STYLE,m_legStore:null,m_fromStore:null,m_toStore:null,m_routes:null,m_startTime:null,m_endTime:null,m_vectors:null,m_markers:null,m_extent:null,m_valid:false,initialize:function(A){console.log("enter planner.Itinerary constructor");this.geoURL=trimet.utils.URL.plannerGEO;trimet.configure(this,A);this.m_vectors=new Array();this.m_markers=new Array();this.m_legStore=trimet.widget.planner.Utils.makeLegStore();this.m_fromStore=trimet.widget.planner.Utils.makeFromStore();this.m_toStore=trimet.widget.planner.Utils.makeToStore();this.load();console.log("exit planner.Itinerary constructor")},load:function(){console.log("enter Itinerary.load");this.m_legStore.loadData(this.xml.node);this.m_fromStore.loadData(this.xml.node);this.m_toStore.loadData(this.xml.node);this.m_valid=false;if(this.m_legStore.getCount()>0){if(this.m_fromStore.getCount()==this.m_toStore.getCount()&&this.m_fromStore.getCount()==this.m_legStore.getCount()){this.m_valid=true}}this.makeStartEndTime();var A=this.getTreeNodes(this.renderer.legClick,this.renderer);this.tree.appendChild(A);console.log("exit Itinerary.load");return this.m_valid},draw:function(B,A){console.log("enter Itinerary.draw");
try{if(this.m_vectors.length<1){this.makeRouteLines(B);this.makeWalkLines(B);this.makeMarkers();trimet.utils.OpenLayersUtils.drawMarkers(A,this.m_markers);this.m_extent=A.getDataExtent()}else{B.addFeatures(this.m_vectors);trimet.utils.OpenLayersUtils.drawMarkers(A,this.m_markers)}}catch(C){console.log("exception Itinerary.draw "+C)}console.log("exit Itinerary.draw ")},getRoutes:function(){return this.m_routes},getExtent:function(){return this.m_extent},getMarkers:function(){return this.m_markers},getVectors:function(){var B=null;try{if(this.m_vectors.length<1){this.makeRouteLines();this.makeWalkLines()}B=this.m_vectors}catch(A){console.log("exit Itinerary.getVectors "+A)}return B},pushVector:function(A){if(A!=null){this.m_vectors.push(A)}},concatVectors:function(A){if(A&&A.length>0){this.m_vectors=this.m_vectors.concat(A)}},getFrom:function(){return this.from},getTo:function(){return this.to},getId:function(){return this.id},isValid:function(){return this.m_valid},getParams:function(){console.log("enter Itinerary.getParams");var B={};try{this.m_startTime=this.xml.data.startTime;this.m_endTime=this.xml.data.endTime}catch(A){console.log("exception Itinerary.getParams "+A)}console.log("exit Itinerary.getParams");return B},makeStartEndTime:function(){console.log("enter Itinerary.makeStartEndTime");try{this.m_startTime=this.xml.data.startTime;this.m_endTime=this.xml.data.endTime}catch(A){console.log("exception Itinerary.makeStartEndTime "+A)}console.log("exit Itinerary.makeStartEndTime")},makeRouteLines:function(C){console.log("enter Itinerary.makeRouteLines");var F=null;var E=this.m_legStore.getCount();for(var B=0;B<E;B++){var D=this.m_legStore.getAt(B);var A=D.get("urlParam");if(A!=null&&A.length>0){if(F==null){F=A}else{F=F+";"+A}}}var A=this.geoURL+"?bksTsIDeTeID="+F;trimet.utils.OpenLayersUtils.drawLinesViaAjax(A,C,this.lineStyle,this);console.log("exit Itinerary.makeRouteLines")},makeWalkLines:function(B){console.log("enter Itinerary.makeWalkLines");var C=new Array();var D=this.m_fromStore.getCount()-1;for(var A=0;A<=D;A++){var H=this.m_fromStore.getAt(A);var F=H.get("mode");if(F=="Walk"){try{var G=trimet.utils.OpenLayersUtils.makeStraightLine(H,this.m_toStore.getAt(A));C.push(G)}catch(E){console.log("exception Itinerary.makeWalkLines "+E)}}}if(C.length>0){this.concatVectors(C);if(B){B.addFeatures(C)}}console.log("exit Itinerary.makeWalkLines")},makeMarkers:function(){console.log("enter Itinerary.makeMarkers");try{var K=0;var C=this.m_fromStore.getCount()-1;var H=this.m_fromStore.getAt(K);var D=H.get("mode");if(D!="Walk"){K=0;trimet.utils.OpenLayersUtils.makeFromMarker(H.get("x"),H.get("y"),this.m_markers)}else{K=1;trimet.utils.OpenLayersUtils.makeFromWalkingMarker(H.get("x"),H.get("y"),this.m_markers)}var J=this.m_fromStore.getAt(C);var D=J.get("mode");if(D=="Walk"){C--;trimet.utils.OpenLayersUtils.makeWalkMarker(J.get("x"),J.get("y"),this.m_markers)}var A=false;if(this.m_routes==null){this.m_routes=new Array();A=true}for(var B=K;B<=C;B++){var H=this.m_fromStore.getAt(B);var I=this.m_toStore.getAt(B);var F=H.get("order");var G=H.get("routeID");if(A&&G!=null&&G.length>0){this.m_routes.push(G)}if(F==null||F!="thru-route"){trimet.utils.OpenLayersUtils.makeDiskMarker(H.get("x"),H.get("y"),this.m_markers);trimet.utils.OpenLayersUtils.makeRouteMarker(H.get("x"),H.get("y"),G,this.m_markers)}trimet.utils.OpenLayersUtils.makeDiskMarker(I.get("x"),I.get("y"),this.m_markers)}var I=this.m_toStore.getAt(this.m_toStore.getCount()-1);trimet.utils.OpenLayersUtils.makeToMarker(I.get("x"),I.get("y"),this.m_markers)}catch(E){console.log("exit Itinerary.makeMarkers"+E)}console.log("exit Itinerary.makeMarkers")},LEG_ID:"-leg-",collapse:function(){try{this.tree.collapse()}catch(A){}},expand:function(){try{this.tree.expand();this.tree.ui.show();this.tree.ui.show()}catch(A){}},getLegStartPoint:function(D){try{var C=D.substring(D.lastIndexOf(this.LEG_ID)+this.LEG_ID.length);var B=this.m_fromStore.getAt(C);return B}catch(A){console.log("exit Itinerary.getLegStartPoint "+A)}},getTreeNodes:function(B,A){return this.makeTreeNodes(this.m_legStore,this.xml,this.from,this.to,B,A)},makeTreeNodes:function(H,F,M,E,B,C){var A=trimet.widget.planner.Templates.TP_START.applyTemplate(M.data);var S=trimet.widget.planner.Templates.TP_END.applyTemplate(E.data);var D=trimet.widget.planner.Templates.TP_TRIPDETAILS.applyTemplate(F.data);var G=this.id+"-"+trimet.widget.planner.Utils.FROM_ID;var I=this.id+"-"+trimet.widget.planner.Utils.TO_ID;var T=this.id+"-"+trimet.widget.planner.Utils.TRIP_ID;var Q=new Array();Q.push(trimet.utils.ExtUtils.makeTreeNode(G,A,"itiny magnify","start-icon",true,B,C));for(var N=0;N<H.getCount();N++){var R=H.getAt(N);var L;var J=true;var P="bus-icon";var K=null;if(R.get("mode")=="Walk"){L=trimet.widget.planner.Templates.TP_WALK_LEG.applyTemplate(R.data);J=false;P="walk-icon"}else{if(R.get("order")=="thru-route"){L=trimet.widget.planner.Templates.getInterlineLeg().applyTemplate(R.data)}else{L=trimet.widget.planner.Templates.getTransitLeg().applyTemplate(R.data)}if(R.get("mode")=="Bus"){P="bus-icon"}else{if(R.get("mode")=="Tram"){P="tram-icon"}else{if(R.get("mode")=="Streetcar"){P="streetcar-icon"}else{if(R.get("mode")=="Commuter Rail"){P="commrail-icon"}else{P="ltrail-icon"}}}}}Q.push(trimet.utils.ExtUtils.makeTreeNode(this.id+this.LEG_ID+N,L,"itiny magnify",P,J,B,C))}Q.push(trimet.utils.ExtUtils.makeTreeNode(I,S,"itiny magnify","end-icon",true,B,C));var O=trimet.utils.ExtUtils.makeTreeNode(T,D,"trip-details-shell","no-icon",true,B,C);Q.push(O);return Q},CLASS_NAME:"trimet.widget.planner.Itinerary"};trimet.widget.planner.Itinerary=new trimet.Class(trimet.widget.planner.Itinerary);trimet.namespace("trimet.widget.planner");trimet.widget.planner.Planner={map:null,poi:null,planner:null,profile:trimet.locale.profile.BaseStatic,controller:null,m_tabs:null,m_tabPanel:null,m_mainPanel:null,m_activeTabID:0,m_numTabs:0,m_tabCount:0,m_forms:null,m_renderer:null,initialize:function(A){console.log("enter planner.Planner constructor");this.planner=this;trimet.configure(this,A);this.controller=trimet.utils.ObjUtils.defaultController(this.controller);this.m_tabs=new Array();this.m_tabPanel=new Ext.TabPanel({id:"tripplanner-panel",title:this.profile.locale.tripPlanner.labels.panelTitle,activeTab:0,layoutOnTabChange:true,resizeTabs:true,enableTabScroll:true,minTabWidth:75,autoScroll:false,bodyStyle:"background-color:#F0F0F0",plugins:new Ext.ux.TabCloseMenu()});this.m_tabPanel.on("tabchange",this.tabChange,this);this.m_mainPanel=new Ext.Panel({layout:"fit",id:"tp-accordion",title:this.profile.locale.tripPlanner.labels.panelTitle,iconCls:"planner-panel",autoShow:true,border:false,items:[this.m_tabPanel]});this.m_renderer=new trimet.widget.planner.Renderer(this);this.m_forms=new trimet.widget.planner.Forms(this);this.addFormPanel(this.m_forms.getPanel());var B=this;this.m_forms.submitSuccess=function(){B.formSuccessCB()};this.m_forms.submitFailure=function(){B.formFailureCB()};console.log("exit planner.Planner constructor")},expand:function(A){if(A==null){A=this}if(A&&A.m_mainPanel){A.m_mainPanel.bubble(A.m_mainPanel.expand)}},getPanel:function(){return this.m_mainPanel},getMainPanel:function(){return this.m_mainPanel},getForms:function(){return this.m_forms},clearForms:function(){try{this.m_forms.clear()}catch(A){console.log("exception Planner.clearForms "+A)}},showFormTab:function(A){try{this.m_activeTabID=0;this.m_tabPanel.setActiveTab(0);this.controller.deactivate(this.CLASS_NAME)}catch(B){console.log("exception Planner.showFormTab "+B)}},populateFormTab:function(A){this.m_forms.populate(A);this.showFormTab()},getTabPanel:function(){return this.m_tabPanel},clear:function(){try{this.showFormTab();this.m_forms.clear();this.m_renderer.clear()}catch(A){console.log("exception Planner.clear "+A)}},focus:function(){try{this.showFormTab();this.m_mainPanel.bubble(this.m_mainPanel.expand)}catch(A){console.log("exception in Planner.focus (might be nothing if you're not using the trip planner & extjs): "+A)
}},getTripInfo:function(B,A){var E={url:"",txt:"",txtUrl:"",valid:false};try{if(B==null){B="http://ride.trimet.org"}if(A==null){A="http://trimet.org/go/cgi-bin/plantrip.cgi"}var D=this.getForms().getFormData(B);E.txt=trimet.widget.planner.Templates.tripFeedbackDetails.applyTemplate(D);E.url=trimet.widget.planner.Templates.tripPrintTemplate.applyTemplate(D);D.url=A;E.txtUrl=trimet.widget.planner.Templates.txtPlannerURL.applyTemplate(D);E.valid=(((D.from!=null&&D.from.length>0)||(D.fromPlace!=null&&D.fromPlace.length>0))&&((D.to!=null&&D.to.length>0)||(D.toPlace!=null&&D.toPlace.length>0)))}catch(C){console.log("exception Planner.getTripInfo "+C)}return E},getActiveItinerary:function(){var C=null;try{var A=this.m_tabs[this.m_activeTabID];if(A){C=A.getActiveItinerary()}}catch(B){console.log("exception Planner.getActiveItinerary "+B)}return C},getSelectedRoutes:function(){var B=[];var A=this.getActiveItinerary();if(A){B=A.getRoutes()}return B},newTripPlan:function(A,B){console.log("enter Planner.newTripPlan");try{console.log("Planner.newTripPlan: create new trip tab");var D=new trimet.widget.planner.TripTab({planner:this,xml:A,id:++this.m_tabCount,renderer:this.m_renderer,profile:this.profile,request:B});var E=D.getPanel();if(E&&D.isValid()){this.m_activeTabID=E.getId();this.m_tabs[this.m_activeTabID]=D;this.m_tabPanel.add(E);this.m_tabPanel.setActiveTab(E)}}catch(C){this.m_activeTabID=0;console.log("exception Planner.newTripPlan: exception "+C)}console.log("exit Planner.newTripPlan")},tabChange:function(C,A){console.log("enter Planner.tabChange");try{this.m_renderer.clear();var D=this.m_tabs[A.id];if(D!=null){this.m_activeTabID=A.id;D.draw(this.m_activeTabID)}else{this.m_activeTabID=0;this.controller.deactivate(this.CLASS_NAME)}}catch(B){console.log("exception Planner.tabChange "+B)}console.log("exit Planner.tabChange")},addFormPanel:function(A){this.m_tabPanel.add(A);this.m_tabPanel.activate(0);A.doLayout();this.m_tabPanel.doLayout()},CLASS_NAME:"trimet.widget.planner.Planner"};trimet.widget.planner.Planner=new trimet.Class(trimet.widget.planner.Planner);trimet.namespace("trimet.widget.planner");trimet.widget.planner.Renderer={map:null,profile:null,m_markerLayer:null,m_vectorLayer:null,m_itinerary:null,initialize:function(A){console.log("enter planner.Renderer constructor");trimet.configure(this,A);console.log("exit planner.Renderer constructor")},draw:function(B,A){console.log("enter planner.Renderer.draw");if(B!=null){this.m_itinerary=B;this.drawItineraryOntoMap()}console.log("exit planner.Renderer.draw")},clear:function(){console.log("enter planner.Renderer.clear");if(this.m_vectorLayer){trimet.utils.OpenLayersUtils.clearVectorLayer(this.m_vectorLayer)}if(this.m_markerLayer&&this.m_itinerary){trimet.utils.OpenLayersUtils.clearMarkerLayer(this.m_markerLayer,this.m_itinerary.getMarkers())}console.log("exit planner.Renderer.clear")},drawItineraryOntoMap:function(){console.log("enter Renderer.drawItineraryOntoMap");if(this.m_vectorLayer==null){this.m_vectorLayer=new OpenLayers.Layer.Vector("tm-trip-vector-layer",{isBaseLayer:false,isFixed:false,visibility:true});this.m_vectorLayer=new OpenLayers.Layer.Vector();this.map.getMap().addLayer(this.m_vectorLayer);this.m_vectorLayer.setZIndex(222);this.m_markerLayer=new OpenLayers.Layer.Markers("tm-trip-marker-layer",{isBaseLayer:false});this.map.getMap().addLayer(this.m_markerLayer);this.m_markerLayer.setZIndex(223)}this.clear();this.m_itinerary.draw(this.m_vectorLayer,this.m_markerLayer);this.map.zoomToExtent(this.m_itinerary.getExtent());console.log("exit Renderer.drawItineraryOntoMap")},drawItineraryIntoPrinter:function(){console.log("enter planner.Renderer.drawItinerayIntoPrinter");console.log("exit planner.Renderer.drawItinerayIntoPrinter")},drawItineraryIntoEmail:function(){console.log("enter planner.Renderer.drawItinerayIntoEmail");console.log("exit planner.Renderer.drawItinerayIntoEmail")},legClick:function(C,B){console.log("enter Renderer.legClick");if(C.id.indexOf(trimet.widget.planner.Utils.TRIP_ID)>=0){trimet.utils.OpenLayersUtils.zoomToMarkerLayerExtent(this.map,this.m_markerLayer)}else{var E=null;if(C.id.indexOf(trimet.widget.planner.Utils.FROM_ID)>=0){E=this.m_itinerary.getFrom()}else{if(C.id.indexOf(trimet.widget.planner.Utils.TO_ID)>=0){E=this.m_itinerary.getTo()}else{E=this.m_itinerary.getLegStartPoint(C.id)}}var A=E.get("x");var D=E.get("y");this.map.zoom(A,D)}console.log("exit Renderer.legClick")},CLASS_NAME:"trimet.widget.planner.Renderer"};trimet.widget.planner.Renderer=new trimet.Class(trimet.widget.planner.Renderer);trimet.namespace("trimet.widget.planner");try{trimet.widget.planner.Templates={TODO_FARE_ZONE:"For ALL to show up, we have an if 2.30 conditional - SEE BELOW - TODO PUT FARE ZONE IN XML",TP_ITINERARY:new Ext.XTemplate('<h2>Option {id}<tpl if="id == 1">: Your best bet</tpl></h2>','<p class="details">','<tpl if="numTransfers">','<tpl if="numTransfers == 0">No transfers</tpl>','<tpl if="numTransfers == 1">1 transfer</tpl>','<tpl if="numTransfers &gt; 1">{numTransfers} transfers</tpl>',", ","</tpl>",'{duration} minute<tpl if="duration != 1.0">s</tpl>',"</p>").compile(),tripFeedbackDetails:new Ext.XTemplate("Trip Details: {from} to {to} {arr} {[trimet.utils.DateUtils.fixAmPm(values.time)]} on {date}, {opt} with a walk of {walk} via {mode}.").compile(),txtPlannerURL:new Ext.XTemplate("{url}?",'from={[values.from.replace(/&/g,"@")]}','&to={[values.to.replace(/&/g,"@")]}',"&min={optParam}&walk={walkParam}&mode={modeParam}&id={id}","&on={date}",'&{[values.arrParam=="D" ? "after" : "by"]}={time}').compile(),tripPrintTemplate:new Ext.XTemplate("{url}?",'fromPlace={[values.from.replace(/&/g,"@")]}','&toPlace={[values.to.replace(/&/g,"@")]}','<tpl if="fromCoord != null">&fromCoord={fromCoord}</tpl>','<tpl if="toCoord   != null">&toCoord={toCoord}</tpl>',"&arr={arrParam}&min={optParam}&walk={walkParam}&mode={modeParam}&itinID={itinID}&submit","&date={date}","&time={time}").compile(),TP_TRIPDETAILS:new Ext.XTemplate('<div id="trip-details">',"<h3>Trip details</h3>",'<table cellpadding="3" cellspacing="0" border="0" align="center">',"<tr><td><strong>When</strong></td><td>Board at {[trimet.utils.DateUtils.fixAmPm(values.startTime)]} on {date}</td></tr>",'<tr><td><strong>Time</strong></td><td>{duration} minute<tpl if="duration != 1">s</tpl>'," {[trimet.widget.planner.Templates.waitTime(values.waitingTime, values.walkTime)]} ","</td></tr>",'<tpl if="numTransfers">',"<tr><td><strong>Transfers</strong></td><td>",'<tpl if="numTransfers == 0">None</tpl>','<tpl if="numTransfers == 1">1</tpl>','<tpl if="numTransfers &gt; 1">{numTransfers}</tpl>',"</td></tr>","</tpl>","<tr><td><strong>Fare</strong></td><td>",'<tpl if="regularFare &gt; 0.00">Adult <tpl if="regularFare == 2.30">All-Zone</tpl> (${regularFare})<br/>Honored Citizen (${honoredFare})<br/>Youth/Student (${youthFare})</tpl>',"<tpl if=\"regularFare == ''\">This trip is within the Free Rail Zone, so no fare is required.</tpl>",'<tpl if="tramFare &gt; 0"><br/><I>+ Tram Fare</I> (${tramFare} round-trip)</tpl>',"</td></tr>","</table></div>").compile(),TP_LEG_BASE_STR:'<tpl if="fromStopId != null"><p><span class="time">{[trimet.utils.DateUtils.fixAmPm(values.startTime)]}</span> Depart {fromDescription}<br/><span class="stopid">Stop ID {fromStopId}</span></p></tpl><tpl if="duration != null"><div class="duration">{duration} minute<tpl if="duration != 1.0">s</tpl></div></tpl><tpl if="toStopId &gt; 0"><p><span class="time">{[trimet.utils.DateUtils.fixAmPm(values.endTime)]}</span> Arrive {toDescription}<br/><span class="stopid">Stop ID {toStopId}</span></p></tpl><tpl if="alerts != null && alerts.length &gt; 0"><tpl for="alerts"><p class="alert"> <img src="/images/ui/trip/alert.png" align="absmiddle"/>  {.}</p></tpl></tpl>',TP_LEG_MODE:"<h4>{mode} {routeName}</h4>",TP_LEG_CONTINUES:'<h4>Continues as {routeName} <h10 class="transfers">(stay on board)</h10></h4>',waitTime:function(C,A){var B="";if((C&&C>0)||(A&&A>0)){B="(including ";if(A&&A>0){B+=A+" "+trimet.locale.TemplateGlobals.minutes(A)+" walking";
if(C&&C>0){B+=" and "}}if(C&&C>0){B+=C+" "+trimet.locale.TemplateGlobals.minutes(C)+" waiting"}B+=")"}return B},m_transitLeg:null,getTransitLeg:function(){if(this.m_transitLeg==null){this.m_transitLeg=new Ext.XTemplate(this.TP_LEG_MODE+this.TP_LEG_BASE_STR).compile()}return this.m_transitLeg},m_interlineLeg:null,getInterlineLeg:function(){if(this.m_interlineLeg==null){this.m_interlineLeg=new Ext.XTemplate(this.TP_LEG_CONTINUES+this.TP_LEG_BASE_STR).compile()}return this.m_interlineLeg},TP_WALK_LEG:new Ext.XTemplate("<h4>Walk {[trimet.utils.StringFormattingUtils.getDirection(values.direction)]} to {toDescription}</h4>",'<tpl if="toStopId &gt; 0"><p><span class="stopid">Stop ID {toStopId}</span></p></tpl>','<p class="transfers">About {duration} minute<tpl if="duration != 1.0">s</tpl> - {distance} miles</p>').compile(),TP_START:new Ext.XTemplate("<h4>Start at {description}</h4>").compile(),TP_END:new Ext.XTemplate("<h4>End at {description}</h4>").compile(),makeTTPUBLinkFromData:function(B){try{return trimet.widget.feature.Templates.getTimeTableString(B.routeName,B.routeNumber=="MAX"?"90":B.routeNumber,B.direction=="in"?"1":"0",true,true,true)}catch(A){}},CLASS_NAME:"trimet.widget.planner.Templates"}}catch(e){console.log("planner.Templates Ext exception can be ignored -- just means you aren't including Ext.js in your app, which is OK")}trimet.namespace("trimet.widget.planner");trimet.widget.planner.PrintTripWin=null;trimet.widget.planner.TripTab={profile:trimet.locale.profile.BaseStatic,planner:null,renderer:null,xml:null,request:null,id:0,m_utils:trimet.widget.planner.Utils,XML_ITINERARIES_NODE:"itineraries",ROOT_NODE_CSS:"itin-root itiny",ITIN_NODE_CSS:"itiny",ITIN_ICON_CSS:"itinys-icon",m_itinerariesXML:null,m_itinerariesStore:null,m_valid:true,m_activeItinerary:null,m_itineraryCache:null,m_title:"",m_from:null,m_to:null,m_panel:null,m_nodes:null,m_itinerariesTree:null,m_tripNodePrefix:"tn-",initialize:function(A){console.log("enter planner.TripTab constructor");trimet.configure(this,A);this.m_tripNodePrefix="tn-"+this.id+"-";this.m_itinerariesXML=this.m_utils.domSelect(this.XML_ITINERARIES_NODE,this.xml);this.m_itinerariesStore=this.m_utils.makeItinerariesStore();this.m_itineraryCache=new Array();if(this.load()){}console.log("exit planner.TripTab constructor")},load:function(){console.log("enter TripTab.load");var I=this.m_itinerariesStore;I.loadData(this.m_itinerariesXML);this.m_from=trimet.utils.ExtUtils.loadPointRecord("from",this.xml);this.m_to=trimet.utils.ExtUtils.loadPointRecord("to",this.xml);if(this.m_from&&this.m_from.get("description")){this.m_title+=this.m_from.get("description")}if(this.m_to&&this.m_to.get("description")){this.m_title+=" to "+this.m_to.get("description")}var B="<h1>"+this.m_title+"</h1>";this.m_nodes=new Array();this.m_nodes[0]=trimet.utils.ExtUtils.makeTreeNode("info",B,this.ROOT_NODE_CSS,this.ITIN_ICON_CSS,true,null,this);for(var E=1;E<=I.getCount();E++){var D=this.m_tripNodePrefix+E;var F=I.getAt(E-1);F.set("id",E);var J=trimet.widget.planner.Templates.TP_ITINERARY.applyTemplate(F.data);this.m_nodes[E]=trimet.utils.ExtUtils.makeTreeNode(D,J,this.ITIN_NODE_CSS,this.ITIN_ICON_CSS,true,this.itineraryClick,this)}if(this.m_nodes.length>0){var A=new Ext.Toolbar.Button({text:this.profile.locale.buttons.reverse,id:"trip-reverse",cls:"blueButton",tooltip:this.profile.locale.buttons.reverseTip,scope:this,handler:this.reverseCB});var G=new Ext.Toolbar.Button({text:this.profile.locale.buttons.edit,id:"trip-edit",cls:"blueButton",tooltip:this.profile.locale.buttons.editTip,scope:this,handler:this.editCB});var C=new Ext.Toolbar.Button({text:this.profile.locale.buttons.print,id:"trip-print",cls:"blueButton",tooltip:this.profile.locale.buttons.printTip,scope:this,handler:this.printCB});this.m_itinerariesTree=this.m_utils.makeItinerariesTree(this.id,this.itineraryClick,this);this.m_panel=this.m_utils.makeTripTab(this.id,this.m_title,this.m_itinerariesTree,[A,G,C]);var K=this.m_itinerariesTree;var H=K.getRootNode();H.appendChild(this.m_nodes);this.activateItinerary(1)}console.log("exit TripTab.load");return this.isValid()},printCB:function(A,D){console.log("enter TripTab.print");console.log("TripTab.print: close request object");var C=trimet.clone(this.request);C.url=trimet.utils.URL.plannerPrint;if(this.m_activeItinerary&&this.m_activeItinerary.id){C.itinID=this.m_activeItinerary.id}var B=trimet.widget.planner.Templates.tripPrintTemplate.apply(C);console.log("TripTab.print: url "+C.url);console.log("TripTab.print: open window");trimet.widget.planner.PrintTripWin=window.open(B,"WORKING","width=800,height=600,resizable=1,scrollbars=1,left=100,top=100,screenX=100,screenY=100");console.log("TripTab.print: window focus");trimet.widget.planner.PrintTripWin.focus();trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_PRINT);console.log("exit TripTab.print")},editCB:function(A,B){console.log("enter TripTab.edit");this.planner.clearForms();this.planner.populateFormTab(this.request);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_EDIT);console.log("exit TripTab.edit")},reverseCB:function(A,D){console.log("enter TripTab.reverse");this.planner.clearForms();var B=trimet.clone(this.request);var C=B.from;B.from=B.to;B.to=C;C=B.fromPlace;B.fromPlace=B.toPlace;B.toPlace=C;C=B.fromCoord;B.fromCoord=B.toCoord;B.toCoord=C;if(this.m_activeItinerary&&this.m_activeItinerary.m_endTime){B.time=this.m_activeItinerary.m_endTime.toLowerCase();B.arrParam="D"}this.planner.populateFormTab(B);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.TRIP_REVERSE);console.log("exit TripTab.reverse")},draw:function(A){console.log("enter TripTab.draw");this.renderer.clear();this.renderer.draw(this.m_activeItinerary,this.m_tripDetailsTree);this.planner.controller.activate(this.CLASS_NAME);console.log("exit TripTab.draw")},itineraryClick:function(C,B){console.log("enter TripTab.itineraryClick");try{var A=C.id.substring(C.id.lastIndexOf("-")+1);console.log("TripTab.itineraryClick: activate itinerary number "+A);this.activateItinerary(A);this.draw(A)}catch(D){console.log("exception TripTab.itineraryClick "+D)}console.log("exit TripTab.itineraryClick")},activateItinerary:function(B){var A=this.getItinerary(B);if(A!=null&&A.isValid()){if(this.m_activeItinerary){this.m_activeItinerary.collapse()}this.m_activeItinerary=A;this.m_activeItinerary.expand()}},getItinerary:function(E){var D=null;try{if(E==null){E=1}var D=this.m_itineraryCache[E];if(D==null){var B=this.m_itinerariesStore.getAt(E-1);var A=this.m_nodes[E];D=new trimet.widget.planner.Itinerary({tree:A,renderer:this.renderer,xml:B,from:this.m_from,to:this.m_to,id:E});if(D!=null&&D.isValid()){this.m_itineraryCache[E]=D}}}catch(C){console.log("exception TripTab.getItinerary (id = "+E+") "+C)}return D},getId:function(){return this.id},getActiveItinerary:function(){return this.m_activeItinerary},getPanel:function(){return this.m_panel},isValid:function(){if(this.m_itinerariesStore==undefined||this.m_itinerariesStore.getCount()<=0){this.m_valid=true}return this.m_valid},CLASS_NAME:"trimet.widget.planner.TripTab"};trimet.widget.planner.TripTab=new trimet.Class(trimet.widget.planner.TripTab);trimet.namespace("trimet.widget.search");trimet.widget.search.Search={profile:trimet.locale.profile.BaseStatic,url:trimet.utils.URL.solrSelect,poi:null,searchPanel:null,m_searchResultTpl:null,m_contentTpl:null,m_accordion:null,m_id:"location-panel",m_resultsDivName:"location-results-div",m_resultsDiv:null,initialize:function(A){console.log("enter Search constructor");trimet.configure(this,A);this.locale=this.profile.locale;this.templates=this.profile.templates;this.m_searchResultTpl=trimet.locale.TemplateGlobals.makeLoopingTemplate("search-item",this.templates.nameCityType);this.m_contentTpl=trimet.locale.TemplateGlobals.makeTemplate("search-info-pane",this.templates.nameCityStopHTML,this.templates.spacer,this.templates.placeNotes,this.templates.tripLinksHTML,this.templates.spacer,this.templates.streetView);
this.m_contentTpl.compile();this.m_searchResultTpl.compile();console.log("exit Search constructor")},expand:function(A){if(A==null){A=this}if(A&&A.m_accordion){A.m_accordion.bubble(A.m_accordion.expand)}},getPanel:function(){return this.makeSearchAccordion()},clear:function(){try{this.searchPanel.collapse();this.searchPanel.reset()}catch(A){console.log("EXCEPTION: search.clear "+A)}},selectCB:function(F,G){try{console.log("enter search.selectCB "+F+" "+G);var B=this.m_searchCtl.getResultsDiv();var I=[];var C=trimet.utils.SolrUtils.fields;for(var E in C){var D=C[E].name;var A=F.get(D);if(D!=null&&A!=null){I[D]=A}}console.log(this.m_contentTpl);this.m_contentTpl.overwrite(B,I);this.m_itemSelected==true;this.collapse();if(this.poi){this.poi.highlight(I.x,I.y,6,"","<h3>"+I.name+"</h3>")}trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.SEARCH);console.log("exit search.selectCB")}catch(H){console.log("EXCEPTION: search.selectCB "+H)}},getResultsDiv:function(){var B=this.m_resultsDivName;try{console.log("enter Search.getResultsDiv");if(this.m_resultsDiv==null){this.m_resultsDiv=Ext.get(this.m_resultsDivName)}if(this.m_resultsDiv!=null){B=this.m_resultsDiv}console.log("exit Search.getResultsDiv: ",B)}catch(A){console.log("EXCEPTION: in Search.getResultsDiv: ",A)}return B},makeSearchAccordion:function(){console.log("enter makeSearchAccordion");if(this.m_accordion==null){this.m_accordion=new Ext.Panel({id:this.m_id,title:this.locale.tools.search,iconCls:this.m_id,cls:this.m_id,layout:"anchor",autoScroll:false,border:false,items:[this.makeSearchPanel(),{html:'<DIV id="'+this.m_resultsDivName+'"></DIV>'}]})}if(this.poi){this.m_accordion.on("expand",this.poi.show,this.poi)}console.log("exit makeSearchAccordion",this);return this.m_accordion},makeSearchPanel:function(){var B=trimet.utils.SolrUtils.makeSolrStore(this.url,{baseParams:{wt:"json",qt:"dismax",rows:10}});var A=new Ext.form.ComboBox({store:B,queryParam:"q",displayField:"title",minChars:3,loadingText:this.locale.indicators.searching,emptyText:this.locale.indicators.qEmptyText,tpl:this.m_searchResultTpl,itemSelector:"div.search-item",onSelect:this.selectCB,m_searchCtl:this,m_contentTpl:this.m_contentTpl,poi:this.poi,editable:true,typeAhead:false,hideTrigger:false,selectOnFocus:true,anchor:"100%",resizable:true,shadow:"frame",pageSize:10,keys:{key:[10,13],handler:function(C){try{this.expand()}catch(D){}}}});A.on("expand",function(C){if(C&&C.view){C.view.on("dblclick",C.collapse,this);C.view.on("contextmenu",C.collapse,this)}});A.on("focus",function(D){try{D.expand()}catch(C){}});this.searchPanel=A;return A},CLASS_NAME:"trimet.widget.search.Search"};trimet.widget.search.Search=new trimet.Class(trimet.widget.search.Search);trimet.namespace("trimet.widget.ui");trimet.widget.ui.Buttons={map:null,ui:null,control:null,toolbar:null,profile:trimet.locale.profile.BaseStatic,initialize:function(A){console.log("enter ui.Buttons constructor");trimet.configure(this,A);if(this.control==null){this.control=this}if(this.map==null&&this.ui&&this.ui.map){this.map=this.ui.map}trimet.extend(this.control,trimet.widget.ui.ButtonCallbacks);this.toolbar=this.makeToolBar();console.log("exit ui.Buttons constructor")},addContextMenu:function(){this.map.el=Ext.get("map");var A=new trimet.control.ContextMenu(this.map,this.m_tripPlanner.getForms());return A},getToolBar:function(){return this.toolbar},getMapToolBar:function(){this.getFeedback();this.getFullScreen();this.getSatellite();this.getMap();this.getMap();return this.toolbar},MEASURE:"measure-button",OVERLAY:"overlay-button",CLEAR:"clear-button",VEHICLES:"vehicles-button",MEASURE:"measure-button",FEEDBACK:"feedback-button",SHARETHIS:"sharethis-button",PRINT:"print-button",FULLSCREEN:"fullScreen-button",SATELLITE:"satellite-button",MAP:"map-button",SNOW:"snow-button",getVehicles:function(){var A=this.toolbar.getComponent(this.VEHICLES);A.hide();return A},getOverlay:function(){var A=this.toolbar.getComponent(this.OVERLAY);A.hide();return A},getClear:function(){var A=this.toolbar.getComponent(this.CLEAR);A.show();return A},getMeasure:function(){var A=this.toolbar.getComponent(this.MEASURE);A.show();return A},getFeedback:function(){var A=this.toolbar.getComponent(this.FEEDBACK);A.show();return A},getPrint:function(){var A=this.toolbar.getComponent(this.PRINT);A.show();return A},getShareThis:function(){var A=this.toolbar.getComponent(this.SHARETHIS);A.show();return A},getFullScreen:function(){var A=this.toolbar.getComponent(this.FULLSCREEN);A.show();return A},getSatellite:function(){var A=this.toolbar.getComponent(this.SATELLITE);A.show();return A},getMap:function(){var A=this.toolbar.getComponent(this.MAP);A.show();return A},getSnow:function(){var A=this.toolbar.getComponent(this.SNOW);A.show();return A},makeToolBar:function(){var B;try{B=this.ui.center.getTopToolbar()}catch(A){B=new Ext.Toolbar()}try{this.makeLeftButtons(B,this.control,this.profile.locale);this.makeRightButtons(B,this.control,this.profile.locale)}catch(A){console.log("Exception in makeToolBar routine: "+A)}return B},makeLeftButtons:function(D,C,A){try{D.addButton({hidden:true,id:this.CLEAR,iconCls:this.CLEAR,text:A.buttons.clear,tooltip:A.buttons.clearTip,scope:C,handler:C.clear});D.addButton({hidden:true,id:this.MEASURE,iconCls:this.MEASURE,toggleGroup:"overlay-measure",text:A.buttons.measure,tooltip:A.buttons.measureTip,enableToggle:true});D.addButton({hidden:true,id:this.SNOW,iconCls:this.SNOW,text:A.buttons.snow,tooltip:A.buttons.snowTip,stateful:true,enableToggle:true});D.addButton({hidden:true,id:this.VEHICLES,iconCls:this.VEHICLES,text:A.vehicles.button,tooltip:A.vehicles.tip,stateful:true,enableToggle:true});D.addButton({hidden:true,id:this.OVERLAY,iconCls:this.OVERLAY,toggleGroup:"overlay-measure",text:A.buttons.identify,tooltip:A.buttons.identifyTip,enableToggle:true})}catch(B){console.log("Exception in makeLeftButtons routine: "+B)}},makeRightButtons:function(E,D,A){try{var B=true;if(this.map){B=false}E.addFill();E.addButton({hidden:true,id:this.PRINT,iconCls:this.PRINT,text:A.buttons.print,tooltip:A.buttons.printTip,handler:D.print,scope:D});E.addButton({hidden:true,id:this.SHARETHIS,iconCls:this.SHARETHIS,text:A.buttons.shareThis,tooltip:A.buttons.shareThisTip,handler:D.shareThis,scope:D});E.addButton({hidden:B,id:this.FEEDBACK,iconCls:this.FEEDBACK,text:A.buttons.feedback,tooltip:A.buttons.feedbackTip,handler:D.feedback,scope:D});E.addButton({hidden:B,id:this.FULLSCREEN,iconCls:this.FULLSCREEN,text:A.buttons.fullScreen,tooltip:A.buttons.fullScreenTip,disabled:false,enableToggle:true,pressed:false,handler:D.fullScreen,scope:D});E.addSeparator();E.addButton({hidden:B,id:this.SATELLITE,iconCls:this.SATELLITE,pressed:false,toggleGroup:"map-render",text:A.buttons.satellite,tooltip:A.buttons.satelliteTip,handler:D.showSatelliteView,scope:D});E.addButton({hidden:B,id:this.MAP,iconCls:this.MAP,pressed:true,toggleGroup:"map-render",text:A.buttons.map,tooltip:A.buttons.mapTip,handler:D.showMapView,scope:D})}catch(C){console.log("Exception in makeRightButtons routine: "+C)}},CLASS_NAME:"trimet.widget.ui.Buttons"};trimet.widget.ui.Buttons=new trimet.Class(trimet.widget.ui.Buttons);trimet.widget.ui.Buttons.makeEmptyToolBar=function(){var B=null;try{B=new Ext.Toolbar({height:25})}catch(A){}return B};trimet.widget.ui.ButtonCallbacks={clear:function(){try{this.ui.clear();this.map.clear()}catch(A){}},print:function(){try{Ext.Msg.alert("Print","Please try printing from your browser (as we work to enable better printing in the future).")}catch(A){}},shareThis:function(){try{Ext.Msg.alert("ShareThis","TBD...")}catch(A){}},feedback:function(){try{Ext.Msg.alert("Feedback","Please write to mapfeedback@trimet.org")}catch(A){}},fullScreen:function(A){try{this.ui.fullScreen(A.pressed)}catch(B){}},showSatelliteView:function(){try{this.map.showSatelliteView()}catch(A){}},showMapView:function(){try{this.map.showMapView()}catch(A){}},CLAZZ_NAME:"trimet.widget.ui.ButtonCallbacks"};trimet.namespace("trimet.widget.ui");trimet.widget.ui.ContextMenu={map:null,forms:null,elements:null,renderTo:null,constructor:function(A){console.log("enter ui.ContextMenu constructor");
trimet.configure(this,A);try{if(this.renderTo==null){this.renderTo=Ext.get(trimet.utils.OpenLayersUtils.MAP_PANEL)}var B={renderTo:this.renderTo,items:this.getElements()};this.renderTo.on("contextmenu",function(D){this.showAt(D.xy);D.stopEvent()},this);this.renderTo.on("click",function(D){this.hide()},this);this.renderTo.on("blur",function(D){this.hide()},this);Ext.menu.Menu.call(this,B)}catch(C){console.log("trimet.widget.ui.ContextMenu: consturctor error "+C)}console.log("exit ui.ContextMenu constructor")},getElements:function(){if(this.elements){return this.elements}this.elements=new Array();if(this.forms){this.elements.push(this.forms.getContextMenu(this));this.elements.push("-")}if(this.map){this.elements.push(this.map.getContextMenu(this))}return this.elements},getMapCoordinate:function(){var B=trimet.utils.ExtUtils.getPixelXY(this.el,this.map.el);var A=trimet.utils.OpenLayersUtils.getLatLonOfPixel(this.map.getMap(),B.x,B.y);return A},centerMapFromContextMenuXY:function(){var A=trimet.utils.ExtUtils.getPixelXY(this.el,this.map.el);this.map.centerMapAtPixel(A.x,A.y)},CLASS_NAME:"trimet.widget.ui.ContextMenu"};try{trimet.widget.ui.ContextMenu=Ext.extend(Ext.menu.Menu,trimet.widget.ui.ContextMenu)}catch(e){console.log("trimet.widget.ui.ContextMenu: error creating this type...please ignore this error if you are not using Ext")}trimet.namespace("trimet.widget.ui");trimet.widget.ui.UI={north:null,south:null,east:null,west:null,center:null,accordion:null,innerCenter:null,innerSouth:null,innerEast:null,viewport:null,map:null,alwaysUseDefaultNorthWestCenter:false,centerTitle:"",initialize:function(A){console.log("enter ui.UI constructor");trimet.configure(this,A);this.viewport=new Ext.Viewport({layout:"border",deferredRender:false,items:this._getSubPanels()});if(this.south==null){this.south=this.innerSouth}if(this.east==null){this.east=this.innerEast}console.log("exit ui.UI constructor")},_getSubPanels:function(){var C=[];if(this.alwaysUseDefaultNorthWestCenter||(this.north==null&&this.south==null&&this.east==null&&this.west==null&&this.center==null)){var A={id:"center-inner",region:"center",layout:"fit",html:"this is the (inner) center panel"};if(this.map){A=new GeoExt.MapPanel({id:trimet.utils.OpenLayersUtils.MAP_PANEL,region:"center",layout:"fit",map:this.map.getMap(),zoom:this.map.getMap().getZoom(),bodyStyle:"background-color:#F7F7F2"})}var B={title:this.centerTitle,region:"center",id:"center",layout:"border",margins:"1 0 0 0",hideMode:"offsets",tbar:trimet.widget.ui.Buttons.makeEmptyToolBar(),items:[A,{hidden:true,id:"south",region:"south",html:"this is the (inner) south panel",layout:"fit",height:140,border:false,split:true,useSplitTips:true,collapseMode:"mini"},{hidden:true,id:"east",region:"east",html:"this is the (inner) east panel",layout:"fit",border:false,width:250,split:true,useSplitTips:true,collapseMode:"mini"}]};this.center=new Ext.Panel(B);this.innerCenter=this.center.getComponent(0);this.innerSouth=this.center.getComponent(1);this.innerEast=this.center.getComponent(2);this.west=new Ext.Panel({layout:"accordion",region:"west",id:"west-panel",width:360,minSize:150,maxSize:450,margins:"30 0 1 1",split:true,useSplitTips:true,collapsible:true,collapseMode:"mini",layoutConfig:{animate:true,collapseFirst:true}});this.accordion=this.west}if(this.south){C.push(this.south)}if(this.east){C.push(this.east)}if(this.west){C.push(this.west)}if(this.center){C.push(this.center)}if(this.north){C.push(this.north)}return C},doLayout:function(){console.log("UI doLayout");try{this.viewport.doLayout()}catch(A){}},fullScreen:function(A){if(A){if(this.south){this.south.collapse()}if(this.innerSouth&&this.south!=this.innerSouth){this.innerSouth.collapse()}if(this.east){this.east.collapse()}if(this.innerEast&&this.innerEast!=this.east){this.innerEast.collapse()}if(this.west){this.west.collapse()}this.isFullScreen=true}else{if(this.south){this.south.expand()}if(this.innerSouth&&this.south!=this.innerSouth){this.innerSouth.expand()}if(this.east){this.east.expand()}if(this.innerEast&&this.innerEast!=this.east){this.innerEast.expand()}if(this.west){this.west.expand()}this.isFullScreen=false}this.doLayout()},clear:function(){this.doLayout()},CLASS_NAME:"trimet.widget.ui.UI"};trimet.widget.ui.UI=new trimet.Class(trimet.widget.ui.UI);trimet.namespace("trimet.widget.ui.form");trimet.widget.ui.form.ComboBox={m_form:null,m_store:null,m_template:null,maxNumValues:10,id:"cb.id",name:"cb.name",label:"Form",display:"display",anchor:"95%",msgTarget:"qtip",emptyText:"...",maxHeight:150,initialize:function(A){console.log("enter form.Text constructor");trimet.configure(this,A);this.m_store=new Ext.data.SimpleStore({fields:[this.display],data:Ext.state.Manager.get(this.id,[])});this.m_template=new Ext.XTemplate('<tpl for=".">','<div class="x-combo-list-item" >',"{"+this.display+"}","</div>","</tpl>");this.m_form=new Ext.form.ComboBox({id:this.id,hiddenName:this.name,fieldLabel:this.label,displayField:this.display,msgTarget:this.msgTarget,tpl:this.m_template,emptyText:this.emptyText,valueNotFoundText:"",store:this.m_store,mode:"local",anchor:this.anchor,triggerAction:"all",allowBlank:false,typeAhead:false,resizable:true,maxHeight:this.maxHeight,lazyRender:false,selectOnFocus:true})},persist:function(G){if(Ext.isEmpty(G)){G=this.getRawValue();if(Ext.isEmpty(G)){return }}this.m_store.clearFilter(false);var B=this.m_store.find(this.display,G,0,false,true);if(B<0){var E=[[G]];var D=this.m_store.getTotalCount();var A=D>this.maxNumValues?this.maxNumValues-1:D;for(var C=0;C<A;C++){E.push([this.m_store.getAt(C).get(this.display)])}var F=Ext.state.Manager.getProvider();if(F){F.expires=trimet.utils.DateUtils.addDays(365);Ext.state.Manager.set(this.id,E)}this.m_store.loadData(E)}B=null},getComboBox:function(){return this.m_form},getRawValue:function(){return this.m_form.getRawValue()},setRawValue:function(A){this.m_form.setRawValue(A)},load:function(A,B){},clear:function(){this.m_form.collapse();this.m_form.reset()},collapse:function(){this.m_form.collapse()},reverse:function(C){try{var A=this.getRawValue();this.setRawValue(C.getRawValue());C.setRawValue(A)}catch(B){}},CLASS_NAME:"trimet.widget.form.ComboBox"};trimet.widget.ui.form.ComboBox=new trimet.Class(trimet.widget.ui.form.ComboBox);trimet.namespace("trimet.widget.ui");trimet.widget.ui.ExampleGrid={store:null,gridPanel:null,initialize:function(A){console.log("enter vehicles.Grid constructor");trimet.configure(this,A);this.store=new Ext.data.ArrayStore({fields:[{name:"company"},{name:"price",type:"float"},{name:"change",type:"float"},{name:"pctChange",type:"float"},{name:"lastChange",type:"date",dateFormat:"n/j h:ia"}]});this.store.loadData(this.myData);var B=new Ext.grid.RowExpander({tpl:new Ext.XTemplate("{company} is a good company, and a steal at {price} per share")});this.gridPanel=new Ext.grid.GridPanel({store:this.store,plugins:B,columns:[B,{header:"Company",width:200,sortable:true,dataIndex:"company",id:"company"},{header:"Price",width:190,sortable:true,dataIndex:"price",renderer:"usMoney",id:"price"},{header:"% Change",width:90,sortable:true,dataIndex:"pctChange",renderer:this.pctChange},{hidden:true,header:"Change",width:50,sortable:true,dataIndex:"change",renderer:this.change},{hidden:true,header:"Last Updated",width:85,sortable:true,dataIndex:"lastChange",renderer:Ext.util.Format.dateRenderer("m/d/Y")}],autoExpandColumn:"price",stripeRows:true,autoScroll:true,autoWidth:true,title:"Example Grid"});console.log("enter vehicles.Control constructor")},getPanel:function(){return this.gridPanel},change:function(A){if(A>0){return'<span style="color:green;">'+A+"</span>"}else{if(A<0){return'<span style="color:red;">'+A+"</span>"}}return A},pctChange:function(A){if(A>0){return'<span style="color:green;">'+A+"%</span>"}else{if(A<0){return'<span style="color:red;">'+A+"%</span>"}}return A},myData:[["3m Co",71.72,0.02,0.03,"9/1 12:00am"],["American Express Company",52.55,0.01,0.02,"9/1 12:00am"],["Boeing Co.",75.43,0.53,0.71,"9/1 12:00am"],["Hewlett-Packard Co.",36.53,-0.03,-0.08,"9/1 12:00am"],["Honeywell Intl Inc",38.77,0.05,0.13,"9/1 12:00am"],["Intel Corporation",19.88,0.31,1.58,"9/1 12:00am"],["International Business Machines",81.41,0.44,0.54,"9/1 12:00am"],["Johnson & Johnson",64.72,0.06,0.09,"9/1 12:00am"],["JP Morgan & Chase & Co",45.73,0.07,0.15,"9/1 12:00am"],["McDonald's Corporation",36.76,0.86,2.4,"9/1 12:00am"],["Merck & Co., Inc.",40.96,0.41,1.01,"9/1 12:00am"],["Microsoft Corporation",25.84,0.14,0.54,"9/1 12:00am"],["Pfizer Inc",27.96,0.4,1.45,"9/1 12:00am"],["The Coca-Cola Company",45.07,0.26,0.58,"9/1 12:00am"],["The Home Depot, Inc.",34.64,0.35,1.02,"9/1 12:00am"],["The Procter & Gamble Company",61.91,0.01,0.02,"9/1 12:00am"],["United Technologies Corporation",63.26,0.55,0.88,"9/1 12:00am"],["Verizon Communications",35.57,0.39,1.11,"9/1 12:00am"],["Wal-Mart Stores, Inc.",45.45,0.73,1.63,"9/1 12:00am"]],CLASS_NAME:"trimet.widget.ui.Grid"};
trimet.widget.ui.ExampleGrid=new trimet.Class(trimet.widget.ui.ExampleGrid);trimet.namespace("trimet.widget.ui");trimet.widget.ui.ExampleJsonGrid={store:null,panel:null,url:"test/vehicles.json",geomName:"geometry",maxUpdates:200,updateInterval:20000,running:false,interval:null,initialize:function(A){console.log("enter vehicles.Grid constructor");trimet.configure(this,A);this.store=new Ext.data.JsonStore({storeId:"vehicles",autoDestroy:true,autoSave:false,restful:false,url:this.url,idProperty:"~unique-id~",totalProperty:"total",successProperty:"success",root:"data",fields:[{name:"geometry"},{name:"type"},{name:"properties"},{name:"route",mapping:"properties.routeNumber"},{name:"vehicle",mapping:"properties.vehicleNumber"},{name:"heading",mapping:"properties.heading"},{name:"time",mapping:"properties.reportTime"},{name:"speed",mapping:"properties.speed"}]});this.panel=new Ext.grid.GridPanel({title:"Vehicles Grid",iconCls:"vehicles-panel",store:this.store,columns:[{header:"Route",width:60,sortable:true,dataIndex:"route",id:"route"},{header:"Vehicle #",width:60,sortable:true,dataIndex:"vehicle",id:"vehicle"},{header:"Time",width:60,sortable:true,dataIndex:"time"},{header:"Heading",width:60,sortable:true,dataIndex:"heading"},{header:"Speed",width:60,sortable:true,dataIndex:"speed",renderer:this.speed}],autoExpandColumn:"route",stripeRows:true,autoScroll:true,autoWidth:true});console.log("enter vehicles.Control constructor")},getPanel:function(){return this.panel},load:function(B){console.log("enter vehicles.Grid.load");try{this.store.load(B)}catch(A){console.log("ERROR: in vehicles.Grid.load "+A)}console.log("exit vehicles.Grid.load")},loader:function(D){console.log("enter vehicles.Grid.loader");try{this.clear();var B=this;var A=1;console.log("vehicles.Grid.loader setInterval callback (count 1 of "+B.maxUpdates+") - initial load");this.store.load(D);this.interval=setInterval(function(){if(B.updateInterval<2000){B.updateInterval=20000}if(B.maxUpdates>2000){B.updateInterval=2000}try{B.running=true;A++;if(A>B.maxUpdates){B.running=false;B.clear()}else{console.log("vehicles.Grid.loader setInterval callback (count "+A+" of "+B.maxUpdates+")");B.store.load(D)}}catch(E){B.running=false;B.clear();console.log(E)}},B.updateInterval)}catch(C){console.log("ERROR: in vehicles.Grid.loader "+C)}console.log("exit vehicles.Grid.loader")},clear:function(){try{clearInterval(this.interval)}catch(A){console.log("ERROR: in vehicles.clear "+A)}},speed:function(E,A,B,F,D,C){if(E>0){return'<span style="color:green;">'+E+"</span>"}else{if(E<=0){return'<span style="color:red;">'+E+"</span>"}}return E},CLASS_NAME:"trimet.widget.ui.ExampleJsonGrid"};trimet.widget.ui.ExampleJsonGrid=new trimet.Class(trimet.widget.ui.ExampleJsonGrid);trimet.namespace("trimet.widget.vehicles");trimet.widget.vehicles.GridStatic={profile:trimet.locale.profile.BaseStatic,url:trimet.utils.URL.vehicles,map:null,layer:null,store:null,panel:null,loadParams:null,geomName:"geometry",disabled:false,maxUpdates:160,updateInterval:15000,updateTimer:null,tracking:null,featureCache:null,help:"/html/map/vehicles.html",popup:null,popupTimer:null,loadTime:null,popupTemplate:null,clockDiv:"vehicle-clock",initialize:function(A){console.log("enter vehicles.Grid constructor");trimet.configure(this,A);this.layer=trimet.utils.OpenLayersUtils.simpleVectorLayers("RtVehicleLayer","/images/map/misc/vehicle-arrow.png","/images/map/misc/vehicle-arrow-on.png","${heading}",15,15,-7,1);this.map.addLayer(this.layer);this.store=new GeoExt.data.FeatureStore({layer:this.layer,fields:[{name:"route",type:"string"},{name:"destination",type:"string"},{name:"vehicleNumber",type:"string"},{name:"routeNumber",type:"int"},{name:"reportDate",type:"string"},{name:"speed",type:"int"},{name:"direction",type:"float"},{name:"heading",type:"float"},{name:"minutes",type:"int"},{name:"seconds",type:"int"}],sortInfo:{field:"reportDate",direction:"DESC"},proxy:new GeoExt.data.ProtocolProxy({protocol:new OpenLayers.Protocol.HTTP({url:this.url,format:new OpenLayers.Format.GeoJSON()})})});this.panel=new Ext.grid.GridPanel({title:this.profile.locale.vehicles.tool,iconCls:"vehicles-panel",store:this.store,columns:[{header:this.profile.locale.vehicles.number,width:75,sortable:true,dataIndex:"vehicleNumber",id:"vehicle"},{header:this.profile.locale.vehicles.route,width:170,sortable:true,dataIndex:"route",hidden:true},{header:this.profile.locale.vehicles.destination,sortable:true,dataIndex:"destination",id:"dir"},{header:this.profile.locale.vehicles.lastUpdate,width:135,sortable:true,dataIndex:"reportDate"}],autoExpandColumn:"dir",stripeRows:true,autoScroll:true,singleSelect:true,autoWidth:true,sm:new GeoExt.grid.FeatureSelectionModel()});this.panel.store.on("load",this.loadStoreCB,this);this.panel.on("rowdblclick",this.dblClickCB,this);var B=this.panel.getSelectionModel();B.on("rowselect",this.selectCB,this);B.on("rowdeselect",this.deselectCB,this);this.popupTemplate=new Ext.XTemplate("<P>{destination}</P>",'<p><a href="#" onClick="trimet.widget.vehicles.GridStatic.setPopup();">'+this.profile.locale.vehicles.lastPositionLink+":</a>","<br/>&nbsp;&nbsp;{reportDate}",'<br/>&nbsp;&nbsp;<b><span id="'+this.clockDiv+'">...</span></b>ago.</p>').compile();this.endServiceTemplate=new Ext.XTemplate(this.profile.locale.vehicles.endService,'<br/>&nbsp;&nbsp;<b><span id="'+this.clockDiv+'">...</span></b>ago.</p>').compile();console.log("exit vehicles.Grid constructor")},buttonOn:function(){if(this.isActive()){this.button.toggle(true,true)}},buttonOff:function(){if(this.isActive()){this.button.toggle(false,false)}},buttonShow:function(){if(this.isActive()){this.button.show()}},hide:function(){if(this.isActive()){this.button.hide();this.clear()}},show:function(B,A){if(this.isActive()){console.log("NOTE: vehicles.show() is getting ready to show these vehicle routes: "+B);this.loader({params:{id:B}});this.showLayerCB();if(A){console.log("NOTE vehicles.show() is going to show this panel "+A);A.show();A.expand()}}else{console.log("NOTE vehicles.show(): vehicles are disabled (probaby via startup config), so not going to show anything() ")}},setDisabled:function(A){if(A===true){this.disabled=true;if(this.button){this.button.hide()}}},isDisabled:function(){return this.disabled},isActive:function(){return this.disabled!=true},getPanel:function(){return this.panel},getStore:function(){return this.store},getLayer:function(){return this.layer},clear:function(){try{this.loadParams=null;this.stopLoader();this.hidePopup();this.store.removeAll()}catch(A){console.log("ERROR: in vehicles.clear "+A)}},close:function(){try{this.clear();var B=this.panel.findParentByType("panel");B.collapse(true)}catch(A){console.log("ERROR: in vehicles.close "+A)}},isRunning:function(){return this.loader!=null},load:function(B){console.log("enter vehicles.Grid.load");try{this.loadParams=B;this.store.load(B)}catch(A){console.log("ERROR: in vehicles.Grid.load "+A)}console.log("exit vehicles.Grid.load")},loader:function(D){console.log("enter vehicles.Grid.loader");try{this.clear();var B=this;var A=1;console.log("vehicles.Grid.loader setInterval callback (count 1 of "+B.maxUpdates+") - initial load");D.params.reqTime=new Date().getTime();D.params.reqCount=1;this.store.load(D);trimet.utils.AnalyticsUtils.gaEvent(trimet.utils.AnalyticsUtils.VEHICLES);this.updateTimer=setInterval(function(){if(B.updateInterval<10000){B.updateInterval=20000}if(B.maxUpdates>2000){B.maxInterval=2000}try{A++;if(A>B.maxUpdates){B.stopLoader();Ext.Msg.confirm(B.profile.locale.vehicles.tool,B.profile.locale.vehicles.timeOut,function(F,G){if(F=="yes"){this.loader(D)}else{this.close()}},B)}else{console.log("vehicles.Grid.loader setInterval callback (count "+A+" of "+B.maxUpdates+")");D.params.reqTime=new Date().getTime();D.params.reqCount=A;B.store.load(D)}}catch(E){B.stopLoader();console.log(E)}},B.updateInterval)}catch(C){console.log("ERROR: in vehicles.Grid.loader "+C)}console.log("exit vehicles.Grid.loader")},stopLoader:function(){if(this.updateTimer){var A=this.updateTimer;
this.updateTimer=null;clearInterval(A)}},setTracking:function(A){this.tracking=A},notFoundCount:0,loadStoreCB:function(B,A,C){this.loadTime=new Date();if(this.tracking){var D=B.find("vehicleNumber",this.tracking);if(D>=0&&this.tracking!="debug"){this.newLoad=true;this.featureCache=null;this.notFoundCount=0;this.panel.getSelectionModel().selectRow(D,false,false)}else{this.notFoundCount++;if(this.notFoundCount==10){var E=this.endServiceTemplate.apply({num:this.tracking});this.popupTimer=this.makePopupTimer(this.featureCache,this.popup);this.popup.body.update(E)}}}},selectCB:function(B,E,A){var C=A.data.feature;this.featureCache=C;console.log("vehicles selectCB "+C.attributes.vehicleNumber);if(this.newLoad&&this.popup&&this.popup.anc==null){trimet.utils.OpenLayersUtils.zoomToGeometry(this.map,C.geometry);this.popupTimer=this.makePopupTimer(C,this.popup);var D=this.popupTemplate.apply(C.attributes);this.popup.body.update(D)}else{this.showPopup(C)}this.newLoad=false},deselectCB:function(B,D,A){var C=A.data.feature;console.log("vehicles deSelectCB "+C.attributes.vehicleNumber);this.hidePopup()},dblClickCB:function(D,B,A){var A=D.getSelectionModel().getSelected();if(A){var C=A.data.feature;console.log("vehicles dblClickCB "+C.attributes.vehicleNumber);trimet.utils.OpenLayersUtils.zoomToGeometry(this.map,C.geometry)}},hidePopup:function(){try{if(this.popupTimer){clearInterval(this.popupTimer);this.popupTimer=null}if(this.popup){trimet.widget.vehicles.GridStatic.popup=null;this.popup.close();this.popup.destroy();this.popup=null;this.setTracking(null)}}catch(A){console.log("ERROR: in vehicles.Grid.hidePopup "+A)}},showPopup:function(A){try{var B=this.popupTemplate.apply(A.attributes);var E=new GeoExt.Popup({title:"Vehicle "+A.attributes.vehicleNumber,width:220,feature:A,unpinnable:true,collapsible:false,autoDestory:false,shadow:true,html:B});E.on("close",this.setTracking,this);var D=this.makePopupTimer(A,E);E.show();this.hidePopup();this.popup=E;this.popupTimer=D;trimet.widget.vehicles.GridStatic.popup=E;this.setTracking(A.attributes.vehicleNumber)}catch(C){console.log("ERROR: in vehicles.Grid.showPopup "+C)}},makePopupTimer:function(A,F){var E=null;try{var D=trimet.utils.DateUtils.getElapsedTime(this.loadTime,A.attributes.minutes,A.attributes.seconds);F.minutes=D.min;F.seconds=D.sec;if(this.popupTimer){clearInterval(this.popupTimer);this.popupTimer=null}var B=this;E=setInterval(function(){try{F.seconds++;if(F.seconds>=60){F.seconds=0;F.minutes++}var G=trimet.utils.DateUtils.getMinutesAndSeconds(F.minutes,F.seconds);var I=document.getElementById(B.clockDiv);if(G&&I&&I.firstChild){I.firstChild.nodeValue=G}}catch(H){console.log("ERROR: in vehicles.Grid.showPopup seconds setInterval callback "+H);if(B&&B.popupTimer){clearInterval(B.popupTimer);B.popupTimer=null}}},1000)}catch(C){console.log("EXCEPTION: in vehicles.Grid.showPopup "+C)}return E},setPopup:function(A){try{if(A==null){A=this.help}console.log(A);this.popup.load(A);this.popup.doLayout()}catch(B){}},showLayerCB:function(){this.layer.setVisibility(true);this.layer.redraw()},hideLayerCB:function(){this.stopLoader();this.hidePopup();this.layer.setVisibility(false)},CLASS_NAME:"trimet.widget.vehicles.Grid"};trimet.widget.vehicles.Grid=new trimet.Class(trimet.widget.vehicles.GridStatic);