﻿function popImage(imageURL,imageTitle){
    // Image size
    var image = new Image();
    image.src = imageURL;
    var imageWidth = image.width;
    var imageHeight = image.height;
    var imageWidthMax = 700;
    if (imageWidth > imageWidthMax)
    {
        imageHeight = (imageHeight * imageWidthMax) / imageWidth;
        imageWidth = imageWidthMax;
    }
    
    // Calculates the middle of the screen.
    var leftVal = (screen.width / 2) - (imageWidth / 2);
    var topVal = (screen.height / 2) - (imageHeight / 2);
  
    // Window attributes
    var showScrollbars = 0;
    var isResizable = 0;
    var showToolbar = 0;
    var showStatus = 0;
    var showMenuBar = 0; 
    var showDirectories = 0; 
    var showTitleBar = 0; 
    var showLocation = 0; 
    
    // Popup the image
    window.open(image.src
        ,''
        ,'scrollbars = ' + showScrollbars +
         ', height = ' + imageHeight +
         ', width = ' + imageWidth +
         ', menubar = ' + showMenuBar +
         ', location = ' + showLocation +
         ', titlebar = ' + showTitleBar +
         ', directories = ' + showDirectories +
         ', resizable = ' + isResizable +
         ', toolbar = ' + showToolbar +
         ', status = ' + showStatus +
         ', left = ' + leftVal + 
         ', top = ' + topVal);
}
