/* Opens any .gif, .jpg or .png image thru /bin/phplib/popup_image.php script
** on a new window with no toolbar that is resized automatically based on the size of the 
** image
** Parameters :
**   urlImage = absolute or relative url of the image to open
**   do not refer absolute urls as http://... Relative paths should be refered to the actual php
**   script from where this function is called.
** Optional parameter :
**   Window title, default is NOAA/AOML/PhOD
*********************************************************************/
//$RCSID = '$$';
RCSID = '$$';

function openImage(urlImage) {
    
	var winTitle = arguments[1];
	var w; 	var h; var name; var pageUrl;
	
	name = "imagesautoresize";
	pageUrl = document.location.href;
	if (!winTitle){
		winTitle = "NOAA/AOML/PhOD";
	}
	w = 400;
	h = 200;
	if (pageUrl.indexOf("?") > -1){
		pageUrl = pageUrl.substring(0,pageUrl.indexOf("?"));
	}
	url = "/phod/soto/bin/phplib/popup_image.php?&pImgUrl="+urlImage+"&pPageUrl="+pageUrl+"&pSWidth="+screen.width+"&pSHeight="+screen.height+"&pTitle="+winTitle;
	
	var win = window.open(url, name, "resizable=yes,scrollbars=yes,toolbar=no,status=no,left=20,top=20,width=" + w + ",height=" + h);
	
    	if (win.opener == null) win.opener = this;
	
    	win.focus();
}
