//<![CDATA[
	jQuery(document).ready(function(){
	
	
		jQuery(".Sidebar .SearchInput").each(function()
		{
			var searchTxt = jQuery(this).val();
			
			if (searchTxt == "")
			{
				jQuery(this).val("Search").addClass("Blank");
			}
			else if (searchTxt == "Search")
			{
				jQuery(this).addClass("Blank");
			}
		}),
		
		jQuery(".EIR").each(function()
		{
			var bits = ["challenger", "lucy", ".com", "lucych", "allenger.com", "@"];
			jQuery(this).html("<a href=\"mailto:" + bits[1] + bits[5] + bits[1] + bits[0] + bits[2] + "\">" + bits[1] + bits[5] + bits[3] + bits[4] + "</a>");
		}),
		
		jQuery("a[href^='#']").click(function()
		{
			jQuery("html, body").animate({ scrollTop: jQuery(jQuery(this).attr("href")).addFade().offset().top - 100 }, 200);
		}),
		
		jQuery(".SearchForm").submit(function()
		{
			var searchTxt = jQuery(this).children(".SearchInput, .TextInput").val();
			return !(searchTxt == "Search" || searchTxt == "");
		}),	
		
		jQuery(".Sidebar .SearchInput").focus(function()
		{
			if (this.value == "Search")
			{
				this.value = "";
			}
			else
			{
				selectAll(this);
			}
			
			jQuery(this).removeClass("Blank");
		}),
		
		jQuery(".Sidebar .SearchInput").blur(function()
		{
			if (this.value == "" || this.value == "Search")
			{
				this.value = "Search";
				jQuery(this).addClass("Blank");
			}
		}),
		
		jQuery(".TextInput:text").focus(function()
		{
			selectAll(this);
		})
		
		
	});
	
	// Fade code from http://www.codylindley.com/blogstuff/js/jquery/
	function easeInOut(minValue,maxValue,totalSteps,actualStep,powr)
	{
		var delta = maxValue - minValue;
		var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
		return Math.ceil(stepp);
	}

	function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) 
	{
		if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
		var actStep = 0;
		elem.bgFadeInt = window.setInterval(
			function() {
				elem.style.backgroundColor = "rgb("+
					easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
					easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
					easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
				actStep++;
				if (actStep > steps) {
				elem.style.backgroundColor = finalColor;
				window.clearInterval(elem.bgFadeInt);
				}
			}
			,intervals)
	}
	
	function selectAll(ctl)
	{
		ctl.focus();
		ctl.select();
	}
//]]>
