//JavaScript functions for Topographic Change Mapping Web site

//Open a popup window and center it according to the user's screen and height & width.
function openWin(URL) {
	var w=650
	var h=600
	var winLeft = (screen.width - w) / 2;
	var winTop = (screen.height - h) / 2;
	windowName = "myWin";
	var windowFeatures = "width="+w+",height="+h+",status,scrollbars,resizable,"+"left="+winLeft+",top="+winTop 
	newWindow = window.open(URL, windowName, windowFeatures);
	newWindow.focus();
}

//Image rollover function
function switchImage(imgName, imgSrc) {
	if (document.images) {
		if (imgSrc != "none"){
			document.images[imgName].src = imgSrc;
		}
	}
}

//Determine how to direct a user to a particular url from a popup window
function onClickEvent(url) {
	var onclickCode = ""
	if ("myWin" == window.name) {
		onclickCode = opener.location.href=url;  window.close(); return false;
	}
	return onclickCode;
}
