DailyClean = function (id, images, timeout)
{
	this.id = id;
	this.item = null;
	this.images = images;
	this.timeout = timeout;
	this.current = 0;
	this.count = 0;
	
	this.changeImage = function ()
	{
		this.current = (this.current + 1) % this.count;
		this.item.style.backgroundImage = 'url(' + this.images[this.current] + ')';
	}
	
	this.init = function ()
	{
		this.count = this.images.length;
		this.item = document.getElementById(this.id) || false;
		if (this.item)
		{
			this.item.style.backgroundImage = 'url(' + this.images[this.current] + ')';
			var func = function (param)
			{
				return function ()
				{
					param.changeImage();
				}
			}
			setInterval(func(this), this.timeout);
			
			for (var i = 1; i < this.images.length; i++)
			{
				var x = new Image();
				x.src = this.images[i];
			}
		}
	}
	this.init();
}

var images = [
	'/images/t/dailyclean.jpg', 
	'/images/c/animation/1/1.jpg', 
	'/images/c/animation/1/2.jpg',
	'/images/c/animation/1/3.jpg',
	'/images/c/animation/1/4.jpg',
	'/images/c/animation/1/5.jpg',
	'/images/c/animation/1/6.jpg',
	'/images/c/animation/1/7.jpg',
	'/images/c/animation/1/8.jpg'
];
var id = 'dailyclean';
var DC = new DailyClean(id, images, 2000);
