function toggleDiv(elementId) {
	if (document.getElementById(elementId).style.display == 'none') {
		document.getElementById(elementId).style.display = 'block';
	} else {
		document.getElementById(elementId).style.display = 'none';
	}
	return false;
}
function loadNewLink(link) {
	window.open(link); 
	return false;
}
function loadImages(){
   var img;
   if (document.images){
      if (!loadedImages) loadedImages = new Array();
      for (var i=0; i < arguments.length; i++){
         img = new Image();
         img.src = arguments[i];
         loadedImages[loadedImages.length] = img;
      }
   }
}
function resizeDivs(leftSection, leftWidth, rightSection, rightWidth) {
	
// resizes left and right div widths for scroller in footer.
	leftSection.style.width = + leftWidth + "px";
	rightSection.style.width = rightWidth + "px";

}
function absoluteArrows() {
	var footerDiv = document.getElementById("footer-container");
	var leftArrowDiv = document.getElementById("left-arrow-float");
	var rightArrowDiv = document.getElementById("right-arrow-float");
	leftArrowDiv.style.position = "absolute";
	leftArrowDiv.style.top = "0";
	leftArrowDiv.style.left = "0";
	leftArrowDiv.style.padding = "64px 0 0 0";
	leftArrowDiv.style.height = eval (footerDiv.scrollHeight - 64) + "px";
	rightArrowDiv.style.position = "absolute";
	rightArrowDiv.style.top = "0";
	rightArrowDiv.style.right = "340px";
	rightArrowDiv.style.padding = "64px 0 0 0";
	rightArrowDiv.style.height = eval (footerDiv.scrollHeight - 64) + "px";
}
function normalArrows() {
	var leftArrowDiv = document.getElementById("left-arrow-float");
	var rightArrowDiv = document.getElementById("right-arrow-float");
	leftArrowDiv.style.position = "static";
	leftArrowDiv.style.height = "auto";
	leftArrowDiv.style.padding = "44px 0 20px 0";
	rightArrowDiv.style.position = "static";
	rightArrowDiv.style.height = "auto";
	rightArrowDiv.style.padding = "44px 340px 20px 0";
}
function scrollDivsLeft() {
	var footerDiv = document.getElementById("footer-container");
	var shifterDiv = document.getElementById("footer-shifter");
	// scrolls divs in the footer to the left.
	lastSubsection = curSubsection + 4; // last of the four sections.
	if (lastSubsection > Subsections) {
		lastSubsection = lastSubsection - Subsections;
	}
	var leftSection = document.getElementById("subsection-" + curSubsection);
	var midSection1 = document.getElementById("subsection-" + eval (curSubsection + 1));
	var midSection2 = document.getElementById("subsection-" + eval (curSubsection + 2));
	var midSection3 = document.getElementById("subsection-" + eval (curSubsection + 3));
	var rightSection = document.getElementById("subsection-" + lastSubsection);
	var rightWidth = Math.abs (Math.floor (i * subSectionWidth / frames));
	var jogger = -1 * (rightWidth - 20);
	var newPosition = jogger + "px";
	rightWidth += "px";
	if (i == 1) {
		var footerHeight = footerDiv.scrollHeight + "px";
		absoluteArrows();
		leftSection.style.position = "relative";
		midSection1.style.position = "relative";
		midSection2.style.position = "relative";
		midSection3.style.position = "relative";
		rightSection.style.position = "relative";
		rightSection.style.display = "block";
		shifterDiv.style.width = "auto";
	}
	leftSection.style.left = newPosition;
	midSection1.style.left = newPosition;
	midSection2.style.left = newPosition;
	midSection3.style.left = newPosition;
	rightSection.style.left = newPosition;
	rightSection.style.width = rightWidth;
//	resizeDivs(leftSection, leftWidth, rightSection, rightWidth);
	i = i + 1;
	if (i > frames) {
		clearInterval (scroller);
		scroller = null;
		leftSection.style.display = "none";
		leftSection.style.width = "160px";
		midSection1.style.position = "static";
		midSection2.style.position = "static";
		midSection3.style.position = "static";
		rightSection.style.position = "static";
		shifterDiv.style.width = "640px";
		shifterDiv.style.position = "static";
		normalArrows();
		curSubsection = eval (curSubsection + 1);
		if (curSubsection > Subsections) {
			curSubsection = 1;
		}
		if (lastSubsection == Subsections) {
			document.getElementById("left-arrow-link").style.visibility = "hidden";
		} else {
			document.getElementById("left-arrow-link").style.visibility = "visible";
		}
		document.getElementById("right-arrow-link").style.visibility = "visible";
		inScroll = 0;
		i = 1;
	}
}
function scrollDivsRight() {
	var footerDiv = document.getElementById("footer-container");
	var shifterDiv = document.getElementById("footer-shifter");
	// scrolls divs in the footer to the right.
	lastSubsection = curSubsection + 3; // last of the four sections.
	if (lastSubsection > Subsections) {
		lastSubsection = lastSubsection - Subsections;
	}
	var leftSection = document.getElementById("subsection-" + eval (curSubsection - 1));
	var midSection1 = document.getElementById("subsection-" + eval (curSubsection));
	var midSection2 = document.getElementById("subsection-" + eval (curSubsection + 1));
	var midSection3 = document.getElementById("subsection-" + eval (curSubsection + 2));
	var rightSection = document.getElementById("subsection-" + lastSubsection);
	var leftWidth = Math.abs (Math.floor (i * subSectionWidth / frames));
	var rightWidth = 160 - leftWidth;
	var jogger = -1 * (rightWidth - 20);
	var newPosition = jogger + "px";
	rightWidth += "px";
	if (i == 1) {
		var footerHeight = footerDiv.scrollHeight + "px";
		absoluteArrows();
		rightSection.style.position = "relative";
		midSection1.style.position = "relative";
		midSection2.style.position = "relative";
		midSection3.style.position = "relative";
		leftSection.style.position = "relative";
		leftSection.style.display = "block";
		shifterDiv.style.width = "auto";
	}
	rightSection.style.left = newPosition;
	midSection1.style.left = newPosition;
	midSection2.style.left = newPosition;
	midSection3.style.left = newPosition;
	leftSection.style.left = newPosition;
	rightSection.style.width = rightWidth;
 	i = eval (i + 1);
//	resizeDivs(rightSection, rightWidth, leftSection, leftWidth);
	if (i > frames) {
		clearInterval (scroller);
		scroller = null;
		rightSection.style.display = "none";
		rightSection.style.width = "160px";
		midSection1.style.position = "static";
		midSection2.style.position = "static";
		midSection3.style.position = "static";
		leftSection.style.position = "static";
		shifterDiv.style.width = "640px";
		shifterDiv.style.position = "static";
		normalArrows();
		curSubsection = eval (curSubsection - 1);
		if (curSubsection == 1) {
			document.getElementById("right-arrow-link").style.visibility = "hidden";
		} else {
			document.getElementById("right-arrow-link").style.visibility = "visible";
		}
		document.getElementById("left-arrow-link").style.visibility = "visible";
		inScroll = 0;
	}
}
function arrowOver(elementId) {
	var imgSrc = pageRoot + "images/" + elementId + "-over.gif";
	document.getElementById(elementId).src = imgSrc;
	var elementType = elementId.substring(0, 4);
	if (elementType == "left" && inScroll == 0) {
		i = 1;
		inScroll = 1;
		scrollCount = scrollCount + 1;
		scroller = setInterval ('scrollDivsLeft()', timer);
	} else if (inScroll == 0) {
		i = 1;
		inScroll = 1;
		scroller = setInterval ('scrollDivsRight()', timer);
	}
}
function arrowOut(elementId) {
	var imgSrc = pageRoot + "images/" + elementId + ".gif";
	document.getElementById(elementId).src = imgSrc;
}
//Fix Netscape resize bug for mouseDown and mouseUp events.
function forceReload() {
      location.reload()
}
function fixNetscape4(){
   NS4 = document.layers
   NSVer = parseFloat(navigator.appVersion)
   if (NSVer >= 5.0 || NSVer < 4.1) NS4 = false

   if (NS4) onresize = forceReload
}
function postLoadFunctions(passedRoot) {
	pageRoot = passedRoot;
	loadImages(pageRoot + 'images/left-arrow.gif', pageRoot + 'images/left-arrow-over.gif', pageRoot + 'images/right-arrow.gif', pageRoot + 'images/right-arrow-over.gif');
	countSubsections();
}
function countSubsections() {
	// counts the number of subsections for the slide show functionality.
	var subSectionClass = "footer-subsection"; // class defined for all footer subsections.
	var sectionHeight = 0;
	var isIE6 = false;
	if (browserName == "Microsoft Internet Explorer" && browserVer.indexOf("MSIE 6.0") > -1) {
		isIE6 = true;
	}
	var allDivs = document.getElementsByTagName('div');
	for (var i = 0; i < allDivs.length; i++) {
		var currentClass = allDivs.item(i).className;
		if (currentClass == subSectionClass) {
			Subsections = eval (Subsections) + 1;
			if (isIE6) {
				var curSectionHeight = allDivs.item(i).scrollHeight;
				if (curSectionHeight > sectionHeight) {
					sectionHeight = curSectionHeight;
				}
			}
		}
	}
	if (isIE6) {
		for (var i = 0; i < allDivs.length; i++) {
			var currentClass = allDivs.item(i).className;
			if (currentClass == subSectionClass) {
				var curDiv = allDivs.item(i).id;
				document.getElementById(curDiv).style.height = sectionHeight;
			}
		}
		document.getElementById("footer-container").style.height = sectionHeight;
		document.getElementById("footer").style.height = eval (sectionHeight) + 40;
//		document.getElementById("footer-container").style.backgroundColor = '#2F2824';
		document.getElementById("footer").style.overflowY = 'hidden';
	}
}
function displayHoverDiv(divId, visible) {
	if (visible) {
		document.getElementById(divId).style.display = "block";
	} else {
		document.getElementById(divId).style.display = "none";
	}
}
var Subsections = 0;
var frames = 40; // number of frames used for the scroll effect.
var curSubsection = 1; // starting subsection id.
var visibleSubs = 4; // visible subsections in the footer.
var subSectionWidth = 160; // width of the subsection.
var timer = 50; // time gap between iterations of slider function.
var loadedImages = null;
var i = 1;
var scroller = null;
var inScroll = 0;
var maxHeight = 0;
var scrollCount = 0;
var pageRoot;
var browserVer = navigator.appVersion;
var browserName = navigator.appName;
