function popupwin(thehref, win, xwidth, yheight, attrib )
	{
	//figure out the center position
	var scrW = screen.availWidth;
	var scrH = screen.availHeight;
	if (xwidth > scrW)
		{
		pW = scrW - 10;
		}
	else
		{
		pW = xwidth;
		}
	if (yheight > scrH)
		{
		pH = scrH - 40;
		}
	else
		{
		pH = yheight;
		}
	scrX = (scrW - pW - 10) * .5;
	scrY = (scrH - pH - 30) * .5; 
	
	var windowatts = "width=" + xwidth + ",height=" + yheight + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
  windowatts += "," + attrib;
	window.open( thehref, win, windowatts);
	return false;
	}
	
// POPUP Classed links
document.observe("dom:loaded", function()
	{
	$$("a.popup").each(function(link)
		{
		link.observe('click', function(e) 
			{															 
			var address = this.href;
			popupwin(address, '', 900, 700, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			Event.stop(e);
			return false;
			});
		});
  
	});
	