$(document).ready(function(){
	

	$(window).load(function(){
		$('#sectionRotate').cycle({ 
			speed: 1000, 
			timeout: 6000,
			pause: 1,
			pager: '#redNav',
			before: onBefore,
			pagerAnchorBuilder: function(idx, slide) { 
					// return selector string for existing anchor 
					return '#redNav li:eq(' + idx + ') a'; 
				} 
		});
		
		$("div#mysteryandmanners").load("/tags/preview/tags:mysteryandmanners/article:1/post:4/review:1/ajax:1", null, function(){
			$("div#rivervue").load("/tags/preview/tags:rivervue/article:1/post:4/review:1/ajax:1");
			$("div#spf").load("/tags/preview/tags:spf/article:1/post:4/review:1/ajax:1");
			$("div#tribalfever").load("/tags/preview/tags:tribalfever/article:1/post:4/review:1/ajax:1");
		});

		$('ul#reviewNav > li').fadeTo("fast", 0.6);  
			
	});

	$('ul#redNav > li > a').click(function() {
		$('ul#redNav > li > a').removeClass('on');
		$('ul#redNav > li').removeClass('on');
		$(this).addClass('on');
		$(this).parent().addClass('on');
		$('#sectionRotate').cycle('pause');
	});
	
	
	$('ul#reviewNav > li').hover(function(){
		$(this).fadeTo("fast", 1.0); // This sets the opacity to 100% on hover
	},function(){
		$(this).fadeTo("fast", 0.6); // This sets the opacity back to 60% on mouseout
	});

	$("ul#reviewNav > li").click(function(){
		var type = $(this).text();
		$("div#review").load("/reviews/preview/cat:" + type + "/view:3");
		$("ul#reviewNav > li").removeAttr("class");
		$(this).attr("class","on");
	});

	
	
		
});
	
function onBefore(){
	$('ul#redNav > li > a').removeClass('on');
	$('ul#redNav > li').removeClass('on');
	$('li#' + this.id + 'Link').addClass('on');
	$('li#' + this.id + 'Link').children().addClass('on');
}

