/// Externe Links
$$('a.extern').each(function(link){
    link.setProperty('target','_blank');    
});

if ($chk (document.id('galerie-wrapper'))) {
    // scroller für die Vorschaubilder
    var $scroller = new Scroller_Controls({
        'scroller' : 'galerie-wrapper',
        'element'  : 'div.bild',
        'controls' : { 
            'forward'  : 'rechts',
            'backward' : 'links'
        },
        'steps'     : 4,
        'fx'        : {               // for all options see: http://mootools.net/docs/core/Fx/Fx
            'duration'   : 800,
            'link'       : 'cancel',
            'transition' : 'linear' // for all options see: http://mootools.net/docs/core/Fx/Fx.Transitions
        }
    });

    // scroller für die Detailansicht
    var $dscroller = new Scroller_Controls({
        'scroller' : 'hauptbild-wrapper',
        'element'  : 'div.bild',
        'controls' : false,
        'steps'     : 1,
        'fx'        : {
            'duration'   : 800,
            'link'       : 'cancel',
            'transition' : 'expo:out'
        }
    });
    Scroller_Controls.implement({
        moveToID: function(id) {
            var $el = document.id(id);
            $index = this.elements.indexOf($el);    
            if( $index !== -1) {
                this.move($index);    
            }
        }
    });
    $$('#galerie-slider div.bild').addEvent('click', function(){
        $dscroller.moveToID( this.get('id').replace('relto','b'));
    });
}
