///////////////////////////////////////////////////
//         THIS IS A SHARED FILE
//
//         THIS IS A SHARED FILE
//
//         THIS IS A SHARED FILE
///////////////////////////////////////////////////



//  *check-Web Window Scripts
//  Author: Geoffrey Elliott
//  Updated: February, 2004

    var windows = new Array;

    windows['newUser'] = null;
    windows['email'] = null;
    windows['load'] = null;
    windows['update'] = null;
    windows['delete'] = null;
    windows['help'] = null;
    windows['report'] = null;
    windows['warning'] = null;

//  createWindow - opens a new window with the given properties to a given URL

    function createWindow(url, type, windowWidth, maxHeight, showToolbar) {
        var windowHeight = ((screen.availHeight-100) > maxHeight) ? maxHeight : screen.availHeight-100;
        var windowName = type + "Window";
        var attributes = (showToolbar) ? "toolbar,scrollbars,status,resizable" : "scrollbars,status,resizable";
        var nw=window.open(url, windowName, attributes + ",width=" + windowWidth + ",height=" + windowHeight);
        var nwLeft = (screen.availWidth - windowWidth) / 2;
        var nwTop = (screen.availHeight - windowHeight) / 2;
        nw.moveTo(nwLeft,nwTop);
        nw.focus();
        windows[type] = nw;
    }

// checkWindow - checks to see if the window is already open.  If it is the script just uses the existing window.

    function checkWindow(url, type, windowWidth, maxHeight, showToolbar) {
        if(!showToolbar) showToolbar = false;
        if(!windows[type] || windows[type].closed) {
            createWindow(url, type, windowWidth, maxHeight, showToolbar);
        }
        else {
            windows[type].location = url;
            windows[type].focus();
        }
    }

// highlight - given an ID, styles the element to appear highlighted

    function highlight(elementID) {
        var helpLink = document.getElementById(elementID);
        helpLink.style.backgroundColor = "#FEC";
        helpLink.style.textDecoration = "none";
    }