/**
*	Site-specific configuration settings for Highslide JS
*/
hs.graphicsDir = '/IBSStaticResources/highslide/graphics/';
hs.showCredits = false;
hs.outlineType = 'custom';
hs.allowMultipleInstances = true;
hs.transitions = ['expand','crossfade'];
hs.restoreCursor = null;
hs.lang.restoreTitle = '';
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2, // fading the semi-transparent overlay looks bad in IE
	thumbnailId: 'thumb1'
});
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2, // fading the semi-transparent overlay looks bad in IE
	thumbnailId: 'thumb2'
});

// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'detailGroup',
	interval: 5000,
	repeat: true,
	useControls: false,
	overlayOptions: {
		position: 'bottom right',
		offsetY: '50'
	},
	thumbstrip: {
		position: 'below',
		mode: 'horizontal',
		relativeTo: 'expander'
	}
});
// Add the slideshow controller
hs.addSlideshow({
	slideshowGroup: 'searchGroup',
	interval: 5000,
	repeat: false,
	useControls: false,
	allowSizeReduction: false
});
// Options for the in-page items
var inPageOptions = {
	slideshowGroup: 'detailGroup',
	thumbnailId: 'detailThumb',
	outlineType: null,
	allowSizeReduction: false,
	wrapperClassName: 'in-page controls-below',
	useBox: true,
	width: 360,
	height: 260,
	targetX: 'item-image 0px',
	targetY: 'item-image 0px',
	captionEval: 'this.thumb.alt',
	numberPosition: 'null',
	transitions: ['fade', 'crossfade']
};
// Options for the in-page items
var inPageOptionsSW3D = {
	slideshowGroup: 'detailGroup',
	thumbnailId: 'detailThumb',
	outlineType: null,
	allowSizeReduction: false,
	//wrapperClassName: 'in-page controls-below',
	wrapperClassName: 'no-header no-footer',
	useBox: true,
	width: 360,
	height: 260,
	objectWidth: 360, 
	objectHeight: 260,
	targetX: 'item-image 0px',
	targetY: 'item-image 0px',
	captionEval: 'this.thumb.alt',
	numberPosition: 'null',
	objectType: 'swf',
	objectLoadTime: 'after',
	preserveContent: false,
	transitions: ['fade', 'crossfade'],
	swfOptions: {
		params: {
			autoPlay: 'true'
		}
	}
};
var config2 = {
	slideshowGroup: 'searchGroup',
	thumbnailId: 'thumb2',
	numberPosition: 'null',
	align: 'auto'
};
// Open the first thumb on page load
hs.addEventListener(window, 'load', function() {
	document.getElementById('detailThumb').onclick();
});
// Cancel the default action for image click and do next instead
hs.Expander.prototype.onImageClick = function() {
	if (/in-page/.test(this.wrapper.className))	return hs.next();
}
// Under no circumstances should the static popup be closed
hs.Expander.prototype.onBeforeClose = function() {
	if (/in-page/.test(this.wrapper.className))	return false;
}
// ... nor dragged
hs.Expander.prototype.onDrag = function() {
	if (/in-page/.test(this.wrapper.className))	return false;
}
// 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);
		}
	}
});

