﻿/// <reference path="VEJS/VeJavaScriptIntellisenseHelper.js" />

// NOTE:    The above reference is used only at design time.
//          It provides a skeleton of the VE API to enable 
//          intellisense.  Notice that the Default.aspx 
//          page DOES NOT reference VeJavaScriptIntellisenseHelper.js.
//          At run time, we use the real VE API.


var map
var oPRShapeL = new VEShapeLayer();  // park-n-ride layer
var oStationShapeL = new VEShapeLayer();
var findLayer = new VEShapeLayer();
var findArray = new Array();
var bTrafficLoaded;


var index = 0;
var results = null;

if (typeof(DESIGN_TIME) == 'undefined') 
{
    map = null;
}
else
{
    map = new VEMap();
}

function pageLoad()
{
    
    
    map = new VEMap("myMap"); 
    
    bTrafficLoaded = false;
    FP_preloadImgs('../images/VEMap/button1F.jpg','../images/VEMap/button20.jpg') 
    map.onLoadMap = map_Loaded;
    map.LoadMap(new VELatLong(33.4483, -112.0736), 12 ,VEMapStyle.Road,false,VEMapMode.Mode2D,true,1);
    oStationShapeL.SetTitle = "Stations";
    oPRShapeL.SetTitle = "ParkRideLoc";
    document.getElementById('MSVE_obliqueNotification').innerHTML = "";
    
   // map.LoadMap(new VELatLong(33.414805, -111.8700), 20 ,VEMapStyle.Hybrid,false,VEMapMode.Mode2D,true,1);
}

function GetSmallMap()
{
    map = new VEMap("myMap"); 
    bTrafficLoaded = false;
    FP_preloadImgs('../images/VEMap/button1F.jpg','../images/VEMap/button20.jpg') 
    map.onLoadMap = map_Loaded;
    map.LoadMap(new VELatLong(33.4483, -112.0736), 12 ,VEMapStyle.Road,false,VEMapMode.Mode2D,true,1);
    oStationShapeL.SetTitle = "Stations";
    oPRShapeL.SetTitle = "ParkRideLoc";
}

function pageUnload()
{
   if (map != null)
    {
        map.Dispose();
    }
}

function PrintMap() 
{ 
    var pOptions = new VEPrintOptions(true);
    map.SetPrintOptions(pOptions);
    window.print(); 
    pOptions = new VEPrintOptions(false); 
    map.SetPrintOptions(pOptions);
}

function map_Loaded()
{
    var cssRef = document.createElement("link");
    cssRef.setAttribute("rel", "stylesheet");
    cssRef.setAttribute("type", "text/css");
    cssRef.setAttribute("href", "~/Map/MapStyle.css");
    document.getElementsByTagName("head")[0].appendChild(cssRef);
    
    AddRail(map);
    
    AddStations(map, 1);
    LoadParkRideLoc(); 
    
    ToggleTraffic();
    
    AddEvent(map);
    
}

function AddEvent(map)
{
//    var points1 = new VELatLong(33.431521, -111.940700, 0, VEAltitudeMode.RelativeToGround)
//    var shape1 = new VEShape( VEShapeType.Pushpin, points1)
//    shape1.SetDescription("<div style='z-index:5000;background-color: #FF0000;text-align:center'><h2><a href='http://temp.com/'><u>Temp Festival</u></a></h2><br/>April 3 & 4 <br /><img src='http://tempemusicfestival.com/images/photoGallery/thumbs08/fergietv4_thumb.jpg' alt='Tempe Music Festival'/><br/> <img src='http://tempemusicfestival.com/images/photoGallery/thumbs08/fergie2_thumb.jpg' alt='Tempe Music Festival'/><img src='http://tempemusicfestival.com/images/photoGallery/thumbs08/Puddle%20of%20Mud%203_thumb.jpg' alt='Tempe Music Festival'/><img src='http://tempemusicfestival.com/images/photoGallery/thumbs08/Peachcake_thumb.jpg' alt='Tempe Music Festival'/></div>"); 
//    shape1.SetCustomIcon("http://www.downtownlightrail.com/light-rail-maps/Images/camera39_big.gif");
//    map.AddShape(shape1);
    
}

