///----------------------------------------------------------------
/// Begin : NTRotator

var g_nNTRotatorScrollDirectionUp = 0;
var g_nNTRotatorScrollDirectionDown = 1;
var g_nNTRotatorScrollDirectionLeft = 2;
var g_nNTRotatorScrollDirectionRight = 3;

var g_nNTRotatorTransitionTypeScroll = 0;
var g_nNTRotatorTransitionTypeSlideshow = 1;

var g_arrNTRotatorEffects;

function NTRotator(
	bAutoAdvance,
	strCustomTransitionFilter,
	nFramesToShow,
	nFrameTimeout,
	bPauseOnMouseOver,
	nScrollDirection,
	nScrollSpeed,
	nSmoothScrollDelay,
	nSmoothScrollTime,
	nTransitionEffect,
	nTransitionType,
	bUseRandomSlide,
	bUseSmoothScroll,
	strClientID,
	nNumberOfFrames
)
{
	// Assign members' value
	this.m_bAutoAdvance = bAutoAdvance;
	this.m_strCustomTransitionFilter = strCustomTransitionFilter;
	this.m_nFramesToShow = nFramesToShow;
	this.m_nFrameTimeout = nFrameTimeout;
	this.m_bPauseOnMouseOver = bPauseOnMouseOver;
	this.m_nScrollDirection = nScrollDirection;
	this.m_nScrollSpeed = nScrollSpeed;
	this.m_nSmoothScrollDelay = nSmoothScrollDelay;
	this.m_nScrollTime = nSmoothScrollTime;
	this.m_nTransitionEffect = nTransitionEffect;
	this.m_nTransitionType = nTransitionType;
	this.m_bUseRandomSlide = bUseRandomSlide;
	this.m_bUseSmoothScroll = bUseSmoothScroll;
	this.m_strClientID = strClientID;	
	this.m_nNumberOfFrames = nNumberOfFrames;
	this.m_ctlControl = document.getElementById(strClientID);	
	this.m_ctlControl.m_objRotator = this;	
	this.m_ctlFrameContainer = document.getElementById(strClientID + "_frContainer");
	this.m_nTimerID = null;
	this.m_bStopped = true;
	this.m_bPaused = false;
	
	if (bAutoAdvance)
	{
		//window.setTimeout("fnNTRotator_OnWindowLoad('" + strClientID + "')", this.m_nFrameTimeout);
		
		// Attach onload event
		if (this.m_ctlControl.attachEvent)	// IE ?
			window.attachEvent('onload', function(){window.setTimeout("fnNTRotator_OnWindowLoad('" + strClientID + "')", this.m_nFrameTimeout)});
		else
			window.addEventListener('load', function(){window.setTimeout("fnNTRotator_OnWindowLoad('" + strClientID + "')", this.m_nFrameTimeout)}, true);
	}
}

function fnNTRotator_OnWindowLoad(strClientID)
{
	var ctlRotator = document.getElementById(strClientID);
	if (ctlRotator && ctlRotator.m_objRotator)
		ctlRotator.m_objRotator.StartRotator();	
}

function fnNTRotator_OnMouseTimeOut(strClientID)
{
	var ctlRotator = document.getElementById(strClientID);
	
	if (ctlRotator && ctlRotator.m_objRotator)
	{	
		//TRACE(obj.m_objRotator.m_nMouseTimerID);
		window.clearTimeout(ctlRotator.m_nMouseTimerID);
		ctlRotator.m_objRotator.UnpauseRotator();
	}
}

function fnNTRotator_OnMouseOver(evtEvent, strClientID)
{	
	if (document.all)
	{
		var obj = document.getElementById(strClientID);		
		if (obj.m_objRotator && obj.m_objRotator.m_bPauseOnMouseOver)
		{
			obj.m_objRotator.PauseRotator();
		}
	}
	else
	{
		var obj = evtEvent.currentTarget;		
		if (obj.m_objRotator && obj.m_objRotator.m_bPauseOnMouseOver)
		{
			obj.m_objRotator.PauseRotator();
		}
		window.clearTimeout(obj.m_objRotator.m_nMouseTimerID);
	}
}

