﻿//Jackpot holder collection
TJPHolds = function(){
	this.holds = new Array();
	this.idx = 0;
	this.ticker = new TTicker(50, true);
}

TJPHolds.prototype.next = function(){
	if(this.ticker.tick()){
		this.switchNext();
	} else {
		if(this.idx >= 0 && this.idx < this.holds.length) 
			this.holds[this.idx].next();
	}
}

TJPHolds.prototype.switchOff = function(){
	if(this.idx>=0 && this.holds[this.idx].obj)
		this.holds[this.idx].obj.style.display='none';
}

TJPHolds.prototype.switchOn = function(){
	if(this.idx>=0 && this.holds[this.idx].obj)
		this.holds[this.idx].obj.style.display='';
}

TJPHolds.prototype.switchNext = function(){
	if(this.holds.length>1){
		this.switchOff();
		if((++this.idx)>=this.holds.length) this.idx=0;
		this.switchOn();
	}
}

TJPHolds.prototype.addNew = function(aId){
	var h = new TJPHold(aId);
	h.setParentIndex(this.holds.length, this);
	this.holds.length++; 
	this.holds[this.holds.length-1]=h;
	
	return h;
}