/*
Highligher Scroller script- By JavaScript Kit
For this and over 400+ free scripts, visit http://www.javascriptkit.com/
This notice must stay intact
*/


var tickdelay=3000 //delay btw messages
var highlightspeed=10 //10 pixels at a time.
var clipwidth=0
var newsitems; 
var curritem=0; 
//var crosstick




$(document).ready(function() {

    crosstick = document.getElementById("highlighter")
    newsitems = $("#tom a").size(); 
    $("#highlighter").click(function() {bbctickergoto()})

    changetickercontent()
});




function changetickercontent(){
	crosstick.style.clip="rect(0px 0px auto 0px)"
	
	crosstick.innerHTML=$("#tom a:eq(" + curritem + ")").attr('innerHTML');

	myaddr = $("#tom a:eq(" + curritem + ")").attr('href');


	highlightmsg(crosstick.offsetWidth)
}


function highlightmsg(msgwidth){
	var msgwidth=crosstick.offsetWidth
	if (clipwidth<msgwidth){
		clipwidth+=highlightspeed
		crosstick.style.clip="rect(0px "+clipwidth+"px auto 0px)"
		beginclip=setTimeout("highlightmsg()",20)
	}else{
		clipwidth=0
		clearTimeout(beginclip)
		curritem = ++curritem%newsitems; 
		setTimeout("changetickercontent()",tickdelay)
	}
}



function bbctickergoto(){
	window.location = myaddr
}

