/*
    2) Optionally override the settings defined at the top
    of the highslide.js file. The parameter hs.graphicsDir is important!
    Add the slideshow and do some adaptations to this example.
*/


//<![CDATA[
hs.graphicsDir = '/extension/jac_highslide/design/standard/javascript/highslide/4.1.8/graphics/';
hs.transitions = ['expand', 'crossfade'];
hs.restoreCursor = null;
hs.lang.restoreTitle = 'Click for next image';

//German language strings
hs.lang = {
    cssDirection: 'ltr',
    loadingText: 'Lade...',
    loadingTitle: 'Klick zum Abbrechen',
    focusTitle: 'Klick um nach vorn zu bringen',
    fullExpandTitle: 'Zur Originalgröße erweitern',
    creditsText: 'Powered by <i>Highslide JS</i>',
    creditsTitle: 'Gehe zur Highslide JS Homepage',
    previousText: 'Voriges',
    nextText: 'Nächstes',
    moveText: 'Verschieben',
    closeText: 'Schließen',
    closeTitle: 'Schließen (Esc)',
    resizeTitle: 'Größe wiederherstellen',
    playText: 'Abspielen',
    playTitle: 'Slideshow abspielen (Leertaste)',
    pauseText: 'Pause',
    pauseTitle: 'Pausiere Slideshow (Leertaste)',
    previousTitle: 'Voriges (Pfeiltaste links)',
    nextTitle: 'Nächstes (Pfeiltaste rechts)',
    moveTitle: 'Verschieben',
    fullExpandText: 'Vollbild',
    number: 'Bild %1 von %2',
    restoreTitle: 'Klick um das nächste Bild zu sehen.'
};


// Add the slideshow providing the controlbar and the thumbstrip
hs.addSlideshow({
	// slideshowGroup: 'group1',
	interval: 5000,
	repeat: true,
    autoplay: true,
   	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: '0.75',
		position: 'bottom center',
		offsetX: '0',
		offsetY: '-15',
		hideOnMouseOut: true
	}
});

// Options for the in-page items
var inPageOptions = {
    //slideshowGroup: 'group1',
    outlineType: null,
    allowSizeReduction: false,
    wrapperClassName: 'in-page controls-in-heading',
    useBox: true,
    width: 720,
    height: 440,
    targetX: 'gallery-area',
    targetY: 'gallery-area',
    captionEval: 'this.thumb.alt',
    numberPosition: 'caption'
}

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

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