//loads the light rail map
function AddRail(map)
{
     var points;
    points = new Array(
 new VELatLong(33.523564032471256, -112.09970712661746, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.52121615121983, -112.09971517324449, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.518427679931484, -112.0997178554535, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.516303283018864, -112.09980100393296, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.514813937866286, -112.09976881742479, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.513908242466925, -112.09979832172394, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.51120004484985, -112.09985196590425, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50992307007613, -112.09987342357637, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50979112239657, -112.09987074136734, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50971955746929, -112.09984928369522, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50967706576568, -112.09981441497803, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50963457404123, -112.09976077079774, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50962562841237, -112.09970176219941, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50962339200503, -112.09962666034698, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.509621155597614, -112.09944158792498, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50957642743712, -112.09707856178286, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.509527226433896, -112.09296137094499, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50948920745768, -112.09001630544664, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.509437769992715, -112.08599030971527, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.509361731944985, -112.08248466253282, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.5093192400657, -112.07866519689563, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.509343840629945, -112.07681715488434, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50932371289608, -112.07672059535981, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50929911232612, -112.07664281129838, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.508874192286726, -112.07580596208574, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50867067721308, -112.07537949085237, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.508080257148165, -112.07397133111954, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.508017636601984, -112.07387745380401, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50799303566073, -112.07385063171387, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50795501601048, -112.07381039857866, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50792594214901, -112.07378089427951, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50787450375481, -112.07377284765246, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.507747025863495, -112.07377284765246, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50516388076984, -112.07378625869751, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.504229009259035, -112.07378089427951, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50385326858206, -112.07376480102539, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50366092450905, -112.07376748323442, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.503347805336354, -112.07379162311554, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.503247159647415, -112.07379162311554, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50302573871981, -112.07381308078766, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.502433043550475, -112.07382380962373, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.50121856492161, -112.0738157629967, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4999503894931, -112.07377552986146, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.499189922653414, -112.0737835764885, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.497912770665536, -112.07382649183273, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.496454423463916, -112.0738211274147, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.49536735726889, -112.07382649183273, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.494720926660946, -112.07383990287782, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.493266999354205, -112.0738184452057, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.49184212690697, -112.07386404275894, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.48795883902022, -112.07381308078766, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.48533707384961, -112.0737996697426, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.48072194799063, -112.07378625869751, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.47266334432512, -112.07380235195163, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.463221161745345, -112.07382380962373, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.46243799614212, -112.07386136054994, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.462066549410906, -112.0739257335663, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.461831597343504, -112.07393646240234, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.461491475127325, -112.07394450902941, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.46105960749571, -112.07390427589418, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.460844791706755, -112.07387477159503, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4605248047008, -112.07385063171387, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.46009516994025, -112.07386404275894, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.459934056356126, -112.07388281822206, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.459723713170696, -112.07394719123842, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45937239415912, -112.0740732550621, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.459061352572185, -112.07425564527513, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45879730200394, -112.07447290420535, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45857576743223, -112.07467138767242, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45827814938929, -112.07489401102067, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.458031998356304, -112.07503885030746, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45789325837523, -112.07510054111482, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45775228042511, -112.07512468099597, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45752626767755, -112.07515686750412, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45676319058337, -112.07515150308609, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.45472231796649, -112.07514077425004, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.452918612050496, -112.07515954971313, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44972734814102, -112.075132727623, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448308473600974, -112.07514345645904, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44752517329579, -112.07517027854921, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447337180169946, -112.07517564296724, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44727003966912, -112.07513809204101, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447223041287614, -112.07509249448776, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447180518920504, -112.07503348588945, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44716037673933, -112.07496643066409, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44714694861596, -112.07486718893051, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447140234553494, -112.07475721836091, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44711785434149, -112.07454532384872, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44711785434149, -112.07424759864808, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44709771214577, -112.0734402537346, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447090998079496, -112.07314789295196, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44705518971721, -112.07274019718171, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44697238282284, -112.07214206457138, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.446938812437736, -112.07199990749359, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44689628993129, -112.07180678844455, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44682243500211, -112.07152515649797, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44651582447218, -112.07061052322389, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44643749314109, -112.07033425569537, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.446379304106486, -112.07011431455613, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44634573349185, -112.06978440284732, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.446339019367365, -112.06933647394182, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44636363782127, -112.06810265779495, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4463882562682, -112.06782907247543, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44644644529679, -112.06754207611085, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.446533728766504, -112.06731677055359, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44686495754476, -112.06660330295564, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44703057145958, -112.06619560718535, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44713575851156, -112.06563234329223, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44717380486064, -112.06530243158342, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44718275694034, -112.06506639719011, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44718499496012, -112.0647606253624, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44718275694034, -112.06302255392076, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44718499496012, -112.06065416336058, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44719170901914, -112.05700904130937, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44720513713558, -112.05298572778702, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44721632723105, -112.04657256603242, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44724765949063, -112.03936278820038, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44726780165154, -112.03887462615968, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44729018182482, -112.03834891319276, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447296895875695, -112.03793048858644, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44729913389252, -112.03451603651048, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44725437354478, -112.03213423490526, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44721632723105, -112.02946007251741, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44722975534368, -112.02809482812883, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44724765949063, -112.0278587937355, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4473013719093, -112.02757179737092, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44741998671606, -112.02723115682603, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44771764202632, -112.02663302421571, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44797053633692, -112.02621728181839, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4480645322644, -112.02595442533496, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44812495816399, -112.02576130628587, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44816300407918, -112.02555477619172, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4481876220154, -112.0252650976181, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448227905895955, -112.02496469020845, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44823685786688, -112.02480375766755, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44823461987425, -112.02433437108995, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448216715931025, -112.02222615480423, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448183146027524, -112.01357066631318, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448156290095355, -112.00263261795044, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448156290095355, -111.99601829051971, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44812495816399, -111.99174821376799, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448122720168456, -111.99137538671495, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44810257820608, -111.99112057685853, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44808691223212, -111.99090063571931, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44808691223212, -111.99067533016206, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44808019824241, -111.98975533246995, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44807348425218, -111.989221572876, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44807796024573, -111.98633283376694, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.448017534313394, -111.9849541783333, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447977250335114, -111.98422729969024, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.447916824332616, -111.9832643866539, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44778254417636, -111.98204934597015, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44757888554262, -111.9802710413933, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44676872228685, -111.9730693101883, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44613311929741, -111.96779608726503, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44548408326969, -111.96251749992372, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.445331894808625, -111.96131050586702, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44522894363942, -111.96040928363801, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.445125992348046, -111.95988357067108, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44503646938665, -111.95957243442537, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4449782794122, -111.95941150188447, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.444879803981905, -111.95915400981904, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44474999528935, -111.95887506008148, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44462913874579, -111.9586604833603, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44449037732148, -111.95842444896698, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44434713948936, -111.9582098722458, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.444136758494636, -111.95795238018037, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44392190078194, -111.95771634578705, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4437428522815, -111.95755004882814, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44316989459674, -111.95709943771364, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44163452839412, -111.95580124855041, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44140623547207, -111.95557594299318, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44122270543247, -111.95537745952606, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44104812771743, -111.95516288280488, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44085564418854, -111.95486783981324, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44075268770709, -111.95468544960023, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44063182559471, -111.95440649986267, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.440560203522736, -111.95417582988739, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.440443817529676, -111.95373594760895, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.440363242519936, -111.95338726043702, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.44030057301618, -111.95303857326509, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.440237903467164, -111.95270597934723, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43955748830695, -111.94950342178346, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.439481388911204, -111.9492620229721, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43936947791386, -111.9489723443985, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.439087461560355, -111.94827497005465, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43884573252777, -111.94778680801391, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43806682328601, -111.94662809371951, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.437650506858404, -111.94601655006408, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43676414910106, -111.94477736949923, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.436338873225495, -111.94439113140105, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43607027686178, -111.94425702095033, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4353898290194, -111.9439834356308, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43510332306845, -111.94388151168824, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.434767572703414, -111.94381713867189, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.432900776983715, -111.94360792636873, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43210390710927, -111.9435167312622, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43173680728967, -111.94349527359009, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43088172729896, -111.94350600242617, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.43038926903106, -111.94351136684418, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42909543354051, -111.94350063800813, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42872832099606, -111.94346845149994, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42840597699388, -111.9433504343033, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42822689647544, -111.94323778152466, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.428101539892665, -111.9431358575821, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42796275203631, -111.9429910182953, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.427859780257535, -111.94283545017244, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42771651497084, -111.94262623786927, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42763145109497, -111.94242238998414, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42757324944766, -111.94222390651701, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.427537433029926, -111.94197177886964, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42752400186947, -111.94160163402557, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42751504776133, -111.94113492965698, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42751504776133, -111.93969726562501, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42750609365229, -111.93950414657593, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42747027720684, -111.93935930728914, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42743893780495, -111.93923592567445, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42736282778183, -111.93905353546144, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42687930372332, -111.93795919418335, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.426498750486914, -111.93697214126587, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.426001790219296, -111.93555593490602, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42589881611433, -111.9352662563324, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.425809273315046, -111.93511068820955, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42569734468608, -111.93497121334077, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4255898930665, -111.93486392498018, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42546900983548, -111.93474054336549, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42534812643613, -111.93458497524261, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.425272014579804, -111.9344347715378, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42521381135053, -111.93430066108703, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42497652085812, -111.93361401557922, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.424828773620085, -111.93320095539096, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42470341213002, -111.9329059123993, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4246049136894, -111.93273425102234, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.424488506297294, -111.9325840473175, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42439000761285, -111.93243384361267, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42429150881663, -111.93232119083404, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.424175101004295, -111.93219780921937, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.423530377986665, -111.93141996860504, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42348112811486, -111.93133950233461, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42341844641943, -111.93124294281008, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42330651470788, -111.93102300167084, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42327069652972, -111.9308888912201, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42322592378622, -111.93059921264651, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.423181151019634, -111.93033099174501, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.4231542873486, -111.93009495735168, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.423091605417184, -111.92981600761413, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42297967328426, -111.92952096462251, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.422890127474005, -111.92935466766359, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.42277819508131, -111.92917227745056, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.422576716410795, -111.92894697189332, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.421949890890204, -111.92822813987732, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41929478689701, -111.92526161670685, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41721273455967, -111.92295491695405, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41525600761255, -111.92073404788971, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41497391290611, -111.92043900489808, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.414908986216965, -111.92036122083665, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41486868686826, -111.92028880119325, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41483062635508, -111.9201895594597, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.414805998955316, -111.92012250423431, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41478808811474, -111.92002326250078, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41477913269306, -111.91992402076722, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41477689383749, -111.91980063915252, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41475674413485, -111.91781044006347, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41477017727046, -111.91182643175125, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41477689383749, -111.89695894718171, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41483062635508, -111.87969088554382, 0, VEAltitudeMode.RelativeToGround),
 new VELatLong(33.41488435883942, -111.86786234378814, 0, VEAltitudeMode.RelativeToGround)
    );
    
     myPolygon = new VEShape(VEShapeType.Polyline , points);
     myPolygon.SetLineWidth(6);
     myPolygon.HideIcon();
     map.AddShape(myPolygon);

    
 //*** Jefferson Line
      points = new Array(
                            new VELatLong(33.45993, -112.0738, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4600, -112.0738, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4588, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4584, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4538, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4533, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4530, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4527, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4520, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4493, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4489, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4486, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4484, -112.0739, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4484, -112.0738, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0738, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0737, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0736, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0734, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0728, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0726, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0723, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0706, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.06659, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0657, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0652, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0640, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0636, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0633, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0627, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4482, -112.0623, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4482, -112.0590, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4482, -112.0572, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4483, -112.0472, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4482, -112.0293, 0, VEAltitudeMode.RelativeToGround),
                            new VELatLong(33.4482, -112.0254, 0, VEAltitudeMode.RelativeToGround)
                            );

    myPolygon = new VEShape(VEShapeType.Polyline , points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    map.AddShape(myPolygon);
}

//formats the station pushpins
 function onStationsFeedLoad(feed)
 {      
    if(feed != null)
    {
        var numShapes = feed.GetShapeCount();
        for(var i=0; i < numShapes; ++i)
        {
            try
            {
                var shape1 = feed.GetShapeByIndex(i);
                shape1.SetCustomIcon("http://www.downtownlightrail.com/light-rail-maps/images/Station.gif");
                
                var shapeHTML = shape1.GetDescription();
                var sImage = "";
                
                if (i == 0)
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3142/3091968297_3869ba1be2.jpg?v=0' width='190px' height='155px' />";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 15, 19, 60, 576</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'>Adjacent park-and-ride - 800 spaces<br /><br/>Adjacent to <a href='http://www.christownspectrum.com/' target='_blank'><u>Spectrum Mall</u></a><br /><br/>Easy access to I-17 via Bethany Home Road</p>"
                }
                else if(i == 1) //19th ave and Camelback
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3198/3092806012_5de095415f.jpg?v=0' width='190px' height='155px' />";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 19, 50</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'>Adjacent park-and-ride - 411 spaces.<br/><br/>Convenient freeway access to I-17</p>"
                }
                else if(i == 2) //7th Avenue / Camelback
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3100/2764474676_a0c3b60cf2_m.jpg' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 8, 50</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'>Provides access to a variety of retail and commercial developments.</p>"
                }
                else if(i == 3) //Jefferson / 1st Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3214/2662361313_bd6e37635a_m.jpg' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 1, 8, 10, 15, DASH, GAL, 510, 512,520, 521, 531, 532, 533, 535, 540, 541, 560, 570, 571, 573, 575, 581, 582, 590, RAPID: 1-10 East, 1-10 West, 1-17, SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'></p>"
                }
                else if(i == 4) //Van Buren / 1st Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3167/3092815266_85e05e7a2e.jpg?v=0'width='190px' height='155px' />";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>:Bus Routes: 0, 1, 3, 7, 7L, 8, 10, 12, 15,DASH, GAL, 510, 512, 520, 521, 531, 532, 533,535, 540, 541, 560, 562, 570, 571, 573, 575, 581, 582, 590, RAPID: 1-10 East, 1-10 West, 1-17, SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'></p>"
                }
                else if(i == 5) //Camelback / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3004/2763631647_7c6e6c3975_m.jpg' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>:Bus Routes: 0, 39, 50, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'>Gateway to the Uptown Business District.</p>"
                }
                else if(i == 6) //Van Buren / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3167/3092815266_85e05e7a2e.jpg?v=0'width='190px' height='155px' />";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>:Bus Routes: 0, 1, 3, 7, 7L, 8, 10, 12, 15,DASH, GAL, 510, 512, 520, 521, 531, 532, 533,535, 540, 541, 560, 562, 570, 571, 573, 575, 581, 582, 590, RAPID: 1-10 East, 1-10 West, 1-17, SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'></p>"
                }
                else if(i == 7) //McDowell / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3269/3092812702_b5eabe8462.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 17, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.phxart.org/'><u>Phoenix Art Museum</u></a><br /><br /><a href='http://www.phoenixpubliclibrary.org/branchinfo.jsp?bid=BBB'><u>Burton Barr Central Library</u></a></p>"
                }
                else if(i == 8) //Roosevelt / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3266/3091975257_f35b852918.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 10, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.azirish.org/'><u>Irish Cultural Center</u></a><br /><br />Roosevelt Phoenix Art District <br /><br /><a href='http://www.phoenixpubliclibrary.org/branchinfo.jsp?bid=BBB'><u>Burton Barr Central Library</u></a></p>"
                }
                else if(i == 9) //Indian School / Central Ave Station 
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3129/3091965639_922682409d.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 41, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://phoenix.gov/parks/sisp.html'><u>Steele Indian School Park</u></a><br /><br /><a href='http://www.phoenix.va.gov/'><u>Carl T. Hayden VA Medical Center</u></a></p>"
                }
                else if(i == 10) //Encanto / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3217/2764473318_52181be178.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.heard.org/'><u>Heard Museum</u></a><br /><br />Monterey Park<br /><br />Willo Historic District</p>"
                }
                else if(i == 11) //Campbell / Central Ave Station  - no station pic
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3136/2663188692_ca5c9d60a9.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'>Brophy College Preparatory<br /><br />Xavier College Preparatory<br /><br />Central High School<br /><br />Grand Canal multi-use path</p>"
                }
                else if(i == 12) //Osborn / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3121/3091965311_272baee471.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.parkcentralphx.com/'><u>Park Central Mall</u></a><br /><br /><a href='http://www.stjosephs-phx.org/index.htm'><u>St. Joseph's Hospital and Medical Center</u></a><br /><br />Phoenix Corporate Center</p>"
                }
                else if(i == 13) //Thomas / Central Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3014/3091973517_fc04b5cb8f.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 29, 512, 570, 582, 590</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.parkcentralphx.com/'><u>Park Central Mall</u></a><br /><br /><a href='http://www.stjosephs-phx.org/index.htm'><u>St. Joseph's Hospital and Medical Center</u></a><br /><br />Phelps Dodge Building<br /><br />Microsoft<br /><br />Hilton Hotel</p>"
                }
                else if(i == 14) //Jefferson / 1st Ave Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3214/2662361313_bd6e37635a_m.jpg' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 0, 1, 8, 10, 15, DASH, GAL, 510, 512,520, 521, 531, 532, 533, 535, 540, 541, 560, 570, 571, 573, 575, 581, 582, 590, RAPID: 1-10 East, 1-10 West, 1-17, SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'></p>"
                }
                else if(i == 15) //3rd St / Washington Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3021/2769447628_3f58f196fc.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, DASH, SR-51 Rapid</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://phoenix.gov/phxplaza.html'><u>Phoenix Convention Center</u></a><br /><br /><a href='http://www.azchasefield.com/'><u>Chase Field</u></a><br /><br /><a href='http://www.azscience.org/'><u>Arizona Science Center</u></a><br /><br /><a href='http://www.phoenixsymphony.org/'><u>Phoenix Symphony Hall</u></a><br /><br /> </p>"
                }
                else if(i == 16) //3rd St / Jefferson Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3143/3092816198_92a1e43d65.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, DASH, SR-51 Rapid</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://phoenix.gov/phxplaza.html'><u>Phoenix Convention Center</u></a><br /><br /><a href='http://www.azchasefield.com/'><u>Chase Field</u></a><br /><br /><a href='http://www.azscience.org/'><u>Arizona Science Center</u></a><br /><br /><a href='http://www.phoenixsymphony.org/'><u>Phoenix Symphony Hall</u></a><br /><br /> </p>"
                }
                else if(i == 17) //12th St / Washington Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3012/3091979069_6b555ec22d.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, RAPID: SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://phoenix.gov/PARKS/eastlak.html'><u>Eastlake Park Recreation Center</u></a><br /><br /><a href='http://www.ci.phoenix.az.us/FIRE/'><u>Fire Department Headquarters</u></a><br /><br /><a href='http://www.newtimes.com'><u>New Times</u></a></p>"
                }
                else if(i == 18) //12th St / Jefferson Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3267/3092820044_7f86c4b7b6.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, RAPID: SR51</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://phoenix.gov/PARKS/eastlak.html'><u>Eastlake Park Recreation Center</u></a><br /><br /><a href='http://www.ci.phoenix.az.us/FIRE/'><u>Fire Department Headquarters</u></a><br /><br /><a href='http://www.newtimes.com'><u>New Times</u></a></p>"
                }
                else if(i == 19) //24th St / Jefferson Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3062/3092821262_4771ac559e.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, 70</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.greyhound.com'><u>Greyhound bus terminal (3 blocks south)</u></a><br /><br /><a href='http://www.mihs.org'><u>Maricopa Medical Center</u></a><br /><br /><a href='http://www.azdhs.gov/azsh/index.htm'><u>Arizona State Hospital</u></a><br /><br /><a href='http://www.azdot.gov/MVD/'><u>Motor Vehicle Division</u></a></p>"
                }
                else if(i == 20) //24th St / Washington Station
                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3253/2763628833_925e040e8f.jpg?v=0' width='190px' height='155px'/>";
                    shapeHTML = "<p style='text-align:center'><a href='http://routes.valleymetro.org/timetables/2/route_list' target='_blank'><u>Bus Routes</u>: 1, 70</a></p><p style='text-align:left;font-family:Georgia; font-size:11px'><a href='http://www.greyhound.com'><u>Greyhound bus terminal (3 blocks south)</u></a><br /><br /><a href='http://www.mihs.org'><u>Maricopa Medical Center</u></a><br /><br /><a href='http://www.azdhs.gov/azsh/index.htm'><u>Arizona State Hospital</u></a><br /><br /><a href='http://www.azdot.gov/MVD/'><u>Motor Vehicle Division</u></a></p>"
                }
