var delay_fd = 9000; //set delay between message change (in miliseconds)
var maxsteps_fd=50; // number of steps to take to change from start color to endcolor
var stepdelay_fd=20; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor_fd= new Array(190,199,232); // start color (red, green, blue)
var endcolor_fd=new Array(51,51,102); // end color (red, green, blue)

var fcontent_fd=new Array();
begintag_fd='<div style="font: normal 18px Arial; padding-top: 10px; padding-left: 20px">'; //set opening tag, such as font declarations
fcontent_fd[0]="<b>&quot;Few people are capable of expressing with equanimity opinions which differ from the prejudices of their social environment.&quot;</b><br><br>-Albert Einstein"
fcontent_fd[1]="<b>&quot;When Qomolangma becomes the only word for people all over the world to refer to the highest peak on Earth, I, as a Tibetan, will feel very contented.&quot;</b><br><br>-Gelek"
fcontent_fd[2]="<b>&quot;It's forgivable for Westerners to call the peak Everest because of their ignorance of its Tibetan name, but now so many years have passed and it is time for them to correct their mistake.&quot;</b><br><br>-Xu Tiebing"
fcontent_fd[3]="<b>&quot;A fool despises good counsel, but a wise man takes it to heart.&quot;</b><br><br>-Confucious"
fcontent_fd[4]="<b>&quot;We don't come to know Qomolangma by learning, but she comes to us. She is in every Tibetan's heart and the stories about the goddess are passed down to us as part of Tibetan heritage.&quot;</b><br><br>-Daqung"
fcontent_fd[5]="<b>&quot;In an era when colonialism has long been past, it is high time for the Western world to respect us Tibetans by recognizing the highest peak on earth in its Tibetan name, Qomolangma&quot;</b><br><br>-Gelek"
fcontent_fd[6]="<b>&quot;No civilized society can thrive upon victims, whose humanity has been permanently mutilated.&quot;</b><br><br>-Rabindranath Tagore"
fcontent_fd[7]="<b>&quot;I was taught by my respected chief and predecessor, Colonel Sir George Everest, to assign to every geographical object its true local or native appellation.&quot;</b><br><br>-Sir Andrew Waugh"
closetag='</div>';

var fwidth_fd='400px'; //set scroller width
var fheight_fd='120px'; //set scroller height

var fadelinks_fd=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_fd=document.all&&!document.getElementById;
var DOM2_fd=document.getElementById;
var faderdelay_fd=0;
var index_fd=Math.floor(Math.random()*fcontent_fd.length);

/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
	if (index_fd>=fcontent_fd.length)
		index_fd=0
	if (DOM2_fd){
		document.getElementById("fscroller").style.color="rgb("+startcolor_fd[0]+", "+startcolor_fd[1]+", "+startcolor_fd[2]+")"
		document.getElementById("fscroller").innerHTML=begintag_fd+fcontent_fd[index_fd]+closetag
		if (fadelinks_fd)
			linkcolorchange(1);
		colorfade(1, 15);
	}
	else if (ie4_fd)
		document.all.fscroller.innerHTML=begintag_fd+fcontent_fd[index_fd]+closetag;
	index_fd++
}

// 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_fd) {	
		document.getElementById("fscroller").style.color=getstepcolor(step);
		if (fadelinks_fd)
			linkcolorchange(step);
		step++;
		fadecounter=setTimeout("colorfade("+step+")",stepdelay_fd);
	}else{
		clearTimeout(fadecounter);
		document.getElementById("fscroller").style.color="rgb("+endcolor_fd[0]+", "+endcolor_fd[1]+", "+endcolor_fd[2]+")";
		setTimeout("changecontent()", delay_fd);
	
	}	 
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
	var diff
	var newcolor=new Array(3);
	for(var i=0;i<3;i++) {
		diff = (startcolor_fd[i]-endcolor_fd[i]);
		if(diff > 0) {
			newcolor[i] = startcolor_fd[i]-(Math.round((diff/maxsteps_fd))*step);
		} else {
			newcolor[i] = startcolor_fd[i]+(Math.round((Math.abs(diff)/maxsteps_fd))*step);
		}
	}
	return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4_fd||DOM2_fd)
	document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth_fd+';height:'+fheight_fd+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent