function initGallery(){
	$$('.entry').each(function(item){ Event.observe(item, 'click', loadImage); })
}


function loadImage( event ){	
 	 var firstEntry = $$('#header-slideshow li.entry:first');
	firstEntry.each(function(item){
		if($(item).hasClassName('active') && item != this){ $(item).removeClassName('active'); }
	})

	this.addClassName('active');

	/* AJAX Url & Content */ 
	var ajaxlink  = this.select('a');
	var url = $( ajaxlink[0] ).readAttribute( 'href' );
	var id = url.split('=');
	var ajaxContent = $(id[id.length-1]);
	
	/* Loading */
	var loading  = $$('.loading');
	var pos = $(this).cumulativeOffset();
	
	var boxPos = $('header-slideshow').cumulativeOffset();
	pos[0] = pos[0]-(boxPos[0] - ($(this).getWidth()/2 - $(loading[0]).getWidth()/2));
	pos[1] = pos[1]-(boxPos[1] - ($(this).getHeight()/2 - $(loading[0]).getHeight()/2));
	
	$(loading[0]).setStyle({ top: pos[1]+"px", left: pos[0]+"px", display: 'block' });
	
	new Ajax.Request( url, {
		method: 'get',
		onSuccess: function( transport ) {
			new Effect.Opacity( ajaxContent, { duration:0.3, from:1.0, to:0, afterFinish:function(){
				ajaxContent.update( transport.responseText );
				new Effect.Opacity(ajaxContent, { duration:0.4, from:0, to:1.0, afterFinish: function(){
					$(loading[0]).setStyle({ display: 'none' });
				}});
			}});
		}
	});
	
	Event.stop( event );
}
