var hbcrstimer
var hbcrstimer_active = true
var hbcrsbtnname = "hbcrsbtn"
var hbcrsitemname = "hbcrsitem"

function ShowHBCarousel(position){

for (i=1; i<=hbcrscount; i++) {
	document.getElementById(hbcrsbtnname + i).style.backgroundPosition="top left";
	if($(hbcrsitemname + i).fx){$(hbcrsitemname + i).fx.stop();};
	$(hbcrsitemname + i + "").fade('out');
}
document.getElementById(hbcrsbtnname + position).style.backgroundPosition="bottom left";	
$(hbcrsitemname + position).fade('in');	

}

function RollHBCarousel(position){
	if(position > hbcrscount) { position=1; };
	ShowHBCarousel(position);
	hbcrstimer = setTimeout("RollHBCarousel(" + (position + 1) + ")",6000);
}

function StopHBCarousel() {
	clearTimeout(hbcrstimer);
	hbcrstimer_active=false;
}

function ClickHBCarousel(position)
{
	StopHBCarousel();
	ShowHBCarousel(position);
}

function StartHBCarousel(position)
{
	if(hbcrstimer_active==false) {
		hbcrstimer_active=true;
		RollHBCarousel(position);
	}
}