var speed = 20;
var delay = 5000;
var stub = 0;
var action = 0;
var timerID;
/*
var message = new Array()
message[0] = "";
message[1] = "<br />RECENT ACHIEVEMENTS OF PROPHYLACTIC MEDICINE<br /><a href='Product.aspx?storyid=1'><img src='images/right_red.gif' border='0' /><font color='#3366aa'> DR. REDOX RUG </font><img src='images/left_red.gif' border='0' /></a>";
message[2] = "<a href='Product.aspx?storyid=1' class='label6'><img src='images/right_red.gif' border='0' /> DR. REDOX RUG <img src='images/left_red.gif' border='0' /></a> <br />is an effective painkiller by backaches.";
message[3] = "<a href='Product.aspx?storyid=1' class='label6'><img src='images/right_red.gif' border='0' /> DR. REDOX RUG <img src='images/left_red.gif' border='0' /></a> <br />helps to get rid of excessive weight and increases the efficiency of special diets.";
message[4] = "<a href='Product.aspx?storyid=1' class='label6'><img src='images/right_red.gif' border='0' /> DR. REDOX RUG <img src='images/left_red.gif' border='0' /></a> <br />increases physical and adaptation abilities of the organism";
*/

var fadeA = new Array()
fadeA[0] = new Array(0,0);
fadeA[1] = new Array(100,1);


onload = init
function init()
{
 txt1 = document.getElementById("text1");
 txt2 = document.getElementById("text2");
 replay();
}

var ie=(document.all && document.getElementById);
var ns=(!document.all && document.getElementById);

function changetext()
{
 stub++;
 if (stub == message.length) stub=1;
 if (action == 0)
 {
  action = 1;
  txt1.innerHTML = message[stub];
  fade(1,0);
 }
 else
 {
  action = 0;
  txt2.innerHTML = message[stub];
  fade(0,1);
 }
}

function replay()
{
  if (timerID != "") clearTimeout(timerID);
  fadeA[0][0] = 0;
  fadeA[1][0] = 100;
  stub = 0
  changetext();
}


function fade(inc,outc)
{
 if (fadeA[outc][0] < 100)
 {
  fadeA[outc][0]++;
  fadeA[inc][0]--;
  opacity = fadeA[outc][0];
  opacity2 = fadeA[inc][0];
  if(inc == 1)
  {
   obj = txt1 
   obj2 = txt2
  }
  else
  {
   obj = txt2
   obj2 = txt1
  } 
  if(ie){ 
	obj.style.filter="alpha(opacity="+fadeA[outc][0]+")";
	obj2.style.filter="alpha(opacity="+fadeA[inc][0]+")";
    }
  if(ns){ 
   	obj.style.MozOpacity = fadeA[outc][0] + '%';
   	obj2.style.MozOpacity = fadeA[inc][0] + '%';
   }
   
  timerID = setTimeout("fade("+inc+","+outc+")",speed);
 }
 else
 {
  timerID = setTimeout("changetext()",delay);
 }
}