var count=0;
var ns6=document.getElementById&&!document.all;
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var iTimer = "";

function init_news_bar(){
	if (ie4||ns6){
	var intHeight = "50px" ;
		//document.write('<table border="1" align="center" cellspacing="0" cellpadding="0" width="'+barwidth+'" height="'+barheight+'">');
		document.write('<table border="0" align="center" cellspacing="0" cellpadding="0" width="'+barwidth+'" height='+intHeight+'">');
		document.write('<tr><td valign="top" onmouseover="this.style.background=mouseover_color" onmouseout="this.style.background=mouseout_color">');
		document.write('<span ID="news_bar_but" style="cursor:hand" onclick="goURL();"></span>');
		document.write('</td></tr>');
		document.write('<tr><td height="10px" align="center">');
		document.write('<a href="javascript:void(0)" onclick="moveit(0)" style="text-decoration:none;color:gray;font-size:9px"><b><</b></a>&nbsp;&nbsp;');
		document.write('<a href="javascript:void(1)" onclick="moveit(1)" style="text-decoration:none;color:gray;font-size:9px"><b>></b></a>');
		document.write('</td></tr>');
		document.write('</table>');
	}
	else
	{
		document.write('<Div id="news_bar">')
		document.write('<a href="javascript:void(0)" onclick="moveit(0)"><</a>');
		if (navigator.userAgent.indexOf("Opera")!=-1)
			document.write('<span ID="news_bar_but" onclick="goURL();" style="width:'+barwidth+'"></span>');
		else
			document.write('<span ID="news_bar_but" onclick="goURL();" style="width:'+barwidth+'"></span>');
		
		document.write('<a href="javascript:void(0)" onclick="moveit(1)">></a></div>');
	}
  document.getElementById("news_bar_but").innerText=msgs[count];
  iTimer = setInterval("moveit(1)",setdelay);
}

function moveit(how){
	clearInterval(iTimer);
	if (how==1){ //cycle foward
		if (count<msgs.length-1)
			count++
		else
			count=0
		}
	else{ //cycle backward
		if (count==0)
			count=msgs.length-1
		else
			count--
	}
	document.getElementById("news_bar_but").innerText=msgs[count];
	iTimer = setInterval("moveit(1)",setdelay);
}

function goURL(){
	location.href=msg_url[count];
}