﻿// JScript File

var webMapAppCoordinatesText = null;
var webMapAppScaleText = null;
var webMapAppOverviewPanel = null;
var webMapAppNavPanel = null;

function customSetPageElementSizes() {
        webMapAppNavPanel= document.getElementById("NavPanel");
        webMapAppOverviewPanel = document.getElementById("OverviewMap_Panel");
        webMapAppScaleText = document.getElementById("Scale");
        webMapAppCoordinatesText = document.getElementById("Coordinates");
        
        var sWidth = getWinWidth();
        var sHeight = getWinHeight();
        if (webMapAppOverviewPanel!=null) {
            var sbWidth = webMapAppOverviewPanel.clientWidth;
            webMapAppOverviewPanel.style.left = (sWidth - sbWidth - 20) + "px";
            webMapAppOverviewPanel.style.top = (webMapAppTopBannerHeight + 10) + "px";
        }
        if (webMapAppNavPanel != null)
        {
            webMapAppNavPanel.style.left = (webMapAppMapLeft + 10) + "px";
            webMapAppNavPanel.style.top = (webMapAppTopBannerHeight + 10) + "px";
        }
        
        if (webMapAppCopyrightText!=null) {
            var crtHeight = webMapAppCopyrightText.clientHeight + 10;
            
            if (webMapAppCoordinatesText!=null) {
                crtHeight += webMapAppCoordinatesText.clientHeight + 10;
                webMapAppCoordinatesText.style.left = webMapAppCopyrightText.style.left;
                webMapAppCoordinatesText.style.top = (sHeight - crtHeight) + "px";

                if (webMapAppScaleText != null) {
                    crtHeight += webMapAppScaleText.clientHeight + 10;
                    webMapAppScaleText.style.left = webMapAppCopyrightText.style.left;
                    webMapAppScaleText.style.top = (sHeight - crtHeight) + "px";
                }
            }
        }
}

function customAdjustMapSize() {
    var sWidth = getWinWidth();
    var sHeight = getWinHeight();
    var mHeight = sHeight - webMapAppTopBannerHeight;

    if (webMapAppOverviewPanel!=null) {
        var sbWidth = webMapAppOverviewPanel.clientWidth;
        webMapAppOverviewPanel.style.left = (sWidth - sbWidth - 20) + "px";
        webMapAppOverviewPanel.style.top = (webMapAppTopBannerHeight + 10) + "px";
       }
    if (webMapAppNavPanel != null)
    {
        var box = calcElementPosition("Map_Panel"); 
        webMapAppNavPanel.style.left = (box.left + 10) + "px";
        webMapAppNavPanel.style.top = (webMapAppTopBannerHeight + 10) + "px";
    }
    if (webMapAppCopyrightText!=null) {
        var crtHeight = webMapAppCopyrightText.clientHeight + 10;

        if (webMapAppCoordinatesText!=null) {
            crtHeight += webMapAppCoordinatesText.clientHeight + 10;
            webMapAppCoordinatesText.style.left = webMapAppCopyrightText.style.left;
            webMapAppCoordinatesText.style.top = (sHeight - crtHeight) + "px";
            
            if (webMapAppScaleText != null) {
                crtHeight += webMapAppScaleText.clientHeight + 10;
                webMapAppScaleText.style.left = webMapAppCopyrightText.style.left;
                webMapAppScaleText.style.top = (sHeight - crtHeight) + "px";
            }
        }
    }
    
}

