$slideshow2 = {
    context: false,
    tabs: false,
    timeout: 5000,      // time before next slide appears (in ms)
    slideSpeed: 1000,   // time it takes to slide in each slide (in ms)
    tabSpeed: 300,      // time it takes to slide in each slide (in ms) when clicking through tabs
    fx: 'scrollLeft',   // the slide effect to use
    
    init: function() {
        // set the context to help speed up selectors/improve performance
        this.context2 = $('#slideshow2');
        
        // set tabs to current hard coded navigation items
        this.tabs2 = $('ul.slides2-nav li', this.context);
        
        // remove hard coded navigation items from DOM 
        // because they aren't hooked up to jQuery cycle
        this.tabs2.remove();
        
        // prepare slideshow and jQuery cycle tabs
        this.prepareSlideshow2();
    },
    
    prepareSlideshow2: function() {
        // initialise the jquery cycle plugin -
        // for information on the options set below go to: 
        // http://malsup.com/jquery/cycle/options.html
        $('div.slides2 > ul', $slideshow2.context).cycle({
            fx: $slideshow2.fx,
            timeout: $slideshow2.timeout,
            speed: $slideshow2.slideSpeed,
            fastOnEvent: $slideshow2.tabSpeed,
            pager: $('ul.slides2-nav', $slideshow2.context),
            pagerAnchorBuilder: $slideshow2.prepareTabs,
            before: $slideshow2.activateTab,
            pauseOnPagerHover: false,
            pause: false,
			cleartype: false,
			cleartypeNoBg: false
        });            
    },
    
    prepareTabs2: function(i, slide2) {
        // return markup from hardcoded tabs for use as jQuery cycle tabs
        // (attaches necessary jQuery cycle events to tabs)
        return $slideshow2.tabs2.eq(i);
    },

    activateTab: function(currentSlide2, nextSlide2) {
        // get the active tab
        var activeTab2 = $('a[href="#' + nextSlide2.id + '"]', $slideshow2.context);
        
        // if there is an active tab
        if(activeTab2.length) {
            // remove active styling from all other tabs
            $slideshow2.tabs2.removeClass('on');
            
            // add active styling to active button
            activeTab2.parent().addClass('on');
        }            
    }            
};


$(function() {
    // add a 'js' class to the body
    $('body').addClass('js');
    
	jQuery(function($) {
		$('body').css('display','block');
    });
	
    // initialise the slideshow when the DOM is ready
    $slideshow2.init();
});  