var StoreLocator={m_map:null,m_currentZip:null,m_pushPingId:0,m_lat:39.3682791491601,m_lon:-98.701171875,m_defaultZoomLevel:4,m_jsloaded:false,m_isfirst:true,GetSwfObj:function(b){if(navigator.appName.indexOf("Microsoft")!=-1)return window[b];else{var a=document[b];if(a.length>1)return a[1];else return a}},loadLibrary:function(){if(!StoreLocator.m_jsloaded){var a=document.createElement("SCRIPT");a.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(a);a.src="VEScriptHandler.ashx"}else OnLiveMapApiLoaded()},showLiveMap:function(b){var a=document.getElementById("mapContainer");if(a!=null)if(!b){a.style.top="-999px";a.style.left="-999px"}if(StoreLocator.m_isfirst)if(StoreLocator.m_currentZip!=null){StoreLocator.m_isfirst=false;StoreLocator.showStores(StoreLocator.m_currentZip)}},locateLiveMap:function(b,c){var a=document.getElementById("mapContainer");if(a!=null){a.style.pixelLeft=b;a.style.pixelTop=c}},showStores:function(a){StoreLocator.m_currentZip=a;if(StoreLocator.m_map!=null){StoreLocator.m_map.SetMapStyle(VEMapStyle.Road);StoreLocator.m_map.Find("Subway Restaurants",a,VEFindType.Businesses,null,0,20,true,true,false,true,StoreLocator.Map_OnClientSearched)}},initVEMap:function(){try{StoreLocator.m_map=new VEMap("map");StoreLocator.m_map.EnableBirdseye=true;var b=new VEMapOptions;b.EnableBirdseye=true;StoreLocator.m_map.SetClientToken(VEServiceToken);StoreLocator.m_map.LoadMap(new VELatLong(StoreLocator.m_lat,StoreLocator.m_lon),StoreLocator.m_defaultZoomLevel,null,false,VEMapMode.Mode2D,true,0,b);StoreLocator.m_map.ShowMessageBox=false;StoreLocator.m_map.SetZoomLevel(StoreLocator.m_defaultZoomLevel);var a=StoreLocator.GetSwfObj("subwayMainFlash");if(a!=null)a.sendToFlash("VEScript_DownloadCompleted")}catch(c){}},addPin:function(g,e,f,b,d){try{var c=new VELatLong(e,f),a=new VEShape(VEShapeType.Pushpin,c);a.SetCustomIcon("<img src='"+baseImgPath+"subwayMapIcon.gif' />");a.SetTitle("");a.SetDescription(StoreLocator.initPinDescription(b,d));StoreLocator.m_map.AddShape(a)}catch(h){}},initPinDescription:function(a,c){var b="";b="<a target='_blank' href='http://maps.live.com/?v=2&where1="+a+"&encType=1' style='text-decoration: none;' onclick='javascript:StoreLocator.Link_OnClick()'><Div style='font-weight: bold; color: #56913F;' >Subway</Div></a><Div>"+a+"</Div><Div>Phone Number:"+c+"</Div>";return b},Map_OnClientSearched:function(h,a){StoreLocator.m_map.Clear();if(a!=null&&a.length>0)for(var b=0;b<a.length;b++){var d=a[b].Description,c=a[b].Phone;StoreLocator.addPin(StoreLocator.m_pushPingId++,a[b].LatLong.Latitude,a[b].LatLong.Longitude,d,c)}},VEMap_OnDownloadComplete:function(){StoreLocator.m_jsloaded=true;StoreLocator.initVEMap()},Link_OnClick:function(){try{var a=StoreLocator.GetSwfObj("subwayMainFlash");if(a!=null)a.sendToFlash("PushPinLink_Clicked")}catch(c){}}};function OnLiveMapApiLoaded(){window.setTimeout(StoreLocator.VEMap_OnDownloadComplete,1000)}