var newwin = "";
var doc = "";
function popup(pic, width, height, alt)
{   
	if(!document.getElementById) return true;
	
	 
	if(!newwin.closed && newwin.location) 
	{	
		newwin.resizeTo(width, height);
		newwin.focus();
		var thepic = doc.getElementById("poppic");
		thepic.setAttribute("src", "http://www.dio5.com/ber/pics/"+pic);
		thepic.onclick = function(){newwin.close()};
	}
	else
	{
		newwin = window.open("","Picture","width="+width+", height="+height);
		newwin.focus();
		doc = newwin.document;
		doc.title = alt;
		doc.body.style.margin = "0";
		doc.body.style.padding = "0";
		if(doc.getElementById("poppic"))
		{
				var img = doc.getElementById("poppic");
				img.setAttribute("src", "http://www.dio5.com/ber/pics/"+pic);
				img.onclick = function(){newwin.close()};
				newwin.resizeTo(width, height);
		}
		else
		{
		var img = doc.createElement("img");
		img.setAttribute("src", "http://www.dio5.com/ber/pics/"+pic);			
		img.setAttribute("alt", pic);
		img.setAttribute("id", "poppic");
		img.style.cursor = "pointer";
		img.onclick = function(){newwin.close()};
		doc.body.appendChild(img);
		}
	}
}