/**
*	Site-specific configuration settings for Highslide JS
*/

$(document).ready(function() {

	hs.graphicsDir = 'http://fundyfootpath.info/highslide/graphics/';
	hs.showCredits = false;
	hs.outlineType = 'custom';
	hs.dimmingOpacity = 0.5;
	hs.align = 'center';
	hs.blockRightClick = true;
	hs.captionEval = 'this.thumb.alt';
	
	
	// Add the slideshow controller
	hs.addSlideshow({
		slideshowGroup: (function() {
			var groups = [];
			$('.gallery').each(function(i, $item) {
				groups.push($item.id);
			});
			return groups;
		})(),
		interval: 5000,
		repeat: false,
		useControls: false,
		thumbstrip: {
			mode: 'horizontal',
			position: 'bottom center',
			relativeTo: 'viewport'
		}
	
	});
	
	
	hs.transitions = ['expand', 'crossfade'];
	
	// for gallery
	$('.gallery-item a').addClass('highslide');
	$('.gallery-item a').each(function() {
		this.onclick = function() {
			return hs.expand(this, {
				slideshowGroup: this.parentNode.parentNode.parentNode.id
			});
		};
	});
	
	// For single images
	hs.onSetClickEvent = function(sender, e) {
		e.element.onclick = function() {
			return hs.expand(this, singleConfig);
		}
		return false;
	};
	
	var singleConfig = {
		slideshowGroup: 'single-image',
		outlineType: 'drop-shadow',
		wrapperClassName: 'borderless',
		numberPosition: null,
		dimmingOpacity: 0
	};
	
	hs.registerOverlay({
		slideshowGroup: 'single-image',
		html: ' <div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
		position: 'top right',
		fade: 2
	});

});
