var windowName = null;

function openWindow(URL, w, h, name, external) { 
	if (!w && !h) { //if a width and height are not specified then use these default values
		width = 400;
		height = 450;
		}
	else { //else use the values specified
		width = w;
		height = h;
		}
	if (!name) { //if a name is not specified
		windowName = "PopUpWindow";
		}
	else { //else use the name specified
		windowName = name;
		}

		windowName = window.open(URL,windowName,"width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1,top=100,left=100");
	if (!(external)){
		windowName.focus();
	}
} 

function showWindow(URL, w, h, name, external) { 
	if (windowName) { // object exists
		if (!windowName.closed) { // check and see if it has not been closed
			windowName.location.href = URL; // if not, set focus
			}
		else {
			openWindow(URL, w, h, name, external);
			}
		}
	else { // the window was closed, create it again
		openWindow(URL, w, h, name, external);
		}
	if (!(external)){
		windowName.focus();
	}
}

