﻿// JScript File

function ShowImagePopup(divID, baseurl, imgpath, winName, imgWidth, imgHeight)
{	
    ShowImage(divID, baseurl + imgpath, imgWidth, imgHeight);
    return false;
}

function ShowImage(divID, imgUrl, myWidth, myHeight) 
{
    var outerWidth = myWidth + 2;
    var outerHeight = myHeight + 20;
    //alert(myWidth + " " + myHeight);
    var myLeft = 0;
    var myTop = 0;
    //alert("outerWidth=" + outerWidth);
    //alert("outerHeight=" + outerHeight);

    if (window.screen) 
    {     
        //alert("availWidth=" + screen.availWidth);
        myLeft = (screen.availWidth - outerWidth)/2;
        //alert("left=" + myLeft);
        //alert("availHeight=" + screen.availHeight);
        myTop = (screen.availHeight - outerHeight)/2;
        //alert("top=" + myTop);
        var scrolltop = (document.body.scrollTop);
        if (scrolltop > 0)
        {
           myTop = (myTop - (myTop/3)) + document.body.scrollTop;
        }
        //alert("top=" + myTop);
    } 
    var div_ctrl = document.getElementById(divID);
	div_ctrl.innerHTML = "<table width='100%' bgcolor='#ffffff' style='border: 1px solid #000000; border-collapse:collapse;'  align='center' cellpadding='0'><tr><td><table border='0' align='center'><tr><td align='right'><a href='javascript: void(0);' onclick='javascript: document.getElementById(\"" + divID + "\").style.display=\"none\";'><img align='right' src='images/ui/icon/close.gif'  border='0' alt='Close' title='Close'></a></td></tr><tr><td><table  border='0' cellpadding='0' cellspacing='0'><tr><td align='left' valign='top' style=\"background-image: url(images/ui/loading.gif); background-repeat: no-repeat; background-position: center;\">$$IMG$$</td></tr></table></td></tr></table></td></tr></table>";  

    div_ctrl.style.position = 'absolute';
    div_ctrl.style.top = parseInt(myTop) + 'px';
    div_ctrl.style.left = parseInt(myLeft) + 'px';
    //div_ctrl.style.top = '0px';
    //div_ctrl.style.left = '0px';
    div_ctrl.style.width = outerWidth + 'px';
    div_ctrl.style.height = outerHeight + 'px';
    div_ctrl.innerHTML = div_ctrl.innerHTML.replace("$$IMG$$", "<img src='" + imgUrl + "' height='" + myHeight + "' width='" + myWidth + "'/>");
    div_ctrl.style.display = "block"; 
}