window.onresize = function() { 
	window.location.reload(); 	
}

// BEGIN BROWSER DETECTION //
function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 
 
   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirebird    = (ua.indexOf('firebird/') != -1);
   this.isFirefox    = (ua.indexOf('firefox/') != -1);   
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );

   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);

  NetscapeVer = navigator.userAgent; 
  NSVersion = NetscapeVer.substring(82,85);
  this.isNS7even = (NSVersion == 7.0);

   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
   this.isIEMac = (this.isIE && this.isMac);
}
var browser = new BrowserDetect();

// END BROWSER DETECTION

ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 300
ypSlideOutMenu.hideDelay = 150
ypSlideOutMenu.minCPUResolution = 10
// constructor
function ypSlideOutMenu(id, dir, left, top, width, height) {
	this.ie = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	if (this.ie || this.ns4 || this.dom) {
		this.id = id
		this.dir = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType = dir == "right" || dir == "down" ? "-" : "+"
		this.dim = this.orientation == "h" ? width : height
		this.hideTimer = false
		this.aniTimer = false
		this.open = false
		this.over = false
		this.startTime = 0
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")
		ypSlideOutMenu.Registry[id] = this
		var d = document
		var strCSS = '<style type="text/css">';
		strCSS += '#' + this.id + 'Container { visibility:hidden; '
		strCSS += 'left:' + left + 'px; '
		strCSS += 'top:' + top + 'px; '
		strCSS += 'overflow:hidden; z-index:10; }'
		strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
		strCSS += 'width:' + width + 'px; '
		strCSS += 'height:' + height + 'px; '
		strCSS += '}'
		strCSS += '</style>'
		d.write(strCSS)
		this.load()
	}
}
ypSlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	var temp
	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
	else {
		this.container = obj1
		this.menu = obj2
		this.style = this.ns4 ? this.menu : this.menu.style
		this.homePos = eval("0" + this.dirType + this.dim)
		this.outPos = 0
		this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
		// set event handlers.
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
		//set initial state
		this.endSlide()
	}
}
ypSlideOutMenu.showMenu = function(id) {
	var reg = ypSlideOutMenu.Registry
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
		obj.over = true
		for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu)
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
}
ypSlideOutMenu.hideMenu = function(id) {
	var obj = ypSlideOutMenu.Registry[id]
	if (obj.container) {
	  if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
	}
}
ypSlideOutMenu.hideAll = function() {
	var reg = ypSlideOutMenu.Registry
	for (menu in reg) {
		ypSlideOutMenu.hide(menu);
		if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
	}
}
ypSlideOutMenu.hide = function(id) {
	var obj = ypSlideOutMenu.Registry[id]
	obj.over = false
	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	obj.hideTimer = 0
	if (obj.open && !obj.aniTimer) obj.startSlide(false)
}
ypSlideOutMenu.prototype.startSlide = function(open) {
	this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime() 
	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}
ypSlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-") d = -d
		else if (this.open && this.dirType == "+") d = -d
		else if (!this.open && this.dirType == "-") d = -this.dim + d
		else d = this.dim + d
		this.moveTo(d)
	}
}
ypSlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.startSlide(this.over)
	}
}
ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}
ypSlideOutMenu.prototype.moveTo = function(p) { 
	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
ypSlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}
ypSlideOutMenu.prototype.onactivate = function() { }
ypSlideOutMenu.prototype.ondeactivate = function() { }



