var SINCCycle = Class.create({

	
    initialize: function(div, period) 
	{    
		this.cycleSponsors = $$('div#'+div+' .cycle');
		this.cyclecount = 0;
		this.onecycle=false;
		this.period = period;
		
		for(var i=1; i<this.cycleSponsors.length; i++){
			$( this.cycleSponsors[i].id ).hide();
		}
		$(this.cycleSponsors[0].id).setStyle({ left: '0px'	});

		//new PeriodicalExecuter(this.cycle.bind(this), period);
	},
	
	start:function()
	{
		Effect.Appear( this.cycleSponsors[ 0 ].id , {duration: "1.0"} );	

		new PeriodicalExecuter(this.cycle.bind(this), this.period);
	},
	
	cycle:function(pe)
	{
		var cyclePrv;
		var stopped = false;
		
		cyclePrv = this.cyclecount;
	
		if ( this.cyclecount < this.cycleSponsors.length-1 )
		{
			this.cyclecount++;
		} 
		else 
		{
			if ( this.onecycle == true )
			{
				pe.stop();
				stopped = true;
			}
			else
			{
				this.cyclecount = 0;
			}
		}

		$(this.cycleSponsors[this.cyclecount].id).setStyle({ left: '0px'	});
		
		if ( stopped == false )
		{
			Effect.Appear( this.cycleSponsors[this.cyclecount].id, {duration: "0.9"} );
		}
		Effect.Fade( this.cycleSponsors[cyclePrv].id, {duration: "0.9"} );
	}

}
)
