
	
	
	
	
	
	var modern = (document.getElementById) ? 1 : 0
	var ns4 = (document.layers) ? 1 : 0	
	var ie4 = (document.all && modern != 1) ? 1 : 0
	
	//The mac version of IE is choking on this page - I'm going to work on fixing the problem, but for now lets patch it by preventing scrolling
	var browser = navigator.userAgent;
	if (browser.search("MSIE") != -1 && browser.search("Mac") != -1) {
		var macie = 1;
		modern = 0;

	} else {
		var macie = 0;
	}
	
	
	var cDivName = "scrollContainer";
	var cDiv;
	var cDivHeight;
	
	var sDivName = "scroller";
	var sDiv;
	var sDivHeight;
	var sDivStart;
	var sDivStop;
	var sDivCurrPos;
	var sDivDirection = "top";
	var sDivDelay = 75;

	var startDelay = 800;

	var sDivStep = 1;
	var ss = new Array();
	
	
	function printItems(elem, arrItems)
	{
		//For NS4 - if elem is undefined, then exit -it's parsing this function before it is called...this simply exits if that is the case.
		var a;
		if (elem == a) {
			return;
		}
		
		var output = "";
		
		for(i=0; i<arrItems.length; i++) {
			if (arrItems[i].indexOf("|") != -1) {		//If | is in the string
				var parts = arrItems[i].split("|");
				output += '<a href="' + parts[1] + '">' + parts[0] + '</a>';
								
			} else {
				output += arrItems[i];
				
			}
			
			if (ns4) {
				output += "<br />";
			}
		}//for loop
		
		if ((modern || ie4 ) && !macie) {
			elem.innerHTML = output + "<br />" + output + "<br />" + output;		//Doing this to give illusion of a fast wrap
			
		} else if (macie) {
			elem.innerHTML = output;
			
		} else if (ns4) {
			output = '<p class="scrollContainerA">' + output + '</p>';	//To maintain CSS styles, because NS4 is just that bad
			elem.document.open();
			elem.document.write(output);
			elem.document.close();
		} 
	}//end printItems

	function startScroll()
	{
		if (ns4) {
			//If netscape 4, no scrolling
			//Get cDiv element and print out items
			if (ns4) {
				cDiv = document.layers[cDivName];
				printItems(cDiv, whatsnew);
			}			

		} else if (modern || ie4 || macie) {
			if (modern || macie) {
				//If it's a modern browser, IE5.5, NS7+
				cDiv = document.getElementById(cDivName);

			} else {
				//If IE4
				cDiv = document.all[cDivName];
			}

			cDivHeight = cDiv.offsetHeight;

			//cDiv.innerHTML = '<div id="scroller" style="position: relative;" onmouseover="stopScroll()" onmouseout="reStartScroll()"></div>';
			cDiv.innerHTML = '<div id="scroller" style="position: relative;"></div>';

			if (modern || macie) {
				sDiv = document.getElementById(sDivName);

			} else {
				sDiv = document.all[sDivName];

			}

			printItems(sDiv, whatsnew);
			prepScroll();
			
			if (modern || ie4) {					
				//reStartScroll();
				setTimeout('reStartScroll()', startDelay);
			} 
		}
	}//end startScroll
	
	function prepScroll()
	{
		if (macie) {
			var theight = sDiv.offsetHeight;
			cDiv.style.height = theight + "px";
			cDiv.style.backgroundColor = "#000066";
			return;
		}
		
		sDivHeight = sDiv.offsetHeight;		//Calculate height of the filled sDiv

		if (sDivDirection == "up") {
			//If scrolling from bottom of "window" up
			sDivStart = cDivHeight;		//Start at bottom of "window"
			sDivStop = 0 - sDivHeight;	//Go until bottom of scroll layer is at top of "window"

		} else if (sDivDirection == "down") {
			//If scrolling from top of "window" down
			sDivStart = 0 - sDivHeight;
			sDivStop = cDivHeight;
		} else {
			//If not set or sDivDirection == "top"
			sDivStart = 15;
			sDivStop = 0 - sDivHeight;
		}

		//Position the layer
		sDiv.style.top = sDivStart + "px";
		sDivCurrPos = sDivStart;
	}//prepScroll
	
	function reStartScroll()
	{
		if (ns4 || macie) {
			//alert("I'm netscape - so I'm just returning");
			return;
		}
		
		//What follow in this function and in stopScroll() is an ugly hack to make the scroll stop in browsers that creates a NEW interval ID
		//each time the setInterval function is executed (Safari, Opera 7 especially)
		//
		//We create an array of the interval ids and, when stopScroll is called, loop backwards through the whole of the array cancelling each previous 
		//interval. 
		ss[ss.length] = setInterval('moveText()', sDivDelay);
	}//end reStartScroll
	
	function stopScroll()
	{
		if (macie || ns4) {
			return;
		}
		//alert(ss);
		for(i=ss.length; i>=0; i--) {
			clearInterval(ss[i]);
		}		
		ss.length = 0;					//Reset array size - we no longer need the old interval ids	
	}
	
	function moveText()
	{
		if (ns4) return;

		if (sDivDirection == "down") {
			if (parseFloat(sDiv.style.top) >= sDivStop) {
					sDiv.style.top  = sDivStart + "px";
				}
				sDiv.style.top = parseFloat(sDiv.style.top) + sDivStep + "px";
				
		} else if (sDivDirection == "up" || sDivDirection == "top") {
				if (parseFloat(sDiv.style.top) <= sDivStop) {
					sDiv.style.top  = sDivStart + "px";
				}
				sDiv.style.top = parseFloat(sDiv.style.top) - sDivStep + "px";
		}	
		
	}//end moveText
	
	function imgHover(imgName)
	{
		if (ns4) return;
		
		var pth = document.images[imgName].src;
		var lclpos = pth.lastIndexOf("/");
		if (lclpos != -1) {
			var path = pth.substr(lclpos+1);
		} else {
			return;
		}
		
		if (path == "who_on.gif" || path == "what_on.gif") {
			return;
		} else {
			if (imgName == "whatsnew") {
				document.images["whatsnew"].src = "images/what_over.gif";
				
			} else {
				document.images["whoareyou"].src = "images/who_over.gif";
				
			}
		}		
	}//end imgHover
	
	function imgOut(imgName)
	{
		if (ns4) return;
		
		var pth = document.images[imgName].src;
		var lclpos = pth.lastIndexOf("/");
		if (lclpos != -1) {
			var path = pth.substr(lclpos+1);
		} else {
			return;
		}
		
		if (path == "who_on.gif" || path == "what_on.gif") {
			return;
		} else {
			if (imgName == "whatsnew") {
				document.images["whatsnew"].src = "images/what_off.gif";
				
			} else {
				document.images["whoareyou"].src = "images/who_off.gif";
				
			}
		}		
	}//end imgOut
	
	function imgClick(imgName)
	{
		//Netscape 4 doesn't get any nice features
		if (ns4) {
			if (imgName == "whatsnew") {
				printItems(cDiv, whatsnew);
			} else {
				printItems(cDiv, whoareyou);
			}
			return;		
		}
		
		var pth = document.images[imgName].src;
		var lclpos = pth.lastIndexOf("/");
		if (lclpos != -1) {
			var path = pth.substr(lclpos+1);
		} else {
			return;
		}
		
		if (path != "who_on.gif" || path != "what_on.gif") {
			//If the clicked on image is not already on
			stopScroll();
			
			if (imgName == "whatsnew") {
				document.images["whatsnew"].src = "images/what_on.gif";
				document.images["whoareyou"].src = "images/who_off.gif";
				
				if (macie) {
					printItems(sDiv, whatsnew);
				} else {
					printItems(sDiv, whatsnew);
				}
				
			} else {
				document.images["whoareyou"].src = "images/who_on.gif";
				document.images["whatsnew"].src = "images/what_off.gif";
				
				if (macie) {
					printItems(sDiv, whoareyou);
				} else {
					printItems(sDiv, whoareyou);
				}
				
			}
			
			prepScroll();			
			setTimeout('reStartScroll()', startDelay);
		}
	}//end imgClick
	
	if (ns4) {
		cDiv = document.layers[cDivName];
		printItems(cDiv, whatsnew);
	}
	
	window.onload = startScroll;
