// browser detection

function BrowserStats() {
  var ua = " " + navigator.userAgent.toLowerCase();
  // determine nn/ie, rounded version number and platform
  this.nn = ua.indexOf( "mozilla" ) > 0;
  // "compatible" versions of mozilla are not netscape
  if( ua.indexOf( "compatible" ) > 0 )
    this.nn = false;
  this.ie = ua.indexOf( "msie" ) > 0;
  this.version = navigator.appVersion;
  this.major = parseInt( this.version );
  this.mac = ua.indexOf( "mac" ) > 0;
  // ie 5 reports itself as 4
  if( this.ie ) {
    if( ua.indexOf( "msie 5" ) > 0 )
      this.major = 5;
  }
  return this;
}

var browser = new BrowserStats();

// font platform resize

var platformCSS;

if( browser.mac && browser.nn && browser.major < 5  ) {
  platformCSS = "bigger.css";
}

if( platformCSS ) document.write( "<link rel='stylesheet' href='/design/styles/" + platformCSS + "' type='text/css'>" );

function getParameter( argParam ) {
  var queryString = location.search.substring( 1, location.search.length );
  var params = queryString.split( "&" );
  var val = "";
  var val2 = "";
  if( argParam ) {
    for( i = 0; i < params.length; i++ ) {
      if( params[i].split( "=" )[0] == argParam )
        val = params[i].split( "=" )[1];
    }
    return val;
  }
}

// popup window

function popWin( argURL, argWidth, argHeight, argScrollbars ) {
  var options = "";
  // make window scrollable?
  if( argScrollbars ) options += "scrollbars,";
  options += "width=" + argWidth + ",height=" + argHeight;
    if( window.screen ) {
      var xPos = ( screen.availWidth - argWidth ) / 2;
      var yPos = ( ( screen.availHeight - argHeight ) / 2 ) - 40;
      options += ",left=" + xPos + ",screenX=" + xPos;
      options += ",top=" + yPos + ",screenY=" + yPos;
    }
  window.open( argURL, "popWin", options );
  //return true;
}

// footer

function getWinW() {
  if( document.all ) return document.body.clientWidth;
    else return window.innerWidth;
}

function getWinH() {
  if( document.all ) return document.body.clientHeight;
    else return window.innerHeight;
}

var winWidth;
var winHeight;

function resizeFix() {
  if( winWidth != getWinW() || winHeight != getWinH() )
    window.location.reload( true )
}

function initFooter() {
  winWidth = getWinW();
  winHeight = getWinH();
  setY( 'footer', getWinH() -13 );
  showE( 'footer' );
}

// animate subnav

var subY = 17, subClipTop = 17;

function animSub() {
  if( subY < 40 ) {
    subY++, subClipTop--;
    setY( "subnav", subY );
    setC( "subnav", subClipTop, 456, 17, 0 );
    setTimeout( "animSub()", 10 );
  } else {
    setC( "subnav", subClipTop, 456, 34, 0 );
  }
}