﻿var arrEcScroller = new Array();
// ################################  FW_Scroller  Helper functions ###################
function FW_Scroller_Scroll(ccName)
{
	var HTMLControl = document.getElementById(ccName);
	HTMLControl.Object.Event_Scroll();
}


// ################################  FW_Scroller  class #############################
function FW_Scroller(ccName,iWidth,iHeight)
{
	this.ccName = ccName;
	this.width = iWidth;
	this.height = iHeight;
	
	this.Interval = null;
	
	this.HTMLControl = document.getElementById(ccName)
	this.HTMLControl.Object = this;
	
	this.cntA = document.getElementById(ccName + '_ContentA')
	this.cntB = document.getElementById(ccName + '_ContentB')
	this.Event_Scroll = function()
	{
		if(this.cntA.offsetHeight == 0)
		{
			return;
		}
		this.cntA.style.top = (parseInt(this.cntA.style.top,10)-1) + "px"; 
		this.cntB.style.top = ( parseInt(this.cntA.style.top,10) + this.cntA.offsetHeight) + "px";
		
		
		if(this.height>this.cntA.offsetHeight)
		{
		    this.cntB.style.display = "none" 
		    this.cntB.style.top = this.height + "px"; 
		 }
        else
            {
            this.cntB.style.display = "block"
            }
		
		
		if( parseInt(this.cntA.style.top,10) < (-1 * this.cntA.offsetHeight) )
		{
			window.status = this.cntB.offsetHeight
			if(this.height > this.cntA.offsetHeight)
				this.cntA.style.top = this.height + "px"; 
			  else
			     this.cntA.style.top = parseInt(this.cntB.style.top,10) + this.cntB.offsetHeight; 
			// Replace between divs
			var tmpDiv = this.cntA;
			this.cntA = this.cntB;
			this.cntB = tmpDiv;
			
			this.cntA.style.display = "block"

		}
	}
	this.Event_StopScroll = function()
			{	
				if(this.Interval!=null) 
					{
					clearInterval(this.Interval);	
					this.Interval = null;
					}
			}
	this.Event_StartScroll = function()
			{	
				this.Interval = setInterval("FW_Scroller_Scroll('"+this.ccName+"')", 35);	
			}
	
	this.HTMLControl.onmouseover = function()
			{	var Object = this.Object; Object.Event_StopScroll();	}
	
	this.HTMLControl.onmouseout = function()
			{	var Object = this.Object; Object.Event_StartScroll();	}	

	this.Event_StartScroll()
}			
