window.addEvent('domready', function() {

    //scroller
    new SmoothScroll({ duration: 500, transition: Fx.Transitions.sineOut });

    //accordian
    var accordion = new Accordion('h3.atStart', 'div.atStart', {
        opacity: false,
        onActive: function(toggler, element) {
            toggler.setStyle('opacity', '1');
        },
        onBackground: function(toggler, element) {
            toggler.setStyle('opacity', '0.5');
        }
    },
	$('accordion'));

    //scroll follow
    simulateFixed = new Class({

        options: { duration: 500, transition: Fx.Transitions.Elastic.easeOut },

        initialize: function(id, bound, fixed_top, options,fixed) {
            this.fixed = id;
            this.options = options ? options : this.options;
            this.bound = bound;
            this.fixed_top = fixed_top//;
            this.fx = new Fx.Style(this.fixed, 'top', this.options);

            window.addEvent('scroll', this.scrolled.bind(this));
        },

        scrolled: function() {
            //mootools.js: getScrollTop document.body.scrollTop
            this.fx.stop();
            if (window.getScrollTop() < this.bound) {
                this.fx.start(this.offset);
            }
            else {
                this.fx.start(this.fixed_top + window.getScrollTop());
            }
        }
    });

    window.addEvent('domready', function() {
        new simulateFixed('fixed', 168, -168, { duration: 500 });
    });

});