﻿// JScript File 

//fires a callback to the server initiating server processing or whatever for AJAX
function FireCallBack(ServerFunction,ServerMode,ServerVars)
{
    var message = "ControlID=Map1&ControlType=Map&EventArg=" + ServerFunction + "&Map1_mode=" + ServerMode + ServerVars; 
    var context = map.controlName;
    WebForm_DoCallback('__Page',message,processCallbackResult,context,postBackError,true);
}        

//toggles css div's display property from none to block.  whichlayer is the div and dowhat is 0 unless you want to clear values from text boxes like with geocode address by city.
function toggleLayer(whichLayer, doWhat)
{          
    if (document.getElementById)// this is the way the standards work
    {
        var style2 = document.getElementById(whichLayer).style;
        style2.display = style2.display? "":"block";

        if(whichLayer == "divAddress")
            document.getElementById("Search_Panel_cityZipList").value = "";

        if(doWhat > 0)
        {   
            document.getElementById("Search_Panel_TextBox3").value = "";
            document.getElementById("Search_Panel_cityZipList").value = "";
        }
    }
    else
        alert("Browser Incompatibility, please email SGourley@Utah.gov with browser version");
}

function hideLoading()
{
    var style2 = document.getElementById('loading').style;
    style2.display = "";
}

function showLoading()
{
    var style2 = document.getElementById('loading').style;
    style2.display = "block";
}

function showBusyIndicator(sender) 
{
    showLayer("BusyIndicator");

    if (sender!=null) 
    {
        window.status = "Pending Tiles: " + sender.pendingTiles.length;
    } 
}

function showPendingTiles(sender) 
{
    if (sender!=null) 
    {
         window.status = "Pending Tiles: " + sender.pendingTiles.length;
    } 
}

function hideBusyIndicator(sender) 
{
    hideLayer("BusyIndicator");
    if (sender!=null) 
    {
        window.status = "";
    }
}

// add busy indicator functions to the map
map = Maps["Map1"];
map.pendingTiles.add_onRequestsPending(showBusyIndicator);
map.pendingTiles.add_onRequestsRemove(showPendingTiles);
map.pendingTiles.add_onRequestsCompleted(hideBusyIndicator);  

