/*
 * ========== BASIC INFO SNIFF ====================
 *
 * This is not the most fully-featured browser sniff, but it determines enough
 * information to make the sort of simple decisions that we need to make.
 */

// initial info
var agt    = navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

// version number
//   (IE and Mozilla spoof other browsers, so the real version number is sort of buried)
var version = parseInt(navigator.appVersion);

var iePos = appVer.indexOf('msie');
if (iePos != -1) {
  version = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
  version = parseInt(version);
}

var nav6Pos = agt.indexOf('netscape6');
if (nav6Pos !=-1) {
  version = parseFloat(agt.substring(nav6Pos+10))
  version = parseInt(version)
}

// browser type
var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);
var is_ie    = (iePos!=-1);
var is_nav   = ((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1)
             && (agt.indexOf('compatible') == -1) && !is_opera && !is_webtv);

// platform
var is_win = ( (agt.indexOf("win") != -1) || (agt.indexOf("16bit") != -1) );
var is_mac = ( agt.indexOf("mac") != -1 );


/*
 * ========== STYLESHEET SNIFF ====================
 */

// default to the most common option...
var sheet = "ie_windows.css";

// .. and see whether we have an exception
if( is_nav ) {
  if( is_win ) {
    sheet="netscape_windows.css";
  } else if( is_mac ) {
    sheet="netscape_mac.css";
  }
}

// dynamically load the chosen sheet:
document.write('<link rel="stylesheet" href="/files/ICBAsites/style/' + sheet + '" type="text/css">');


/*
 * ========== MOUSEOVER SNIFF ====================
 */

var doMouseovers = false;

if( is_nav || is_ie ) {
  doMouseovers = (version > 2);
} else if( is_opera ) {
  doMouseovers = true;
}
