/**
*	Site-specific configuration settings for Highslide JS
*/
$(document).ready(function() {
	hs.graphicsDir = 'http://www.franskraal-accommodation.co.za/highslide/graphics/';
	hs.outlineType = 'custom';
	hs.dimmingOpacity = 0.75;
	hs.fadeInOut = true;
	hs.align = 'center';
	hs.marginBottom = 105;
	hs.captionEval = 'this.thumb.alt';

	// Add the slideshow controller
	hs.addSlideshow({
		//slideshowGroup: 'group1',
		slideshowGroup: (function() {
		var groups = [];
		$('.gallery').each(function(i, $item) {
		    groups.push($item.id);
		});
		return groups;
		})(),
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: false,
		overlayOptions: {
			className: 'text-controls',
			opacity: 1,
			position: 'bottom center',
			offsetX: 0,
			offsetY: -60,
			relativeTo: 'viewport',
			hideOnMouseOut: false
		},
		thumbstrip: {
			mode: 'horizontal',
			position: 'bottom center',
			relativeTo: 'viewport'
		}

	});

	// gallery config object
	hs.numberPosition = 'caption';
	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
		});
});
