$slideshow = {

    init: function(fx_var, timeout_var, slideSpeed_var, tabSpeed_var, bgYes_var) {

		context = false;

		tabs = false;

		if(bgYes_var=="false") bgYes = false; 

		if(bgYes_var=="true") bgYes = true; 

		timeout = timeout_var;      // time before next slide appears (in ms)

		slideSpeed = slideSpeed_var;   // time it takes to slide in each slide (in ms)

		tabSpeed = tabSpeed_var;      // time it takes to slide in each slide (in ms) when clicking through tabs

		fx = fx_var;   // the slide effect to use

       

	   // set the context to help speed up selectors/improve performance

        this.context = $('#slideshow');

        

        // set tabs to current hard coded navigation items

        this.tabs = $('ul.slides-nav li', this.context);

        

        // remove hard coded navigation items from DOM 

        // because they aren't hooked up to jQuery cycle

        this.tabs.remove();

        

        // prepare slideshow and jQuery cycle tabs

        this.prepareSlideshow();

    },

    

    prepareSlideshow: function() {

        // initialise the jquery cycle plugin -

        // for information on the options set below go to: 

        // http://malsup.com/jquery/cycle/options.html

        $('div.slides > ul', $slideshow.context).cycle({

            fx: fx,

            timeout: timeout,

            speed: slideSpeed,

            fastOnEvent: tabSpeed,

			prev: '#cycle_prev',

			next: '#cycle_next',

            pager: $('ul.slides-nav', context),

            pagerAnchorBuilder: $slideshow.prepareTabs,

            before: $slideshow.activateTab,

			cleartypeNoBg:  bgYes,

            pauseOnPagerHover: true,

            pause: true

			

        }); 

		//pause and esumebuttons

		$('#cycle_resume').click(function() { 

			$('div.slides > ul', $slideshow.context).cycle('resume'); 

			$("#cycle_resume").addClass("resume");

			$("#cycle_pause").removeClass("pause");

		});

	

		$('#cycle_pause').click(function() { 

			$('div.slides > ul', $slideshow.context).cycle('pause'); 

			$("#cycle_pause").addClass("pause");

			$("#cycle_resume").removeClass("resume");

		});

	

		

    },

    

    prepareTabs: function(i, slide) {

        // return markup from hardcoded tabs for use as jQuery cycle tabs

        // (attaches necessary jQuery cycle events to tabs)

        return $slideshow.tabs.eq(i);

    },

    activateTab: function(currentSlide, nextSlide) {

        // get the active tab

        var activeTab = $('a[href="#' + nextSlide.id + '"]', $slideshow.context);

        

        // if there is an active tab

        if(activeTab.length) {

            // remove active styling from all other tabs

            $slideshow.tabs.removeClass('on');

            

            // add active styling to active button

            activeTab.parent().addClass('on');

        }            

    } 

	

};