ArrowGallery = {

    setup: function() {
        if (AC.Detector.isIE()) {
            this.viewer = this.view.view.view();

            this.view.view.view().observe('mouseover', function(evt) {
                this.viewer.addClassName('hover');
            }.bind(this));

            document.body.observe('mouseover', function(evt) {
                var element = evt.findElement('#'+this.viewer.id);
                this.viewer.removeClassName('hover');
            }.bind(this));
        }
    },

    didAppendContent: function(view, content) {
        this.view = view;

        var section = view.currentSection;
        if (!section.arrows) {
            section.arrows = {};
            section.arrows.previous = new Element('a', { className:'arrow prev '+view.triggerClassName, href:'#previous' }).insert('&lt;');
            section.arrows.next = new Element('a', { className:'arrow next '+view.triggerClassName, href:'#next' }).insert('&gt;');

            section.content.insertBefore(section.arrows.next, section.content.firstChild);
            section.content.insertBefore(section.arrows.previous, section.content.firstChild);
        }
    },

    didShow: function(view, outgoing, incoming) {
        this.view = view;
        this.setup();

        this.didAppendContent(view, incoming.content);
        this.didShow = function() {};
    }
}



CloseButton = {

    didAppendContent: function(view, content) {
        this.view = view;

        var section = view.currentSection;
        if (section.movieLink) {
            if (!section.close) {
                section.close = new Element('a', { className:'close '+view.triggerClassName, href:'#' }).insert('schließen');
                section.content.insertBefore(section.close, section.content.firstChild);
            }

            var previous = (view.previousSection) ? view.previousSection.id : view.orderedSections[0];
            section.close.href = '#'+previous;
        }
    },

    didShow: function(view, outgoing, incoming) {
        this.didAppendContent(view, incoming.content);
        this.didShow = function() {};
    }
}
