﻿
			    function scrollers()
			    {
			        if (news.length > 0) 
			        {
				        createOnloadDisplay();                  // Not Animated... Just Show It
				        t=setTimeout("beginRotation()",pause);   // Start Ticker
				    }
				}

			    function createOnloadDisplay()
			    {
			        //This add's the first item to display, and positions it 0/0
			        //Every additional item is turned off and positioned to the bottom of the container
    			    
			        var containerElement	= document.getElementById(container);
			        var allContent          = "";
			        var positionStyle       = "";
			        var firstItem           = true;
			        height                  = containerElement.offsetHeight;
			        
			        //Set custom shit for the container...
			        containerElement.style.overflow = "hidden";
			        containerElement.style.position = "relative";
    			    
			        for (i = 0; i < news.length; i++)
			        {
			            if (firstItem)
			            {
			                positionStyle = "style=\"position: absolute; top: 0px; left: 0px; width: 100%; height: " + height.toString() + "px;\"";
			            } 
			            else 
			            {
			                positionStyle = "style=\"position: absolute; top: " + (height).toString() + "px; left: 0px; width: 100%; height: " + height.toString() + "px;\"";
			            }			        
    			      
			            allContent = allContent + "<div id=\"item" + i.toString() + "\" " + positionStyle + ">";
			            allContent = allContent + news[i];
			            allContent = allContent + "</div>";
    			        
			            firstItem = false;
			        }
    				
				    containerElement.innerHTML = allContent;
			    }
			    
			    function beginRotation()
			    {
			        //Get the next array item number
			        var nextArrayItem       = (news.length == currentArrayItem + 1) ? 0 : (currentArrayItem + 1);
			        //Get the current element and next element
			        currentElement          = document.getElementById("item" + currentArrayItem);
			        nextElement             = document.getElementById("item" + nextArrayItem);
			        
			        if (animate)
			        {
			            //Start Animation
			            setTimeout("animateItems()",0); 
			        }
			        else
			        {			        
			            currentElement.style.display    = "none";
			            nextElement.style.display       = "";
			            nextElement.style.top           = "0px";
			            
			            //Loop without Animation
			            t=setTimeout("beginRotation()",pause); 
			        }
			        
			        currentArrayItem = nextArrayItem;
			    }	
			    
			    function animateItems()
			    {
			        var positionOfCurrentY          = currentElement.offsetTop;
			        var positionOfNextY             = nextElement.offsetTop;
			        
			        if (positionOfNextY < 1)
			        {
			            currentElement.style.top    = (height).toString() + "px";
			            nextElement.style.top       = "0px";
			            t=setTimeout("beginRotation()",pause);
			        }
			        else
			        {
			            currentElement.style.top    = (positionOfCurrentY - 2) + "px";
			            if ((positionOfNextY - 2) < 1)
			            {
			                nextElement.style.top   = "0px";		            
			            }
			            else
			            {
			                nextElement.style.top   = (positionOfNextY - 2) + "px";	
			            }
			            setTimeout("animateItems()", 10);
			        }
			    }
    			
			    //window.onload = scrollerRates;
