function openFeatureImage(image,caption,title) {
	var newWin = "newWin";
	var winTitle = "Bird-in-Hand";
	if(title) {var newWin = title.replace(/\s/g, "");
			   winTitle = title;}
	
	var winCap = "";
	if(caption) {var winCap = caption;}
	
	var code = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><title>" + winTitle + "</title><script language='JavaScript' src='/scripts/pop.js'></script><style>body{background-color: #f5edd6;}#popimage{display:block;background-color:#fff;border:1px solid #a9a9a9;			padding:5px;margin:0; text-align:center;}#caption{font-family: Verdana, Arial, Helvetica, sans-serif;font-size:75%;color:#383838;line-height:160%;}</style></head><body onLoad='popResize(); window.focus()'><img src='" + image + "' id='popimage'><div id='caption'>" + winCap + "</div></body></html>"
	
	var featureWindow = window.open("",newWin,"width=200,height=200,resizable=yes,scrollbars=yes");

	featureWindow.document.open();
	featureWindow.document.write(code);
	featureWindow.document.close();
}

function popResize(xh,xw) {
	var hpad = 150;
	if (document.getElementById("caption") != null) {
		if (document.getElementById("caption").innerHTML == "") hpad = 110;
	}
	if(xh) {hpad = hpad + xh;}
	var wpad = 50;
	if(xw) {hpad = wpad + xw;}
	var featureImg = document.getElementById("popimage");
	var height = featureImg.height + hpad;
	var width = featureImg.width + wpad;
	if (height > screen.availHeight) {height=screen.availHeight;}
	if (width > screen.availWidth) {width=screen.availWidth;}
	window.resizeTo(width, height);
}

function getArgs() {
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&")
	for (var i=0; i<pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args
}

function loadPop() {
	args = getArgs();
	document.getElementById("popimage").src = args.img;
	if(args.caption) {
		document.getElementById("caption").innerHTML = args.caption;
	}
	popResize();
}

function launchPopUp(linkObject) {
	// This closes a pop-up window by the same name if it is already open.
	var winName = linkObject.href;
	if (linkObject.name) {
		winName = linkObject.name;
		if (eval("window." + winName) != null) {
			eval("window." + winName + ".close()");
		}
	}
	
	var h = 400;
	if (linkObject.getAttribute("h")) {h = linkObject.getAttribute("h")}
	
	var w = 400;
	if (linkObject.getAttribute("w")) {w = linkObject.getAttribute("w")}
	
	var r = "yes";
	if (linkObject.getAttribute("r")) {r = linkObject.getAttribute("r")}
	
	var s = "yes";
	if (linkObject.getAttribute("s")) {s = linkObject.getAttribute("s")}
	
	var newWin = window.open(linkObject.href,"","width=" + w + ",height=" + h + ",resizable=" + r + ",scrollbars=" + s);

	newWin.focus();
	
	return newWin;

}