function initGalleries()
{
	var img = $$('.gallery img')[0];
	var as = $$('.gallery a');
	if (as.length)
	{
		var lastA = as[0];
		lastA.addClassName('current');
		as.each(function(a){
			Event.observe(a, 'click', function(e)
			{
				if (a == lastA) return Event.stop(e);
				img.src = a.href;
				a.addClassName('current');
				lastA.removeClassName('current');
				lastA = a;
				Event.stop(e);
			});
		});
	}
}

Event.observe(window, 'load', initGalleries);

