<!--

function JSWindow(evt, title, bordercolor, titlebkgcolor, titlefontcolor, oContent, align, x, y, id, width, height, popupColor, contentstring)
{
	this.title = title;
	this.oContent = oContent;
	this.width = width;
	this.id = id;
	this.bgcolor = popupColor;
	this.oTable = document.createElement("table");
	this.oTable.id = "Window " + this.id;
	this.oTable.style.border = "1px solid " + bordercolor;
	this.oTable.cellSpacing = 0;
	this.oTable.cellPadding = 0;
	this.oTable.border = 0;
	this.oTable.style.backgroundColor =popupColor;
	this.oTable.style.position = "absolute";
	this.oTable.style.zIndex  = "100";
	
	//Positioning code
	var evt = (evt) ? evt : ((window.event) ? event : null);
	var xPos = evt.clientX;
	var yPos = evt.clientY;
	var bwindow_width = f_clientWidth();
	var bwindow_height = f_clientHeight();
	var scroll_top = f_scrollTop();	
	
	if (align == '' || align =='center') {
	this.oTable.style.left = ((bwindow_width - width)/2 + x)+'px';
    this.oTable.style.top  = ((bwindow_height + scroll_top -height)/2 + y)+'px';	
	}
	if (align == 'xcenter') {
	this.oTable.style.left = ((bwindow_width - width)/2 + x)+'px';
    this.oTable.style.top  = (y + scroll_top)+'px';	
	}
	if (align == 'ycenter') {
	this.oTable.style.left = (x)+'px';
    this.oTable.style.top  = ((bwindow_height + scroll_top -height)/2 + y)+'px';	
	}
	if (align == 'absolute') {
	this.oTable.style.left = (x)+'px';
    this.oTable.style.top  = (y + scroll_top)+'px';	
	}
	if (align == 'mouse') {
	this.oTable.style.left = (xPos + x) + 'px';
    this.oTable.style.top = (yPos + scroll_top + y) + 'px';
	}
	//Acount for Smaller Browser window than jsWindow
	if ((bwindow_width - width) < 0){
		this.oTable.style.left = xPos + 'px';
	}
	if ((bwindow_height-height) < 0) {
		this.oTable.style.top = (yPos + scroll_top) + 'px';
	}
	
	
	// link from the table to the JSWindow object
	this.oTable.jsWindow = this;

	// if the table is clicked anywhere, show the table in front of other open windows
	this.oTable.onmousedown = JSWindow.prototype.onBringToFront;

	// append to document body
	document.body.appendChild(this.oTable);
	
	// add a row for the titlebar
	var oTR = this.oTable.insertRow(0);
	
	// Title: add the title to the titlebar	
	oTD = oTR.insertCell(0);
	oTD.innerHTML = title;
	oTD.style.color = titlefontcolor;
	oTD.style.fontSize = "11px";
	oTD.style.cursor = "default";
	oTD.jsWindow = this;
	oTD.onmousedown = JSWindow.prototype.tdOnMouseDown;
	oTD.onselectstart = JSWindow.prototype.tdOnSelectStart;
	oTD.style.backgroundColor = titlebkgcolor;
	
	// Close: add the close button to the titlebar
	oTD = oTR.insertCell(1); 
	oTD.jsWindow = this;
	oTD.onmousedown = JSWindow.prototype.onClose;
	oTD.style.background = titlebkgcolor + " url(" + imageURL + "close-win.gif) no-repeat top right";
	oTD.width = "15px";
	oTD.height= "16px";
	oTD.align = "right";
	
	//add 1pxl row (border on bottom of title bar)
	oTR = this.oTable.insertRow(1);	
	oTD = oTR.insertCell(0);
	oTD.colSpan = 2;
	oTD.height= "1px";
	oTD.style.backgroundColor = bordercolor;
	
	// add a row for the window's content
	oTR = this.oTable.insertRow(2);	
	this.oContentTD = oTR.insertCell(0);
	this.oContentTD.colSpan = 2;
	this.oContentTD.style.backgroundColor = this.bgcolor;
	//this.oContentTD.innerHTML = document.all[this.id].innerHTML;
	this.oContentTD.innerHTML = contentstring;
}

JSWindow.prototype.onBringToFront = function()
{
	this.jsWindow.bringToFront();
}

JSWindow.prototype.bringToFront = function()
{
	// if not already the last child of the document.body, make it so
	//if ( document.body.childNodes[document.body.childNodes.length-1] !== this.oTable )
	//{
		// move to bottom of document
		//alert("document.body.childNodes.length : " + document.body.childNodes.length);
	//	document.body.appendChild(this.oTable);
	//}
}

JSWindow.prototype.tdOnSelectStart = function()
{
	return false;
}

JSWindow.prototype.tdOnMouseDown = function()
{
	this.jsWindow.onMouseDown();
}

JSWindow.prototype.onMouseDown = function()
{
	// record that an onmousedown has just occurred
	this.bDown = true;
	
	// link from body to this JSWindow object
	document.body.jsWindow = this;

	// save body mouse handlers
	this.saveMouseMove = document.body.onmousemove;
	this.saveMouseUp = document.body.onmouseup;

	// set new handlers.
	document.body.onmousemove = JSWindow.prototype.bodyOnMouseMove;
	document.body.onmouseup = JSWindow.prototype.bodyOnMouseUp;
}

JSWindow.prototype.bodyOnMouseMove = function(evt)
{
	var e = window.event ? window.event : evt;
	this.jsWindow.onMouseMove(e);
}

JSWindow.prototype.onMouseMove = function(evt)
{
	// if mouse not down, stop the move (for IE only)
	if ( (document.all) && !(evt.button & 1) )
	{
		this.onMouseUp();
		return;
	}
	if ( this.bDown )
	{
		this.dx = parseInt(this.oTable.style.left, 10) - evt.clientX;
		this.dy = parseInt(this.oTable.style.top, 10) - evt.clientY;
		this.bDown = false;
	}
	else
	{
		this.oTable.style.left = Math.max((this.dx + evt.clientX),0) + "px";
		this.oTable.style.top = Math.max((this.dy + evt.clientY),0) + "px";
	}
}

JSWindow.prototype.bodyOnMouseUp = function()
{
	this.jsWindow.onMouseUp();
}

JSWindow.prototype.onMouseUp = function()
{
	document.body.onmouseup = this.saveMouseUp;
	document.body.onmousemove = this.saveMouseMove;
	document.body.jsWindow = null;
}

JSWindow.prototype.close = function()
{	
	// remove from browser document
	this.oTable.parentNode.removeChild(this.oTable);
}

JSWindow.prototype.onClose = function()
{
	this.jsWindow.close();
}


function createWindow(evt, title, bordercolor, titlebkgcolor, titlefontcolor, popupColor, width, height,  windowID, align, x, y, contentstring)
{
	if (document.getElementById('Window ' + windowID)) {
		//do nothing
	}
	else {
		new JSWindow(evt, "&nbsp;" + title, bordercolor, titlebkgcolor, titlefontcolor, document.getElementById(windowID), align, x, y, windowID, width, height, popupColor, contentstring); 
	}
}
-->