function ActivateZoomIn (imgPrefix)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface

    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    

    setToolImage ('ZOOMIN', '2', imgPrefix) ; 
    document.frmNavigation.Cmd.value = 'ZOOMIN' ;
    document.frmNavigation.target = "" ;
    document.frmNavigation.action = 'map.asp' ;
}

function ActivateZoomOut (imgPrefix)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface

    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    

    setToolImage ('ZOOMOUT', '2', imgPrefix) ; 
    document.frmNavigation.Cmd.value = 'ZOOMOUT' ;
    document.frmNavigation.target = "" ;
    document.frmNavigation.action = 'map.asp' ;
}

function ActivatePan (imgPrefix)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface

    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    
    setToolImage ('PAN', '2', imgPrefix) ; 
    document.frmNavigation.Cmd.value = 'PAN' ;
    document.frmNavigation.target = "" ;
    document.frmNavigation.action = 'map.asp' ;
}

function ActivatePan2 (imgPrefix, sPan)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface
    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    

    document.frmNavigation.Cmd.value = 'SNAPSHOT' ;
    document.frmNavigation.APAN.value = sPan ;
    // document.location = 'map.asp?' + svalue
    document.frmNavigation.target = "" ;
    document.frmNavigation.action = 'map.asp' ;
    document.frmNavigation.submit () ;
}

function ActivateIdentify (targetwin, imgPrefix)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface

    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    
    setToolImage ('IDENTIFY', '2', imgPrefix) ; 
    document.frmNavigation.Cmd.value = 'IDENTIFY' ;
    document.frmNavigation.target = targetwin ;
    document.frmNavigation.action = 'identify.asp' ;
}

function ActivateRefresh (imgPrefix)
{
    // Used by SingleClick Client except Basic Viewer
    // imgPrefix is optional... used by Chameleon Interface

    if (imgPrefix == null)
    {
        imgPrefix = "" ;
    }    

    setToolImage ('ZOOMIN', '2', imgPrefix) ; 
    document.frmNavigation.Cmd.value = 'SNAPSHOT' ;
    // document.location = 'map.asp?' + svalue
    document.frmNavigation.target = "" ;
    document.frmNavigation.action = 'map.asp' ;
    document.frmNavigation.submit () ;
}

function setToolImage (tool, mode, prefix)
{
    // Used by Graphical Button Clients.
    // prefix is an optional argument to the image file name.

    if (prefix == null)
    {
        prefix = "" ;
    }

    var imageFile = 'images/' + prefix + tool + mode + '.gif' ;    

    //  Dull all images first.
    document.ZOOMIN.src   = 'images/' + prefix + 'zoomin1.gif' ;
    document.ZOOMOUT.src  = 'images/' + prefix + 'zoomout1.gif' ;
    document.PAN.src      = 'images/' + prefix + 'pan1.gif' ;
    document.IDENTIFY.src = 'images/' + prefix + 'identify1.gif' ;

    // Then brighten the passed tool.
    switch (tool)
    {
        case "ZOOMIN" :
            document.ZOOMIN.src = imageFile ;
            break ;
        case "ZOOMOUT" :
            document.ZOOMOUT.src = imageFile ;
            break ;
        case "PAN" :
            document.PAN.src = imageFile ;
            break ;
        case "IDENTIFY" :
            document.IDENTIFY.src = imageFile ;
            break ;
    }
}

function PopOut (sURL, sTitle, iHeight, iWidth, ynScroll, ynResize)
{
    var objWin = window.open (sURL, sTitle, "height=" + iHeight + ",width=" + iWidth + ",scrollbars=" + ynScroll + ",resizable=" + ynResize + "") ;
    if (parseInt (navigator.appVersion) >= 4) objWin.window.focus () ;
}

function ProcessLink (sURL)
{
    document.body.style.cursor = "wait" ;
    document.location = sURL.toUpperCase () ;
}

function ProcessLink2 (sURL, svalue)
{ 
    var sresult ;
    var subvalue ;

    if (svalue.length < 4)
    { 
        alert ("A minimum of 4 characters are required") ; 
    }
    else
    { 
        sresult = svalue ;

        if (sresult.substring (sresult.length-1, sresult.length) == "-")
        {
            alert ("A 7 character number can not end in '-'.") ; 
            sresult = '9-' + svalue.substring (0, svalue.length-1) ;
        }

        if (svalue.length > 7)
        { 
            if (svalue.indexOf ("-") == -1)
            { 
                subvalue = svalue.substring (0, 2) ;

                if (subvalue.valueOf () >= 37)
                { 
                    sresult = svalue.substring (0, 4) + "-" + svalue.substring (4, 7) + "-" + svalue.substring (7, 10) ;
                    subvalue = svalue.substring (7, 10) ;

                    if (subvalue.length == 3)
                    {
                        sresult = sresult + "-" + svalue.substring (10, 14) ;
                    }
                } 
                else
                {
                    sresult = svalue.substring (0, 6) + "-" + svalue.substring (6, 7) + "-" + svalue.substring (7, 10) ;
                    subvalue = svalue.substring (7, 10) ;

                    if (subvalue.length == 3)
                    {
                        sresult = sresult + "-" + svalue.substring (10, 14) ;
                    }
                }

                if (sresult.substring (sresult.length-1, sresult.length) == "-")
                {
                  sresult = sresult.substring (0, sresult.length-1) ;
                }
            }
            else
            {
                // alert (svalue.substring (svalue.length-1, svalue.length)) ;
                if (svalue.substring (svalue.length-1, svalue.length) == "-")
                {
                  sresult = svalue.substring (0, svalue.length-1)
                }
            }
        } 

        // alert (sresult) ;
        document.body.style.cursor = "wait" ; 
        document.location = sURL + sresult ; 
    } 
} 

function ProcessLink3 (sURL)
{
    alert (sURL) ;
}

function ProcessLink4 (sURL, svalue1, svalue2)
{ 
    var sresult ;
    var subvalue ;

    if (svalue2.length == 0)
    { 
        alert ("A street name is required") ; 
    }
    else
    { 
        // alert (svalue2.length) ;
        document.body.style.cursor = "wait" ; 
        document.location = sURL + 'p_in_site_addr_no=' + svalue1.toUpperCase () + '&p_in_site_addr_name=' + svalue2.toUpperCase () ; 
    } 
} 

function ProcessLink5 (sURL, svalue1)
{ 
    var sresult ;
    var subvalue ;
    
    if (svalue1.length == 0)
    { 
        alert ("A name is required") ; 
    }
    else
    { 
        document.body.style.cursor = "wait" ; 
        document.location = sURL + svalue1 ; 
    } 
}

function ShowMapExtent (sValue)
{
    var frmCoords = document.frmExtent ;
    var sMinX = frmCoords.MinX.value ;
    var sMinY = frmCoords.MinY.value ;
    var sMaxX = frmCoords.MaxX.value ;
    var sMaxY = frmCoords.MaxY.value ;
    
    if (sMinX == "" || sMinY == "" || sMaxX == "" || sMaxY == "")
    {
        alert ('You must fill in all coordinates...') ;
        return ;
    }

    var sExtent = "&ExtentLeft=" + sMinX + "&ExtentRight=" + sMaxX + "&ExtentBottom=" + sMinY + "&ExtentTop=" + sMaxY ;
    PopOut ('launch.asp?Cmd = INIT' + sExtent, 'Map', 560, 630, 'no', 'no') ;
}
