function openDynamicImageWindow(file,w,h,typ,closeText) {
    if(typ == "dhtml") {
        if(document.all) {
            var windowWidth = self.document.body.clientWidth;
            var windowHeight = self.document.body.clientHeight;
            var scrolltop = document.body.scrollTop;
            var scrollleft = document.body.scrollLeft;
        } else {
            var windowWidth = self.innerWidth;
            var windowHeight = self.innerHeight;
            var scrolltop = document.documentElement.scrollTop;
            var scrollleft = document.documentElement.scrollLeft;
        }
        var postop =(windowHeight/2)-(h/ 2)+scrolltop+document.body.style.padding;
        var posleft =(windowWidth/2)-(w/ 2)+scrollleft+document.body.style.padding;
        if(document.all) {
            if(postop >= 20) { postop = postop-20; }
        } else {
            if(postop >= 30) { postop = postop-30; }
        }
        var bodyObj = document.getElementsByTagName('BODY')[0];
        if(!document.getElementById("dynamicImageContainer")) {
            divObjContainer = document.createElement("div");
            divObjContainer.setAttribute("id", "dynamicImageContainer");
            bodyObj.appendChild(divObjContainer);
            //bodyObj.insertBefore(divObjContainer, bodyObj.firstChild);
        } else {
            divObjContainer = document.getElementById("dynamicImageContainer");
        }
        divObjContainer.style.display = "block";
        divObjContainer.innerHTML = "<div class=\"imageContainer\" style=\"top:"+postop+"px; left:"+posleft+"px; position: absolute; display:block;\"><div class=\"imageBorder\" style=\"background-color: #fff; padding: 4px; border: solid 1px #ccc\"><img onclick=\"closeDynamicImageWindow();\" style=\"cursor:pointer;border: solid 1px #000\" src=\""+file+"\" alt=\""+closeText+"\" width=\""+w+"\" height=\""+h+"\"\/><\/div><\/div>";
    } else if(typ == "javascript") {
        // center popup
        var postop =(screen.height /2)-(h/ 2);
        var posleft =(screen.width /2)-(w/ 2);
        window.open(file+'&closeText='+encodeURI(closeText)+'', '', 'dependent=yes,width='+w+',height='+h+',left='+posleft+',top='+postop+',scrollbars=no,resizable=no,menubar=no,location=no,status=no');
    }
}
function closeDynamicImageWindow() {
    document.getElementById("dynamicImageContainer").style.display = "none";
}