function fullscreen(src) {
	if (!Prototype) {
		alert("fullscreen needs prototype to work!");
		return;
	}
	var img = new Image();
	img.src = src;

	/* shows a fullscreen image at the current position,
       with scroll protection */
	
	var d = new Element('DIV',{id:"fullscreenImage",
							   "class":"fullscreen"});

	d.appendChild(new Element("DIV"));
	d.appendChild(img);


	d.repos = function() {
		var vp = document.viewport;
		var img = d.lastChild;
		img.style.position = 'absolute';

		if (!this.ratio) {
			this.ratio = img.width / img.height;
		}

		var d1 = vp.getDimensions();
		var so = vp.getScrollOffsets();
		
		this.style.position = 'absolute';
		this.style.top = so[1]+'px';
		this.style.left = so[0]+'px';
		
		this.style.width = d1.width+'px';
		this.style.height = d1.height+'px';

		// resize image, keep aspect ratio
		img.style.position = 'absolute';
		img.style.left = '50px';

		img.style.width = (d1.width-100) + 'px';

		img.style.height = parseInt((d1.width-100) / this.ratio) + 'px';
		
		img.style.top = parseInt((d1.height - ((d1.width-100) / this.ratio))/2)+'px';
	}

	d.repos();

	Event.observe(d,"click",function() {
		Event.stopObserving(window,"scroll");
		Event.stopObserving(window,"resize");
		d.remove();
	});

	Event.stopObserving(window,"scroll");
	Event.stopObserving(window,"resize");

	Event.observe(window,"scroll",function() {
		d.repos();
	});

	Event.observe(window,"resize",function() {
		d.repos();
	});

	document.body.appendChild(d);


}
