﻿
var theCurrentNewsStory = -1;
var newsText = new Array();
var theStorySummary = '';
//var newsTimeout = 0;
	    
function newsScrolling()
{
    if(isdefined('theCurrentNewsStory')==false)
    {
        theCurrentNewsStory = -1;
    }
    if(isdefined('newsText')==false)
    {
        newsText = new Array();
    }
    if(isdefined('theStorySummary')==false)
    {
        theStorySummary = '';
    }
    if(isdefined('storyCount')==false)
    {
        storyCount = 0;
    }
    if(isdefined('newsTimeout')==false)
    {
        newsTimeout = 0;
    }
    
    
    
    var newsObj = document.getElementById('news');
    var myTimeout;
      
    // Go for the next story data block
     if(newsObj.style.top == '0px')
     {
        theCurrentNewsStory++;
        if(theCurrentNewsStory >= storyCount){
            theCurrentNewsStory = 0;
        }
                
        theStorySummary = newsText[theCurrentNewsStory];	
        
        newsObj.style.top = '180px'	
                
     }

     
     // Stuff the current ticker text into the anchor
     newsObj.innerHTML = theStorySummary;
    
     if(parseInt(newsObj.style.top.substr(0, newsObj.style.top.length-2)) > 6)
     {
         newsObj.style.top = (parseInt(newsObj.style.top.substr(0, newsObj.style.top.length-2)) -5)+'px';
         myTimeout = 50;
     }
     else
     {
         newsObj.style.top = '0px';
         myTimeout = 5000;
     }

    // Call up the next cycle of the ticker
    //newsTimout = setTimeout("newsScrolling()", myTimeout);
    setTimeout("newsScrolling()", myTimeout);
    
}

