function createPopup() {
    var popup = document.getElementById("popup");
    popup.className = "popup";

    // Display the title of the popup as window title.
    var h3Node = document.createElement("h3");
    h3Node.className = "title";
    h3Node.appendChild(document.createTextNode(popup.title));
    popup.insertBefore(h3Node, popup.firstChild);

    // Create a link element as close button.
    var closeNode = document.createElement("a");
    closeNode.href = "javascript:void 0";
    closeNode.title="Fenster schließen";
    closeNode.onclick = function() {
	hidePopup(popup);
	return false;
    }
    h3Node.appendChild(closeNode);

    // Create the image for the close button.
    var closeImg = new Image(16, 14);
    closeImg.className = "closeButton";
    closeImg.src = "/buttons/close.gif";
    closeNode.appendChild(closeImg);
}

function hidePopup(popup) {
    popup.style.visibility = "hidden";
}

// Add createPopup to the list of methods called after page load is completed
if (window.addEventListener) {
    window.addEventListener("load", createPopup, false);
} else if (window.attachEvent) {
    window.attachEvent("onload", createPopup);
}

