
var delay = 2000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<strong>Do book your travel and accommodation in Tirumala through TTD in advance...</strong>";
fcontent[1]="<strong>Don't carry too much jewellery or cash with you..</strong>";
fcontent[2]="<strong>Do pay obeisance to your Ishta Daivam or Kula Daivam before you start for Tirumala...</strong>";
fcontent[3]="<strong>Don't eat non-vegetarian food. Don't consume liquor or other intoxicants...</strong>";
fcontent[4]="<strong>Do bathe in the Pushkarini and worship Sri Varahaswami in His temple before you worship Lord Sri Venkateswara...</strong>";
fcontent[5]="<strong>Don't approach strangers for accommodation...</strong>";
fcontent[6]="<strong>Do bathe and wear clean clothes before you enter the temple...</strong>";
fcontent[7]="<strong>Don't wear footwear, or move around in a vehicle, in and around the premises of the temple...</strong>";
fcontent[8]="<strong>Do observe absolute silence inside the temple and chant Om Sri Venkatesaya Namah to yourself...</strong>";

fcontent[9]="<strong>Don't rush in for darshan, but move along in the queue...</strong>";
fcontent[10]="<strong>Do respect ancient customs while at Tirumala...</strong>";
fcontent[11]="<strong>Do respect and promote religious sentiments among co-pilgrims...</strong>";
fcontent[12]="<strong>Do deposit your offerings in the hundi only...</strong>";
fcontent[13]="<strong>Do contact any of the Tirumala Tirupati Devasthanams Enquiry Offices for information regarding the temple and your worship there...</strong>";
fcontent[14]="<strong>Do pradakshinam (keeping the shrine to your right) with devotion before entering the temple...</strong>";
fcontent[15]="<strong>Do wear a tilak in accordance with your religious affiliation...</strong>";
fcontent[16]="<strong>Do follow the procedures of the temple and wait for your turn for the darshan of the Lord...</strong>";
fcontent[17]="<strong>Don't buy spurious prasadam from street vendors...</strong>";

fcontent[18]="<strong>Don't throw away the prasadam and teertham given to you at the temple...</strong>";
fcontent[19]="<strong>Don't enter the temple, if, according to custom or usage, you are prohibited to enter...</strong>";
fcontent[20]="<strong>Don't wear flowers and garlands in Tirumala; all flowers are for the Lord only...</strong>";
fcontent[21]="<strong>Don't encourage beggars...</strong>";
fcontent[22]="<strong>Don't spit or be a nuisance inside the temple premises..</strong>";
fcontent[23]="<strong>Don't enter the shrine naked or wearing only a loin-cloth...</strong>";
fcontent[24]="<strong>Don't wear any head guards like helmets, caps, turbans and hats inside the temple premises...</strong>";
fcontent[25]="<strong>Don't carry any weapon inside the temple...</strong>";
fcontent[26]="<strong>Don't eat food brought from outside or chew betel leaves in the temple premises...</strong>";

fcontent[27]="<strong>Don't evacuate urine or motion or spit in the premises of the temple...</strong>";
fcontent[28]="<strong>Don't sleep in the temple premises...</strong>";
fcontent[29]="<strong>Don't commit any act of violence or harshness in the temple premises...</strong>";
fcontent[30]="<strong>Don't quarrel in the temple premises...</strong>";
fcontent[31]="<strong>Don't talk about your wealth, money and status...</strong>";
fcontent[32]="<strong>Don't sit with your back facing the Deity...</strong>";
fcontent[33]="<strong>Don't pay obeisance with only one hand...</strong>";
closetag='</div>';

var fwidth='700px'; //set scroller width
var fheight='30px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length)
    index=0
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
    colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
  document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent



