
var samples = ajax("post","samples.html","").split("<!--[SPLIT]-->");
var sampleIncrement = 1;
var sampleRotating = true;
var rsr;
var thumbRot;

function loadNextSample(inc) {
	if (!inc)  { inc = sampleIncrement; }
	randSample += inc;
	if (randSample >= samples.length) { randSample = 0; }
	if (randSample < 0) { randSample = samples.length-1; }
	document.getElementById('randSample').innerHTML = samples[randSample];
}

function incRandomSampleRotation(inc) {
	stopRandomSampleRotation();
	loadNextSample(inc);
}

function reverseRandomSampleRotation() {
	if (!sampleRotating) {
		sampleIncrement = sampleIncrement * 1;
		startRandomSampleRotation();
	}
}

function startRandomSampleRotation() {
	clearInterval(rsr);
	rsr = setInterval("loadNextSample();",5000);
	sampleRotating = true;
}

function stopRandomSampleRotation() {
	clearInterval(rsr);
	sampleRotating = false;
}

document.getElementById('randomSampleControls').style.display = "block";
startRandomSampleRotation();

