function DialogBox(title, content, name)
{
	this.frame = document.createElement("div");
	this.frame.id = name;
	this.frame.dialogBox = this;
	this.frame.className = "dialogFrame";
	
	this.titleBar = document.createElement("div");
	this.titleBar.className = "dialogTitleBar";

	this.title = document.createElement("div");
	this.title.className = "dialogTitle";
	this.title.appendChild(document.createTextNode(title));
	this.titleBar.appendChild(this.title);
	
	this.controlBar = document.createElement("div");
	this.controlBar.className = "dialogControlBar";
	var a = document.createElement("a");
	a.appendChild(document.createTextNode("[X]"));
	a.className = "dialogCloseButton";
	
	this.controlBar.appendChild(a);
	this.titleBar.appendChild(this.controlBar);
	
	var div = document.createElement("div")
	div.style.clear = "both";
		
	this.titleBar.appendChild(div);
	
	this.frame.appendChild(this.titleBar);
	
	this.body = document.createElement("div");
	this.body.className = "dialogBody";
	
	this.body.appendChild(content);
	
	this.frame.appendChild(this.body);
	
	this.frame.style.position = "absolute";
	this.frame.style.left = "0px";
	this.frame.style.top = "0px";
	
	var box = new BlackBox(this.frame);
	this.box = box;
	
	a.href = "#";
	a.onclick = new Function("BlackBox.Remove(BlackBox.GetBoxById('" + this.box.box.id + "')); return false;");
	
	DialogBox.prototype.boxList.push(this);
}

DialogBox.prototype.boxList = new Array();

DialogBox.prototype.SetTitle = function (title)
{	
	this.titleBar.firstChild.nodeValue = title;
	this.box.Refresh();
}

DialogBox.prototype.Show = function ()
{	
	this.box.Show();
}

DialogBox.prototype.Hide = function ()
{
	this.box.Hide();
}

DialogBox.GetDialogBoxById = function (id)
{
	for(var i = 0; i < DialogBox.prototype.boxList.length; i++)
	{
		if(DialogBox.prototype.boxList[i].frame.id == id)
			return DialogBox.prototype.boxList[i];
	}
	return null;
}

DialogBox.Remove = function (dialogBox)
{
	for(var i = 0; i < DialogBox.prototype.boxList.length; i++)
	{
		if(DialogBox.prototype.boxList[i] == dialogBox)
		{
			DialogBox.prototype.boxList.splice(i, 1);
			BlackBox.Remove(dialogBox.box);
			return true;
		}
	}
	return false;
}