function fnNTRotator_OnMouseOut(evtEvent, strClientID)
{
	if (document.all)
	{
		var obj = evtEvent.toElement;
		if (obj && !obj.m_objRotator)
		{
			document.getElementById(strClientID).m_objRotator.UnpauseRotator();
		}		
	}
	else
	{
		var obj = evtEvent.currentTarget;
		if (obj.m_objRotator && obj.m_objRotator.m_bPauseOnMouseOver)
		{
			obj.m_objRotator.m_nMouseTimerID = window.setTimeout("fnNTRotator_OnMouseTimeOut('" + obj.m_objRotator.m_strClientID + "')", 500);
		}
	}
}

function fnNTRotator_OnTimeout(strClientID)
{	
	var obj = document.getElementById(strClientID).m_objRotator;
	
	if (!obj.m_bStopped)
		if (obj.m_nTransitionType == g_nNTRotatorTransitionTypeScroll)
		{
			obj.m_nSegmentCount = 0;
			window.clearTimeout(obj.m_nTimerID);
			obj.m_nTimerID = window.setInterval("fnNTRotator_OnTimer('" + strClientID + "')", obj.m_nSmoothScrollDelay);
		}
}

function fnNTRotator_OnTimer(strClientID)
{
	var obj = document.getElementById(strClientID).m_objRotator;
	
	if (obj.m_bPaused)
		return;
		
	if (obj.m_nSegmentCount < obj.m_nSegments)
	{
		if (obj.m_bUseSmoothScroll)
			switch (obj.m_nScrollDirection)
			{
				case g_nNTRotatorScrollDirectionUp:											
					obj.m_nPassed -= obj.m_arrSegments[obj.m_nSegments - obj.m_nSegmentCount - 1];						
					obj.m_ctlFrameContainer.style.top = obj.m_nPassed % obj.m_nTotalScroll;
				break;
				
				case g_nNTRotatorScrollDirectionDown:					
					obj.m_nPassed += obj.m_arrSegments[obj.m_nSegments - obj.m_nSegmentCount - 1];
					obj.m_ctlFrameContainer.style.top = obj.m_nPassed % obj.m_nTotalScroll - obj.m_nTotalScroll;
				break;
							
				case g_nNTRotatorScrollDirectionLeft:
					obj.m_nPassed -= obj.m_arrSegments[obj.m_nSegments - obj.m_nSegmentCount - 1];						
					obj.m_ctlFrameContainer.style.left = obj.m_nPassed % obj.m_nTotalScroll;
				break;
				
				case g_nNTRotatorScrollDirectionRight:
					obj.m_nPassed += obj.m_arrSegments[obj.m_nSegments - obj.m_nSegmentCount - 1];
					obj.m_ctlFrameContainer.style.left = obj.m_nPassed % obj.m_nTotalScroll - obj.m_nTotalScroll;
				break;
			}
		else
			switch (obj.m_nScrollDirection)
			{
				case g_nNTRotatorScrollDirectionUp:											
					obj.m_nPassed -= obj.m_nIncreament;					
					obj.m_ctlFrameContainer.style.top = obj.m_nPassed % obj.m_nTotalScroll;
				break;
				
				case g_nNTRotatorScrollDirectionDown:					
					obj.m_nPassed += obj.m_nIncreament;
					obj.m_ctlFrameContainer.style.top = obj.m_nPassed % obj.m_nTotalScroll - obj.m_nTotalScroll;
				break;
							
				case g_nNTRotatorScrollDirectionLeft:
					obj.m_nPassed -= obj.m_nIncreament;
					obj.m_ctlFrameContainer.style.left = obj.m_nPassed % obj.m_nTotalScroll;
				break;
				
				case g_nNTRotatorScrollDirectionRight:
					obj.m_nPassed += obj.m_nIncreament;
					obj.m_ctlFrameContainer.style.left = obj.m_nPassed % obj.m_nTotalScroll - obj.m_nTotalScroll;
				break;
			}			
		
		obj.m_nSegmentCount++;
	}
	else
	{
		switch (obj.m_nTempScrollDirection)
		{
			case g_nNTRotatorScrollDirectionUp:											
				obj.m_nScrollDirection = g_nNTRotatorScrollDirectionUp;
				//obj.m_nPassed = 0;
				//obj.m_ctlFrameContainer.style.top = 0;
				obj.m_nTempScrollDirection = null;
			break;
			
			case g_nNTRotatorScrollDirectionDown:					
				obj.m_nScrollDirection = g_nNTRotatorScrollDirectionDown;
				//obj.m_nPassed = 0;
				//obj.m_ctlFrameContainer.style.top = -obj.m_nTotalScroll;
				obj.m_nTempScrollDirection = null;
			break;
						
			case g_nNTRotatorScrollDirectionLeft:
				obj.m_nScrollDirection = g_nNTRotatorScrollDirectionLeft;
				//obj.m_nPassed = 0;
				//obj.m_ctlFrameContainer.style.left = 0;
				obj.m_nTempScrollDirection = null;
			break;
			
			case g_nNTRotatorScrollDirectionRight:
				obj.m_nScrollDirection = g_nNTRotatorScrollDirectionRight;
				//obj.m_nPassed = 0;
				//obj.m_ctlFrameContainer.style.left = -obj.m_nTotalScroll;
				obj.m_nTempScrollDirection = null;
			break;
		}
		
		window.clearInterval(obj.m_nTimerID);
		obj.m_nTimerID = window.setTimeout("fnNTRotator_OnTimeout('" + obj.m_strClientID + "')", obj.m_nFrameTimeout);
	}	
	
	//TRACE(obj.m_ctlFrameContainer.style.left + ':' + obj.m_ctlFrameContainer.style.top);	
}