//                else if(i == 21) //38th St / Washington Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3040/2764471480_3bbb1b88da.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 22) //44th St / Washington Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3223/3092822220_f838474ca0.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 23) //Priest Dr / Washington Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3284/3073279950_b81fb6fd8d.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 24) //Center Pkwy / Washington Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3142/2790300550_936112947f.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 25) //3rd St / Mill Ave Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3106/2611891698_14b3c127f2.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 26) //5th St / College Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3250/3091988491_0a5020cf55.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 27) //University Dr / Rural Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3124/2781514961_88deccdfc7.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 28) //Dorsey Ln / Apache Blvd Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3124/2781514961_88deccdfc7.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 29) //McClintock Dr / Apache Blvd Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3134/2604882131_87bf61b102.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 30) //Smith-Martin / Apache Blvd Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3161/2605713170_1f93dbc5b6.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 31) //Price-101 / Apache Blvd Station
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3157/2605713306_b15c4429c9.jpg?v=0' width='190px' height='155px'/>";
//                }
//                else if(i == 32) //Sycamore / Main St Station 
//                {
//                    sImage = "<img src='http://farm4.static.flickr.com/3149/2605713460_3c465583f2.jpg?v=0' width='190px' height='155px'/>";
//                }
                sImage = sImage + "<br />";
                
                var latlong = shape1.GetPoints()[0];
                var lat = latlong.Latitude;
                var lon = latlong.Longitude;
                shapeHTML = shapeHTML + "<br /><hr /><a onclick='JavaScript:DoZoom(" + lat + "," + lon + ") ;' style='background-color:#BBC423; cursor:pointer; color:black; padding:3px;border: solid 1px black;'>Zoom to this station</a>";

                shape1.SetDescription("<div style='z-index:5000;'>" + sImage + shapeHTML + "</div>"); 

            }
            catch(e)
            {

            }
        }
    }
 }

