var val=100;
var opac='';
var obj;
var arrFadeContent = new Array();
var arrFadeCursor=0;
var arrFadeMax = 0;


function fading_init(){
arrFadeMax = arrFadeContent.length-1;

obj=document.getElementById("newsticker");

setFadeContent();
//arrFadeCursor++;
if(typeof(obj.style.MozOpacity)=='string')opac='moz';
else if(typeof(obj.style.opacity)=='string')opac='css3';
else if(typeof(obj.style.filter)=='string')opac='ie';
if(opac!='')setTimeout('fade()',5);
}

function setFadeContent() {
  
  if (obj) obj.innerHTML = arrFadeContent[arrFadeCursor];
}

function fade(){

val2=Math.round(val);

if(opac=='css3')obj.style.opacity=val2/100;
if(opac=='ie')obj.style.filter='alpha(opacity='+val2+')'; 
if(opac=='moz')obj.style.MozOpacity=parseFloat(obj.style.MozOpacity)+val2/100;

obj.style.opacity=val2/100;
val-=0.5;
 

if (val>0) {       
  setTimeout('fade()',2);
} else {
  setTimeout('fadeout()',2);
  arrFadeCursor++;
  setFadeContent();
  

  if (arrFadeCursor>arrFadeMax) {
    arrFadeCursor=0;
    setFadeContent();
  }
  
}
}

function fadeout() {
val2=Math.round(val);
if(opac=='css3')obj.style.opacity=val2/100;
if(opac=='ie')obj.style.filter='alpha(opacity='+val2+')';
if(opac=='moz')obj.style.MozOpacity=val2/100;

obj.style.opacity=val2/100;
val+=0.5;


if (val<100) {     
  setTimeout('fadeout()',5);
} else {
  setTimeout('fade()',5);
}

}
