function egZoomImage(id) {
	var self = this;
	var orig = null;
	var eventhandler = null;
	var w=0;
	var h=0;
	var bg;
	var title = '';
	
	self.eventhandler = new olEvent();
	
	self.bg = document.createElement('div');
	self.bg.id = id + '_bg';
	self.bg.style.zIndex = 99;
	self.bg.style.visibility = 'hidden';
	self.bg.style.display = 'block';
	self.bg.style.position = 'absolute';
	self.bg.style.left = '0px';
	
	self.bg.style.width = '100%'; // document.body.clientWidth+'px';
	self.bg.style.height = '100%'; // document.body.clientHeight+'px';

	if (navigator.userAgent.indexOf('MSIE') != -1)
		self.bg.style.filter = 'alpha(opacity=70)';
	else
		self.bg.style.opacity = '0.70';

	document.body.appendChild(self.bg);

	self.orig = new olPopup(id, " ");
	self.orig.el.style.overflow = 'hidden';
	
	var fi = 0.1;
	
	this.fadein = function(){
		/* Opera is too slow for this. */
		if (navigator.userAgent.indexOf('Opera') != -1)
			fi = 1;
			
		fi+=0.1;
		
		if (fi <= 1.0){
			var w = Math.round(self.w * fi);
			var h = Math.round(self.h * fi);
			$('zoomImage').setAttribute("width", w);
			$('zoomImage').setAttribute("height", h);
			try { self.orig.resize(w, h+32); } catch(e) {}
			window.setTimeout(self.fadein, 40);
		} else
			self.orig.heading.innerHTML = self.title;
	};
	this.f_scrollTop = function() {
		return self.f_filterResults (
			(typeof(window.pageYOffset)!='undefined') ? window.pageYOffset : 0,
			(typeof(document.documentElement.scrollTop)!='undefined') ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	this.f_filterResults = function (n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}

	this.show = function(imagefile, title, status){
		var ajax = olAjax();
		var maxW = Math.round(self.bg.clientWidth * 0.9);
		var maxH = Math.round(self.bg.clientHeight * 0.9);
	
		self.bg.style.top = parseInt(self.f_scrollTop()) + 'px';
		self.bg.style.visibility = 'visible';
		
		ajax.onError = function(err, msg){
			//self.show2(imagefile, err);
			alert(msg);
		};

		ajax.onComplete = function(msg){
			try { eval(msg.split("<!-"+"-").join("").split("-"+"->").join(""));
			} catch(e) { alert (e.message); }
			self.w = ImageDimensions[0];
			self.h = ImageDimensions[1];
			self._show(imagefile, title, status);
			self.orig.setStatus(imagefile);
		};

		ajax.send("imginfo.php?getImageDimensions=" + imagefile + "&w="+maxW+"&h="+maxH);
	}
	
	this._show = function(imagefile, title, status){
		var x = Math.round((self.bg.clientWidth - self.w)/2);
		var y = Math.round((self.bg.clientHeight - self.h)/2);
		var yoff = parseInt(self.f_scrollTop());
		yoff-=16;
		self.title = title;
		self.orig.setCaption(" ");
		self.orig.setStatus(status);
		self.orig.container.style.zIndex = 100;
		self.orig.container.style.display = 'block';
		self.orig.resize(self.w,self.h+32);
		self.orig.el.style.width='100%';//self.w+'px';
		
		self.orig.show('<img id="zoomImage" src="'+imagefile+'" border="0" title="'+title+'" alt="" width="'+self.w+'" height="'+self.h+'">',
			false, false, x, y+yoff);

		self.eventhandler.observe($('zoomImage'), 'click', self.orig.hide);

		
		fi = 0.1, self.fadein();
	};
	
	self.orig.hide = function(){
		self.bg.style.visibility = 'hidden';
		self.orig.container.style.display = 'none';
		self.eventhandler.remove($('zoomImage'), 'click', self.orig.hide);
		return false;
	};

	return this;
}