function fnNTRotator_OnFilterTimeout(strClientID)
{
	var obj = document.getElementById(strClientID).m_objRotator;
	
	if (!obj.m_bStopped)
	{
		if (!obj.m_bPaused)
		{
			var filter;
			
			if (obj.m_nTransitionEffect == 0)	// RANDOM
			{			
				var n = Random(g_arrNTRotatorEffects.length - 2) + 2;
				obj.m_ctlControl.style.filter = g_arrNTRotatorEffects[n];							
			}	
				
			var filter = obj.m_ctlControl.filters[0];		
			filter.Percent = 0;
			filter.stop();
			filter.Apply();
			
			if (obj.m_bUseRandomSlide)
				obj.m_nPassed -= obj.m_nFrameHeight * obj.m_nFramesToShow * (Random(obj.m_arrFrames.length - 1) + 1);
			else
				obj.m_nPassed -= obj.m_nFrameHeight * obj.m_nFramesToShow;
				
			obj.m_ctlFrameContainer.style.top = obj.m_nPassed % obj.m_nTotalScroll;		
			
			filter.Play();			
			window.clearTimeout(obj.m_nTimerID);
			obj.m_nTimerID = window.setTimeout("fnNTRotator_OnFilterTimeout('" + obj.m_strClientID + "')", filter.Duration * 1000 + obj.m_nFrameTimeout);
			
			//TRACE(this.m_ctlFrameContainer.style.top);
		}
		else
		{
			window.clearTimeout(obj.m_nTimerID);
			obj.m_nTimerID = window.setTimeout("fnNTRotator_OnFilterTimeout('" + obj.m_strClientID + "')", obj.m_nFrameTimeout);
		}
	}
}

NTRotator.prototype.PauseRotator = function()
{
	this.m_bPaused = true;
	//TRACE('p');
}

NTRotator.prototype.UnpauseRotator = function()
{
	this.m_bPaused = false;
	//TRACE('up');
}

