﻿//
function map_Loaded() {
    try {
        var geoRssLayer = new VEShapeLayer();

        veLayerSpec = new VEShapeSourceSpecification(
                            VEDataType.GeoRSS,
                            "GeoRSSTest.xml",
                            geoRssLayer);

        map.ImportShapeLayerData(veLayerSpec, onFeedLoad, 1);

    }
    catch (Err) {
        alert(Err.description);
    }
}

function onFeedLoad(feed) {
    //alert('RSS or Collection loaded. There are ' + feed.GetShapeCount() + ' items in this list.');
}

// This function calls the geoRSS handler to repopulate the map with the location of a store.
function GetAddressFeed(AddressID) {
    map.DeleteAllShapes();
    try {
        var geoRssLayer = new VEShapeLayer();

        veLayerSpec = new VEShapeSourceSpecification(
                            VEDataType.GeoRSS,
                            "GeoRSSHandler.ashx?addressid=" + AddressID,
                            geoRssLayer);

        map.ImportShapeLayerData(veLayerSpec, SucceededCallback, 1);
    }
    catch (Err) {
        alert(Err.description);
    }
}

function SucceededCallback(result) {
    map.SetZoomLevel(8);
    var resultsBox = document.getElementById("txtResults");
    resultsBox.value = "Done.";
}
