﻿/// <reference path="jquery-1.4.2.js" />

$slideshow = {
    context: false,    

    init: function () {
        // set the context to help speed up selectors/improve performance  
        this.context = $('#slideshow');
        
        // prepare slideshow and jQuery cycle tabs  
        this.prepareSlideshow();
    },

    prepareSlideshow: function () {
        $('.slides', $slideshow.context).cycle({
            fx: 'fade',
            timeout: 6000,
            speed: 300,
            pause: true,
            pager: $('ul.slides-nav', $slideshow.context),
            pagerAnchorBuilder: $slideshow.prepareTabs,
            pagerEvent: 'mouseover',
            pauseOnPagerHover: true
        });
    },

    prepareTabs: function (i, slide) {
        // return markup from hardcoded tabs for use as jQuery cycle tabs  
        // (attaches necessary jQuery cycle events to tabs)  
        return $('ul.slides-nav li', this.context).eq(i);
    }
}


$(function () {
    // initialise the slideshow when the DOM is ready  
    $slideshow.init();          
});
