/*
slideshow
*/
var images = [];  // array of loaded images
var ct = 0; // slide counter

function switchslide() 
{ 
	var n = (ct+1) % (slidelist.length);
	if (images[n] && (images[n].complete || images[n].complete == null)) {
		var slideimage = document.getElementById("slideimage");
		slideimage.src = images[n].src;
		ct = n;
	} else {
		images[n] = new Image;
		images[n].src = slidelist[n][0];
	}
	setTimeout("switchslide()", duration * 1000);
}

function learnmore()
{
	location.href = slidelist[ct][1];
} 



/*

===================================================
XHTML/CSS/DHTML semantically correct drop down menu
===================================================
Author: Sam Hampton-Smith
Site: www.hampton-smith.com

Description:	This script takes a nested set of <ul>s
		and turns it into a fully functional
		DHTML menu. All that is required is 
		the correct use of class names, and
		the application of some CSS.
		
Use:		Please leave this information at the
		top of this file, and it would be nice
		if you credited me/dropped me an email
		to let me know you have used the menu.
		sam AT hampton-smith.com


---------------------------------------------------
Credits: 	Inspiration/Code borrowed from Dave Lindquist (www.gazingus.org)
		Menu hide functionality was aided by some code I found on www.jessett.com/
		modified by pbdh 4/2004 www.pbdh.com
*/



var currentMenu = null;
var mytimer = null;
var timerOn = false;
var opera = window.opera ? true : false;

if (!document.getElementById) document.getElementById = function() { return null; }

function initializeMenu(menuId, starterId) 
{
	var menu =    document.getElementById(menuId);
	var starter = document.getElementById(starterId);

	if (menu == null || starter == null) return;
	
	currentMenu = menu;


	starter.onmouseover = function() {
		if (currentMenu) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			this.showMenu();
			stopTime();
		}
	}

	menu.onmouseover = function() {
		if (currentMenu) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			this.showMenu();
		}
	}	


	menu.onmouseout = function(event) { this.hideMenu(); }
	starter.onmouseout = function() {   menu.hideMenu(); }


	starter.onfocus	 = function() { this.onmouseover(); }
	starter.onblur	 = function() { this.onmouseout(); }


	starter.showMenu = function() {
		menu.style.left = this.offsetLeft + "px";
		if (!opera) { menu.style.top = this.offsetTop + this.offsetHeight + "px"; }
		else {        menu.style.top = this.offsetHeight + "px"; }
		menu.style.visibility = "visible";
		currentMenu = menu;
	}
	
	menu.showMenu = function() {
		menu.style.visibility = "visible";
		currentMenu = menu;
		stopTime();
	}


	menu.hideMenu = function()  {
		if (!timerOn) {
			mytimer = setTimeout("killMenu('" + menuId + "');", 2000);
			timerOn = true;
		}
	}
}


function killMenu(amenu) 
{
	var menu = document.getElementById(amenu);
	menu.style.visibility = "hidden";
	stopTime();
}


function stopTime() 
{
	if (mytimer) {
		 clearTimeout(mytimer);
		 mytimer = null;
		 timerOn = false;
	}
} 


function imagehover(imgcontainerobj) 
{
	var img = imgcontainerobj.getElementsByTagName("img").item(0);
	img.style.top = "-121px";
}

function imagerestore(imgcontainerobj) 
{	
	var img = imgcontainerobj.getElementsByTagName("img").item(0);
	img.style.top = "0";
}




onload = function() 
{
	// disable menu for ie5 mac, because it forces floated elements in the body to stack above our absolutely-positioned dropdowns
	var notIE5Mac = !(
		(navigator.appVersion.indexOf("Mac") != -1) && 
		(navigator.appName.indexOf("Explorer") > 0) && 
		(parseFloat(navigator.appVersion) == 4)
	);

	if (notIE5Mac) {
		initializeMenu("menu8", "menu8Starter");
		initializeMenu("menu7", "menu7Starter");
		initializeMenu("menu6", "menu6Starter");
		initializeMenu("menu5", "menu5Starter");
		initializeMenu("menu4", "menu4Starter");
	}
	
	// start slideshow
	if (document.images) {
		switchslide();
	}
}

