var fadeIn = true;
var curText = 0;

function fadetext(opacity_value) 
{
  var element = document.getElementById("fader");
  element.innerHTML = texts[curText];
  
  if (opacity_value > 100)
  {
    fadeIn = false;
  }

  if (opacity_value < 0)
  {
    if (curText < texts.length-1)
      curText = curText + 1;
    else
      curText = 0;
 
    fadeIn = true;
  }
      
  if (fadeIn)
    opacity_value = opacity_value + 2;
  else
    opacity_value = opacity_value - 2;
	
  if (element.filters) 
  {  //For IE
    try 
    {
      element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity_value;
    } 
    catch (e) 
    { 
      // If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
      element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+opacity_value+')';
    }
  } 
  else 
  {
    var opc = (opacity_value/100);
    element.style.opacity = opc;
    element.style.MozOpacity = opc;  //This is for older Mozilla Browsers
  }

  setTimeout("fadetext("+opacity_value+")",100);
}