NTRotator.prototype.StartRotator = function()
{
	if (this.m_bStopped)
	{
		if (this.m_nTimerID == null)
		{			
			// Init Frame Control array list
			this.m_arrFrames = new Array();
			for (var i = 0; i < this.m_nNumberOfFrames; i++)
			{
				var ctlObject = document.getElementById(this.m_strClientID + "_fr" + i);
				this.m_arrFrames.push(ctlObject);
				ctlObject.m_objRotator = this;
			}
			
			if (this.m_arrFrames.length == 0)
				return;
			
			// Attach onmouseover and onmouseout events
			if (this.m_ctlControl.attachEvent)	// IE ?
			{
				var fn;
				eval("fn = function(){fnNTRotator_OnMouseOver(event,'" + this.m_strClientID + "')}");
				this.m_ctlControl.attachEvent('onmouseover', fn);
				eval("fn = function(){fnNTRotator_OnMouseOut(event,'" + this.m_strClientID + "')}");
				this.m_ctlControl.attachEvent('onmouseout', fn);
			}
			else
			{
				/*var fn;
				eval("fn = function(){fnNTRotator_OnMouseOver(event,'" + this.m_strClientID + "')}");
				this.m_ctlControl.addEventListener('mouseover', fn, true);
				eval("fn = function(){fnNTRotator_OnMouseOut(event,'" + this.m_strClientID + "')}");
				this.m_ctlControl.addEventListener('mouseout', fn, true);*/
				this.m_ctlControl.addEventListener('mouseover', fnNTRotator_OnMouseOver, true);
				this.m_ctlControl.addEventListener('mouseout', fnNTRotator_OnMouseOut, true);
			}
			
			//this.m_ctlControl.style.zIndex = 2;
			//var dim = new NTGetElementDims(this.m_ctlControl);
			var nWidth = NTGetElementWidth(this.m_ctlControl);
			var nHeight = NTGetElementHeight(this.m_ctlControl);
			var ctlParent = this.m_arrFrames[0].parentNode;
				
			// Calculate increments
			//this.m_nFrameHeight = NTGetElementHeight(this.m_arrFrames[0]);
			//this.m_nFrameWidth = NTGetElementWidth(this.m_arrFrames[0]);			
			
			_lbScrollRotator:
			if (this.m_nTransitionType == g_nNTRotatorTransitionTypeScroll)
			{	
				if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp ||	
					this.m_nScrollDirection == g_nNTRotatorScrollDirectionDown)
				{
					this.m_nFrameHeight = nHeight / this.m_nFramesToShow;
					this.m_nFrameWidth = nWidth;
				}
				else
				{
					this.m_nFrameWidth = nWidth / this.m_nFramesToShow;
					this.m_nFrameHeight = nHeight;
				}				
				
				if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp ||
						this.m_nScrollDirection == g_nNTRotatorScrollDirectionLeft)
				{
					// copy the first content to the last content (newly added element)
					for (var i = 0; i < this.m_nNumberOfFrames; i++)
					{
						var ctl = document.createElement(this.m_arrFrames[i].tagName);
						ctl.style.width = this.m_nFrameWidth;
						ctl.style.height = this.m_nFrameHeight;
						ctl.style.overflow = "hidden";
						ctl.m_objRotator = this;
						ctl.id = 'rmm';				
						
						ctl.innerHTML = this.m_arrFrames[i].innerHTML;						
						
						ctlParent.appendChild(ctl);
					}
					
					// copy the first content to the last content (newly added element)
					for (var i = 0; i < this.m_nNumberOfFrames; i++)
					{
						var ctl = document.createElement(this.m_arrFrames[i].tagName);
						ctl.style.width = this.m_nFrameWidth;
						ctl.style.height = this.m_nFrameHeight;
						ctl.style.overflow = "hidden";
						ctl.m_objRotator = this;
						ctl.id = 'rmm';				
						
						ctl.innerHTML = this.m_arrFrames[this.m_nNumberOfFrames - i - 1].innerHTML;						
						
						ctlParent.insertBefore(ctl, ctlParent.firstChild);
					}
					
					// copy the first content to the last content (newly added element)
					for (var i = 0; i < this.m_nNumberOfFrames; i++)
					{
						var ctl = document.createElement(this.m_arrFrames[i].tagName);
						ctl.style.width = this.m_nFrameWidth;
						ctl.style.height = this.m_nFrameHeight;
						ctl.style.overflow = "hidden";
						ctl.m_objRotator = this;
						ctl.id = 'rmm';						
						
						ctl.innerHTML = this.m_arrFrames[this.m_nNumberOfFrames - i - 1].innerHTML;						
						
						ctlParent.insertBefore(ctl, ctlParent.firstChild);
					}					
					
					if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionLeft)
					{
						ctlParent.parentNode.parentNode.style.width = this.m_nFrameWidth * (4 * this.m_nNumberOfFrames);						
					}
					
					this.m_nPassed = 0;
				}
				else
				{					
					// copy the first content to the last content (newly added element)
					for (var i = 0; i < this.m_nNumberOfFrames; i++)
					{
						var ctl = document.createElement(this.m_arrFrames[i].tagName);
						ctl.style.width = this.m_nFrameWidth;
						ctl.style.height = this.m_nFrameHeight;
						ctl.style.overflow = "hidden";
						ctl.m_objRotator = this;
						ctl.id = 'rmm';
						ctlParent.appendChild(ctl);
						
						ctl.innerHTML = this.m_arrFrames[i].innerHTML;
					}
					
					// copy the first content to the last content (newly added element)
					for (var i = 0; i < this.m_nNumberOfFrames; i++)
					{
						var ctl = document.createElement(this.m_arrFrames[i].tagName);
						ctl.style.width = this.m_nFrameWidth;
						ctl.style.height = this.m_nFrameHeight;
						ctl.style.overflow = "hidden";
						ctl.m_objRotator = this;
						ctl.id = 'rmm';
						ctlParent.insertBefore(ctl, ctlParent.firstChild);
						
						ctl.innerHTML = this.m_arrFrames[this.m_nNumberOfFrames - i - 1].innerHTML;
					}
					
					if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionRight)
					{
						ctlParent.parentNode.parentNode.style.width = this.m_nFrameWidth * (3 * this.m_nNumberOfFrames);
					}
					
					this.m_nPassed = 0;
				}		
				
				if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp ||
					this.m_nScrollDirection == g_nNTRotatorScrollDirectionDown)						
					this.m_nTotalScroll = this.m_nFrameHeight * this.m_nNumberOfFrames;
				else
					this.m_nTotalScroll = this.m_nFrameWidth * this.m_nNumberOfFrames;					
			
				this.m_nSegments = Math.ceil(this.m_nScrollTime / this.m_nSmoothScrollDelay);
				this.m_nSegmentCount = 0;
			
				if (this.m_bUseSmoothScroll)
				{	
					var fa;
					
					// a = s / t^2;
					if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp ||
						this.m_nScrollDirection == g_nNTRotatorScrollDirectionDown)						
						fa = this.m_nFrameHeight * this.m_nFramesToShow / (this.m_nSegments * this.m_nSegments);
					else
						fa = this.m_nFrameWidth * this.m_nFramesToShow / (this.m_nSegments * this.m_nSegments);
							
					this.m_arrSegments = new Array();
					var fPrev = 0;							
					for (var i = 1; i <= this.m_nSegments; i++)
					{
						var f = fa * i * i;
						this.m_arrSegments[i - 1] = f - fPrev;
						fPrev = f;
						//TRACE(i + ':' + this.m_arrSegments[i - 1]);
					}					
					
					this.m_nTimerID = window.setInterval("fnNTRotator_OnTimer('" + this.m_strClientID + "')", this.m_nSmoothScrollDelay);
				}
				else
				{					
					if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp ||
						this.m_nScrollDirection == g_nNTRotatorScrollDirectionDown)
						this.m_nIncreament = this.m_nFrameHeight * this.m_nFramesToShow / this.m_nSegments;
					else
						this.m_nIncreament = this.m_nFrameWidth * this.m_nFramesToShow / this.m_nSegments;
						
					this.m_nTimerID = window.setInterval("fnNTRotator_OnTimer('" + this.m_strClientID + "')", this.m_nScrollSpeed);
				}
			}
			else
			{
				if (document.all)	// IE
				{
					this.m_nTimerID = 1;					
					
					this.m_nFrameHeight = nHeight / this.m_nFramesToShow;
					this.m_nFrameWidth = nWidth;
					this.m_nCurrentSlide = 0;				
					
					if (!g_arrNTRotatorEffects)
					{
						g_arrNTRotatorEffects = [
													'',
													'!',
													'progid:DXImageTransform.Microsoft.Barn( motion=out,orientation=vertical)',
													'progid:DXImageTransform.Microsoft.Blinds( Bands=10,direction=up)',
													'progid:DXImageTransform.Microsoft.Checkerboard( Direction=right,SquaresX=2,SquaresY=2)',
													'progid:DXImageTransform.Microsoft.Fade(Overlap=1.00)',
													'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward)',
													'progid:DXImageTransform.Microsoft.Inset()',
													'progid:DXImageTransform.Microsoft.Iris(irisstyle=PLUS,motion=out)',
													'progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=50)',
													'progid:DXImageTransform.Microsoft.RadialWipe(wipestyle=CLOCK)',
													'progid:DXImageTransform.Microsoft.RandomBars()',
													'progid:DXImageTransform.Microsoft.RandomDissolve()',
													'progid:DXImageTransform.Microsoft.Slide(slidestyle=HIDE,Bands=1)',
													'progid:DXImageTransform.Microsoft.Spiral(GridSizeX=16,GridSizeY=16)',
													'progid:DXImageTransform.Microsoft.Stretch(stretchstyle=SPIN)',
													'progid:DXImageTransform.Microsoft.Strips(motion=leftdown)',
													'progid:DXImageTransform.Microsoft.Wheel(spokes=4)',
													'progid:DXImageTransform.Microsoft.Zigzag(GridSizeX=16,GridSizeY=16)'
												];
						
					}
					
					var strFilter;
					if ((strFilter = g_arrNTRotatorEffects[this.m_nTransitionEffect]) != '!')	// NONE
					{	
						// copy the first content to the last content (newly added element)
						for (var i = 0; i < this.m_nNumberOfFrames; i++)
						{
							var ctl = document.createElement(this.m_arrFrames[i].tagName);
							ctl.style.width = this.m_nFrameWidth;
							ctl.style.height = this.m_nFrameHeight;
							ctl.style.overflow = "hidden";
							ctl.m_objRotator = this;
							ctl.id = 'rmm';
							ctlParent.appendChild(ctl);
							
							ctl.innerHTML = this.m_arrFrames[i].innerHTML;
						}
						
						// copy the first content to the last content (newly added element)
						for (var i = 0; i < this.m_nNumberOfFrames; i++)
						{
							var ctl = document.createElement(this.m_arrFrames[i].tagName);
							ctl.style.width = this.m_nFrameWidth;
							ctl.style.height = this.m_nFrameHeight;
							ctl.style.overflow = "hidden";
							ctl.m_objRotator = this;
							ctl.id = 'rmm';
							ctlParent.insertBefore(ctl, ctlParent.firstChild);
							
							ctl.innerHTML = this.m_arrFrames[this.m_nNumberOfFrames - i - 1].innerHTML;
						}
					
						if (strFilter.length == 0)	// RANDOM
						{
							var n = Random(g_arrNTRotatorEffects.length - 2) + 2;
							strFilter = g_arrNTRotatorEffects[n];							
						}
							
						this.m_nTotalScroll = this.m_nFrameHeight * this.m_nNumberOfFrames;
						
						this.m_ctlControl.style.filter = strFilter;
						var filter = this.m_ctlControl.filters[0];
						filter.Apply();					
						this.m_nPassed = -this.m_nFrameHeight * this.m_nFramesToShow;
						this.m_ctlFrameContainer.style.top = this.m_nPassed % this.m_nTotalScroll;
						filter.Play();
						this.m_nTimerID = window.setTimeout("fnNTRotator_OnFilterTimeout('" + this.m_strClientID + "')", filter.Duration * 1000 + this.m_nFrameTimeout);
						this.m_nCurrentFrame = 0;						
					}
				}
				else
				{
					this.m_nTransitionType = g_nNTRotatorTransitionTypeScroll;
					this.m_bUseSmoothScroll = true;
					this.StartRotator();
				}
			}			
		}
		else if (this.m_nTimerID == 0)
		{
			if (this.m_nTransitionType == g_nNTRotatorTransitionTypeScroll)
				this.m_nTimerID = window.setInterval("fnNTRotator_OnTimer('" + this.m_strClientID + "')", this.m_bUseSmoothScroll ? this.m_nSmoothScrollDelay : this.m_nScrollDelay);
			else if (document.all)
			{
				this.m_ctlFrameContainer.filters[0].play();
			}
		}
		
		this.m_bStopped = false;
	}	
}

