$(document).ready(function() {
	$('#preview_gallery a').lightBox();
	$('div.portfolio_gallery a').lightBox();
	$('a.lightbox').lightBox();
	previewGallery();

});

function previewGallery() {
	//Make all dull spans invisible
	$('span.gallery_dull').css({ display: 'block', opacity: 0.0});

	$('#preview_gallery a').hover(function() {
		//Toggle Active class
		$(this).toggleClass('active');
		//Show gallery name
		$(this).find('span.gallery_name').show();
		//Hide dull span
		$(this).find('span.gallery_dull').hide();
		//Make all other dull spans visible
		$('span.gallery_dull').stop().animate({ opacity: 0.7 }, 300);
	}, function() {
		//Change previously active image's dull span display:block but invisible
		$('#preview_gallery a.active span.gallery_dull').css({ display: 'block', opacity: 0.0 });
		//Hide gallery name
		$(this).find('span.gallery_name').hide();
		//Fade in dull span
		$('#preview_gallery a.active span.gallery_dull').stop().animate({ opacity: 0.7 }, 300);
		//Toggle off the Active class
		$(this).toggleClass('active');
		//Fade out full spans
		$('span.gallery_dull').stop().animate({ opacity: 0.0 }, 300);
	});
}
