// begin set of functions to set menu division to butt to bottom of window

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setmenuDiv() {
	if (document.getElementById) {
		var isExplorer = (navigator.appName.indexOf('Microsoft')!=-1) ? true : false;
		var isMac = (navigator.appVersion.indexOf('Mac')!=-1) ? true : false;
		var windowHeight = getWindowHeight();
		var menuDivElement = document.getElementById('menu');
		var mainDivElement = document.getElementById('main_content');
		var mainDivTop = mainDivElement.offsetTop;
		var mainDivHeight = mainDivElement.offsetHeight;
			if (((windowHeight - 16) - (mainDivTop + mainDivHeight)) > 0) {
				if (isExplorer && isMac) {
					menuDivElement.style.height = (windowHeight - mainDivTop) + 'px';
					menuDivElement.style.margin = '0 0 -15px 0';
				}
				else {
				menuDivElement.style.height = (windowHeight - mainDivTop) + 'px';
				}
			}
			else {
				if (isExplorer && isMac) {
				menuDivElement.style.height = (mainDivHeight + 30) + 'px'; 
				menuDivElement.style.margin = '0 0 -15px 0';
				}
				else {
				menuDivElement.style.height = (mainDivHeight + 30) + 'px';
				}
			}
	}
}

window.onload = function() {
	setmenuDiv();
}

window.onresize = 
	function() {
	setmenuDiv();
}

window.onscroll = function() {
	setmenuDiv();
}

// end set of functions to set menu division to butt to bottom of window


// shorthand for getting objects and images
// (Nothing happens with older browsers, too bad.)

isw3c = (document.getElementById) ? true : false;
imgs = (document.images) ? true: false;

function gObj(me) {
	if (isw3c) {
	return document.getElementById(me);
	}
}

function gImg(me) {
	if (imgs) {
	return document.images[me];
	}
}

// navbar mouseovers

var loc = "";

var imgname = new Array('why_us','were_diff','our_proc','recog','resources','our_team','contact','homepg');

function imgOn(a) {		
	im = imgname[a];
	gImg(im).src = "images/" + im + "_on.gif";
}

function imgOff(a) {		
	im = imgname[a];
		if ((a == 7) && (self.name == "visited") && (loc == "homepage")) {
		gImg(im).src = "images/" + im + "_on.gif";
		}
		else {
		gImg(im).src = "images/" + im + "_off.gif";
		}
}

// functions for index page to make home button on or off

function checkHomeButton() {
	loc = "homepage";
	if (self.name == "visited") {
	var hb = gImg("homepg");
	hb.src = "images/homepg_on.gif";
	}
}

function clicked(b) {
window.name = "visited";
	if (b == 1) {
	loc = "homepage";
	}
	else {
	loc = ""
	}
}