// Activate rollovers & preload images.
// NOTE: images that get rollovers must have a class of roll
//			and have an associated *_o.* file to preload
/*
function prepRollovers() {
	var rollfound=0;
	if (document.getElementsByTagName) {
		// grab all the images on a page
		for (z=0;z<document.getElementsByTagName("img").length;z++) {
			thisImg = document.getElementsByTagName("img")[z];
			// check that its got the proper class
			if (thisImg.className !=null) { // safari seems to break when these two tests are combined
				if (thisImg.className.indexOf("roll") != -1) {
					rollfound++;
					// define states, preload the image and attach the event handlers
					thisImg.out = new Image(); thisImg.out.src = thisImg.src;
					thisImg.over = new Image(); thisImg.over.src = thisImg.src.toString().replace(/.gif/i,"_o.gif");
					thisImg.parentNode.onmouseover = function () {
						this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].over.src;
					};
					thisImg.parentNode.onmouseout = function () {
						this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].out.src;				
					};
				}
			}
			
		}
	}
}
*/
		function prepRollovers() {
			var rollfound=0;
			var ext, imgname, noext;
			if (document.getElementsByTagName) {
				// grab all the images on a page
				for (z=0;z<document.getElementsByTagName("img").length;z++) {
					thisImg = document.getElementsByTagName("img")[z];
					// check that its got the proper class
					if (thisImg.className !=null) { // safari seems to break when these two tests are combined
						if (thisImg.className.indexOf("roll") != -1) {
							rollfound++;
							imgname = thisImg.src.toString();					// get the image name
							noext = imgname.slice(0, imgname.length-4);			// get the image name without extension
							ext = imgname.slice(imgname.length-4);				// get the extention for this image
							
							// define states, preload the image and attach the event handlers
							thisImg.out = new Image(); thisImg.out.src = thisImg.src;
							thisImg.over = new Image(); thisImg.over.src = noext + "_o"+ext;
							thisImg.parentNode.onmouseover = function () {
								this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].over.src;
							};
							thisImg.parentNode.onmouseout = function () {
								this.getElementsByTagName("img")[0].src = this.getElementsByTagName("img")[0].out.src;				
							};
						}
					}
					
				}
			}
		}

function prepExtLinks() {
	if (document.getElementsByTagName) {
		// grab all the links in the page (content?)
		for (x=0; x<document.getElementsByTagName("A").length; x++) {
			if (document.getElementsByTagName("A")[x].className.indexOf("external") != -1) {
				document.getElementsByTagName("A")[x].target="_blank";
			}
		}
	}
}


function initPage(whichPage) {
	prepRollovers();
	prepExtLinks();
	cssjsmenu("dropdownnav");	
	if (document.getElementById) {
		if ((whichPage != "home") && (document.getElementById("pnhtreenav"))) { initTree("pnhtreenav"); }
		if (document.getElementById("filtercontent")) { initFilter(); }
	}
} 


function openWindowAt(href) {
	nw = window.open(href, 'popup', 'width=500,height=600,status=no,menubar=no,location=no,scrollbars=yes,resizable=no');
	nw.focus();
}

function openRadioWindowAt(href) {
	nw = window.open(href, 'popup', 'width=395,height=125,status=no,menubar=no,location=no,scrollbars=no,resizable=no');
	nw.focus();
}
