function NewText()
{
	var txt = RndA(arySnowClones);
	var newword;
	
	var blnDone = false;
	while(!blnDone)
	{
		var word = "<span class='word'>" + RndA(aryWords) + "</span>";
		newtext = txt.replace(/\[\[X\]\]/,word);
		if (txt.length != newtext.length)
			txt = newtext;				
		else
			blnDone = true
	}
	
	$('txt').innerHTML = txt;
}

//return a random number from 1 up to and including intMax
function Rnd(intMax)
{
	return Rnd0(intMax)+1;
}

//return a random number from 0 up to and not including intMax
function Rnd0(intMax)
{
	return Math.floor(Math.random()*intMax);
}

//return a random array item
function RndA(ary)
{
 	return ary[Rnd0(ary.length)];
}

function transition()
{
  new Effect.Fade('txt', { queue: 'end', afterFinish: transition_afterfinish, duration: .2 } );
  return false;
}

function transition_afterfinish()
{
  NewText();
  new Effect.Appear('txt', { queue: 'end', duration: .2 } );
}

function addLoadEvent(func) 
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
  {
    window.onload = func;
  } 
  else 
  {
    window.onload = function() 
    {
      if (oldonload) 
      {
        oldonload();
      }
      func();
    }
  }
}

var arySnowClones;
var aryWords;
function initText()
{
	    arySnowClones = [
            "these aren't the [[X]] you are looking for",
            "all your [[X]] are belong to us",
            "that [[X]], he's not my kind of [[X]]",
            "In space, no one can hear you [[X]]",
            "have [[X]], will travel",
            "what happens in [[X]], stays in [[X]]",
            "EVERYBODY PANIC",
            "...wait, what?",
            "what is this [[X]] of which you speak?",
            "If it's wrong to [[X]], then I don't want to be right. ",
            "You can take the [[X]] out of the [[X]], but you can't take the [[X]] out of the [[X]].",
            "To [[X]], or not to [[X]]?",
            "The Decline and Fall of [[X]]",
            "[[X]] is a dish best served with [[X]].",
            "I [[X]] therefore I [[X]]",
            "[[X]] is the [[X]] of [[X]]",
            "The only good [[X]] is a dead [[X]]",
            "Lies, damned lies, and [[X]]",
            "Yes, Virginia, there is a(n) [[X]]",
            "The [[X]] to end all [[X]]s.",
            "The Care and Feeding of [[X]]",
            "[[X]] for fun and profit",
            "you can take my [[X]] but dont take my [[X]]",
            "[[X]] is the greatest thing since [[X]].",
            "[[X]] is to [[X]] like [[X]] is to [[X]]."
            ];
            
        aryWords = [
        	"ruby on rails",
        	"photoshop",
        	"css",
        	"html",
        	"https",
        	"community",
        	"web 2.0",
        	"itv",
        	"dot net",
        	"php",
        	"twitter",
        	"facebook",
        	"API",
        	"web 3.0",
 	       	"CDN",
	       	"AJAX",
       		"w3c strict"
        ];            
}
addLoadEvent(initText);
addLoadEvent(NewText);