/***********************************************
* Fading Ticker Tape Script- ? Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//default speed is 4.5 seconds, Change that as desired
var speed	= 8000
var news	= new Array()

news[0] = "<p>People are often unreasonable, illogical and self-centered;</p><p>Forgive them anyway.</p><p>&nbsp;</p><p>人们经常是不讲道理的、没有逻辑的和以自我为中心的；</p><p>不管怎样，你要原谅他们。</p>"
news[1] = "<p>If you are kind, people may accuse you of selfish, ulterior motives;</p><p>Be kind anyway.</p><p>&nbsp;</p><p>即使你是友善的，人们可能还是会说你自私和动机不良；</p><p>不管怎样，你还是要友善。</p>"
news[2] = "<p>If you are successful, you will win some false friends and some true enemies;</p><p>Succeed anyway.</p><p>&nbsp;</p><p>当你功成名就，你会有一些虚假的朋友和一些真实的敌人；</p><p>不管怎样，你还是要取得成功。</p>"
news[3] = "<p>If you are honest and frank, people may cheat you;</p><p>Be honest and frank anyway.</p><p>&nbsp;</p><p>即使你是诚实的和率直的，人们可能还是会欺骗你；</p><p>不管怎样，你还是要诚实和率直。</p>"
news[4] = "<p>What you spend years building, Someone could destroy overnight;</p><p>Build anyway.</p><p>&nbsp;</p><p>你多年来营造的东西，有人在一夜之间把它摧毁；</p><p>不管怎样，你还是要去营造。</p>"
news[5] = "<p>If you find serenity and happiness, they may be jealous;</p><p>Be happy anyway.</p><p>&nbsp;</p><p>如果你找到了平静和幸福，他们可能会嫉妒你；</p><p>不管怎样，你还是要快乐。</p>"
news[6] = "<p>The good you do today, people will often forget tomorrow;</p><p>Be good anyway.</p><p>&nbsp;</p><p>你今天做的善事，人们往往明天就会忘记；</p><p>不管怎样，你还是要做善事。</p>"
news[7] = "<p>Give the world the best you have, And it may never be enough;</p><p>Give the world the best you have anyway.</p><p>&nbsp;</p><p>即使把你最好的东西给了这个世界，也许这些东西永远都不够；</p><p>不管怎样，把你最好的东西给这个世界。</p>"
news[8] = "<p>You see, in the final analysis, it is between you and God;</p><p>It is never between you and them anyway.</p><p>&nbsp;</p><p>你看，说到底，它是你和上帝之间的事；</p><p>而决不是你和他人之间的事。</p>"

shown = new Array(news.length);
for (var x = 0; x < news.length; x++)
{
	shown[x] = 0
}

var hex= 0

var ie=document.all
var ns6=document.getElementById
var ns4=document.layers

tickerobject=ie? subtickertape: document.getElementById("subtickertape")

function regenerate()
{
	window.location.reload()
}

function regenerate2()
{
	if (document.layers)
		setTimeout("window.onresize=regenerate",450)
}

function bgcolorfadeIn()
{
	if(hex < 255)
	{
		tickerobject.style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
		hex= hex+4
		setTimeout("bgcolorfadeIn()",20);
	}
	else
	{
		hex=255
		tickerobject.style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
	}
}

var nextquote = 0

function bgcolorfadeOut()
{
	if(hex > 30)
	{
		tickerobject.style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
		hex= hex-4
		setTimeout("bgcolorfadeOut()",20);
	}
	else
	{
		hex = 26
		tickerobject.style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
		var lastquote = nextquote;

		nextquote = Math.floor(Math.random() * news.length);

		var count = 0;
		while (shown[nextquote] > 0)
		{
			count++;
			nextquote = Math.floor(Math.random() * news.length);
			if (count > 50)
			{
				for (var x = 0; x < news.length; x++)
				{
					shown[x] = 0
				}
				shown[lastquote] = 1;
			}
		}

		tickerobject.innerHTML=news[nextquote]
		shown[nextquote] = 1
		setTimeout("bgcolorfadeIn()",speed * .2)
		setTimeout("updatecontent()",speed)
	}
}

function updatecontent()
{
  bgcolorfadeOut()
}

regenerate2();
updatecontent();
