//------------------------------------------------------
function stripBR(string) {
	var newString = "";
	var j = 0;
	var skip = 0;
	var debug = 0; //1 = True, 0 = False
	
	if (debug) { document.write("<table border=\"1\"><tr><th>i</th><th>j</th><th>string[box]</th><th>newString complete</th></tr>"); }
	for (var i = 0; i < string.length; i++) {
		if (skip > 0) {
			skip--;
		} else {
			if (string[i] == "<" && string[i+1] == "b" && string[i+2] == "r" && string[i+3] == ">") {
				newString += " ";
				skip = 3;
				j++;
			} else {
				newString += string[i];
				j++;
			}
		}
		if (debug) { document.write("<tr><td>" + i + "</td><td>" + j + "</td><td>" + string[i] + "</td><td>" + newString + "</td></tr>"); }
	}
	if (debug) { document.write("</table>"); }
	
	return newString;
}
//------------------------------------------------------
var source = new Array("store1",
					   "store2",
					   "store3",
					   "store4",
					   "store5",
					   "store6");
						   
var text =  new Array("Advanced Saddle Fit Client<br>Pierre St. Jacques and Lucky Tiger<br>Pan Am Gold Medalists, 2003",
					  "Advanced Saddle Fit Client<br>Sue Jaccoma",
					  // old --> "Jumping Saddles from Albion, Black Country, <br> and other premier British saddlemakers",
					  "Kathy Meyer on Tiger",
					  "Trainer and Clinician Ellie Coletti<br>and Opo",
					  "\"R\" Judge and FEI-level competitor<br>Sandy Osborn and Milestone",
					  "Advanced Saddle Fit sponsored rider, Lauren Sprieser, and Billy, on their way to their thid-place finish in the Brentina Cup at Gladstone, June 2006");

var imageCount = source.length;
//
//	These arrays will store the pre-loaded images, so that there is
//	no annoying lag.
//	Preloading is a good thing!
//
var image = new Array(imageCount);

for (var i = 0; i < imageCount; i++)  {
	image[i] = new Image(210, 197);
	image[i].src = "images/" + source[i] + ".jpg";
	image[i].alt = stripBR(text[i]);
	//image[i].title = stripBR(text[i]);
}

var timerID = null;
var delay = 5000;
var imageNumber = 0;

document.getElementById('rotatingImage').src = image[imageNumber].src;
document.getElementById('rotatingImage').alt = image[imageNumber].alt;
//document.getElementById('rotatingImage').title = image[imageNumber].title;
document.getElementById('rotatingText').innerHTML = text[imageNumber];

//------------------------------------------------------
function runTimer() {
	if (imageNumber == 5) {
		imageNumber = 0;
	} else {
		imageNumber++;
	}
	document.getElementById('rotatingImage').src = image[imageNumber].src;
	document.getElementById('rotatingImage').alt = image[imageNumber].alt;
	//document.getElementById('rotatingImage').title = image[imageNumber].title;
	document.getElementById('rotatingText').innerHTML = text[imageNumber];
	timerID = self.setTimeout("runTimer()", delay);
}
//------------------------------------------------------