NTRotator.prototype.StopRotator = function()
{
	if (!this.m_bStopped)
	{
		if (this.m_nTransitionType == g_nNTRotatorTransitionTypeScroll)
		{
			this.m_bStopped = true;
			window.clearInterval(this.m_nTimerID);
			this.m_nTimerID = 0;
		}
		else if (document.all)
		{
			this.m_ctlFrameContainer.filters[0].stop();
		}
	}
}

NTRotator.prototype.ScrollUpNextFrame = function()
{
	if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionDown)
	{
		this.m_nTempScrollDirection = g_nNTRotatorScrollDirectionUp;
	}
}

NTRotator.prototype.ScrollDownNextFrame = function()
{
	if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionUp)
	{
		this.m_nTempScrollDirection = g_nNTRotatorScrollDirectionDown;
	}
}


NTRotator.prototype.ScrollLeftNextFrame = function()
{
	if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionRight)
	{
		this.m_nTempScrollDirection = g_nNTRotatorScrollDirectionLeft;
	}
}

NTRotator.prototype.ScrollRightNextFrame = function()
{
	if (this.m_nScrollDirection == g_nNTRotatorScrollDirectionLeft)
	{
		this.m_nTempScrollDirection = g_nNTRotatorScrollDirectionRight;
	}
}


