
/**
*day by day slide show object
**/

var dbdDiashow = function(pages,callback)
{
	this.pages = pages || 0;
	this.skip_pages = [];
	this.callback = callback || null;
	this.active = 1;
	this.duration = 5000;
	this.timer = null;
	this.init();
	dbdDiashow.obj = this;	
}
	//=====================================
	dbdDiashow.prototype.init = function()
	{
				
	}
	//=======================================
	dbdDiashow.prototype.setDuration = function(duration)
	{
		this.duration = duration*1000;
	}
	//=============================
	dbdDiashow.prototype.setPage = function(page)
	{
		this.active = parseInt(page);		
	}
	//=========================================
	dbdDiashow.prototype.move = function()
	{

		if(this.active > this.pages) this.active = 1;
		if(UTIL.in_array(this.active,this.skip_pages)){
			this.active ++;
			this.move();			
			return;
		}
		
		this.callback(this.active);	
		
		this.active++;		
	}
	//===========================================
	dbdDiashow.prototype.skip = function(skip_pages)
	{
		//only skip items:
		if(skip_pages.length >= this.pages.length){
			this.disabled = true;
		}
		this.skip_pages = skip_pages;
		
	}
	//===========================================
	dbdDiashow.prototype.stop = function()
	{
		window.clearTimeout(this.timer);	
	}
	
	
/*CLASS METODS AND PROPERTIES *************************************/	
	dbdDiashow.obj = null;
	dbdDiashow.is_on = false;
	dbdDiashow.work = function()
	{		
		if(false==dbdDiashow.is_on){	
			if(UTIL.in_array(ftcImage._load.no,ftcImage.diashow.skip_pages)){
				window.setTimeout("ftcImage.diashow.move()",ftcImage.diashow.duration);
			}		
			dbdDiashow.is_on = true;
			dbdDiashow.obj.move();
		}else{
			dbdDiashow.obj.stop();
			dbdDiashow.is_on = false;
			if(dbdDiashow.obj.active >= dbdDiashow.obj.pages) dbdDiashow.obj.active = 1;
		}	
	}
	//==================================================
	dbdDiashow.setDuration = function(elem)
	{
		dbdDiashow.obj.setDuration(elem.value);
	}

	
