﻿/*<![CDATA[*/
window.onresize = function() {on_resize();}

function on_divmasterinitsize()
{
    var rowC = document.getElementById("rowContent");
    if (rowC)
    {
        var h = GetContentHeight() - 25;

        if (h > 200)
        {
            rowC.style.height = h;
            rowC.style.minheight = h;
        }
    }
}
function on_resize()
{
    var rowC = document.getElementById("rowContent");
    var colLeft = document.getElementById("fullheightLeft");
    var col1 = document.getElementById("fullheightCol1");
    var col1Header = document.getElementById("fullheightCol1Header");
    var col1Body = document.getElementById("fullheightCol1Body");
    var col2 = document.getElementById("fullheightCol2");
    var col2Header = document.getElementById("fullheightCol2Header");
    var col2Body = document.getElementById("fullheightCol2Body");
    var rowFooter = document.getElementById("fullheightFooter");
    //resize the table according to the size of the window

    if (rowC)
    {
        var h = GetContentHeight() - 10;
        if (window.navigator.userAgent.toLowerCase().indexOf("ie") > -1)
            h = h - 27;
        var w = GetClientWidth() - 20;
        if (col1)
            w = w - GetControlWidth(col1);
        if (h > 200)  //  rowC.offsetHeight != h && 
        {
            rowC.style.height = h + 'px';
            rowC.style.minheight = h + 'px';
            if (colLeft)
            {
                colLeft.style.height = h + 'px';
                colLeft.style.minheight = h + 'px';
            }
            var footerHeight = 0;
            if (rowFooter)
                footerHeight = GetControlHeight(rowFooter);
            if (col1)
            {
                col1.style.height = (h - footerHeight) + 'px';
                col1.style.minheight = (h - footerHeight) + 'px';
                var col1HeaderHight = 0;
                if (col1Header)
                    col1HeaderHight = GetControlHeight(col1Header);
                if (col1Body)
                {
                    col1Body.style.height = (h - footerHeight - col1HeaderHight) + 'px';
                    col1Body.style.minheight = (h - footerHeight - col1HeaderHight) + 'px';
                }
            }
            if (col2)
            {
                col2.style.height = (h - footerHeight) + 'px';
                col2.style.minheight = (h - footerHeight) + 'px';
                col2.style.width = w + 'px';
                col2.style.minwidth = w + 'px';
                var col2HeaderHeight = 0;
                if (col2Header)
                    col2HeaderHeight = GetControlHeight(col2Header);
                if (col2Body)
                {
                    col2Body.style.height = (h - footerHeight - col2HeaderHeight) + 'px';
                    col2Body.style.minheight = (h - footerHeight - col2HeaderHeight) + 'px';
                    if (document.getElementById("bodyOffset") && document.getElementById("bodyFullheight"))
                        document.getElementById("bodyFullheight").style.height = (h - footerHeight - col2HeaderHeight - GetControlHeight(document.getElementById("bodyOffset")) - 3) + 'px';

                    var ww = document.getElementById('ctl00_ContentPlaceHolder1_QueryFrame');
                    if (ww && document.getElementById("bodyOffset"))
                        ww.style.height = (h - footerHeight - col2HeaderHeight - GetControlHeight(document.getElementById("bodyOffset")) - 3) + 'px';
                }
            }
        }
    }
}
function ScrollPageDown()
{
    var y = GetClientHeight() - 25;
    window.scrollTo(0, y);
}
function GetContentHeight()
{
	var h;
	var x;
	var y;
    var rowB = document.getElementById("rowBanner");
    var rowL = document.getElementById("rowBar");
    var rowM = document.getElementById("rowMenu");
    y = GetClientHeight();
    //resize the table according to the size of the window
    if (rowL && rowB && rowM)
    {
        h = GetControlHeight(rowB) + GetControlHeight(rowL) + GetControlHeight(rowM);
        return y-h;
    }
    else
        return y;
}
function GetControlHeight(ctrl)
{
    if (ctrl.style.height)
        return parseInt(ctrl.style.height.replace('px', ''));
    else return ctrl.offsetHeight;
}
function GetControlWidth(ctrl)
{
    if (ctrl.offsetWidth)
        return ctrl.offsetWidth;
    else
        return parseInt(ctrl.style.width.replace('px', ''));
}
function GetClientWidth()
{
    var x;
    if (self.innerWidth) // all except Explorer
        x = self.innerWidth;
    else if (document.documentElement && document.documentElement.clientWidth)
        x = document.documentElement.clientWidth;
    else if (document.body) // other Explorers
        x = document.body.clientWidth;
    return x;
}
function GetClientHeight()
{
    var y;
    if (self.innerHeight) // all except Explorer
        y = self.innerHeight-15; //Quirk with opera
    else if (document.documentElement && document.documentElement.clientHeight)
        y = document.documentElement.clientHeight;
    else if (document.body) // other Explorers
        y = document.body.clientHeight;
    return y;
}
/*]]>*/ 