﻿function popUp(url,width,height,scroll,resize)
{
	var left = screen.width/2 - width/2;
	var top = screen.height/2 - height/2;
	var popWin = window.open(url, "pop", "left=" + left + ",top=" + top + ",width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",resizable=" + resize);
}

function GoogleSearch()
{
    this.document.forms["googleSearchFRM"].q.value = this.document.forms["aspnetForm"].q.value;
    for (l_i = 0; l_i < document.forms["aspnetForm"].sitesearch.length; l_i++ )
    {
        if (document.forms["aspnetForm"].sitesearch[l_i].checked == true )
        {
            this.document.forms["googleSearchFRM"].sitesearch.value = document.forms["aspnetForm"].sitesearch[l_i].value;
        }
    }
    this.document.forms["googleSearchFRM"].submit();
}

function Show(a_show)
{
    if (document.layers)
    {
        if (document.layers(a_show).style.display.toLowerCase() != "block")
        {//show it
            document.layers(a_show).style.display = "block";
        }
        else
        {//hide it
            document.layers(a_show).style.display = "none";
        }
    }
    else
    {
        if (document.getElementById(a_show).style.display.toLowerCase() != "block")
        {//show it
            document.getElementById(a_show).style.display = "block";
        }
        else
        {//hide it
            document.getElementById(a_show).style.display = "none";
        }
    }
}

function ShowHide(a_show, a_hide)
{
    if (document.layers)
    {
        document.layers(a_show).style.display = "block";
        document.layers(a_hide).style.display = "none";
    }
    else
    {
        document.getElementById(a_show).style.display = "block";
        document.getElementById(a_hide).style.display = "none";
    }
}

//these can be set on a page by page basis if needed
var processingIMG = "";
var processingSRC = "";

function ShowWorking(a_show, a_hide)
{
    ShowHide(a_show,a_hide);
    setTimeout("ProgressBar()", 100);
    window.status = "Working ...";
} 

function ProgressBar()
{
    document[processingIMG].src = processingSRC;
}

function ShowPageLink()
{
    document.write("<input type='text' value='<a href=\"" + document.location + "\">" + document.title + "</a>' onclick='this.select()' />");
}

function PageTitle()
{
    document.write(document.title);
}

function ShowGutters()
{
    var l_width = 0;
    var l_height = 0;

    if (typeof window.innerWidth != 'undefined')
    {
        l_width = (window.innerWidth - 1000)/2;
        l_height = window.innerHeight;
    }
    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
     {// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
         l_width = (document.documentElement.clientWidth - 1000)/2;
         l_height = document.documentElement.clientHeight;
    }
    else
    {// older versions of IE
        l_width = (document.getElementsByTagName('body')[0].clientWidth - 1000)/2;
        l_height = document.getElementsByTagName('body')[0].clientHeight;
    }

    if (document.layers)
    {
        document.layers('leftGutter').style.position = "absolute";
        document.layers('leftGutter').style.top = "0px";
        document.layers('leftGutter').style.left = "0px";
        document.layers('leftGutter').style.width = l_width;
        document.layers('leftGutter').style.height = l_height;

        document.layers('rightGutter').style.position = "absolute";
        document.layers('rightGutter').style.top = "0px";
        document.layers('rightGutter').style.right = "0px";
        document.layers('rightGutter').style.width = l_width;
        document.layers('rightGutter').style.height = l_height;
    }
    else
    {
        document.getElementById('leftGutter').style.position = "absolute";
        document.getElementById('leftGutter').style.top = "0px";
        document.getElementById('leftGutter').style.left = "0px";
        document.getElementById('leftGutter').style.width = l_width;
        document.getElementById('leftGutter').style.height = l_height;

        document.getElementById('rightGutter').style.position = "absolute";
        document.getElementById('rightGutter').style.top = "0px";
        document.getElementById('rightGutter').style.right = "0px";
        document.getElementById('rightGutter').style.width = l_width;
        document.getElementById('rightGutter').style.height = l_height;
    }

    document.leftGutterImage.width = l_width;
    document.leftGutterImage.height = l_height;
    
    document.rightGutterImage.width = l_width;
    document.rightGutterImage.height = l_height;
}