// JavaScript Document
this.randomtip = function(){

	var pause = 10000; // define the pause for each tip (in milliseconds) Feel free to make the pause longer so users can have time to read the tips :)
	var length = $("#testimonials li").length; 
	var temp = -1;		

	this.getRan = function(){
		// get the random number
		var ran = Math.floor(Math.random()*length) + 1;
		return ran;
	};
	this.show = function(){
		var ran = getRan();
		// to avoid repeating tips we need to check 
		while (ran == temp){
			ran = getRan();
		}; 
		temp = ran;
		$("#testimonials li").hide();	
		$("#testimonials li:nth-child(" + ran + ")").fadeIn("slow");		
	};
	// initiate the script and also set an interval
	show(); setInterval(show,pause);
	
};

$(document).ready(function(){	
	randomtip();
});
