$(document).ready(function(){
	$(".slides-nav li:first").addClass("on");
	
	$(".searchBox").focus(function(){
		textNormal = "Search this site for...";
		textCurrent = $(this).val();
		if ( textNormal == textCurrent ) {
			$(this).val("");
		}
	}); 
	var pleb =	$("#singlePost .fullHdr1:first a").text();
	pleb = pleb.toLowerCase();
	pleb1 = pleb.replace("favourites", "");;
	
	$(".singlePostHeader").attr("id",pleb1+"Categoriees");
	var doom = $(".catPostHeader .fullHdr1:first").text()
	doom = doom.toLowerCase();
	$(".catPostHeader").attr("id",doom+"Categoriees");
	
	
	// http://net.tutsplus.com/tutorials/javascript-ajax/building-an-auto-scrolling-slideshow-that-works-with-and-without-javascript/	
	$slideshow = {
	context: false,
	tabs: false,
	timeout: 1000,
	slideSpeed: 1000,
	tabSpeed: 300,
	fx: 'scrollLeft',
	
	init: function() {
		
		this.context = $('#slideshow');
		this.tabs = $('ul.slides-nav li', this.context);
		
		this.tabs.remove();
		this.prepareSlideshow();
	},
	
	prepareSlideshow: function() {
		$("div.slides > ul", $slideshow.context).cycle({
			fx: $slideshow.fx,
			timeout: $slideshow.timeout,
			speed: $slideshow.slideSpeed,
			fastOnEvent:$slideshow.tabSpeed,
			pager: $("ul.slides-nav", $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.removeClass('on');
			activeTab.parent().addClass('on');
		}
	}
}

$(function(){
	$slideshow.init();
});

});