/* --- Dan Hicks variables --- */
	/* menu heights */
	menu1Height = 300;
	menu2Height = 300;
	menu3Height = 300;
	menu4Height = 300;
	menu5Height = 300;	
	menu6Height = 300;	

	/* menu left positioning */
	LeftOffset1 = -350;
	LeftOffset2 = -279;
	LeftOffset3 = -174;	
	LeftOffset4 = -74;
	LeftOffset5 = 71;	
	LeftOffset6 = 190;	

	/* menu top positioning */
	TopOffset = -11;
	
	if (browser.isMozilla || browser.isNS7up) {
		LeftOffset1 = LeftOffset1 + 10;
		LeftOffset3 = LeftOffset3 + 10;
		LeftOffset2 = LeftOffset2 + 10;
		LeftOffset4 = LeftOffset4 + 10;		
		LeftOffset5 = LeftOffset5 + 10;		
		LeftOffset6 = LeftOffset6 + 10;		
		TopOffset = TopOffset + 2;
	}
	if (browser.isSafari || browser.isOpera || browser.isIEMac) {
		LeftOffset2 = LeftOffset2 + 10;
		LeftOffset3 = LeftOffset3 + 10;
		LeftOffset4 = LeftOffset4 + 10;
		LeftOffset5 = LeftOffset5 + 10;		
		LeftOffset6 = LeftOffset6 + 10;	
	}
	if (browser.isFirefox ) {
		menu1Height = menu1Height - 4;
		menu2Height = menu2Height - 12;
		menu3Height = menu3Height - 2;
		menu4Height = menu4Height - 14;
		menu5Height = menu5Height - 4;
		menu6Height = menu6Height - 4;
		LeftOffset1 = LeftOffset1 + 1;
		LeftOffset2 = LeftOffset2 + 1;
		LeftOffset3 = LeftOffset3 + 1;
		LeftOffset4 = LeftOffset4 + 1;
		LeftOffset5 = LeftOffset5 + 1;		
		LeftOffset6 = LeftOffset6 + 1;		
		TopOffset = TopOffset + 2;
	}
	if ( (browser.isFirefox && browser.isWin) || (browser.isOpera && browser.isWin) ) {
		menu1Height = menu1Height + 4;
		menu2Height = menu2Height + 12;
		menu3Height = menu3Height + 2;		
		menu4Height = menu4Height + 14;
		menu5Height = menu5Height + 4;				
		menu6Height = menu6Height + 4;				
	}
	if (browser.isOpera && browser.isMac) {
		menu1Height = menu1Height + 2;
		menu2Height = menu2Height + 6;
		menu3Height = menu3Height + 1;
		menu4Height = menu4Height + 7;
		menu5Height = menu5Height + 2;
		menu6Height = menu6Height + 2;
	}	
	if (browser.isIEMac || (browser.isFirefox && browser.isWin) || (browser.isNS7up && browser.isMac) ) {
		TopOffset = TopOffset - 1;
	}
	if (browser.isNS7up && browser.isMac) {
		menu1Height = menu1Height - 4;
		menu2Height = menu2Height - 12;
		menu3Height = menu3Height - 2;
		menu4Height = menu4Height - 14;
		menu5Height = menu5Height - 4;
		menu6Height = menu6Height - 4;
	}
	
var myMenu1 = new ypSlideOutMenu("menu1", "down", 0, 0, 169, menu1Height)
var myMenu2 = new ypSlideOutMenu("menu2", "down", 0, 0, 169, menu2Height)
var myMenu3 = new ypSlideOutMenu("menu3", "down", 0, 0, 169, menu3Height)
var myMenu4 = new ypSlideOutMenu("menu4", "down", 0, 0, 169, menu4Height)
var myMenu5 = new ypSlideOutMenu("menu5", "down", 0, 0, 169, menu5Height)
var myMenu6 = new ypSlideOutMenu("menu6", "down", 0, 0, 169, menu6Height)

myMenu1.onactivate = repositionMenu1
myMenu2.onactivate = repositionMenu2
myMenu3.onactivate = repositionMenu3
myMenu4.onactivate = repositionMenu4
myMenu5.onactivate = repositionMenu5
myMenu6.onactivate = repositionMenu6

// Dan Hicks variables
menu1ID = 'firstLink';
menu2ID = 'secondLink';
menu3ID = 'thirdLink';
menu4ID = 'fourthLink';
menu5ID = 'fifthLink';
menu6ID = 'sixthLink';

// Dan Hicks: these variables control where submenus appear when browser does not display full screen
browsMin_Top = 146;

