function JSWindow(title, oContent, x, y, id, width, popupColor, minimizeIcon, videoURL)
{
	
	// define variables
	this.videoURL = videoURL;
	this.title = title;
	this.oContent = oContent;
 	this.width = width;
	this.x = x;
	this.y = y;
  	this.id = id;
	this.bgcolor = popupColor;
	
	
	// create the table window and define CSS properties
	this.oTable = document.createElement("table");
  this.oTable.id = "Window " + this.id;
	this.oTable.style.width = this.width + "px";
	this.oTable.style.border = "1px solid #000000";
  this.oTable.cellSpacing = 0;
	this.oTable.cellPadding = 0;
	this.oTable.border = 0;
	this.oTable.style.backgroundColor = "#000000";

	// determine the windows position when first open
	this.oTable.style.position = "absolute";
	this.oTable.style.left = this.x + "px";
	this.oTable.style.top = this.y + "px";

	// link from the table to the JSWindow object
	this.oTable.jsWindow = this;

	
	// append to document body
	document.body.appendChild(this.oTable);

	// add a row for the titlebar
	var oTR = this.oTable.insertRow(0);

	// add a row for the window's content
	//oTR = this.oTable.insertRow(1);
	
	this.oContentTD = oTR.insertCell(0); 
	this.oContentTD.style.backgroundColor =  "#000000";
	
	
 	document.getElementById('flashVideo').src = this.videoURL;
 	
	// use the content from the referenced div as the content for the window
	this.oContentTD.innerHTML = document.all["Div" + this.id].innerHTML;
}
 




/* ---------------------------------------------------------------------- *\
  Function    : createWindows()
  Description : determines if Window already exists, else calls JSWindow
  Usage       : createWindows([windowID], [width], "title")
  Arguments   : windowID - The <div> this window will use for its content
                width    - The default width of the window
                title    - The title of the window as displayed in the titlebar
\* ---------------------------------------------------------------------- */

function createWindow(title, width, popupColor, windowID, minimizeIcon, x, y, videoURL)
{
if (document.getElementById('Window ' + windowID)) {
  }
else {
  new JSWindow("&nbsp;" + title, document.getElementById("Div" + windowID), x, y, windowID, width, popupColor, minimizeIcon, videoURL); 
  }
}

function closeWindow(windowID)
{	
	// remove from browser document
	document.getElementById('Window '+windowID).parentNode.removeChild(document.getElementById('Window '+windowID));
}
