// (c) Andrii Vasyliev
// ThR - Thumb Rotator

if (typeof(sol)=="undefined") var sol = new Object();
sol.thr = {
	preloads: [],
	timeouts: [],
	quantity: [],

	init: function (id,path,ext,num,start) {
		if (typeof(this.preloads[id])=='undefined') this.preloads[id] = new Array();
		this.quantity[id] = num;
		for (var j=1;j<=num;j++) {
			if (typeof(this.preloads[id][j])=='undefined') this.preloads[id][j] = new Image();
			this.preloads[id][j].src = path+j+ext;
		};
		this.play(id,start);
	},

	stop: function (id,j) {
		clearTimeout(this.timeouts[id]);
		this.show(id,j);
	},

	show: function (id,j) {
		document.getElementById(id).src = this.preloads[id][j].src;
	},

	play: function (id,j) {
		this.show(id,j);
		j++;
		if (j>this.quantity[id]) j=1;
		this.timeouts[id] = setTimeout("sol.thr.play('"+id+"',"+j+")",600);
	}
};


