// JavaScript Document

var curImg=0;
var timeToChange=250;
var stopped=0;
var numImg=backImage.length;

function changeTime(){
	if(!stopped || !timeToChange){
		timeToChange-=250;
		if(timeToChange<=0){
			timeToChange=5000;
			changeBG();
		}
	}
	setTimeout("changeTime()", 250);
}
function changeBG(){

	 document.getElementById('ROLLERimg').style.backgroundImage="url('uploads/flashHeader/"+backImage[curImg]+"')";
	 document.getElementById('ROLLERtxt').innerHTML=headTestoSel[curImg];
	 for(i=0;i<numImg;i++){
	 	document.getElementById('ROLLERbut0'+(i+1)).style.backgroundImage=(i!=curImg?"none":"url('img/ROLLERbut.png')");
	 }
	 curImg=(curImg+1)%numImg;
}

if(headTestoSel.length>0) changeTime();
