jQuery(function($) {
    $('ul.gallery').galleria(
	{
	    clickNext : true, // helper for making the image clickable
	    insert : '#galleria_main_image', // the containing selector for our main image
	    history: false,
  
	    onImage : function(image,caption,thumb) { 
		// fade in the image & caption
		// FF/Win fades large images terribly slow
		if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) {
		    image.css('display','none').fadeIn(500);
		}

		caption.css('display','none').fadeIn(1000);
	    
		// fetch the thumbnail container
		var _li = thumb.parents('li');
	    
		// fade out inactive thumbnail
		_li.siblings().children('img.selected').fadeTo(500,1);
	    
		// fade in active thumbnail
		thumb.fadeTo('fast',.5).addClass('selected');

		// add a title for the clickable image
		image.attr('title','Next image >>');
	    },
	    onThumb : function (thumb) {
		thumb.css('display', 'none').slideDown();
		if (thumb.parent().is(':first-child'))
		    $.galleria.activate(thumb.attr('rel'));
	    }
	});
});
	