//imports Stations from the data feed.
function AddStations(map, bestlocation)
{
    var shapeSource = new VEShapeSourceSpecification(VEDataType.ImportXML, 'http://www.downtownlightrail.com/light-rail-maps/StationFeed.ashx?lineId=1', oStationShapeL);
    map.ImportShapeLayerData(shapeSource, onStationsFeedLoad, bestlocation);
}

function DoZoom(lat, lon) {
    map.SetCenterAndZoom(new VELatLong(lat, lon), 19);
    map.SetMapStyle(VEMapStyle.Hybrid);
}

//formats the pushpins for the park-n-rides
function onParkRideLocFeedLoad(feed)
 {      
    if(feed != null)
    {
        var numShapes = feed.GetShapeCount();
        for(var i=0; i < numShapes; ++i)
        {
            try
            {
                var shape = feed.GetShapeByIndex(i);
                shape.SetCustomIcon("http://www.downtownlightrail.com/light-rail-maps/images/car.gif");
            }
            catch(e)
            {

            }
        }
    }
 }
 
//gets the park and ride locations and loads them in the shapelayer. 
function LoadParkRideLoc()
{
//    var shapeSource = new VEShapeSourceSpecification (VEDataType.ImportXML, 'http://www.downtownlightrail.com/light-rail-maps/Parking.ashx?lineId=1', oPRShapeL);
  var shapeSource = new VEShapeSourceSpecification (VEDataType.ImportXML, 'http://www.phoenixcommute.com/Map/GeoRssFeed.aspx?TypeID=2', oPRShapeL);    
  map.ImportShapeLayerData(shapeSource, onParkRideLocFeedLoad, 0);
}

