﻿window.addEvent('domready', function() {
    if (tc_isIE6 == false) {
        var handles8_more = $$('#handles8_more span');
        var nS8 = new noobSlide({
            box: $('box8'),
            mode: 'vertical',
            items: $$('#box8 h3'),
            size: 190,
            handles: $$('#handles8 span'),
            autoPlay: true,
            //		addButtons: {previous: $('prev8'), play: $('play8'), stop: $('stop8'), playback: $('playback8'), next: $('next8') },
            onWalk: function(currentItem, currentHandle) {
                //style for handles
                $$(this.handles, handles8_more).removeClass('active');
                $$(currentHandle, handles8_more[this.currentIndex]).addClass('active');
                //text for "previous" and "next" default buttons
                $('prev8').set('html', '&lt;&lt; ' + this.items[this.previousIndex].innerHTML);
                $('next8').set('html', this.items[this.nextIndex].innerHTML + ' &gt;&gt;');

                var ci = this.currentIndex.toInt();
                try {
                    var trigs = ['_rd_savings.png', '_rd_compliance.png', '_rd_marketing.png'];
                    var trigs_sel = ['_rd_savings_sel.png', '_rd_compliance_sel.png', '_rd_marketing_sel.png'];
                    var marq = $('marquee-menu');
                    //                    var selid = 'mmi' + ci.toString();
                    var marqItems = $$(marq.getElements('div'));
                    marqItems.each(function(item, i) {
                        var mmi = item.get('id').replace('mmi', '').toInt();
                        item.setStyle('background', 'transparent url(/images/' + trigs[mmi - 1] + ') no-repeat');
                        if (mmi == ci + 1)
                        { item.setStyle('background', 'transparent url(/images/' + trigs_sel[ci] + ') no-repeat') }

                        item.addEvent('click', function(e) { this.blur(); nS8.walk(mmi - 1, false, true); nS8.stop(); });
                    });
                }
                catch (err) { alert(err) }
            }

        });
        //more "previous" and "next" buttons
        nS8.addActionButtons('previous', $$('#box8 .prev'));
        nS8.addActionButtons('next', $$('#box8 .next'));
        //more handle buttons
        nS8.addHandleButtons(handles8_more);
        //walk to item 2 without fx
        //	nS8.walk(2,false,true);
        nS8.play(20000, 'next', true);
    }
});