// JavaScript Document

websiteLocation = "http://www.cmnw.org/";

if ((BrowserDetect.browser == 'Explorer') && (BrowserDetect.version == 6)) {
	document.write('<link href="' + websiteLocation + 'css/ie6.css" rel="stylesheet" type="text/css" />');	
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


highlight = function(li) {
	//document.getElementById(li).firstChild.firstChild.src = websiteLocation + 'images/website_v2_template/images/buttons/' + li + 'Down.gif';
	
}

unHighlight = function(li) {
	//document.getElementById(li).firstChild.firstChild.src = websiteLocation + 'images/website_v2_template/images/buttons/' + li + 'Up.gif';
	
}

function buildAddress(user, text) {
	email = user + '@' + 'cmnw' + '.' + 'org';
	emailLink = 'm' + 'a' + 'i' + 'l' + 't' + 'o' + ':' + user + '@' + 'cmnw' + '.' + 'org';
	return "<a href=" + emailLink + ">" + email + "</a>";
}

function showFullText() {
	document.getElementById('fullText').style.visibility = 'visible';
	document.getElementById('fullText').style.height = 'auto';
	document.getElementById('fullText').style.overflow = 'visible';
}
/*
var currentMenuOpen;
	var currentHeadingHighlighted;
	
	function menuOpen(theMenu, theSubDiv) {
		bringForwardDropDown();
		closeOthers(theSubDiv);
		document.getElementById(theSubDiv).style.display = 'block';
		currentMenuOpen = theSubDiv;
		currentHeadingHighlighted = theMenu;
	}
	
	function menuClose (theMenu, theSubDiv) {
		
		document.getElementById('menuContainer').style.zIndex = "1000";
		document.getElementById(theMenu).src = 'images/menus/' + theMenu + 'Up.jpg';
		document.getElementById(theSubDiv).style.display = 'none';
	}
	
	
	function highlightSub(theMenuItem) {
		theMenuItem.style.color = "#333";
		theMenuItem.style.backgroundImage = "url(images/website_v2_template/images/menu_highlight_bg.gif)";
		theMenuItem.style.backgroundColor = "#e49f13";
		theMenuItem.style.backgroundRepeat = "no-repeat";
	}
	function unHighlightSub(theMenuItem) {
		theMenuItem.style.color = "#F9E4C0";
		theMenuItem.style.backgroundImage = "url(images/website_v2_template/images/menu_item_bg.gif)";
		theMenuItem.style.backgroundRepeat = "repeat-y";
		theMenuItem.style.backgroundColor = "#333";
	}
	
	function singleMenuHighlight(theMenu) {
		closeAll();
		document.getElementById(theMenu).src = "images/website_v2_template/images/" + theMenu + "_down.gif";
	}
	
	function singleMenuUnHighlight(theMenu) {
		document.getElementById(theMenu).src = "images/website_v2_template/images/" + theMenu + "_up.gif";
	}
	
	function closeOthers(theSubDiv) {
		if (currentMenuOpen != null) {
			if (currentMenuOpen != theSubDiv) {
				menuClose(currentHeadingHighlighted, currentMenuOpen);
			}
		}
	}
	
	var bodyIgnore = false;
	
	function closeAll() {
			if (currentMenuOpen != null) {
				menuClose(currentHeadingHighlighted, currentMenuOpen);
		}
	}
	
	
	function sendDropDownBack() {
		document.getElementById('menuContainer').style.zIndex = "999";
	}
	
	function bringForwardDropDown() {
		document.getElementById('menuContainer').style.zIndex = "1001";
	}
*/
	
function openPhotoWindow(gallery_ID) {
	fileLocation = 'galleryPage.php?gallery_ID=' + gallery_ID + '&current=1';
	album = window.open(fileLocation, 'album', 'directories=false, width=500, height=650, top=50, left=50, menubar=false, status=no, resizable=yes, scrollbars=false');
}

function windowOpen(name, Display) {
	fileLocation = 'staff/' + name + '.html';
	popUp = window.open(fileLocation, 'popUp', 'directories=false, height=700, width=600, top=50, left=50, menubar=false, resizable=yes, scrollbars=yes, status=true, toolbar=false');

}

function windowOpenBio(name, Display) {
	fileLocation = 'staff/' + name + 'Bio.html';
	popUp = window.open(fileLocation, 'popUp', 'directories=false, height=700, width=800, top=50, left=50, menubar=false, resizable=yes, scrollbars=yes, status=true, toolbar=false');
}

function windowOpenYafBio(name) {
	fileLocation = 'yafBios/' + name + '.html';	
	popUp = window.open(fileLocation, 'popUp', 'directories=false, height=400, width=600, top=50, left=50, menubar=false, resizable=yes, scrollbars=yes, status=true, toolbar=false');
}
function windowOpenProgramHistory(name) {
	fileLocation = 'bioPopUps/' + name + '.html';	
	popUp = window.open(fileLocation, 'popUp', 'directories=false, height=400, width=600, top=50, left=50, menubar=false, resizable=yes, scrollbars=yes, status=true, toolbar=false');
}

function buildAddress(user, text) {
	email = user + '@' + 'cmnw' + '.' + 'org';
	emailLink = 'm' + 'a' + 'i' + 'l' + 't' + 'o' + ':' + user + '@' + 'cmnw' + '.' + 'org';
	return "<a href=" + emailLink + ">" + email + "</a>";
}

function printPage(filename) {
	printableWindow = 'printable/' + filename;
	theWindow = window.open(printableWindow, 'theWindow', 'directories=false, height=700, width=600, top=50, left=50, menubar=false, resizalbe=yes, scrollbars=yes, status=true, toolbar=false');
}

function staffPreload() {
	for (x=0; x<staffPreload.arguments.length; x++) {
		myImages[x] = new Image();
		myImages[x].src = staffPreload.arguments[x];	
	}
}

function staffRollover(theImgID) {
	document.getElementById(theImgID).src = '../images/staff/headshots/' + theImgID + '_over.jpg';
}

function staffRollout(theImgID) {
	document.getElementById(theImgID).src = '../images/staff/headshots/' + theImgID + '.jpg';
}