/******************************************************
Simple Ajax Get Image Function

Version	: 1.0b
Author	: irc@isd.gov.hk
Date		: 13 Jul 2006

******************************************************/

	//loading
Ajax.Responders.register({
	onCreate: function() {
		if($('loading') && Ajax.activeRequestCount > 0)
			Effect.Appear('loading',{duration: 0.25, queue: 'end'});
	},
	onComplete: function() {
		if($('loading') && Ajax.activeRequestCount == 0)
			Effect.Fade('loading',{duration: 0.25, queue: 'end'});
	}
});
	
function showImage(n){

	var url = "../../gh/images/gallery" + n + ".jpg";
	var caption = Captions[n];
	
	var myAjax = new Ajax.Request(url ,{method: 'get',
		onComplete: function() {
			Effect.Fade('photo',
				{to: 0.01, queue: {position:'front', scope: 'imagescope'},
					afterFinish: function(){
						$('photo').setAttribute('src', url);
						$('photo').setAttribute('title', caption);
						Element.update($('caption'), caption);
						Effect.Appear('photo',{from: 0.01, queue: {position:'end', scope: 'imagescope'} });
					}
				}
			);
		}
	});
}

