//GLOBAL VARIABLES

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

//GLOBAL FUNCTIONS

//Pick appropriate style sheet (due to larger IE font sizes)

function getStyleSheet() {
  if ((browserName == "Netscape") && (browserVer <= 4)) {
    document.write("<link rel=\"stylesheet\" href=\"/lib/sas_netscape.css\" type=\"text/css\">");
  }
  else { 
    document.write("<link rel=\"stylesheet\" href=\"/lib/sas.css\" type=\"text/css\">");
  }
}

//Fix Netscape 4 bug which loses CSS info with window resize

function fixNetscapeCSS() {
  if (document.debug.fixNetscapeCSS.initWindowWidth != window.innerWidth ||  document.debug.fixNetscapeCSS.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function fixNetscapeCSS_Init() {
  // Set all resize events to be handled by the fixNetscapeCSS() function
  if ((browserName == 'Netscape') && (browserVer == 4)) {
    if (typeof document.debug == 'undefined'){
      document.debug = new Object;
    }
    if (typeof document.debug.scaleFont == 'undefined') {
      document.debug.fixNetscapeCSS = new Object;
      document.debug.fixNetscapeCSS.initWindowWidth = window.innerWidth;
      document.debug.fixNetscapeCSS.initWindowHeight = window.innerHeight;
    }
    window.onresize = fixNetscapeCSS;
  }
}

var newWindow;

function openPlainWin(thisURL,winName,winWidth,winHeight,xPos,yPos) {
  if (!newWindow || newWindow.closed) {
    winOpts = "width=" + winWidth + ",height=" + winHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
    if (xPos != "") winOpts += ",screenX=" + xPos + ",left=" + xPos;
    if (yPos != "") winOpts += ",screenY=" + yPos + ",top=" + yPos;
    newWindow = window.open("",winName,winOpts);
    newWindow.location.href = thisURL;
    if (!newWindow.opener) {
      newWindow.opener = window;
    }
  }
  else {
    // window's already open; bring to front
    newWindow.focus();
    newWindow.location.href = thisURL;
  }
}


//INITIALIZATION

getStyleSheet();
fixNetscapeCSS_Init();
//if (top != self) top.location.href = location.href; // Bust out of frames
document.writeln(""); // Netscape's workaround for their resize bug


