// global variable
var newPopup;

function window_onunload() {
	if (newPopup && !newPopup.closed) {		// determine if popup is open
		newPopup.close();	// close popup if window is closed or another page is accessed
	}
}

function makePopup() {

	if (newPopup && !newPopup.closed) {
		newPopup.close();	// close popup if already open
	}

	var widthScreen = screen.availWidth;
	var heightScreen = screen.availHeight;
	var widthPopUp = 500;
	var heightPopUp = 480;

	var left = parseInt(widthScreen - widthPopUp) / 2;
	var top = parseInt(heightScreen - heightPopUp) / 2;

	var popupAttributes = "width=" + widthPopUp + ",height=" + heightPopUp;
	popupAttributes += ",location=no,menubar=no,status=no,toolbar=no,";
	popupAttributes += "directories=no,copyHistory=no,scrollbars=no,";
	popupAttributes += "resizable=no,left=" + left + ",top=";
	popupAttributes += top + ",screenX=" + left + ",screenY=" + top;
	
	newPopup = window.open("", "Popup", popupAttributes);	// open new window
	newPopup.focus();

	// create XHTML content for new popup
	var popupContent = "<html><head><title>KVHH Coverage Area</title>";
	popupContent += "</head><body bgcolor=\"#faf7dd\">";
	popupContent += "<img src=\"../_images/site/coverage_area.gif\" width=\"500\" height=\"480\" />"; 
	popupContent += "</body></html>";

	newPopup.document.write(popupContent);	// write XHTML to new popup
}