// JavaScript Document

 var count=0
var index = 0;
var t;
var tDelay;
var textScroll = '';
var links = '';
var scrollList = new Array();

function timedCount()
{
if(index == links.length) index = 0;

textScroll = scrollList[index];
objScroller = document.getElementById('scrollAnchor');
objScroller.innerHTML = textScroll.substring(0,count);
objScroller.href = links[index].href ;
 try{
  hbxName = links[index].name;
hbxName = hbxName.substring(hbxName.indexOf('=')+1,hbxName.length);
 }
catch(e){hbxName = '';}
hbxName = 'javascript:_hbLink("'+hbxName+'");';
//if(index == 2)
   // hbxName += links[index].href.replace("javascript:","") + 'return false;';
objScroller.onclick =  new Function(hbxName);

count=count+1;
if(count > textScroll.length+1)
{
  
waitTime(2);
count = 0;

if( index > scrollList.length-1)
index = 0;
tDelay = setTimeout("cancelDelay()",3000)
return;

}
t=setTimeout("timedCount()",50);
}

function sNext()
{
stopCount();
index++;
if( index > scrollList.length-1)
index = 0; 
count = 0;
timedCount();
}
function sPrevious()
{
stopCount();
index--;
if( index == -1)
index = scrollList.length-1;
count = 0;
timedCount();
}
var date;
function waitTime(mills)
{
stopCount();
date = new Date();
date.setMinutes(mills + date.getMinutes());

}
function cancelDelay()
{
var curDate = new Date();
if(curDate <= date)
{
clearTimeout(tDelay);
t=setTimeout("timedCount()",50);
index = index +1;
}
else
{
tDelay = setTimeout("cancelDelay()",3000)
}
}

function stopCount()
{
    clearTimeout(t);
    clearTimeout(tDelay);
}

function pausePlay()
{
stopCount();
  /*pauseButton = document.getElementById('pauseplay');
     
    if(pauseButton.src.indexOf('publish_pause') != -1)
    {
        stopCount();
        timedCount();
        pauseButton.src = pauseButton.src.replace('f','pause');
        
    }
    else
    {
    stopCount();
    pauseButton.src = pauseButton.src.replace('pause','f');
}*/
}


//scrollList = document.getElementById('txt').value.split('#');
function startScroller()
{
    links = document.getElementById('scrollerLinks').getElementsByTagName('a');
    for(var i = 0;i < links.length ;i++)
    {
        scrollList[scrollList.length] = links[i].innerHTML;
    }

    if(scrollList.length > 0)
        timedCount();
}


function seturl()
{
var obj = document.getElementById('verizon_prods')
_hbLink(obj.options[obj.selectedIndex].getAttribute('hbx'));
document.location.href = obj.options[obj.selectedIndex].getAttribute('url')

}
 