<script type="text/javascript">
  var dialogWidth = 300;
  var dialogHeight = 200;
  function showModal(dW, dH)
  {
    var dialogDiv = document.getElementById("dialogDiv");
    var transparentDiv = document.getElementById("transparentDiv");
    
    if(!dialogDiv) return;
    if(!transparentDiv) return;
    if(!dW) var dW = dialogWidth;
    if(!dH) var dH = dialogHeight;
    
    dialogDiv.style.width = dW + "px";
    dialogDiv.style.height = dH + "px";
    
    var clientWidth = parseInt(document.documentElement.clientWidth);
    var clientHeight = parseInt(document.documentElement.clientHeight);
    var scrollHeight = parseInt(document.documentElement.scrollHeight);
    var scrollWidth = parseInt(document.documentElement.scrollWidth);

    transparentDiv.style.width = Math.max(scrollWidth, clientWidth) + "px";
    transparentDiv.style.height = Math.max(scrollHeight, clientHeight) + "px";

    var left = Math.floor((clientWidth - dWh) / 2);
    var top = Math.floor((clientHeight - dH) / 2);

    dialogDiv.style.top = top + "px";
    dialogDiv.style.left = left + "px";

    dialogDiv.style.display = "block";
    transparentDiv.style.display = "block";
  }
  function closeModal()
  {
    var dialogDiv = document.getElementById("dialogDiv");
    var transparentDiv = document.getElementById("transparentDiv");
    
    if(!dialogDiv) return;
    if(!transparentDiv) return;
    
    dialogDiv.style.display = "none";
    transparentDiv.style.display = "none";
  }
</script>