var newWindow
function makeNewWindow(img,wid,ht,msg){
	var winWid = parseInt(wid) + 20;
	var winHt = parseInt(ht) + 100;
	var features = "\"status,height="+winHt+",width=" + winWid + ",scrollbars\"";
	if(!newWindow || newWindow.closed){
	newWindow = window.open("", "", features)
	if (!newWindow.opener) {
	newWindow.opener = window
	}
	var winContent = "<html><head><title>Pop-Up Window</title></head>";
	winContent += "<body bgcolor='#ffffcc'><div align='center'><img border = '0' src='" + img + "' width='" + wid + "' height='" + ht + "'></div>";
	if (msg != null){
	winContent += "<p align='center' style='color: #cc0033; font-family: sans-serif; font-size: 12pt'>" + msg + "</p>";
	}
	winContent += "<p><form action='' name='but'><div align='center'><input type='button' value='Close this Window' name='btnCancel' onclick='window.close();'></form></div></p></body></html>";
	newWindow.document.write(winContent);
	newWindow.document.close();
	} else {
	newWindow.focus()
	}
}

var newTextWindow;
var oldUrl;
function makeNewTextWindow(url,hgt,wid){
	if (newTextWindow && oldUrl != url){newTextWindow.close()};
	oldUrl = url;
	if (hgt > screen.availHeight){
	hgt = screen.availHeight - 50}
	if (wid > screen.availWidth){
	wid = screen.availWidth - 50}
	var parameters = "status,height=" + hgt + ",width=" + wid + ",scrollbars";
	if(!newTextWindow || newTextWindow.closed){
	newTextWindow = window.open(url,"",parameters)
	if (!newTextWindow.opener) {
	newTextWindow.opener = window
	}
	} else {
	newTextWindow.focus()
	}
}