//function Resize()
//{
//    var mapDiv = document.getElementById("myMap");
//    var sqlTXT = document.getElementById("txtSQL");
//    var accordion = document.getElementById("Accordion1");
//    var windowWidth = document.body.clientWidth;
//    var windowHeight = document.body.clientHeight;
//    mapWidth = windowWidth - 305;
//    mapHeight = windowHeight  - 155;
//    mapDiv.style.width = mapWidth + "px";
//    mapDiv.style.height = mapHeight + "px";
//    sqlTXT.style.width = mapWidth - 175 + "px";
//    accordion.style.height = (windowHeight - 45) + "px";
//    map.Resize(mapWidth, mapHeight);
//    map.ShowMiniMap(mapWidth-205, 13, VEMiniMapSize.Large);
//}

//This function is used to hide and show the station shape layer after it is loaded.
function ToggleStationLayer()
{        
    if (oStationShapeL.GetVisibility())
    {
        oStationShapeL.Hide();
    }
    else
    {
        oStationShapeL.Show();
    }
}

//This function is used to hide and show the park-n-ride shape layer after it is loaded.
function ToggleParknRideLayer()
{        
    if (oPRShapeL.GetVisibility())
    {
        oPRShapeL.Hide();
    }
    else
    {
        oPRShapeL.Show();
    }
}

