var popupWindow, popupWindow2;

function window_opener(w,h,page){

	//ah = available screen height, aw = available screen width
	var ah = screen.availHeight
	var aw = screen.availWidth
	//ph - where the window horizontal top will be positioned to
	//pw - where the window left edge will be positioned to
	var ph = ah/2-(h/2)
	var pw = aw/2-(w/2)
	
	if (popupWindow && !popupWindow.closed) {
		popupWindow.close();
	}
	
	popupWindow = window.open(page,'openedpage','width='+w+',height='+h+',status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,left='+pw+',top='+ph);
	popupWindow.focus();
}

function window_opener2(w,h,page){

	//ah = available screen height, aw = available screen width
	var ah = screen.availHeight
	var aw = screen.availWidth
	//ph - where the window horizontal top will be positioned to
	//pw - where the window left edge will be positioned to
	var ph = ah/2-(h/2)
	var pw = aw/2-(w/2)
	
	if (popupWindow2 && !popupWindow2.closed) {
		popupWindow2.close();
	}
	
	popupWindow2 = window.open(page,'openedpage2','width='+w+',height='+h+',status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,left='+pw+',top='+ph);
	popupWindow2.focus();
}

function window_opener_s(w,h,page){

	//ah = available screen height, aw = available screen width
	var ah = screen.availHeight
	var aw = screen.availWidth
	//ph - where the window horizontal top will be positioned to
	//pw - where the window left edge will be positioned to
	var ph = ah/2-(h/2)
	var pw = aw/2-(w/2)
	
	if (popupWindow && !popupWindow.closed) {
		popupWindow.close();
	}
	
	popupWindow = window.open(page,'openedpage','width='+w+',height='+h+',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,left='+pw+',top='+ph);
	popupWindow.focus();
}

/* Opens up a window with resizable and status bar properties. */
function window_opener_s_r(w,h,page){

	//ah = available screen height, aw = available screen width
	var ah = screen.availHeight
	var aw = screen.availWidth
	//ph - where the window horizontal top will be positioned to
	//pw - where the window left edge will be positioned to
	var ph = ah/2-(h/2)
	var pw = aw/2-(w/2)
	
	if (popupWindow && !popupWindow.closed) {
		popupWindow.close();
	}
	
	popupWindow = window.open(page,'openedpage','width='+w+',height='+h+',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,left='+pw+',top='+ph);
	popupWindow.focus();
}
