$(document).ready(function() {
	//Equal columns
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest);
		});
	}
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
	    var args_len = arguments.length;
	    for (var i = args_len; i--;) {
	      var cacheImage = document.createElement('img');
	      cacheImage.src = arguments[i];
	      cache.push(cacheImage);
	    }
	  }
	/*****************************
	HOMEPAGE CODE
	*****************************/
	//Promo Bar
	$("#homePromoBar").toggle(
		function(){
			$("#homePromoLayer").slideDown(300);
			$(this).addClass('active');
		},
		function(){
			$("#homePromoLayer").slideUp(300);
			$(this).removeClass('active');
		}
	);
	
	$(window).load(function(){
		var t = setTimeout(animateBox, 400);
		$("h4").click(function(){
			$("#funnelNav").css("webkitTransform", "scale(1)");
		});
		
		function animateBox(){
			$("#funnelNav").show("scale", {scale: "both"}, 500, function(){
				
			});
			$("#funnelNav a").show("scale", {scale: "both"}, 500, function(){
				$(this).css('display', 'block');
			});
			clearTimeout(t);
		}
		$(".homeContentBlock").equalHeights();
	});
		
	$(".homeContentBlock:first").css('border', 'none');
	$("#utilityNav li:first").css({backgroundPosition: '0 0', marginLeft: '-10px'});
	$("#utilityNav li:first a").css("border", "none");

	/*****************************
	MISCELLANEOUS 
	*****************************/
	//Fade Buttons
	$(".btnFade").hover(function() {
		$(this).children("span").stop().animate({opacity: "1"}, 250);
	}, function() {
		$(this).children("span").stop().animate({opacity: "0"}, 250);
	});
});