//Toggles traffic off and on.
function ToggleTraffic()
{
    if( bTrafficLoaded )
    {
        bTrafficLoaded = false;
        map.HideTrafficLegend();
        map.ClearTraffic();
    }
    else
    {
        bTrafficLoaded = true;
        map.ShowTrafficLegend(20,470);
        map.SetTrafficLegendText("Traffic");
        map.LoadTraffic(bTrafficLoaded);
    }
}

//Does the find functionality - yellow book find. bNext = -1 means a new search.
 function DoFind(numResults, bNext)
 {
    try
    {
        var what = document.getElementById('txtWhat').value;
        findLayer.DeleteAllShapes();
        findLayer = new VEShapeLayer();

        map.AddShapeLayer(findLayer);
        
        if(bNext == -1) 
        {
            index = 0;
        }
        else if(bNext != 1) 
        {
            index =  parseInt(index) - (numResults * 2)
        }
       
        if (index < 0) index = 0;
        if(numResults > 20) numResults = 20;
        results = map.Find(what,
                          null,
                          null,
                          findLayer,
                          index,
                          numResults,
                          true,
                          true,
                          true,
                          true,
                          MoreResults);
        index = parseInt(index)+numResults;
    }
    catch(e)
    {
       alert(e.message);
    }
 }

 function MoreResults(layer, resultsArray, places, hasMore, veErrorMessage)
 {
    var r = "";
    if(hasMore)
    {
        if(index > 10)
        {
            r = "<a href='#' onclick='javascript:DoFind(10,0);'>&lt;Prev</a>&nbsp;&nbsp;";
        }
        r = r + "<a href='#' onclick='javascript:DoFind(10,1);'>Next></a><hr />";
    }
    else if (index < 10)
    {
        r = "<a href='#' onclick='javascript:DoFind(10,1);'>Next></a><hr />";
    }
    else
    {
        if(index > 9)
        {
            r = "<a href='#' onclick='javascript:DoFind(10,0);'>&lt;Prev</a>";
        }
    }
    
    document.getElementById('results').innerHTML = r;
    var resList = "";
    
    if(layer != null)
    {
        var numShapes = layer.GetShapeCount();
        for(var i=0; i < numShapes; ++i)
        {
            var x = i + 1
            var shape = layer.GetShapeByIndex(i);
            shape.SetCustomIcon("http://www.downtownlightrail.com/light-rail-maps/images/Black" + x + ".gif");
            
            try
            {
                var fName = resultsArray[i].Name;
                var fDescrip = resultsArray[i].Description;
                var fPhone = resultsArray[i].Phone;
            }
            catch(e)
            {
            
            }
            resList = resList + "<img src='http://www.downtownlightrail.com/light-rail-maps/images/Black" + x + ".gif'</img>" + fName + "<br />" + fDescrip + "<br />" + fPhone +"<br /><hr />";
        }
    }
    document.getElementById('resultslist').innerHTML = resList;
 } 
 
