// Change the background so that it is closer to the second random color.
// If it becomes the second random color, create a new color.
function runBGFader()
{
  var bg = runBGFader.start.combine(runBGFader.end, runBGFader.percent += 5);
  $("body").setCSS("background-color", bg);
  if(runBGFader.percent > 100)
  {
    runBGFader.percent = 0;
    runBGFader.start = runBGFader.end;
    runBGFader.end = Color.random();
  }
  setTimeout("runBGFader()", 100);
}

// Create the first two random colors and then start the fader.
JX.set(runBGFader, {start :  new Color("#FFF"), end : new Color("#06C"),
	percent : 0});
runBGFader();

// Make sure the PNG shows up correctly.
(function()
{
	var code = '<style type="text/css">#head-fade-bg{';
	var src = "http://jxtension.gotochriswest.com/images/black2none-down.png";
	if(JX.browser == "Internet Explorer" && JX.browserVersion < 7)
		code += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'
			+ src + '", sizingMethod="scale");';
	else
		code += 'background-image:url("' + src + '")';
	document.write(code + '}</style>');
})();