$(document).ready( function () {
					 
	if ($("#slider").length > 0) {
		
		var active = 1;
		var animation_index = 1;
		var total = $("#slider_nav a").length;
		
		$("#slider_nav a").click( function () {
									
			var index = $(this).html();

			if (active != index) {
			
				$("#slider_nav a").removeClass("act");
				
				$(this).parent().parent().parent().children("div").children("p:eq(" + (active - 1) + ")").fadeOut("fast", function () {
					
					$(this).parent().children("p:eq(" + (index - 1) + ")").fadeIn("fast");
					
				});
				
				active = index;

				$(this).parent().parent().children("li:eq(" + (index - 1) + ")").children("a").addClass("act");

			}
											
		});
		
		var animation = setInterval(function () {

			if (animation_index - 1 == total) {
				animation_index = 0;
			}
			
			$("#slider_nav a:eq(" + animation_index + ")").click();
			
			animation_index++;
			

		}, 3000);
		
	}
	
});

