var index=0;

function getTestimonials() {
	var myurl = '/scripts/testimonials.xml';
	myRand = parseInt(Math.random()*999999999999999);
	// add random number to URL to avoid cache problems
	var modurl = myurl+"?rand="+myRand;
	http.open("GET", myurl, true);
	// set up the callback function
	http.onreadystatechange = useTestimonialData;
	http.send('');
}

function useTestimonialData() {
	if (http.readyState == 4) {
		if(http.status == 200) {
			var testimonialText;
			var numTestimonials = http.responseXML.getElementsByTagName('textItem').length;
			if (index >= numTestimonials) {
				index=0;
			}
			var loc = http.responseXML.getElementsByTagName('textItem')[index];
			testimonialText = loc.firstChild.nodeValue;
			testimonialText = testimonialText.replace(/breakHere/g, "<br />");
			testimonialText = testimonialText.replace(/startBold/g, "<strong>");
			testimonialText = testimonialText.replace(/endBold/g, "</strong>");
			index++;
			document.getElementById('testimonialBoxText').innerHTML = testimonialText;
		}
	}
}