NTRotator.prototype.ShowPrevFrame = function()
{
}

NTRotator.prototype.ShowNextFrame = function()
{
}

/// End : NTRotator
///----------------------------------------------------------------

///----------------------------------------------------------------
/// Begin : NTTicker

function NTTicker(strClientID, bAutoAdvance, nLineDuration, nLoop, nTickSpeed, nLineDuration, arrTickerLines)
{
	this.m_strClientID = strClientID;
	this.m_bAutoAdvanced = bAutoAdvance;
	this.m_nLineDuration = nLineDuration;
	this.m_nLoop = nLoop;
	this.m_nTickSpeed = nTickSpeed;
	this.m_nLineDuration = nLineDuration;
	this.m_arrTickerLines = arrTickerLines;
	this.m_bStopped = true;
	document.getElementById(strClientID).m_objTicker = this;
}

function fnNTTicker_OnTimeout(strClientID)
{
	if (!this.m_bStopped)
	{
		var obj = document.getElementById(strClientID);
		obj.innerHTML = "";
		obj.m_objTicker.m_nTimerID = window.setInterval("fnNTTicker_OnTimer('" + obj.m_objTicker.m_strClientID + "')", obj.m_objTicker.m_nTickSpeed);
		obj.m_objTicker.m_nPos = 0;
	}
}

