window.onload = jQuery(function($)
{
	$('.gallery_demo_unstyled').addClass('gallery_demo'); // adds new class name to maintain degradability
	
	if($('.gallery_demo_unstyled').hasClass('gallery_demo'))
	{
		
	

	$('.gallery_demo').galleria({
		history   : false, // deactivates the history object for bookmarking, back-button etc.
		clickNext : false, // helper for making the image clickable. Let's not have that in this example.
		insert    : '.imgshow', // the containing selector for our main image.
		 insertCaption  : '.galleria_caption',
		// If not found or undefined (like here), galleria will create a container
		// before the ul with the class .galleria_container (see CSS)
		onImage   : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
	});

	$(".gallery_demo_unstyled li").css("display", "block");
	$(".gallery_demo_unstyled li").css("visibility", "visible");

	}

		// add the Galleria class
		$(this).addClass('galleria');
		
		// loop through list
		$(this).children('li').each(function(i) {
			
			// bring the scope
			var _container = $(this);
			                
			// build element specific options
			var _o = $.meta ? $.extend({}, $opts, _container.data()) : $opts;
			
			// remove the clickNext if image is only child
			_o.clickNext = $(this).is(':only-child') ? false : _o.clickNext;
			
			// try to fetch an anchor
			var _a = $(this).find('a').is('a') ? $(this).find('a') : false;

			// reference the original image as a variable and hide it
			var _img = $(this).children('img').css('display','none');
			
			// extract the original source
			var _src = _a ? _a.attr('href') : _img.attr('src');
	

	// get the thumb
	var _thumb = $('.galleria img[rel="'+_src+'"]');

	if (_thumb.hasClass('fewpic')) {
	_thumb.css("height", '76px');
	_thumb.css("width", '76px');
	}

		});
});











