function swx_Dialog(dialogName, returnHandler, dialogButtons, defaultButton, dialogContent) {
	this.hide = function(button) {
		if (!(horizonNode.style.visibility == "hidden")) {
			horizonNode.style.visibility = "hidden";
			horizonNode.parentNode.removeChild(horizonNode);
		}

		if (document.getElementsByTagName) {
			pluginnodes = document.getElementsByTagName("OBJECT");
			for (index = 0; index < pluginnodes.length; index++)
				pluginnodes[index].style.visibility = "visible";
			pluginnodes = document.getElementsByTagName("EMBED");
			for (index = 0; index < pluginnodes.length; index++)
				pluginnodes[index].style.visibility = "visible";

		}
	}

	this.setContent = function(content) {
		//alert("setContent");
		dialogContent = content;
	}

	this.show = function() {
		// NOTE: The div-node has to be set to visible before its dimensions
		//       are requested, otherwise they won't be correct.
		// NOTE: Hide nodes of embedded pugins, since they almost always
		//       ignore that the dialog is the top-layer.
		if (document.getElementsByTagName) {
			pluginnodes = document.getElementsByTagName("OBJECT");
			for (index = 0; index < pluginnodes.length; index++)
				pluginnodes[index].style.visibility = "hidden";
			pluginnodes = document.getElementsByTagName("EMBED");
			for (index = 0; index < pluginnodes.length; index++)
				pluginnodes[index].style.visibility = "hidden";
		}

		if (!(horizonNode.style.visibility == "visible")) {
			document.body.appendChild(horizonNode);
			horizonNode.style.visibility = "visible";
		}

		dialogNode.style.height = "auto";
		dialogNode.style.width = "auto";
		dialogNode.style.margin = "";
		dialogNode.style.visibility = "visible";
		dialogNode.style.position = "absolute";

		dialogNode.firstChild.innerHTML = dialogContent;
		for (idx = 0; idx < dialogButtons.length; idx++) {
			if (dialogButtons[idx] != defaultButton)
				dialogNode.firstChild.innerHTML += "<button type=\"button\" onclick=\""+returnHandler+"(\'"+dialogButtons[idx]+"\')\">"+dialogButtons[idx]+"</button>";
			else
				dialogNode.firstChild.innerHTML += "<button type=\"submit\">"+dialogButtons[idx]+"</button>";
		}

		if (window.getComputedStyle) {
			dialogheight = window.getComputedStyle(dialogNode, "").getPropertyValue("height");
			dialogwidth = window.getComputedStyle(dialogNode, "").getPropertyValue("width");
			//alert("getComputedStyle: "+dialogwidth+", "+dialogheight); // DEBUG
		}
		else if (dialogNode.offsetHeight) {
			dialogheight = dialogNode.offsetHeight;
			dialogwidth = dialogNode.offsetWidth;
			//alert("offsetHeight/Width: "+dialogwidth+", "+dialogheight); // DEBUG
		}
		else if (dialogNode.currentStyle) {
			dialogheight = dialogNode.currentStyle.height;
			dialogwidth = dialogNode.currentStyle.width;
			//alert("currentStyle: "+dialogwidth+", "+dialogheight); // DEBUG
		}
		else {
			dialogheight = dialogNode.style.height;
			dialogwidth = dialogNode.style.width;
			//alert("style: "+dialogwidth+", "+dialogheight); // DEBUG
		}
		dialogheight = parseFloat(dialogheight);
		dialogwidth = parseFloat(dialogwidth);
		//alert("final: "+dialogwidth+", "+dialogheight); // DEBUG

		dialogNode.style.height = dialogheight+"px";
		dialogNode.style.width = dialogwidth+"px";
		dialogNode.style.position = "relative";
		dialogNode.style.margin = "-"+(dialogheight/2)+"px auto";
	}

	var horizonNode = document.createElement("DIV");
	//horizonNode.style.backgroundColor = "#FF00FF"; // DEBUG
	horizonNode.style.left = "0px";
	horizonNode.style.height = "0px";
	horizonNode.style.position = "fixed";
	horizonNode.style.top = "49%";
	horizonNode.style.width = "100%";
	horizonNode.style.visibility = "hidden";

	var dialogNode = document.createElement("FORM");
	dialogNode.setAttribute("action", "javascript:"+returnHandler+"('"+defaultButton+"')");
	dialogNode.setAttribute("class", "sfx_Dialog");
	dialogNode.setAttribute("enctype", "multipart/form-data");
	dialogNode.setAttribute("id", dialogName);
	dialogNode.setAttribute("method", "post");
	dialogNode.innerHTML = "<div class=\"DialogContent\" style=\"margin:10px;\"></div>";

	horizonNode.appendChild(dialogNode);
}
