﻿function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
    newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
    
function clickButton(e, buttonid){
      var evt = e ? e : window.event;
      var bt = document.getElementById(buttonid);
      if (bt){
          if (evt.keyCode == 13){
                bt.click();
                return false;
          }
      }
}

function SetResolution()
{
    var widthR;
    var heightR;
    var widthA;
    var heightA;
    if (self.screen) {     // for NN4 and IE4
        widthR = screen.width
        heightR = screen.height
        widthA = screen.availWidth
        heightA = screen.availHeight
        // Testing this first prevents firing the slow Java of NN4
    }
    else if (self.java) {   // for NN3 with enabled Java
        var jkit = java.awt.Toolkit.getDefaultToolkit();
        var scrsize = jkit.getScreenSize();
        widthR = scrsize.width; 
        heightR = scrsize.height; 
        widthR = scrsize.availWidth; 
        heightR = scrsize.availHeight; 
    }
    else{
        widthR = heightR = widthA = heightA = '?' // N2, E3, N3 w/Java off, probably Opera and WebTV
    }
    // Find the control and set values
    var elem = document.forms[0].elements;
    for(var i = 0; i < elem.length; i++)
    {
        if (elem[i].id.indexOf('hdnRes') > -1)
            elem[i].value = widthR + 'x' + heightR;
        if (elem[i].id.indexOf('hdnAvail') > -1)
            elem[i].value = widthA + 'x' + heightA;
    }
}

function FindElem(id)
{
    // Find the control and set values
    var elem = document.forms[0].elements;
    for(var i = 0; i < elem.length; i++)
    {
        if (elem[i].id.indexOf(id) > -1)
            return elem[i];
    }
}

function toggleDiv(obj, action)
{
    var div = document.getElementById(obj);
    if (div)
    {  
        if (action)
        {
            div.style.visibility = action;
        }
        else
        {
            if (div.style.visibility == 'hidden')
                div.style.visibility = 'visible';
            else
                div.style.visibility = 'hidden';
        }
    }
}
function toggleDisplay(obj, action)
{
    var div = document.getElementById(obj);
    if (div)
    {  
        if (action)
        {
            div.style.display = action;
        }
        else
        {
            if (div.style.display == 'none')
                div.style.display = 'inline';
            else
                div.style.display = 'none';
        }
    }
}