var newImage
var imageURL
var imageTitle

function popImage(INimageURL,INimageTitle)
    {
    // Pre-Load Image
    imageURL = INimageURL;
    imageTitle = INimageTitle;

    newImage = new Image();
    newImage.src = imageURL;
    waitTime = setTimeout("imageCheck()", 5);
    }

function imageCheck()
    {
    
    if (newImage.complete) {

        var imageHght = newImage.height;
        var imageWdth = newImage.width;

        var optBars = "no";

        if (imageHght > screen.height - 32)
            {
            windowHght = screen.height - 32;
            optBars = "yes";
            posY = 0;
            }
        else
            {
            windowHght = imageHght;
            posY = Math.floor((screen.height - 32 - imageHght) / 2);
            }

        if (imageWdth > screen.width - 32)
            {
            windowWdth = screen.width - 32;
            optBars = "yes";
            posX = 12;
            }
        else
            {
            windowWdth = imageWdth;
            posX = Math.floor((screen.width - 16 - imageWdth) / 2);
            }

        // Set autoclose true to have the window close automatically
        // Set autoclose false to allow multiple popup windows

        var AutoClose = true;

        var optWindow = 'scrollbars='+optBars+',width='+windowWdth+',height='+windowHght+',left='+posX+',top='+posY;

        imgWin=window.open('about:blank','',optWindow);

        with (imgWin.document)
            {
            writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
            writeln('<sc'+'ript>');
            writeln('function doTitle(){document.title="'+imageTitle+'";}');
            writeln('</sc'+'ript>');
            if (!AutoClose) 
                {
                writeln('</head><body bgcolor=FFFFFF onload="doTitle();self.focus()">')
                }
            else
                {
                writeln('</head><body bgcolor=FFFFFF onload="doTitle();self.focus()" onblur="self.close()">');
                }
            writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
            close();		
            }
    
        clearTimeout(waitTime);

        }
    else
        {
        waitTime = setTimeout("imageCheck()", 5);  
        }

    }
