
this.randomtip = function(){

	var pause = 7000; // 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 = $("#randbanner p").length; 
	var temp = -1;
	var num = 1; //20110830 satou custom

	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;
		$("#randbanner p").hide();	
		$("#randbanner p:nth-child(" + ran + ")").fadeIn("slow");		
	};
	//20110830 satou custom
	/*this.first = function(){
		var ran = 1;
		temp = ran;
		$("#randbanner p").hide();	
		$("#randbanner p:nth-child(" + ran + ")").fadeIn("slow");		
	};*/
	this.fades = function(){
		$("#randbanner p").hide();	
		$("#randbanner p:nth-child(" + num + ")").fadeIn("slow");
		if(num < length){
			num++;
		}else{
			num=1;
		}
	};
	// initiate the script and also set an interval
	//20110830 satou custom
	fades();
	//setInterval(show,pause);
	setInterval(fades,pause);
	
};

$(document).ready(function(){	
	randomtip();
});
