$(document).ready(function() {


	$(".scroll-container").each(function() {
	
		$(this).find(".scroll-nav").show();
		$(this).find(".scroll-nav a:first").addClass("active");
													
		var windowWidth = $(this).find(".slide-container span").width();
		var windowSum = $(this).find(".slide-container span").size();
		var scrollWidth = windowWidth * windowSum;
		
		$(this).find(".slide-container").css({'width' : scrollWidth});
		
	});	

	$(".scroll-nav a").click(function() {
	
		var triggerID = $(this).attr("rel") - 1;
		var scrollWidth = $(this).parent().parent().find("span").width();
		var scrollPosition = triggerID * scrollWidth;
		
		if ( $(this).hasClass("active")) { 
		}
		else {
			$(this).parent().parent().find(".scroll-nav a").removeClass("active");
			$(this).addClass("active");
			$(this).parent().parent().find(".slide-container").animate({ 
				left: -scrollPosition
			}, 300 );
		}
		return false;

	});

});