// JavaScript Document

var slctd = 1;
var collcount = 8;
var jumpstringindex = 4;
var haltinterval = 10000;
function setcircles(whichNumOn) {
	YAHOO.util.Dom.setStyle(['circ1','circ2','circ3','circ4','circ5','circ6','circ7','circ8'],'background-position','top left');
	YAHOO.util.Dom.setStyle(['hbox01','hbox02','hbox03','hbox04','hbox05','hbox06','hbox07','hbox08'],'display','none');
	oncirc = document.getElementById("circ" + whichNumOn);
	YAHOO.util.Dom.setStyle(oncirc,'background-position','bottom left');
	onhbox0 = document.getElementById("hbox0" + whichNumOn);
	YAHOO.util.Dom.setStyle(onhbox0,'display','block');
}

function advancer(e,direction,auto) {
	if(!auto){stopauto();}
	if(direction == "prev"){
		if(slctd == 1){
			slctd = collcount;
		} else {
			slctd = (slctd - 1);
		}
	} else {
		if(slctd == collcount){
			slctd = 1;
		} else {
			slctd++;
		}
	}
	setcircles(slctd);
}

function jumper(e) {
	stopauto();
	tId = this.id;
	slctd = tId.charAt(jumpstringindex);
	setcircles(slctd);	
}

function stopauto() {if(playon){clearInterval(playon);}}   

YAHOO.util.Event.on(['circ1','circ2','circ3','circ4','circ5','circ6','circ7','circ8'],"mouseover",jumper);
playon = setInterval("advancer('e','next',1)", haltinterval);