$(document).ready(function(){
	
	$('.home-feature-inner-on').hide();
	
	// Fade in "ready" state for each row (staggered)
	/* 5.26.10 cm changing load times for features, making them faster.
	theses are the original times: 1=3000 2=3500 3=4000 4= 4500 */
	/* these are the times for revision 2: 1000 1500 2000 2500 */
	setTimeout( function() {
      	$('#home-row1 .home-feature-inner-ready').fadeIn(500);
		$('#home-row1 .home-row-text').fadeIn(500);
	}, 500);
	setTimeout( function() {
		$('#home-row2 .home-feature-inner-ready').fadeIn(500);
		$('#home-row2 .home-row-text').fadeIn(500);
	}, 1000);
	setTimeout( function() {
      	$('#home-row3 .home-feature-inner-ready').fadeIn(500);
		$('#home-row3 .home-row-text').fadeIn(500);
		$('#home-row4 .home-row-text').fadeOut(500, function() {
			$('#home-row4 .home-row-text').addClass('home-row-text-extra');
		});
	}, 1500);
	setTimeout( function() {
      	$('#home-row4 .home-feature-inner-ready').fadeIn(500);
		$('#home-row4 .home-row-text').fadeIn(500);
	}, 2000);
	setTimeout( function() {
      	$('#home-row4 #quote').fadeTo(500,1);
	}, 2500);
	
	
	// Rollovers
	$.fn.featureHover = function() {
		$(this).hover(
			function() {
				$(this).find(".home-feature-inner-on:not('.busy')").fadeIn(200, function() {
					$(this).addClass('busy');
				});
			},
			function() {
				$(this).find('.home-feature-inner-on').fadeOut(200, function() {
					$(this).removeClass('busy');
				});
				$(this).find('.home-feature-inner-ready').show();
			}
		);
	}
	
		
	// Rollovers, etc.
	
  $(".home-row .home-feature").each( function() {
   $(this).featureHover();
  });
	
	$("#home-row1").find("a").css("padding-left", "743px");
  $("#home-row2").find("a").css("padding-right", "598px");
  $("#home-row3").find("a").css("padding-left", "960px");
  
	// ACTIVATED ROLLOVERS ON ENTIRE STRIPE
  // $(".home-row:not('#home-row4')").each( function() {
  //  $(this).featureHover();
  // });
  // 
  // $("#home-row4 .home-feature").each( function() {
  //  $(this).featureHover();
  // });

	
	// This fixes a bug in IE whereby z-index applied to links rendered as blocks is ignored
	$('.home-feature').click( function() {
		var link = $(this).find('a').attr('href');
		window.location.href = link;
	});
	
	
	// REINFORCED ITEM ROLLOVER WHEN ORIGINAL ROLLOVER STATE WAS INITIATED ON STRIPE
  // $('.home-feature').hover(
  //  function() {
  //    $(this).find('.home-feature-inner-on').addClass('dark');
  //  },
  //  function() {
  //    $(this).find('.home-feature-inner-on').removeClass('dark');
  //  }
  // );
	
});
