
// This script is to create fade-out text effect. 
// InsiteCreation authoring
var texts = new Array("<font color='{col}'>\"The safe way to double your money is to fold it over once and put it in your pocket.\"<small>  ~Frank Hubbard</small></font>",
"<font color='{col}'>\"My problem lies in reconciling my gross habits with my net income.\"<small>  ~Errol Flynn</small></font>",
"<font color='{col}'>\"I am opposed to millionaires, but it would be dangerous to offer me the position.\"<small>  ~Mark Twain</small></font>",
"<font color='{col}'>\"After a visit to the beach, it's hard to believe that we live in a material world.\"<small>  ~Pam Shaw</small></font>",
"<font color='{col}'>\"The real measure of your wealth is how much you'd be worth if you lost all your money.\"<small>  ~Author Unknown</small></font>",
"<font color='{col}'>\"I'd like to live as a poor man with lots of money.\"<small>  ~Pablo Picasso</small></font>",
"<font color='{col}'>\"Waste your money and you're only out of money, but waste your time and you've lost a part of your life. \"<small> ~Michael Leboeuf</small></font>",
"<font color='{col}'>\"There are people who have money and people who are rich.\"<small>  ~Coco Chanel</small></font>",
"<font color='{col}'>\"Inflation is when you pay fifteen dollars for the ten-dollar haircut you used to get for five dollars when you had hair.\"<small>  ~Sam Ewing</small></font>",
"<font color='{col}'>\"A bank is a place that will lend you money if you can prove that you don't need it.\"<small>  ~Bob Hope</small></font>",
"<font color='{col}'>\"Budget: a mathematical confirmation of your suspicions.\"<small>  ~A.A. Latimer</small></font>",
"<font color='{col}'>\"Money is like manure.  You have to spread it around or it smells.\"<small>  ~J. Paul Getty</small></font>",
"<font color='{col}'>\"We live by the Golden Rule.  Those who have the gold make the rules.\"<small>  ~Buzzie Bavasi</small></font>",
"<font color='{col}'>\"When I was young I thought that money was the most important thing in life; now that I am old I know that it is.\"<small>  ~Oscar Wilde</small></font>",
"<font color='{col}'>\"If inflation continues to soar, you're going to have to work like a dog just to live like one.\"<small>  ~George Gobel</small></font>",
"<font color='{col}'>\"In the old days a man who saved money was a miser; nowadays he's a wonder.\"<small>  ~Author Unknown</small></font>",
"<font color='{col}'>\"Inflation is taxation without legislation.\"<small>  ~Milton Friedman</small></font>",
"<font color='{col}'>\"I finance your future, not your past...\"</font>");


var bgcolor = "#A8DADB";
var fcolor = "#000000";
var steps = 20;
var show = 10000;
var sleep = 300;
var loop = true;

var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = 0;
var step = 1;
var text = Math.round(16*Math.random());

function fade() {
    
    var text_out = texts[text].replace("{col}", colors[color]);

	if (document.all) fader.innerHTML = text_out;
	if (document.layers) { document.fader.document.write(text_out); document.fader.document.close(); }
	if(!document.all && document.getElementById){
			  document.fader.document.write(text_out); document.fader.document.close(); 
			}


color += step;

if (color >= colors.length-1) {
step = -1;

if (!loop && text >= texts.length-1) return;
}

if (color == 0) {
step = 1;

text += 1;
if (text == texts.length) text = 0;
}

setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50)); 
}

function getFadeColors(ColorA, ColorB, Colors) {
len = Colors.length;

if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));

var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);

for (i = 0; i < len-1; i++) {
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB;
}

function IntToHex(n) {
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}

function HexToInt(hex) {
return parseInt(hex, 16);
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
