var microcastNodeName = "row";
var microcastVisible = false;
var microcastLayerName = "MicrocastIcons";
var microcastShowing = false;
var microcastMinZoom = 1;
var microcastMaxZoom = 20;

function Microcast_LoadData()
{
var microcastXmlUrl = "xml/MicrocastLocations.xml?host=" + currentHost;

//alert("Microcast_LoadData() url:" + mcXmlUrl);

map.LoadIconsFromXML(microcastXmlUrl, microcastNodeName, "image", "lat", "lon", microcastVisible, "Microcast_onPress", "Microcast_onRollOver", "Microcast_onRollOut", microcastMinZoom, microcastMaxZoom, microcastLayerName , true, false, 2);
}

function Microcast_HideIcons()
{
    if (microcastShowing)
    {
        map.HideGroup(microcastLayerName );
        microcastShowing = false;
    }
    
}

function Microcast_ShowIcons()
{
    if (!microcastShowing)
    {
        map.ShowGroup(microcastLayerName );
        microcastShowing = true;
    }
}

function Microcast_onPress(icon)
{

    //alert("Microcast_onPress");
    LoadMicrocastPopup(icon.locationid);   

}

function Microcast_onRollOver(icon)
{
    //alert("Microcast_onRollOver");
}

function Microcast_onRollOut(icon)
{
    //alert("Microcast_onRollOut");
}

function HideMicrocastPopup()
{
HideThis("microcastDetails");
}

function ShowMicrocastPopup()
{
    ShowThis("microcastDetails");
}

function ShowMicrocastLoading()
{
    ShowThis("microcastLoading");
}

function GetLoadingScreen()
{

    return "<table style='width:100%; height:100%; background-color:#fbfbf3; border:solid 1px #c1c1b3;'><tr><td style='text-align:center; valign:middle;'><img src='/InteractiveRadar/images/ajax-loader.gif'></td></tr></table>";

}

function LoadMicrocastPopup(locationId)
{

    var unit = _hostUnits == 1 ? '-metric' : '';

     var url = "/InteractiveRadar/Microcast/microcastPopup.htm?locationid=" + locationId + "&hostTypeBase=" + hostTypeBase + "&skin=" + _microcastSkin + "&host=" + currentHost + "&unit=" + unit;

    var html = "<iframe id='microcastDetailsFrame' align='top' marginwidth='0' marginheight='0' width='800' height='800' scrolling='no' frameborder='0' style='width:800px; height:800px; margin:0px; padding:0px; overflow-x:hidden;' src='" + url + "'></iframe>";    


    //loading screen spinny ----------------------------
    $("#microcastLoading").html(GetLoadingScreen());
    ShowMicrocastLoading();
    //--------------------------------------------------

    //microcast popup
    $("#microcastDetails").html(html);   
    ShowMicrocastPopup(); 
}

document.KillMicrocastPopup = function()
{
    //this function is called from InteractiveRadar/Microcast/JS/Microcast.js
    $("#microcastDetails").html("");
    HideMicrocastPopup();
}

document.MicrocastPopupLoadComplete = function()
{
    //this function is called from InteractiveRadar/Microcast/JS/Microcast.js
    $("#microcastLoading").html("");
    HideThis("microcastLoading");
}