function repositionMenu1() {
	menu1Left = getWindowWidth() / 2 + LeftOffset1;	
	if (getWindowWidth() < 702) {
		menu1Left = 0;
	}	
	menu1Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu1Top = browsMin_Top;
	}	
	myMenu1.container.style ? myMenu1.container.style.left = menu1Left + "px" : myMenu1.container.left = menu1Left;
	myMenu1.container.style ? myMenu1.container.style.top = menu1Top + "px" : myMenu1.container.left = menu1Top;
}
function repositionMenu2() {
	menu2Left = getWindowWidth() / 2 + LeftOffset2;
	if (getWindowWidth() < 702) {
		menu2Left = 125;
	}	
	menu2Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu2Top = browsMin_Top;
	}		
	myMenu2.container.style ? myMenu2.container.style.left = menu2Left + "px" : myMenu2.container.left = menu2Left;
	myMenu2.container.style ? myMenu2.container.style.top = menu2Top + "px" : myMenu2.container.left = menu2Top;
}
function repositionMenu3() {
	menu3Left = getWindowWidth() / 2 + LeftOffset3;
	if (getWindowWidth() < 702) {
		menu3Left = 290;
	}	
	menu3Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu3Top = browsMin_Top;
	}		
	myMenu3.container.style ? myMenu3.container.style.left = menu3Left + "px" : myMenu3.container.left = menu3Left;
	myMenu3.container.style ? myMenu3.container.style.top = menu3Top + "px" : myMenu3.container.left = menu3Top;
}
function repositionMenu4() {
	menu4Left = getWindowWidth() / 2 + LeftOffset4;
	if (getWindowWidth() < 702) {
		menu4Left = 518;
	}	
	menu4Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu4Top = browsMin_Top;
	}	
	myMenu4.container.style ? myMenu4.container.style.left = menu4Left + "px" : myMenu4.container.left = menu4Left;
	myMenu4.container.style ? myMenu4.container.style.top = menu4Top + "px" : myMenu4.container.left = menu4Top;
}
function repositionMenu5() {
	menu5Left = getWindowWidth() / 2 + LeftOffset5;
	if (getWindowWidth() < 702) {
		menu5Left = 686;
	}	
	menu5Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu5Top = browsMin_Top;
	}	
	myMenu5.container.style ? myMenu5.container.style.left = menu5Left + "px" : myMenu5.container.left = menu5Left;
	myMenu5.container.style ? myMenu5.container.style.top = menu5Top + "px" : myMenu5.container.left = menu5Top;
}
function repositionMenu6() {
	menu6Left = getWindowWidth() / 2 + LeftOffset6;	
	if (getWindowWidth() < 702) {
		menu6Left = 740;
	}	
	menu6Top = ((getWindowHeight() - 500)/2) + TopOffset;
	if (getWindowHeight() < 5000) {
		menu6Top = browsMin_Top;
	}	
	myMenu6.container.style ? myMenu6.container.style.left = menu6Left + "px" : myMenu6.container.left = menu6Left;
	myMenu6.container.style ? myMenu6.container.style.top = menu6Top + "px" : myMenu6.container.left = menu6Top;
}

// IMAGE SWAPPING AND PRELOADING
function init() {
}

function getWindowWidth() {
	return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
}

function getWindowHeight() {
	return window.innerHeight ? window.innerHeight : document.body.offsetHeight;
}

function getImgX(menID) {
	return document.getElementById(menID).x ? document.getElementById(menID).x : document.all[menID].offsetLeft;
}
function getImgY(menID) {
	return document.getElementById(menID).y ? document.getElementById(menID).y : document.getElementById(menID).offsetTop;
}

function subActive(id,OorF) {
	classN = 'menuAr';
	if (OorF == 'on') { classN = 'hover'; }
	document.getElementById(id).className = classN;
}	


if (browser.isNS7x && browser.isWin) {
	document.write('<style type="text/css">.menu { -moz-opacity: 0.7; } .sub-menu { -moz-opacity: 0.7; } </style>');
}

