
function loadPopups(element){
	var _gallerywindow = new Object();
	$$("#"+element+" a").each(function(e){
		e.onclick = function(){
			var _img = e.getFirst();
			var matchs = _img.src.match(/^.+\/([^\/]+)-th.jpg$/, "_");
			var _name = matchs[1];
			var _largeimgsrc = _img.src.replace(/-th/, "");
			var opengallery = function(){
				try{
					var _screenx = window.screenX;
					if(! _screenx)
					_screenx = window.screenLeft;
					var _screeny = window.screenY;
					if(! _screeny)
					_screeny = window.screenTop;
					var _width = 595
					var _height = 595
					var _left = (_screenx + (window.document.body.clientWidth / 2) - (_width / 2))
					var _top = (_screeny + (window.document.body.clientHeight / 2) - (_height ) + 20)
					//var _left = (_screenx)
					_gallerywindow = openWin('',{windowname: _name, width:_width, height:_height, top:_top, left:_left })
					_gallerywindow.onunload = _gallerywindow.onclose = function(){
						_gallerywindow = new Object();
					}
				}
				catch(err){
					alert(err);
				}
			}
			try{
				if(! _gallerywindow.document) // fails on ie
				opengallery();
			}
			catch(err){
				opengallery();
			}
			_gallerywindow.focus();
			_gallerywindow.document.write('<body style="background:#000;padding:0px;margin:0px"><img style="display:bock;margin:auto;" id="'+_name+'" src="'+_largeimgsrc+'" alt="'+_name+'" /></body>');
			_gallerywindow.document.close();
			_newimg = _gallerywindow.document.getElementById(_name)
			_newimg.onload = function(){
				//resize
			}
			return false; // cancel the href

		}
	});
}