function overlayBox(url, boxTitle, overlayBgOpacity, overlayBoxHeight, overlayBoxWidth, overlayBgColor, overlayBoxStyle) {
  if(!overlayBoxStyle) {
    overlayBoxStyle = "background-color: #ffffff; padding: 7px;";
    if(!overlayBgColor) {
      overlayBgColor = "#666666";
      if(!overlayBoxWidth) {
        overlayBoxWidth = 500;
        if(!overlayBoxHeight) {
          overlayBoxHeight = 350;
          if(!overlayBgOpacity) {
            overlayBgOpacity = 7;
            if(!boxTitle) {
              boxTitle = "&nbsp;";
            }
          }
        }
      }
    }
  }

  // Containing box
  var overlayBox = document.createElement("div");
  overlayBox.setAttribute("id" ,"overlayBox");
  overlayBox.style.height = overlayBoxHeight + "px";
  overlayBox.style.width = overlayBoxWidth + "px";
  overlayBox.style.position = "absolute";
  overlayBox.style.top = "0px";
  overlayBox.style.left = "0px";
  overlayBox.style.height = "100%";
  overlayBox.style.width = "100%";
  overlayBox.style.zIndex = "9999";
  overlayBox.innerHTML = "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100%\" border=\"0\"><tr><td valign=\"middle\" align=\"center\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"height: " + (overlayBoxHeight+20) + "px; width: " + overlayBoxWidth + "px; border: 2px groove #000000;\"><tr><td align=\"left\" style=\"height: 20px; background-color: #999999;\">&nbsp;" + boxTitle + "</td><td align=\"right\" style=\"height: 20px; background-color: #999999;\"><img src=\"/resources/global.gui/buttons/close.png\" onclick=\"overlayBoxClose();\" title=\"Close Window\" /></td></tr><tr><td colspan=\"2\"><div id=\"overlayContent\" style=\"text-align: left; overflow: auto; height: " + overlayBoxHeight + "px; width: " + overlayBoxWidth + "px; " + overlayBoxStyle + "\"></div></td></tr></table></td></tr></table>";

  // Partially transparent background
  var overlayBg = document.createElement("div");
  overlayBg.setAttribute("id", "overlayBg");
  overlayBg.setAttribute("height", "100%");
  overlayBg.setAttribute("width", "100%");
  overlayBg.style.position = "absolute";
  overlayBg.style.top = "0px";
  overlayBg.style.left = "0px";
  overlayBg.style.height = "100%";
  overlayBg.style.width = "100%";
  overlayBg.style.backgroundColor = overlayBgColor;
  if(overlayBgOpacity == "10") {
    overlayBg.style.opacity = "1.0";
  } else {
    overlayBg.style.opacity = "." + overlayBgOpacity;
  }
  overlayBg.style.filter = "alpha(opacity=" + overlayBgOpacity + "0)";
  overlayBox.style.zIndex = "9998";
  overlayBg.innerHTML = "<table width=\"100%\" height=\"100%\"><tr><td>&nbsp;</td></tr></table>";

  // Apply the DIVs as a child to BODY
  document.getElementsByTagName("body")[0].appendChild(overlayBg);
  document.getElementsByTagName("body")[0].appendChild(overlayBox);
  
  ajaxGet("overlayContent", url);
}

function overlayBoxClose() {
  document.getElementsByTagName("body")[0].removeChild(document.getElementById("overlayBox"));
  document.getElementsByTagName("body")[0].removeChild(document.getElementById("overlayBg"));
}