﻿Event.onDOMReady(function() {
    // set up the sections and view master
    var links = $$('.herocontentlink');
    var content = $$('.herocontent').concat(links.without(links[0]));
    content[0].remove();
    var viewer = new AC.ViewMaster.Viewer(content, 'herocontent', 'herocontentlink', {
        initialId: 'hero1',
        silentTriggers: true,
        animationDuration: 1.2
    });

    // set up the slideshow
    var slideshow = new AC.ViewMaster.Slideshow(viewer, null, {
        autoplay: true,
        delay: 7500
    });

    // stop slideshow when a link is manually pressed
    links.each(function(link) {
        link.observe('mousedown', function(e) {
            slideshow.stop();
        });
    });
});
