function attachPopup(){
	popups = $$('img.popup');
	for(i=0; i < popups.length, popup = popups[i]; i++){
		popup = $(popup);
		popup.observe('click',function(){
			openLargeImage(this.src);
		});
	}
}
function openLargeImage(url){
	openCenteredPopup(url,"view");
}
function openCenteredPopup(url, name, width, height){
	if(!width) var width = 640;
	if(!height) var height = 480;
	
	if(screen.width < width) width = screen.width - 50;
	if(screen.height < height) height = screen.height - 50;
	
	var left = (screen.width-width)/2;
	var top = (screen.height-height)/2 - 50;
	var features='toolbar=no,resizable=yes,scrollbars=yes';

	if(left < 0) left = 0;
	if(top < 0) top = 0;

	var settings = 'height=' + height + ',';
	settings += 'width=' + width + ',';
	settings += 'top=' + top + ',';
	settings += 'left=' + left + ',';
	settings += features;

	win = window.open(url,name,settings);
	win.focus();
}