// browser detection
function browserStats() {
  var ua = " " + navigator.userAgent.toLowerCase();
  this.nn = ua.indexOf( "mozilla" ) > 0;
  ua.indexOf( "compatible" ) > 0 ? this.nn = false : "";
  this.ie = ua.indexOf( "msie" ) > 0;
  this.version = parseInt( navigator.appVersion );
  this.mac = ua.indexOf( "mac" ) > 0;
  this.ie ? ua.indexOf( "msie 5" ) > 0 ? this.version = 5 : "" : "";
  return this;
}

var b = new browserStats();

// browser/platform font size cascade
var cssPath = "/css/", cssFile;
b.mac && b.nn && b.version >= 5 ? cssFile = "half_size_smaller.css" : b.mac && b.version >= 5 || !b.mac && b.ie || b.nn && b.version >= 5 ? cssFile = "one_size_smaller.css" : cssFile;
cssFile ? document.write( '<link rel="stylesheet" href="' + cssPath + cssFile + '" type="text/css" />' ) : "";

// netscape browser resize fix
if( b.nn ) {widthCheck = window.innerWidth;heightCheck = window.innerHeight;window.onresize = resizeFix;}

function resizeFix() {widthCheck != window.innerWidth || heightCheck != window.innerHeight ? window.location.reload( true ) : "";}

// rollover
function rollover( imgName, imgSrc, container ) {
  var path = "document." + imgName + ".src = '" + imgSrc + "'";
  if( b.nn && b.version < 5 && container ) eval( container + "." + path );
    else eval( path );
}

// universal window function
function flexWin(argUrl,argScrollbar,argWidth,argHeight,argWinName,argOptions,argXpos,argYpos,argCloseWin){
 //Set defaults for new window - All options on by default except Scrollbars
  var winName = argWinName ? argWinName : "flexWin" + nocacheRandom();
  var windowOptions = argOptions ? argOptions : "history=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0";
  var winWidth = argWidth ? argWidth : 800;
    windowOptions += ",width=" + winWidth;
  var winHeight = argHeight ? argHeight : 600;
    windowOptions += ",height=" + winHeight;
  var scrollbar = argScrollbar ? ",scrollbars=yes" : ",scrollbars=no";
    windowOptions += scrollbar;
 //Position window
  var winXpos = argXpos ? argXpos : ( screen.availWidth - winWidth ) / 2;
    windowOptions += ",left=" + winXpos + ",screenX=" + winXpos;
  var winYpos = argYpos ? argYpos : ( ( screen.availHeight - winHeight ) / 2 ) - 40;
    windowOptions += ",top=" + winYpos + ",screenY=" + winYpos;
 //Open Window
 //alert(winName);
  window.open(argUrl,winName,windowOptions);
//Close window if asked to
  argCloseWin ? window.close() : "";
}