(function($) {
	$(document).ready( function() {
	    $('.feature-slider a').click(function(e) {
	        $('.featured-posts section.featured-post').css({
	            opacity: 0,
	            visibility: 'hidden'
	        });
	        $(this.hash).css({
	            opacity: 1,
	            visibility: 'visible'
	        });
	        $('.feature-slider a').removeClass('active');
	        $(this).addClass('active');
	        e.preventDefault();
	    });
	});
})(jQuery);

$(document).ready(function(){
	
	randomtip = function(){
		$(".home-success-story").hide();
		var pause = 20000; // define the pause for each tip (in milliseconds) 
		var length = $(".home-success-story").length; 
		var temp = -1;		

		getRan = function(){
			// get the random number
			var ran = Math.floor(Math.random()*length) + 1;
			return ran;
		};
		show = function(){
			var ran = getRan();
			// to avoid repeating
			while (ran == temp){
				ran = getRan();
			}; 
			temp = ran;
			$(".home-success-story").hide();	
			$(".home-success-story:nth-child(" + ran + ")").fadeIn("slow");		
		};
		
		show(); setInterval(show,pause);
		
	};


	console.log($(".home-success-story").length);
	//if($(".home-success-story").length > 0)
		//randomtip();
		
		
		
		
});
