// If JavaScript is enabled, hide the body until the script which scrolls the
// body into view begins.
document.write('<style type="text/css">#body-wrap{overflow:hidden;height:1px;'
	+ 'visibility:hidden;}</style>');

// 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 += 10);
  $("#head-bg").setCSS("background-color", bg);
	$("#headCell").setCSS("color", bg.getSafeColor());
  if(runBGFader.percent > 100)
  {
    runBGFader.percent = 0;
    runBGFader.start = runBGFader.end;
		do
		{
			runBGFader.end = Color.random();
		} while(Math.abs(runBGFader.end.getLuminance()
			- runBGFader.start.getLuminance()) < 85);
		setTimeout("runBGFader()", 2000);
  }
	else
		setTimeout("runBGFader()", 100);
}

// Make sure the translucent PNGs are displayed correctly.
(function(){
	var code = '<style type="text/css">#head-bg{<PRE-PNG>http://gotochriswest.com'
		+ '/images/gradients/white2none2black-down.png<POST-PNG>}#head-fade-bg{<PRE'
		+ '-PNG>http://gotochriswest.com/images/gradients/black2none-down.png<POST-'
		+ 'PNG>;}</style>';
	var old = (JX.browser == "Internet Explorer" && JX.browserVersion < 7);
	document.write(code.replace(/<PRE-PNG>/g, old ? 'filter:progid:DXImageTransfo'
		+ 'rm.Microsoft.AlphaImageLoader(src="' : 'background-image:url("')
		.replace(/<POST-PNG>/g, old ? '",sizingMethod="scale")' : '")'));
})();

$(window).bind("load", function()
{
	// Change all occurrences of "Save Target As..." to the correct phrase for the
	// user's browser.
	$(".saveAs").setText({"Internet Explorer" : "Save Target As...",
		"Firefox" : "Save Link As...",
		"Safari" : "Download Linked File As..."}[JX.browser]
		|| "Save Target As...");
});