//NAV FUNCTION

var on = false;
var ontitle;
var onblock;

function highlight(section) {
	title = "subnav" + section;
	block = "mainnav" + section;
	
	if (on) {
		document.getElementById(ontitle).style.backgroundPosition = "0px";
		document.getElementById(onblock).className = "";
		on = false;
	}
	else {
		document.getElementById(title).style.backgroundPosition = "-150px";
		document.getElementById(block).className = "on";
		ontitle = title;
		onblock = block;
		on = true;		
	}
	//turn the section colors back to on if not on home page
	if (currentsection != 'home') {
		document.getElementById('subnav'+currentsection).style.backgroundPosition = "-150px";
		document.getElementById('mainnav'+currentsection).className = "on";
	}
}

//IMAGE SWAP FUNCTION

function showPic (whichpic) {

	if (document.getElementById) {
	
		document.getElementById('placeholder').src = whichpic.href;
		if (whichpic.title) {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
		} else {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}
		return false;
	} else {
		return true;
	}
}

//POP UP WINDOWS

DOM = (document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
IE 	= (document.all) ? true : false;

function popWin(urlString,wparam,hparam,scrollparam) {

	parentLeft = 20;
	parentTop = 20;
	
	offsetLeft = 20;
	offsetTop = 20;
	
	w = wparam + 20;
	h = hparam + 20; 
	
	if (DOM || IE) {
	
		parentLeft  	= (window.screenLeft + offsetLeft);
		parentTop   	= (window.screenTop + offsetTop);							
	
	} else if (NS4) {
	
		parentLeft      = (window.screenX + offsetLeft);
		parentTop       = (window.screenY + offsetTop);	
	
	} 	
	
	if (scrollparam == "scroll") { 
		window.open(urlString,"_blank","height=" + h + ",width=" + w + ",scrollbars=yes"); 
	} else {
		//window.open(urlString,"new","height=" + h + ",width=" + w + ",top=" + parentTop + ",left=" + parentLeft + ""); 
		window.open(urlString,"_blank","height=" + h + ",width=" + w + ""); 
	}
} 
