var ticks,thisTick,nextTick,fadertime,state,current=0,delay=5000,speed=20,value=1,faderswitch=1;
function rotateNews(){
var _1=document.getElementById("front_news_text");
ticks=_1.getElementsByTagName("li");
for(var i=0;i<ticks.length;i++){
ticks[i].onmouseover=function(){
faderswitch=0;
window.clearTimeout(fadertime);
this.parentNode.style.opacity=1;
this.parentNode.style.filter="alpha(opacity=0)";
};
ticks[i].onmouseout=function(){
faderswitch=1;
fadertime=window.setTimeout(fader,2000);
};
if(i==0){
ticks[i].style.opacity=1;
}else{
ticks[i].style.opacity=0;
ticks[i].style.filter="alpha(opacity=0)";
ticks[i].style.display="none";
}
}
loopNews();
};
function loopNews(){
if(current>=ticks.length){
current=0;
}
thisTick=(nextTick)?nextTick:ticks[current];
nextTick=(ticks[++current])?ticks[current]:ticks[current=0];
thisTick.style.display="block";
state="on";
value=1;
if(faderswitch==1){
fadertime=window.setTimeout(fader,delay);
}
};
function fader(){
if(state=="on"&&faderswitch==1){
value=value-0.1;
value=parseInt(value*100)/100;
if(value>=0){
thisTick.style.opacity=value;
thisTick.style.filter="alpha(opacity="+(value*100)+")";
fadertime=window.setTimeout(fader,speed);
}else{
thisTick.style.display="none";
nextTick.style.display="block";
state="off";
fadertime=window.setTimeout(fader,speed);
}
}else{
if(state=="off"){
value=value+0.1;
value=parseInt(value*100)/100;
if(value<=1){
nextTick.style.opacity=value;
nextTick.style.filter="alpha(opacity="+(value*100)+")";
fadertime=window.setTimeout(fader,speed);
}else{
loopNews();
}
}
}
};
if(window.addEventListener){
window.addEventListener("load",rotateNews,false);
}else{
if(document.addEventListener){
document.addEventListener("load",rotateNews,false);
}else{
if(window.attachEvent){
window.attachEvent("onload",rotateNews);
}else{
if(typeof window.onload=="function"){
var existing=onload;
window.onload=function(){
existing();
rotateNews();
};
}else{
window.onload=function(){
rotateNews();
};
}
}
}
}

