﻿// JScript File
    
    function GetScrollTop(obj)
    {
        if (obj.scrollTop != null && obj.scrollTop > 0)
            return obj.scrollTop;
        else if (obj.parentNode != null)
            return GetScrollTop(obj.parentNode);
        else
            return 0;
    }
    
    function GetTopFrame(height, width)
    {
        var div = document.getElementById("TopFrame");
        if (div == null)
        {
            var div = document.createElement("DIV");
            div.id = "TopFrame";
            div.style.overflow = "hidden";
            div.style.display = "none";
            document.body.appendChild(div);
            frame = document.createElement("IFrame");
            frame.id = "TopFrameIFrame";
            //frame.style.borderStyle = "solid";
            frame.frameBorder = "0";
            frame.style.zIndex = "1000";
            frame.style.paddingRight = "0px";
            frame.style.overflow = "hidden";
            div.appendChild(frame);
            
        }
        else
        {
            frame = document.getElementById("TopFrameIFrame");
        }
        div.style.position = "absolute";
        if (height != null)
            div.style.height = height;
        if (width != null)
            div.style.width = width;
        frame.style.height = div.style.height;//(div.style.height.replace("px", "") - 20) + "px";
        frame.style.width = div.style.width;
        
        return frame;
    }
    
    function HideTopFrame()
    {
        document.getElementById("disabledDiv").style.display="none";
        if (window.navigator.appName != "Netscape")
          for (i = 0; i < document.all.length-1; i++)
            if (document.all[i].tagName.toUpperCase() == "SELECT")
                document.all[i].disabled = false;
        document.getElementById("TopFrame").style.display = "none";
        document.getElementById("TopFrameIFrame").src = "";
        //debugger;
        var div=document.getElementById("TopFrame");
        var frame=document.getElementById("TopFrameIFrame");
        div.removeChild(frame);
        div.parentNode.removeChild(div);
    }
    
    function ShowTopFrame(x, y, src, width, height, IsCenter)
    {
        var strHeight = String(height) + "px";
        strHeight = strHeight.replace("pxpx", "px");
        var strWidth = String(width) + "px";
        strWidth = strWidth.replace("pxpx", "px");
        ShowDisabledDiv();
        var frame = GetTopFrame(strHeight, strWidth);
        if (frame.tagName.toLowerCase() == "iframe")
            frame = frame.parentNode;
        if (x != null)
            frame.style.left = x;
        if (y != null)
            frame.style.top = y;
        
        if (IsCenter)
        {
            document.getElementById("disabledDiv").style.height = document.documentElement.scrollHeight+"px";
            frame.style.top = (document.documentElement.scrollTop + ((document.documentElement.clientHeight - Number(strHeight.replace("px", ""))) / 2)) + "px";
            frame.style.left = ((document.documentElement.clientWidth - Number(strWidth.replace("px", ""))) / 2) + "px";
        }
        frame.firstChild.src = src;
        frame.style.zIndex = "1000";
        frame.style.display = "";
    }
    
   
    
    function ShowDisabledDiv()
    {
        var div = document.getElementById("disabledDiv");
        div.style.display = "";
            
        if (window.navigator.appName != "Netscape")
          for (i = 0; i < document.all.length-1; i++)
            if (document.all[i].tagName.toUpperCase() == "SELECT")
                document.all[i].disabled = true;
}