

function BrowserStats() {
  var userAgent = " " + navigator.userAgent.toLowerCase();
  // determine nn/ie, rounded version number and platform
  this.nn = userAgent.indexOf( "mozilla" ) > 0;
  // "compatible" versions of mozilla are not netscape
  if( userAgent.indexOf( "compatible" ) > 0 )
    this.nn = false;
  this.ie = userAgent.indexOf( "msie" ) > 0;
  this.version = navigator.appVersion;
  this.major = parseInt( this.version );
  this.mac = userAgent.indexOf( "mac" ) > 0;
  // ie 5 reports itself as 4
  if( this.ie ) {
    if( userAgent.indexOf( "msie 5" ) > 0 )
      this.major = 5;
  }
  return this; 
}

var browser = new BrowserStats();

// font platform resize
var platformCSS;
var macDet;
if( browser.mac && browser.major >= 5 ) {
  platformCSS = "ieadjust.css";
  macDet = "yes";
} else if( browser.mac ) {
  platformCSS = "v4adjustMac.css";
}
if( !browser.mac && browser.ie ) {
  platformCSS = "ieadjust.css";
}
if( platformCSS ){
document.write( "<link rel='stylesheet' href='/Shared/" + platformCSS + "'type='text/css'>" );
}
// netscape browser resize fix
if( browser.nn && !browser.mac ) {
  widthCheck = window.innerWidth;
  heightCheck = window.innerHeight;
  window.onresize = resizeFix;
}

function resizeFix() {
  if((widthCheck != window.innerWidth || heightCheck != window.innerHeight) && !browser.mac )
    window.location.reload( true )
}


// menu objects
function Menu( argName, argItems, argX, argY, argWidth, argSubMenuName, subMenuHilite ) {
  this.name = argName;
  this.items = argItems;
  this.x = argX;
  this.y = argY;
  this.width = argWidth;
  this.subMenuName = argSubMenuName;
  this.subMenuHilite = subMenuHilite;
}

function MenuItem( argValue, argUrl, argSubMenu ) {
  this.value  = argValue;
  this.url = argUrl;
  this.subMenu  = argSubMenu;
}

// menu methods
function hideShow( argMenu, argState ) {
	var menuObj = eval( argMenu );
	if( browser.nn ) {
    if( menuObj ) menuObj.visibility = argState;
	} else if( browser.ie ) {
    if( menuObj ) menuObj.style.visibility = argState;
	}
}

function showMenu( argMenu ) {
	if( browser.nn )
		hideShow( document.layers[argMenu], "show" );
	else if( browser.ie )
		hideShow( document.all[argMenu], "visible" );
}

function hideMenu( argMenu ) {
	if( browser.nn )
		hideShow( document.layers[argMenu], "hide" );
	else if( browser.ie )
		hideShow( document.all[argMenu], "hidden" );
}

function timedHideMenu( argMenu, milliseconds ) {
  if( browser.ie ) hideMenu( argMenu );
  else eval( argMenu + "Timer = setTimeout( \"hideMenu( \'" + argMenu + "\' )\", " + milliseconds + " );" )
}

function BacktimedHideMenu( argMenu, milliseconds ) {
  if( browser.ie ) hideMenu( argMenu );
    else eval( argMenu + "Timer = setTimeout( \"hideMenu( \'" + argMenu + "\' )\", " + milliseconds + " );" )
}


function hiliteBgColor( argMenuItem, color ) {
	var menuObj = eval( argMenuItem );
	if( browser.nn ) {
    if( menuObj ) menuObj.bgColor = color;
	}	else if( browser.ie ) {
		if( menuObj ) menuObj.style.backgroundColor = color;
	}
}

function initModelsWidget() {
	toggleModel( currentModel, 'show' );
}

