hs.graphicsDir = 'graphics/';
hs.transitions = ['expand', 'crossfade'];
hs.restoreCursor = null;
hs.numberPosition = 'null'; // or 'caption'
hs.showCredits = false;

// Language strings
hs.lang = {
   cssDirection:     'ltr',
   loadingText :     'Ladataan...',
   loadingTitle :    'Peru',
   focusTitle :      'Klikkaa aktivoidaksesi',
   fullExpandTitle : 'Näytä kuva täysikokoisena (f)',
   fullExpandText :  'Täysikokoinen kuva',
   creditsText :     'Powered by <em>Highslide JS</em>',
   creditsTitle :    'Siirry Highslide JS:n kotisivulle',
   previousText :    'Edellinen',
   previousTitle :   'Edellinen valokuva (nuoli vasemmalle)',
   nextText :        'Seuraava',
   nextTitle :       'Seuraava valokuva (nuoli oikealle)',
   moveTitle :       'Siirrä',
   moveText :        'Siirrä valokuvaa',
   closeText :       'Sulje',
   closeTitle :      'Sulje valokuva (esc)',
   resizeTitle :     'Muuta kokoa',
   playText :        'Kuvaesitys',
   playTitle :       'Näytä kuvaesitys (välilyönti)',
   pauseText :       'Tauko',
   pauseTitle :      'Pidä tauko (välilyönti)',   
   number :          'Kuva %1 / %2',
   restoreTitle :    'Sulje kuva klikkaamalla, siirrä kuvia hiirellä vetämällä. Liiku kuvien välillä nuolinäppäimillä.'
};

// Add the slideshow providing the controlbar and the thumbstrip
hs.addSlideshow({
	interval: 5000,
	repeat: true,
	useControls: true,
	overlayOptions: {
		position: 'bottom right',
		offsetY: 50,
		hideOnMouseOut: true
	},
	thumbstrip: {
		position: 'rightpanel',
		offsetX: 120,
		mode: 'vertical',
		relativeTo: 'expander',
		hideOnMouseOut: true
	}
});

// Options for the in-page items
var inPageOptions = {
	outlineType: null,
	wrapperClassName: 'in-page controls-in-heading',
	useBox: true,
	width: 460,
	height: 460,
	allowSizeReduction: true,
	anchor: 'top left',
	targetX: 'gallery-area',
	targetY: 'gallery-area',
	// captionEval: 'this.thumb.alt',
}

// Fires when the onclick event is set on an element in unobtrusive mode.
hs.onSetClickEvent = function ( sender, e ) {
   // set the onclick for the element using options variable
   e.element.onclick = function () {
      return hs.expand(this, inPageOptions);
   }
   // return false to prevent the onclick being set once again
   return false;
}

// Tähän edellinen/seuraava custom layout KOODIA...

// Open the first thumb on page load
hs.addEventListener(window, 'load', function() {
	document.getElementById('thumb1').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;
}

// Overrides for translation
hs.lang.restoreTitle = 'Klikkaa seuraavaan valokuvaan.';
hs.lang.number = "%1 / %2";

// 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);
		}
	}
});