function hideFindDiv() 
{ 
    //hide the find part of the control
    if (document.getElementById) 
    { // DOM3 = IE5, NS6 
        document.getElementById('findControl').style.visibility = 'hidden'; 
    } 
    else 
    { 
        if (document.layers) 
        { // Netscape 4 
            document.findControl.visibility = 'hidden'; 
        } 
        else 
        { // IE 4 
            document.all.findControl.style.visibility = 'hidden'; 
        } 
    } 
    
    //hide the results part of the control
    if (document.getElementById) 
    { // DOM3 = IE5, NS6 
        document.getElementById('results').style.visibility = 'hidden'; 
    } 
    else 
    { 
        if (document.layers) 
        { // Netscape 4 
            document.results.visibility = 'hidden'; 
        } 
        else 
        { // IE 4 
            document.all.results.style.visibility = 'hidden'; 
        } 
    } 
} 

function showFindDiv() 
{ 
    //show the find part of the control
    if (document.getElementById) 
    { // DOM3 = IE5, NS6 
        document.getElementById('findControl').style.visibility = 'visible'; 
    } 
    else 
    { 
        if (document.layers) 
        { // Netscape 4 
            document.findControl.visibility = 'visible'; 
        } 
        else 
        { // IE 4 
            document.all.findControl.style.visibility = 'visible'; 
        } 
    } 
    
     //show the results part of the control
    if (document.getElementById) 
    { // DOM3 = IE5, NS6 
        document.getElementById('results').style.visibility = 'visible'; 
    } 
    else 
    { 
        if (document.layers) 
        { // Netscape 4 
            document.results.visibility = 'visible'; 
        } 
        else 
        { // IE 4 
            document.all.results.style.visibility = 'visible'; 
        } 
    } 
} 


//Load images for Find Button
<!--
function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}
// -->

