/*****************************************************************************************************
* VARIABLE DECLARATIONS:
* browser screening variables
* window.onerror = Function("return true");
*****************************************************************************************************/
var appVer = navigator.appVersion.toLowerCase();
var userAgt = navigator.userAgent.toLowerCase();
var mac = (appVer.indexOf("mac") != -1);
var win = (appVer.indexOf("win") != -1);
var nn = (navigator.appName == "Netscape");
var ie = (navigator.appName == "Microsoft Internet Explorer");
var aol = (userAgt.indexOf("aol") != -1);
var opera = (userAgt.indexOf("opera") != -1);
var v4 = (parseInt(appVer) >= 4);
var ver = (ie) ? parseFloat(appVer.substring((appVer.indexOf('msie') + 5), appVer.length)) : parseFloat(appVer);
var docloaded = 0;

/*****************************************************************************************************
* FUNCTION: closeTop
* standard window closing function
*****************************************************************************************************/
function closeTop() {
top.close();
}

/*****************************************************************************************************
* Window Formatting functions
*****************************************************************************************************/
/*
* FUNCTION: getWidth
* returns the correct window width for a window with all features & no frames
* or account for a scrollbar with an optional argument
*/
function getWidth(width) { 
var args = getWidth.arguments;
  if(args[1]) {     // Checks for scrolling boolean variable in the arguments
    if(mac) {
      if(ie && v4) width += 2;
      if(nn) width += 17;
    }
    if(win) {
    width += 16;
      if(aol) width += 10;
    }
  }
  else {            // For non-scrolling windows
    if(mac) {
    if(ie && v4) width -= 17;
    //if(nn && v4) width -= 15;
    }
    if(win) {
      if(aol) width += 10;
    // if(ie && v4) width += 16;
    // if(nn && !v4) width += 20;
    }
  }
return width;
}

/*
* FUNCTION: getHeight
* returns the correct window height for a window with all features & no frames
*/
function getHeight(height) {
var args = getHeight.arguments;
  if(args[1]) {     // Checks for scrolling boolean variable in the arguments
    if(mac) {
      if(ie && v4) height -= 15;
    //if(nn && v4) height -= 15;
    }
    if(win) {
      if(aol) height += 5;
    // if(ie && v4) height -= 19;
    // if(nn && !v4) height  += 30;
    }
  }
  else {            // For non-scrolling windows
    if(mac) {
      if(ie && v4) height -= 15;
    //if(nn && v4) height -= 15;
    }
    if(win) {
      if(aol) height += 7;
    // if(ie && v4) height -= 19;
    // if(nn && !v4) height  += 30;
    }
  }
return height;
}

/*****************************************************************************************************
* FUNCTION: scrollOpen
* primary window open function for popup windows with a scrollbar
*****************************************************************************************************/
function scrollOpen() {
var args = scrollOpen.arguments;
var n = (args[1]) ? args[1] : 'scrollwin';
var t = (args[4]) ? args[4] : 0;
var l = (args[5]) ? args[5] : 0;
var f = (args[6]) ? args[6] : null;

window.remotewidth = args[2];
window.remoteheight = args[3];

scrollwin = window.open(args[0],n,'width='+getWidth(args[2],1)+',height='+getHeight(args[3],1)+',top='+t+',left='+l+',directories=0,'+f);

if(scrollwin.opener == null || scrollwin.opener != self) scrollwin.opener = self;
}
