function Dialog_class() {

	this.setTitle = function (title) {
		titleDiv = document.getElementById("dialogTitle");
		if (titleDiv.hasChildNodes()) {
			while (titleDiv.childNodes.length > 0) titleDiv.removeChild(titleDiv.firstChild);
		}
		titleDiv.appendChild(document.createTextNode(title));
	}

	this.setContent = function (content) {
		contentTag = document.getElementById("dialogContent");
		if (contentTag.hasChildNodes()) {
			while (contentTag.childNodes.length > 0) contentTag.removeChild(contentTag.firstChild);
		}
		var pTag = document.createElement('p');
		pTag.appendChild(document.createTextNode(content));
		contentTag.appendChild(pTag);
	}

	this.setContentHTML = function (contentHTML) {
		contentTag = document.getElementById("dialogContent");
		contentTag.innerHTML = contentHTML;
	}

	this.show = function () {
		dialogDiv = document.getElementById("dialogPlaceholder");
		dialogDiv.style.visibility = 'visible';
	}

	this.hide = function () {
		dialogDiv = document.getElementById("dialogPlaceholder");
		dialogDiv.style.visibility = 'hidden';
	}
	
	this.clearButtons = function () {
		buttonsDiv = document.getElementById("dialogButtons");
		if (buttonsDiv.hasChildNodes()) {
			while (buttonsDiv.childNodes.length > 0) buttonsDiv.removeChild(buttonsDiv.firstChild);
		}
	}
	
	this.addButton = function (text, func) {
		var hide_dialog_func = this.hide
		var linkTag = document.createElement('a');
		linkTag.className = 'Button';
		linkTag.href = '#';
		linkTag.onclick = function () {
			hide_dialog_func();
			if (func) func();
			return false;
		}
		buttonsDiv = document.getElementById("dialogButtons");
		buttonsDiv.appendChild(linkTag);
		linkTag.appendChild(document.createTextNode(text));
	}

	return this;

}

var Dialog = new Dialog_class();

