// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

// Body onload utility (supports multiple onload functions)
var gSafeOnload = new Array();
function SafeAddOnload(f) {
	if (IEmac && IE4) { // IE 4.5 blows out on testing window.onload
		window.onload = SafeOnload;
		gSafeOnload[gSafeOnload.length] = f;
	} else if (window.onload) {
		if (window.onload != SafeOnload) {
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}
		gSafeOnload[gSafeOnload.length] = f;
	} else {
		window.onload = f;
	}
}
function SafeOnload() {
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}
// Call the following with your function as the argument
//SafeAddOnload(yourfunctioname);

function printWindow() {
	if (window.print) {
		window.print();
	} else {
		alert("Your browser doesn't support this funtion. Please select \"File > Print\" from your browser's menu to print this page.");
	}
}

function emailToFriend(url) {
	newWin = window.open('/emailtofriend.asp?emailUrl='+url,'emailtofriend','scrollbars=no,resize=no,width=334,height=226');
	if(window.focus)
		newWin.focus();
}

function swapHomePic(picNum) {
	if (document.getElementById) {
		tempBlockName = window.document.getElementById("homePic");
	}
	else if (document.layers) {
		tempBlockName = window.document.layers["homePic"];
	}
	else if (document.all) {
		tempBlockName = window.document.all["homePic"];
	}
	newClassName = "homePic"+picNum;
	tempBlockName.className=newClassName;
}
function restoreHomePic() {
	if (document.getElementById) {
		tempBlockName = window.document.getElementById("homePic");
	}
	else if (document.layers) {
		tempBlockName = window.document.layers["homePic"];
	}
	else if (document.all) {
		tempBlockName = window.document.all["homePic"];
	}
	tempBlockName.className="homePic1";
}

enlargeStart = function() {
	if (document.getElementsByTagName) {
		enlargeRoot = document.getElementsByTagName("DIV");
		for (i=0; i<enlargeRoot.length; i++) {
			enlarge = enlargeRoot.item(i);
			if (enlarge.className=="enlarge") {
				enlarge.onclick = function() {
					if (this.className=="enlarge") {
						this.className+=" big";
						this.style.zIndex=1000;
					} else {
						this.className=this.className.replace(" big", "");
						if (document.all) { //IE gives an error when setting to auto so make it blank instead
							this.style.zIndex="";
						} else {
							this.style.zIndex="auto";
						}
					}
				}
			}
		}
	}
}
SafeAddOnload(enlargeStart);

//Archive part at NEWSLETTER AND REPORTS page
var dropdown=0;
function displayArchive(arch){
		dropdown = document.getElementById(arch);
		var archiveClass = dropdown.className;
		if (!dropdown.className) { //Is collapsed
			dropdown.className += 'viewArchive';
			//alert("document.getElementById('viewHideArchive').nodeValue is: "+document.getElementById('viewHideArchive').nodeValue);
			//alert("document.getElementById('viewHideArchive').firstChild.nodeValue is: "+document.getElementById('viewHideArchive').firstChild.nodeValue);
			document.getElementById('viewHideArchive').firstChild.nodeValue = 'Hide Archive';
		}
		else { // Is expanded
			dropdown.className = '';
			//alert(document.getElementById('viewHideArchive').nodeValue);
			document.getElementById('viewHideArchive').firstChild.nodeValue = 'View Archive';
		}
}
