$(document).ready(function () {  
	$("#container").height($(document).height()); 
	$("#xtra-bg").height($("#container").height());
	$('.highslide-gallery').cycle({
		fx: 'fade', speed: 2500
	}); 
});  
hs.graphicsDir = 'http://www.roadrash.no/hs-support/highslide/graphics/';
hs.outlineType = 'drop-shadow';
hs.dimmingOpacity = 0.8;
hs.fadeInOut = true;
hs.align = 'center';
hs.captionEval = 'this.thumb.alt';
hs.captionOverlay.position = 'bottom right';


// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'group1',
	interval: 5000,
	repeat: true,
	useControls: true,
	fixedControls: false,
	overlayOptions: {
		className: 'text-controls',
		opacity: '1',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '35',
		hideOnMouseOut: false
	}
});

// gallery config object
var config1 = {
	slideshowGroup: 'group1',
	transitions: ['expand', 'crossfade']
};

// Keep the position after window resize
hs.addEventListener(window, 'resize', function() {
	var i, exp;
	hs.getPageSize();

	for (i = 0; i < hs.expanders.length; i++) {
		exp = hs.expanders[i];
		if (exp) {
			var x = exp.x,
				y = exp.y;

			// get new thumb positions
			exp.tpos = hs.getPosition(exp.el);
			x.calcThumb();
			y.calcThumb();

			// calculate new popup position
		 	x.pos = x.tpos - x.cb + x.tb;
			x.scroll = hs.page.scrollLeft;
			x.clientSize = hs.page.width;
			y.pos = y.tpos - y.cb + y.tb;
			y.scroll = hs.page.scrollTop;
			y.clientSize = hs.page.height;
			exp.justify(x, true);
			exp.justify(y, true);

			// set new left and top to wrapper and outline
			exp.moveTo(x.pos, y.pos);
		}
	}
});
