﻿var SrgNewsticker =
{
	/******************************************************
	 * Indicates whether the ticker is currently rotating *
	 ******************************************************/
	IsStarted: false,
	
	/******************
	 * Start rotation *
	 ******************/
	Start: function()
	{
		/*
		if(typeof(SrgListScroller)=='object')
		{
			SrgListScroller.Register
				(
					'homeNewsTicker', // Key for the scroller, unique on this page
					'scrollHomeNewsTickerList', // Div ID
					'homeNewsTickerList', // List ID
					229, // Width
					211, // Height
					1000/15, // Interval between steps
					3 // Pixel-offset of a single step
				);
		}
		*/
		if(!this.IsStarted && typeof(SrgListRotator)=='object')
		{
			SrgListRotator.Register
				(
					'homeNewsTicker', // Key for the rotator, unique on this page
					'homeNewsTickerList', // List ID
					220, // Width
					178, // Height
					3333, // Timespan between fading in and out in ms
					333, // Timespan between news, display white, in ms
					20, // Interval in ms between opacity change steps
					10 // Opacity change step in percent.
				);
			this.IsStarted = true;
		}
	},
	
	/*****************
	 * Stop rotation *
	 *****************/
	Stop: function()
	{
		if(this.IsStarted && typeof(SrgListRotator)=='object')
		{
			SrgListRotator.Unregister('homeNewsTicker');
			this.IsStarted = false;
		}
	},
	
	/*****************************************
	 * Toggle rotation and cheange link text *
	 *****************************************/
	Toggle: function(oAnchor, sLabelStop, sLabelStart)
	{
		if(this.IsStarted)
		{
			this.Stop();
		}
		else
		{
			this.Start();
		}
		oAnchor.innerHTML = '<span>' + (this.IsStarted ? sLabelStop : sLabelStart) + '</span>';
	}
}
