
onload = function(){
	window.aDivs 	= document.getElementById("testimonials").getElementsByTagName("div");
	var nMax	= 0;
	var nHeight = 0;
	for(var i=0; i<aDivs.length; i++){
		nHeight = aDivs[i].offsetHeight;
		if(nMax < nHeight) nMax = nHeight;
	};
	document.getElementById("testimonials").style.height = nMax + 40 + "px";
	oBar = new Progressbar();
	randomiseQuote();
};

function Progressbar(){
	this.nStep = 1;
	this.nDelay = 40;
	this.nMilliseconds = document.getElementById("testimonials").innerHTML.length * 15 + aDivs.length * 1500;
	document.getElementById("testimonials").innerHTML += '<span id="progress"><span id="bar"><span class="progressBarHandle-0"></span><span class="progressBarHandle-1"></span><span class="progressBarHandle-2"></span><span class="progressBarHandle-3"></span><span class="progressBarHandle-4"></span></span></span>';
	this.__step = function(){
		if(this.nPos > 380) return;
		clearTimeout(this.oTimer);
		this.nPos += this.nStep;
		this.nDelay = (this.nMilliseconds / 425);
		document.getElementById("bar").style.left = this.nPos + "px";
		this.oTimer = setTimeout("oBar.__step()", this.nDelay)
	};
	this.start = function(nTime){
		this.nPos = -30;
		this.__step();
	};
};

randomiseQuote = function(){
	if(typeof window.nCurrent == "undefined"){
		window.nCurrent = 0;
	}else{
		aDivs[nCurrent].style.visibility = "hidden";
		nCurrent ++;
	};
	if(nCurrent > aDivs.length-1){
		nCurrent = 0;
	};
	if(nCurrent == 0)
		oBar.start();
	aDivs[nCurrent].style.visibility = "visible";
	var nTime = parseInt(aDivs[nCurrent].innerHTML.length*15 + 1500);
	window.setTimeout("randomiseQuote()", nTime);
};