//var popbackground="lightskyblue" //specify backcolor or background image for pop window

function openWin(imgURL, title, height, width) {
	//var el = document.getElementById(obj);
	var winTitle=title;  //pop window title
	
	function detectexist(obj){
		return (typeof obj !="undefined")
	}

	function getpos(){
		leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-width/2 : detectexist(window.screenX)? screenX+innerWidth/2-width/2 : 0
		toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-height/2-200 : detectexist(window.screenY)? screenY+innerHeight/2-height/2 : 0
		if (window.opera){
			leftpos-=screenLeft;
			toppos-=screenTop;
		}
	}
	getpos();
	var winattributes='width='+width+',height='+height+',resizable=yes,left='+leftpos+',top='+toppos+',scrollbars=yes';
	//var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
	if (typeof jkpopwin=="undefined" || jkpopwin.closed) {
		imageDisp=window.open("","",winattributes);
	} else {
		getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
		jkpopwin.moveTo(leftpos, toppos)
		imageDisp.resizeTo(width, height+30)
	}
	imageDisp.document.open()
	imageDisp.document.write('<html><title>'+winTitle+'</title><body><img src="'+imgURL+'" style="margin-bottom: 0.5em"><br><a href="#" onclick="self.close();return false;">Close Window</a></body></html>')
	imageDisp.document.close()
	imageDisp.focus()
}
