var popup;
var largerWin;
var scrnwidth=screen.width;
var scrnheight=screen.height;

// "only 1 open at a time" popup function //
function PopUp(url,width,height,addloptions){
	var xspot=Math.round((scrnwidth/2)-(width/2));
	var yspot=Math.round((scrnheight/2)-(height/2));
	features = addloptions+"height="+height+",width="+width+",top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot;
	if (!popup || popup.closed){
		popup = window.open(url, '', features);
	}
	else {
		window.popup.close();
		popup = window.open(url, '', features);
	}
}

//	Function to View Larger Image.
//	Opens window which contains ONLY a 480 x 500 image
function openLarger(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(480/2));
	var yspot=Math.round((scrnheight/2)-(500/2));
	if (!largerWin || largerWin.closed) {
		largerWin = window.open("","","width=480,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin.close();
		largerWin = window.open("","","width=480,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" width="480" height="500" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin.document.open();
	largerWin.document.write(drawstr);
	largerWin.document.close();
}

function closepopups(){
	if (popup && popup.open){
		window.popup.close();
	}
	if (largerWin && largerWin.open){
		window.largerWin.close();
	}
}

