

function MM_openBrWindow(theURL) { //v2.0
  var height = getDocHeight();
  var newDiv = document.createElement("div");
  newDiv.setAttribute('style','height:' + height + 'px;');
  newDiv.setAttribute('id','modal');
  newDiv.innerHTML = '<table style="z-index: 999; width:100%;height:100%"><tr><td style="text-align:center;vertical-align:middle"><div><a onclick="closer(event);" style="color:#fff;"><img style="display:inline;margin-bottom:-7px;" src="/cms/upload/layout/close.png" />&nbsp;close</a><br /><br /><img style="border:5px solid #ccc;display:inline;" src="/cms/upload/' + theURL + '" /></div></tr></td></table>';
  document.body.appendChild(newDiv);
  return false;
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function closer(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;

var oP = document.getElementById("modal");
if(oP)
    document.body.removeChild(oP);
}

window.onkeydown = function(e) { 
closer(e);
 };
