start = function() {
	if (document.getElementById("globalNav")) {
		startList("globalNav");
	}
	if (document.getElementById("sideBar")) {
		startList("sideBar");
	}
	if (document.getElementById("content")) {
		tableruler();
	}
	if (document.getElementById("map_list")) {
		startList("map_list")
	}
	if (document.getElementById("lifecycle")) {
		startList("lifecycle")
	}
	if (document.getElementById("audience")) {
		document.getElementById("content").className="narrowContent"
	}
	if (document.getElementById("audiencecore")) {
		document.getElementById("content").className="narrowContent"
	}
	//startGallery();
//	document.Search_Form.q.focus();
}
function startList(id) {
//	if (document.all&&document.getElementById) {
		navLI = document.getElementById(id).getElementsByTagName("LI");
		for (i=0; i<navLI.length; i++) {
			node = navLI[i];
			node.onmouseover=function() {
				this.className+="over";
			}
			node.onmouseout=function() {
				this.className=this.className.replace("over", "");
			}	
}	}	//}

function tableruler() {
	if (document.getElementById && document.createTextNode) {
		var tables=document.getElementById('content').getElementsByTagName('table');
		for (var i=0;i<tables.length;i++) {
			if(tables[i].className.indexOf('fancy')!=-1) {
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++) {
					if (trs[j].className.length == 0) {
						if (j%2==1) {
								trs[j].className = 'alt';
								trs[j].onmouseover=function(){this.className='hilited';return false}
								trs[j].onmouseout=function(){this.className='alt';return false}
						} else {
							trs[j].onmouseover=function(){this.className='hilited';return false}
							trs[j].onmouseout=function(){this.className='';return false}
}	}	}	}	}	}	}


function getTimeStamp()
{
var aDate = new Date();
var stamp = aDate.getTime();

return stamp;
}

function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}
function resetText(thefield) {
	if (thefield.value=="")
	thefield.value = thefield.defaultValue
}

function sizeFloats() {
	var lists = $$(".floatList");
	for (var i=0; i<lists.length; i++) {
		var firstItemInRow = 0;
		var items = lists[i].childElements();
		var height = items[0].offsetHeight;
		for (var j=1; j<items.length; j++) {
			if (items[j].offsetTop == items[j-1].offsetTop) {
				if (items[j].offsetHeight > height) {
					height = items[j].offsetHeight;
				}
			}
			else {
				height = items[j].offsetHeight;
				firstItemInRow = j;
			}
			for (var k=firstItemInRow; k<=j; k++) {
				items[k].style.height = height+"px";
			}
		}
	}
}

function styleHeadingsWithImages() {
	if (!document.getElementsByTagName) return false;
	var headers = $$(".header");
	for (var i=0; i<headers.length; i++) {
		var headerImage = headers[i].getElementsByTagName("img");
		if (headerImage[0]) {
			headers[i].addClassName("withImage");
		}
	}
}


function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
addLoadEvent(start);
addLoadEvent(sizeFloats);
addLoadEvent(styleHeadingsWithImages);