function fnNTTicker_OnTimer(strClientID)
{
	var obj = document.getElementById(strClientID);
	var ticker = obj.m_objTicker;
	var str = ticker.m_arrTickerLines[ticker.m_nLine];
	
	if (ticker.m_nPos >= str.length) // End of a line
	{
		ticker.m_nCurrentLoop++;
		if (ticker.m_nCurrentLoop < ticker.m_nLoop)
		{
			ticker.m_nPos = 0;
			ticker.innerHTML = "";
		}
		else if (ticker.m_bAutoAdvance)
		{
			ticker.m_nLine++;
			window.setTimeout("fnNTTicker_OnTimeout('" + ticker.m_strClientID + "')", ticker.m_nLineDuration);
			window.clearInterval(ticker.m_nTimerID);
		}
		else
		{
			ticker.m_bStopped = true;
		}		
	}
	else
	{
		//obj.innerHTML += str[m_nPos++];
		obj.innerHTML = str.substr(0, ticker.m_nPos);
	}
}

NTTicker.prototype.StartTicker = function()
{
	if (this.m_bStopped)
	{
		/*if (this.m_nTimerID == null)	// The ticker is not started yet (completely stopped)
		{
			this.m_nTimerID = window.setInterval("fnNTTicker_OnTimer('" + this.m_strClientID + "')", this.m_nTickSpeed);
		}
		else // the ticker is paused
		{
			// Just unpause the ticker
			this.m_
		}*/
		this.m_nTimerID = window.setInterval("fnNTTicker_OnTimer('" + this.m_strClientID + "')", this.m_nTickSpeed);
		this.m_nPos = 0;
		this.m_nLine = 0;
		this.m_nCurrentLoop = 0;
		
		this.m_bStopped = false;
	}
}

NTTicker.prototype.StopTicker = function()
{
	if (!this.m_bStopped)
	{
		window.clearInterval(this.m_nTimerID);
		this.m_bStopped = true;
	}
}

/// End : NTTicker
///----------------------------------------------------------------
