$slideshow = {
	context: false,
	tabs: false,
	timeout: 7000,		// time before next slide appears (in ms)
	slideSpeed: 800,	// time it takes to slide in each slide(in ms)
	tabSpeed: 800,		// time it takes to slide in each slide(in ms) when clicking through tabs
	fx: 'scrollLeft',	// the slide effect to use

	init: function(){
		$('.slideMnu li:first').css('background','url("/images/btn_topVisual_on.png") no-repeat left top');
		//addClass('selected');
		this.context = $('#slideshow');
		this.tabs = $('ul.slideMnu li', this.context);
		this.tabs.remove();
		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
		$('ul.slideList', $slideshow.context).cycle({
			fx: $slideshow.fx,
			timeout: $slideshow.timeout,
			speed: $slideshow.slideSpeed,
			fastOnEvent: $slideshow.tabSpeed,
			pager: $('ul.slideMnu', $slideshow.context),
			pagerAnchorBuilder: $slideshow.prepareTabs,
			before: $slideshow.activateTab,
			pauseOnPagerHover: true,
			pause: true
		});
	},

	prepareTabs: function(i, slide){
		return $slideshow.tabs.eq(i);
	},

	activateTab: function(currentSlide, nextSlide){
		var activeTab = $('a[href="#' + nextSlide.id + '"]', $slideshow.context);
		if(activeTab.length){
//			$slideshow.tabs.removeAttr('id', 'selected');
//			activeTab.parent().attr('id', 'selected');
//			$slideshow.tabs.removeClass('selected');
//			activeTab.parent().addClass('selected');
			$slideshow.tabs.css('background', 'url("/images/btn_topVisual.png") no-repeat left top');
			activeTab.parent().css('background','url("/images/btn_topVisual_on.png") no-repeat left top');
		}
	}
};

$(function(){
	$('body').addClass('slideCnts');
	$slideshow.init();
});
