// $Id: InfoBox.js,v 1.1 2006-03-12 11:36:44 davh Exp $
function infoBox(infoName) {
	var name, title, text, closeText;
	var cssStylesheet, htmlTemplate;
	var width, height;
	var x, y;

	this.name = infoName;
	this.title = "";
	this.text = "";
	this.closeText = "Close";
	this.closeOnClick = "window.close();";
	this.width = 300;
	this.height = 200;
	this.x = null;
	this.y = null;

	this.cssStylesheet =
		"body {\n"+
			"margin: 0px 0px 0px 0px;\n"+
		"}";

	this.htmlTemplate =
		"<html>\n"+
			"<head>\n"+
				"<title>[[TITLE]]</title>\n"+
			"</head>\n"+

			"<style>\n"+
				"[[CSS_STYLESHEET]]\n"+
			"</style>\n"+

			"<body onblur=\"self.focus();\">\n"+
				"<form>\n"+
					"<table border=0 width=\"100%\" height=\"100%\">\n"+
						"<tr>\n"+
							"<td valign=\"top\">\n"+
								"[[TEXT]]\n"+
							"</td>\n"+
						"</tr>\n"+
						"<tr>\n"+
							"<td height=1 align=\"center\">\n"+
								"<input id=\"closeButton\" type=\"button\" name=\"closeButton\" value=\"[[CLOSE_TEXT]]\" onclick=\"[[CLOSE_ON_CLICK]]\">\n"+
							"</td>\n"+
						"</tr>\n"+
					"</table>\n"+
				"</form>\n"+
			"</body>\n"+
		"</html>\n";
}

infoBox.prototype.display = function() {
	var win = openWindow("",this.name,this.width,this.height,true,false);
	var displayText = this.htmlTemplate;

	displayText = displayText.replace(/\[\[TITLE\]\]/ig, this.title);
	displayText = displayText.replace(/\[\[TEXT\]\]/ig, this.text);
	displayText = displayText.replace(/\[\[CLOSE_TEXT\]\]/ig, this.closeText);
	displayText = displayText.replace(/\[\[CLOSE_ON_CLICK\]\]/ig, this.closeOnClick);
	displayText = displayText.replace(/\[\[CSS_STYLESHEET\]\]/ig, this.cssStylesheet);

	win.document.open()
	win.document.write(displayText);
	win.document.close();

	win.focus();
}

