var delay2 = 1700; //set delay between message change (in miliseconds)
var maxsteps2=30; // number of steps to take to change from start color to endcolor
var stepdelay2=25; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor2= new Array(255,255,255); // start color (red, green, blue)
var endcolor2=new Array(0,0,0); // end color (red, green, blue)

var fcontent2=new Array();
begintag2='<div style="padding: 0px; padding-top:8px; text-align:center; margin:0px;" class="anim_text2">'; //set opening tag, such as font declarations
fcontent2[0]="<a href='http://www.avagmah.in/BBA-Register.asp'>BBA (Global)</a>";
fcontent2[1]="<a href='http://www.avagmah.in/BBA-Register.asp'>Click here to Enroll Now</a>";
closetag2='</div>';

var fwidth2='100px'; //set scroller width
var fheight2='38px'; //set scroller height

var fadelinks2=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////

var ie42=document.all&&!document.getElementById;
var DOM22=document.getElementById;
var faderdelay2=0;
var index2=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent2(){
  if (index2>=fcontent2.length)
    index2=0
  if (DOM22){
    document.getElementById("fscroller2").style.color="rgb("+startcolor2[0]+", "+startcolor2[1]+", "+startcolor2[2]+")"
    document.getElementById("fscroller2").innerHTML=begintag2+fcontent2[index2]+closetag2
    if (fadelinks2)
      linkcolorchange2(1);
    colorfade2(1, 15);
  }
  else if (ie42)
    document.all.fscroller2.innerHTML=begintag2+fcontent2[index2]+closetag2;
  index2++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange2(step2){
  var obj2=document.getElementById("fscroller2").getElementsByTagName("A");
  if (obj2.length>0){
    for (i=0;i<obj2.length;i++)
      obj2[i].style.color=getstepcolor2(step2);
  }
}

/*Rafael Raposo edited function*/
var fadecounter2;
function colorfade2(step2) {
  if(step2<=maxsteps2) {	
    document.getElementById("fscroller2").style.color=getstepcolor2(step2);
    if (fadelinks2)
      linkcolorchange2(step2);
    step2++;
    fadecounter2=setTimeout("colorfade2("+step2+")",stepdelay2);
  }else{
    clearTimeout(fadecounter2);
    document.getElementById("fscroller2").style.color="rgb("+endcolor2[0]+", "+endcolor2[1]+", "+endcolor2[2]+")";
    setTimeout("changecontent2()", delay2);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor2(step2) {
  var diff2
  var newcolor2=new Array(3);
  for(var i=0;i<3;i++) {
    diff2 = (startcolor2[i]-endcolor2[i]);
    if(diff2 > 0) {
      newcolor2[i] = startcolor2[i]-(Math.round((diff2/maxsteps2))*step2);
    } else {
      newcolor2[i] = startcolor2[i]+(Math.round((Math.abs(diff2)/maxsteps2))*step2);
    }
  }
  return ("rgb(" + newcolor2[0] + ", " + newcolor2[1] + ", " + newcolor2[2] + ")");
}

if (ie42||DOM22)
  document.write('<div id="fscroller2" style="border:0px solid black;width:'+fwidth2+';height:'+fheight2+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent2, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent2)
else if (document.getElementById)
window.onload=changecontent2
