var ExpPopup = Class.create();

ExpPopup.prototype = {
	initialize: function(element){
		this.button = element;
		Event.observe(this.button , 'click' , this.popup.bindAsEventListener(this));
	},

	popup: function(event) {
		Event.stop(event);
		var url = this.button.src.replace(/_100x100/, '');
		this.win = window.open("" , "" ,'width=600, height=400, scrollbars=no, status=no, toolbar=no, menubar=no, location=no, resizable=no');
		this.win.document.open("text/html", "replace");
		this.win.document.write('<html><head></head><body onload="fitPic();"><script type="text/javascript">var arrTemp=self.location.href.split("?"); var picUrl = (arrTemp.length>0)?arrTemp[1]:""; var NS = (navigator.appName=="Netscape")?true:false;    function fitPic() { iWidth = (NS)?window.innerWidth:document.body.clientWidth; iHeight = (NS)?window.innerHeight:document.body.clientHeight; iWidth = document.images[0].width - iWidth; iHeight = document.images[0].height - iHeight; window.resizeBy(iWidth, iHeight); self.focus(); };</script><img style="border: 0px;" onclick="javascript: self.close();" src="' + url + '" alt="Close photo" title="Close photo" /></body></html>');
		this.win.document.close();
		return false;
	}
}

Event.observe(window , 'load' , function() {
	$$('ul.pic img').each(function (e) {
		new ExpPopup(e);
	});
});
