function JSWindow1(title, oContent, x, y, id, width, popupColor, minimizeIcon)
{
	
	// define variables
	this.title = title;
	this.oContent = oContent;
  this.width = width;
	this.x = x;
	this.y = y;
  this.id = id;
	this.bgcolor = popupColor;
	
	
	
	
	this.divcontent = document.createElement("div");
	this.divcontent.id = "Window " + this.id;
	this.divcontent.style.width = this.width + "px";
	//this.divcontent.style.border = "1px solid #000000";
 
	this.divcontent.border = 0;
	//this.divcontent.style.backgroundColor = "#FFFFFF";
	
	// determine the windows position when first open
	this.divcontent.style.position = "absolute";
	this.divcontent.style.left = this.x + "px";
	this.divcontent.style.top = this.y + "px";
	this.divcontent.JSWindow1 = this;
	document.body.appendChild(this.divcontent);
	
	// use the content from the referenced div as the content for the window
	this.divcontent.innerHTML = document.getElementById("Div" + this.id).innerHTML;
	
	
}

JSWindow1.prototype.onBringToFront = function()
{
	this.JSWindow1.bringToFront();
}

JSWindow1.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.divcontent )
	{
		// move to bottom of document
		document.body.appendChild(this.divcontent);
	}
}



JSWindow1.prototype.close = function()
{	
	// remove from browser document
	this.divcontent.parentNode.removeChild(this.divcontent);
}

JSWindow1.prototype.onClose = function()
{
	this.JSWindow1.close();
}



/* ---------------------------------------------------------------------- *\
  Function    : hideDiv1()
  Description : Hides all Divs on the page.
  Usage       : hideDiv1([divNumber])
  Arguments   : divNumber - The number of Divs in the page that must be hidden
\* ---------------------------------------------------------------------- */

function hideDiv1(divNumber) {
	for (var count = 1; count <= divNumber;) {
		
	if(document.getElementById('Div' + count))
	{
		
    document.getElementById('Div' + count).style.display = 'none';
	}
		count++;
	}
}



/* ---------------------------------------------------------------------- *\
  Function    : createWindows()
  Description : determines if Window already exists, else calls JSWindow1
  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 createWindow1(title, width, popupColor, windowID, minimizeIcon, x, y)
{
if (document.getElementById('Window ' + windowID)) {

	
  }
else {
	
  new JSWindow1("&nbsp;" + title, document.getElementById("Div" + windowID), x, y, windowID, width, popupColor, minimizeIcon); 
  }
}


	
		function findPosX(obj)
{
	 
	
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}


function findPosY(obj)
{
	 
	 
   
	var curtop = 0; 
  
	if (obj.offsetParent)
	{
		  

		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
 
	else if (obj.y)
		curtop += obj.y;
		 
 
	return curtop;
 
}

function closeWindow(id)
{
	var openPopup = document.getElementById('Window '+id); 
    openPopup.parentNode.removeChild(openPopup); 
 
  
}