﻿/// <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() {
    try {
        map = new VEMap("myMap");
        bTrafficLoaded = false;
        map.onLoadMap = map_Loaded;
        map.LoadMap(new VELatLong(39.7413, -105.0097), 12, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
        oStationShapeL.SetTitle = "Stations";
        oPRShapeL.SetTitle = "ParkRideLoc";
        document.getElementById('MSVE_obliqueNotification').innerHTML = "";
    }
    catch (e) {

    }
}

function GetSmallMap() {
    map = new VEMap("myMap");
    bTrafficLoaded = false;
    map.onLoadMap = map_Loaded;
    map.LoadMap(new VELatLong(39.7413, -105.0097), 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() {
    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://tempemusicfestival.com/'><u>Tempe Music 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;

//union station to littleton
    points = new Array(
            new VELatLong(39.7553, -104.9989, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7545, -104.9999, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7543, -105.0007, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7539, -105.0012, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7533, -105.0020, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -105.0022, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -105.0023, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -105.0024, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -105.0025, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -105.0026, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7533, -105.0027, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7538, -105.0034, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7539, -105.0036, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7539, -105.0038, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7539, -105.0040, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7539, -105.0040, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7538, -105.0042, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7537, -105.0043, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7536, -105.0044, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7534, -105.0045, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7528, -105.0050, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7526, -105.0051, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7523, -105.0054, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7516, -105.0063, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7509, -105.0070, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7504, -105.0075, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7495, -105.0082, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7491, -105.0087, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7489, -105.0091, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7485, -105.0101, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7479, -105.0115, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -105.0125, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7471, -105.0130, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7466, -105.0135, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7464, -105.0137, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7460, -105.0140, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7453, -105.0142, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7449, -105.0143, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7443, -105.0143, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7440, -105.0143, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7437, -105.0141, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7436, -105.0140, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -105.0139, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -105.0138, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -105.0137, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -105.0133, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7434, -105.0124, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7433, -105.0121, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7432, -105.0119, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7431, -105.0117, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7416, -105.0106, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7414, -105.0104, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0103, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0101, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0100, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7413, -105.0097, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0095, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0082, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7413, -105.0082, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7412, -105.0081, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7412, -105.0080, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7410, -105.0079, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7396, -105.0069, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7390, -105.0065, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7388, -105.0064, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7386, -105.0064, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7384, -105.0063, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7372, -105.0063, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7360, -105.0062, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7347, -105.0061, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7332, -105.0060, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7327, -105.0059, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7323, -105.0058, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7311, -105.0054, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7299, -105.0050, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7282, -105.0044, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7269, -105.0040, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7259, -105.0036, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7247, -105.0029, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7235, -105.0021, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7225, -105.0015, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7214, -105.0008, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7202, -105.0000, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7190, -104.9992, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7172, -104.9982, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7160, -104.9975, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7145, -104.9966, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7120, -104.9953, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7098, -104.9942, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7093, -104.9938, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7087, -104.9933, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7079, -104.9925, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7073, -104.9920, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7069, -104.9918, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7057, -104.9911, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7047, -104.9907, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7038, -104.9905, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7024, -104.9903, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7010, -104.9901, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.6993, -104.9900, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6956, -104.9893, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6945, -104.9891, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6936, -104.9890, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6930, -104.9891, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6917, -104.9892, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6896, -104.9897, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6873, -104.9902, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6847, -104.9909, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6833, -104.9914, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6817, -104.9918, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6799, -104.9923, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6780, -104.9928, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6754, -104.9935, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6716, -104.9944, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6698, -104.9948, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6667, -104.9956, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6643, -104.9962, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6627, -104.9969, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6603, -104.9980, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6583, -104.9988, 0, VEAltitudeMode.RelativeToGround), 

            new VELatLong(39.6563, -104.9996, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6534, -105.0011, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6488, -105.0026, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6455, -105.0039, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6429, -105.0049, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6403, -105.0058, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6382, -105.0064, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6346, -105.0074, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6322, -105.0080, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6316, -105.0083, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6306, -105.0088, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6298, -105.0090, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6286, -105.0092, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.6270, -105.0096, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6247, -105.0102, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6225, -105.0108, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6201, -105.0115, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6166, -105.0126, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6142, -105.0136, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6120, -105.0148, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6104, -105.0158, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6054, -105.0185, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6039, -105.0194, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6025, -105.0198, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5940, -105.0212, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.5896, -105.0223, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5848, -105.0231, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5837, -105.0234, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5801, -105.0250, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5786, -105.0258, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5760, -105.0270, 0, VEAltitudeMode.RelativeToGround)
            );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    map.AddShape(myPolygon);

//union station to downtown
    points = new Array(

            new VELatLong(39.7410, -105.0079, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7406, -105.0075, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7405, -105.0073, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7405, -105.0071, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7405, -105.0068, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7405, -105.0064, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7404, -105.0058, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7404, -105.0051, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7403, -105.0042, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7403, -105.0033, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7403, -105.0013, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7404, -105.0010, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7405, -105.0008, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7406, -105.0005, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7409, -105.0001, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7411, -104.9998, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7414, -104.9995, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7414, -104.9994, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7414, -104.9993, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7417, -104.9986, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7418, -104.9984, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7419, -104.9982, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7422, -104.9982, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7423, -104.9982, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7426, -104.9982, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7429, -104.9981, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7432, -104.9980, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7433, -104.9977, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -104.9975, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7437, -104.9971, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7438, -104.9967, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7439, -104.9965, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7440, -104.9955, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7440, -104.9953, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7439, -104.9951, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7436, -104.9947, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7436, -104.9946, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7435, -104.9946, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -104.9945, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -104.9944, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -104.9944, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7435, -104.9943, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7436, -104.9942, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7436, -104.9941, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7449, -104.9925, 0, VEAltitudeMode.RelativeToGround),   
            
            new VELatLong(39.7452, -104.9921, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7457, -104.9914, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7463, -104.9906, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7470, -104.9897, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7478, -104.9887, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7478, -104.9886, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7478, -104.9886, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7479, -104.9885, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.7479, -104.9884, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7478, -104.9884, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7478, -104.9883, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7477, -104.9882, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -104.9878, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -104.9877, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -104.9877, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -104.9876, 0, VEAltitudeMode.RelativeToGround),       
            
            new VELatLong(39.7474, -104.9875, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7474, -104.9874, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7475, -104.9873, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7476, -104.9872, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7482, -104.9865, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7483, -104.9865, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7483, -104.9864, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7484, -104.9863, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7484, -104.9862, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7484, -104.9861, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7485, -104.9860, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7504, -104.9836, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7520, -104.9815, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7532, -104.9800, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7542, -104.9787, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7559, -104.9764, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7577, -104.9742, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7579, -104.9739, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7582, -104.9735, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7582, -104.9735, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7583, -104.9735, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7584, -104.9735, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7594, -104.9735, 0, VEAltitudeMode.RelativeToGround)                            
        );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    map.AddShape(myPolygon);


    //85-I-25 split to Lincoln
    points = new Array(
            new VELatLong(39.7016, -104.9902, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7005, -104.9899, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7000, -104.9896, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6999, -104.9894, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6999, -104.9892, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6999, -104.9889, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7000, -104.9887, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7001, -104.9884, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.7002, -104.9880, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7003, -104.9876, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7003, -104.9873, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7004, -104.9871, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7003, -104.9870, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7003, -104.9868, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7002, -104.9867, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.7000, -104.9865, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.6948, -104.9805, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6943, -104.9799, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6932, -104.9786, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6911, -104.9763, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6908, -104.9760, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6907, -104.9758, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6900, -104.9745, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6887, -104.9721, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6872, -104.9690, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6870, -104.9686, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6860, -104.9667, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6857, -104.9660, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6848, -104.9634, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6847, -104.9630, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6841, -104.9606, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6840, -104.9598, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.6840, -104.9589, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6840, -104.9580, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6843, -104.9565, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6844, -104.9558, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6845, -104.9550, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6845, -104.9537, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6845, -104.9532, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6845, -104.9500, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6845, -104.9491, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6842, -104.9468, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6838, -104.9452, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6834, -104.9437, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6833, -104.9435, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6832, -104.9432, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6831, -104.9429, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6829, -104.9427, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6825, -104.9423, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6819, -104.9418, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6815, -104.9415, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6802, -104.9402, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6800, -104.9399, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6799, -104.9398, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6799, -104.9396, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6798, -104.9392, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6797, -104.9384, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6794, -104.9357, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6793, -104.9354, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6792, -104.9352, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6791, -104.9350, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6790, -104.9348, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6788, -104.9346, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6785, -104.9343, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6782, -104.9340, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6773, -104.9334, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6767, -104.9329, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6750, -104.9313, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6733, -104.9300, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6715, -104.9288, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6693, -104.9274, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6685, -104.9270, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6672, -104.9263, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6665, -104.9256, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6662, -104.9252, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6658, -104.9249, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6647, -104.9241, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6635, -104.9234, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6580, -104.9209, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6553, -104.9199, 0, VEAltitudeMode.RelativeToGround),    
            
            new VELatLong(39.6540, -104.9195, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6534, -104.9194, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6524, -104.9189, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6516, -104.9183, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6507, -104.9175, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6487, -104.9163, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6456, -104.9145, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6429, -104.9130, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6408, -104.9118, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6391, -104.9108, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6387, -104.9106, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6369, -104.9097, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6360, -104.9093, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6345, -104.9084, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6337, -104.9079, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6323, -104.9073, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6305, -104.9062, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6288, -104.9052, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6275, -104.9044, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6259, -104.9034, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6241, -104.9026, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6233, -104.9021, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6220, -104.9011, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6178, -104.8985, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.6163, -104.8978, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6135, -104.8962, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6120, -104.8953, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6107, -104.8948, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6098, -104.8944, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6092, -104.8941, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6079, -104.8931, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6072, -104.8925, 0, VEAltitudeMode.RelativeToGround),
                   
            new VELatLong(39.6052, -104.8913, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6021, -104.8895, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.6003, -104.8885, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5978, -104.8870, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5966, -104.8864, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5955, -104.8861, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5947, -104.8857, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5943, -104.8855, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.5926, -104.8840, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5914, -104.8834, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5837, -104.8789, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5826, -104.8784, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5819, -104.8782, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5808, -104.8779, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5804, -104.8778, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5802, -104.8777, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.5799, -104.8775, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5778, -104.8757, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5775, -104.8756, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5773, -104.8755, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5770, -104.8754, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5740, -104.8744, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5715, -104.8737, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5704, -104.8734, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.5696, -104.8733, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5686, -104.8733, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5668, -104.8733, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5663, -104.8732, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5659, -104.8731, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5642, -104.8725, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5637, -104.8724, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5624, -104.8723, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.5600, -104.8723, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5596, -104.8722, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5593, -104.8722, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5590, -104.8721, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5587, -104.8719, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5580, -104.8714, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5576, -104.8712, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5571, -104.8711, 0, VEAltitudeMode.RelativeToGround),
            
            new VELatLong(39.5566, -104.8711, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5544, -104.8712, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5540, -104.8712, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5536, -104.8711, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5532, -104.8711, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5525, -104.8709, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5514, -104.8704, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5504, -104.8700, 0, VEAltitudeMode.RelativeToGround),

            new VELatLong(39.5460, -104.8696, 0, VEAltitudeMode.RelativeToGround),
            new VELatLong(39.5420, -104.8693, 0, VEAltitudeMode.RelativeToGround)                                                                              
        );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    map.AddShape(myPolygon);

    //curve at Bellview
    points = new Array(
        new VELatLong(39.6311, -104.9066, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6317, -104.9068, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6321, -104.9069, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6326, -104.9069, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6330, -104.9069, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6335, -104.9067, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6338, -104.9065, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6339, -104.9063, 0, VEAltitudeMode.RelativeToGround),

        new VELatLong(39.6341, -104.9060, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6344, -104.9056, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6345, -104.9053, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6346, -104.9048, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6347, -104.9043, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6348, -104.9025, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6349, -104.9021, 0, VEAltitudeMode.RelativeToGround) 
        );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    map.AddShape(myPolygon);

    //curve at Bellview to nine mile
    points = new Array(
        new VELatLong(39.6358, -104.9092, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6354, -104.9087, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6351, -104.9082, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6349, -104.9079, 0, VEAltitudeMode.RelativeToGround),
        
        new VELatLong(39.6348, -104.9075, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6347, -104.9069, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6346, -104.9066, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6346, -104.9060, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6347, -104.9053, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6351, -104.8992, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6354, -104.8950, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6354, -104.8946, 0, VEAltitudeMode.RelativeToGround),
        
        new VELatLong(39.6355, -104.8941, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6358, -104.8932, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6359, -104.8925, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6362, -104.8919, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6364, -104.8913, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6368, -104.8906, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6415, -104.8810, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6430, -104.8779, 0, VEAltitudeMode.RelativeToGround),
        
        new VELatLong(39.6445, -104.8749, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6448, -104.8743, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6450, -104.8737, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6452, -104.8731, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6453, -104.8725, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6461, -104.8692, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6463, -104.8686, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6465, -104.8680, 0, VEAltitudeMode.RelativeToGround),
        
        new VELatLong(39.6468, -104.8675, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6531, -104.8567, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6534, -104.8562, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6538, -104.8556, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6543, -104.8546, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6546, -104.8542, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6548, -104.8537, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6550, -104.8532, 0, VEAltitudeMode.RelativeToGround),                        
        
        new VELatLong(39.6552, -104.8525, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6554, -104.8518, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6556, -104.8511, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6560, -104.8492, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6562, -104.8480, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6564, -104.8475, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6566, -104.8470, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6576, -104.8448, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.6600, -104.8403, 0, VEAltitudeMode.RelativeToGround)
        );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    map.AddShape(myPolygon);

    //downtown north loop
    points = new Array(
        new VELatLong(39.7440, -104.9956, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7441, -104.9954, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7443, -104.9951, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7446, -104.9947, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7464, -104.9925, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7485, -104.9897, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9896, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9896, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9895, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9895, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9894, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9894, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7486, -104.9893, 0, VEAltitudeMode.RelativeToGround),
        
        new VELatLong(39.7486, -104.9893, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7485, -104.9892, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7481, -104.9887, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7479, -104.9884, 0, VEAltitudeMode.RelativeToGround),
        new VELatLong(39.7477, -104.9881, 0, VEAltitudeMode.RelativeToGround)
        );
    myPolygon = new VEShape(VEShapeType.Polyline, points);
    myPolygon.SetLineWidth(6);
    myPolygon.HideIcon();
    myPolygon.SetMinZoomLevel(8);
    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);
                var shapeHTML = shape1.GetDescription();
                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>";
                var sImage = "";

                sImage = sImage + "<br />";
                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=2', oStationShapeL);
    map.ImportShapeLayerData(shapeSource, onStationsFeedLoad, bestlocation);
}

function DoZoom(lat, lon) {
    map.SetCenterAndZoom(new VELatLong(lat, lon), 19);
    map.SetMapStyle(VEMapStyle.Hybrid);
}

function GetWalkingDirections() {

}
//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=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';
        }
    }
} 


