/*
*	Javascript written by Michelle Suwandi
*         this script is not for public use
*/

//popup image in new window per image size - by Michelle Suwandi
// imgwidth and imgheight (of image) is optional - if not specified, then will try to take size from the image
// windowtitle is optional - if specified, then will create html page w/ title to display the image
//10/2/2002
function popupImage(imgurl, imgwidth, imgheight, windowtitle) {
if(imgheight == null || imgwidth == null) { //if image width or height not specified, then take size from image
    var img = new Image();
    img.src = imgurl;
    if(img.height > 1 && img.width > 1) { //in mac IE5 the image height is always 0 and width is always 1
        imgheight = img.height;
        imgwidth = img.width;
    }
}

var windowheight = imgheight + 60;
var windowwidth = imgwidth + 30;

var windowprops = "height=" + windowheight + ",width=" + windowwidth + ",screenX=30,screenY=30" +
                ",directories=no,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes,status=no";

var windowtargetname = "imgpopup";

var win;

if(windowtitle != null) { //if windowtitle specified, then display a new html page instead
    win = window.open("", windowtargetname, windowprops);
    win.document.write("<html>\n<head>\n" +
		"<LINK REL='stylesheet' HREF='style.css' TYPE='text/css'>\n" + 
		"</head>\n" + 
		"<title>" + windowtitle + "</title>\n" + 
		"<body>\n" +
		"<center>\n" +
		"<a href='javascript:window.close();'>\n" + 
		"<img src='" + imgurl + "' border='1' width='" + imgwidth + "' height='" + imgheight + "'>\n" + 
		"</a>\n" + 
		"</center>\n" +
		"</body></html>\n");
    win.document.close();
}else {
    win = window.open(imgurl, windowtargetname, windowprops);
}

win.resizeTo(windowwidth, windowheight);
win.focus();
}
