// global variables
var pic = null;
var popImg = null;
var imgCount = 0;

function winOpen() { return (popImg != null && popImg.closed != true) ? true : false; }

function ImgPopUp(picName,winWidth,winHeight) {
	// if existing pic with same name, pop it up else create new window & pop it up
	if (pic == picName && winOpen()) {
		popImg.focus();
	} else {
		// close any pop up windows now open - do not close if early IE
		if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >=4) {
			if (popImg != null && !popImg.closed) popImg.close();
		}

		pic = picName;						// build new pop up window		
		imgWinName = "popImg" + imgCount++;	// unique name for each pop-up window
		
		popImg = window.open("",imgWinName, "toolbar=no,scrollbars=no,resizable=no,width=" + winWidth + ",height=" + winHeight);
		var htmlString = "<html><head><title></title></head><body background=\"" + pic + "\"></body></html>";

		popImg.document.open();
		popImg.document.write(htmlString);
		popImg.document.close();
	}

	return false;
}