// Random Slideshow

this.randomtip = function(){
	var pause = 10000; // define the pause for each tip (in milliseconds) 
	var length = $("#rand img").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
		while (ran == temp){
			ran = getRan();
		}; 
		temp = ran;
		$("#rand img").fadeOut("slow");	
		$("#rand img:nth-child(" + ran + ")").fadeIn("slow");		
	};
	show(); setInterval(show,pause);
};

$(document).ready(function(){	
	randomtip();
});

