var __modalDhtmlWindow;
function ModalDhtmlWindow(pathToImgDir)
{
	if (!pathToImgDir) {pathToImgDir = "/Data/SiteImages/";}
	if (pathToImgDir.substr(pathToImgDir.length-1, 1) != "/") {pathToImgDir += "/";}
		
	//* private methods
	this._instance;
	this._setup = function()
	{
		__modalDhtmlWindow = this;
		this.Element = document.createElement("DIV")
		this.Element.id = "ModalDhtmlWindow";
		this.Element.className = "ModalDhtmlWindow";
		this.Element.innerHTML = "<div onclick='__modalDhtmlWindow.Hide();'>&nbsp;</div>";
		with (this.Element.style)
		{
			position = "absolute";
			top = "0px";
			left = "0px";
			width = "200px";
			height = "200px";
			display = "none";
			backgroundImage = "url(" + pathToImgDir + "ModalDhtmlWindowBg.gif)";
			zIndex = "1001";
		}
		document.body.appendChild(this.Element);
		this._onResize();
		
		__addEventHandler("onresize", this._onResize);

	}
	this.ChildElement = null;
	this._onResize = function() 
	{
    var scrollX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
    var scrollY = window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop;

		with (__modalDhtmlWindow.Element.style)
		{
			width = _b.GetWidth() + 20 + "px";
			height = _b.GetHeight() + 20 + "px";
			top = scrollY;
			left = scrollX;
		}

		if (__modalDhtmlWindow.ChildElement) 
		{
			with (__modalDhtmlWindow.ChildElement)
			{
				style.left = (_b.GetWidth() - offsetWidth) / 2 + scrollX;
				style.top = (_b.GetHeight() - offsetHeight) / 2 + scrollY;
			}
		}
	}
	//* end of private methods

	this._setup();

	this.Show = function(elem)
	{
		document.body.parentNode.style.overflow = "hidden";
		if (typeof(elem) == "object")
		{
			this.ChildElement = elem;
		}
		else
		{
			this.ChildElement = document.getElementById(elem);
		}
		if (this.ChildElement)
		{
			with (this.ChildElement.style)
			{
				position = "absolute";
				visibility = "visible";
				display = "block";
				zIndex = this.Element.style.zIndex + 1;
			}
		}
		this._onResize();
		__modalDhtmlWindow.Element.style.display = "block";
	}
	this.Hide = function()
	{
		__modalDhtmlWindow.Element.style.display = "none";
		__modalDhtmlWindow.ChildElement.style.display = "none";
		document.body.parentNode.style.overflow = "auto";
	}
}
