jQuery("html").addClass('enhanced');

jQuery.fn.equalHeights = function(px) {
	jQuery(this).each(function(){
		var currentTallest = 0;
		jQuery(this).children().each(function(i){
			if (jQuery(this).height() > currentTallest) { currentTallest = jQuery(this).height(); }
		});
		// for ie6, set height since min-height isn't supported
		if (jQuery.browser.msie && jQuery.browser.version == 6.0) { jQuery(this).children().css({'height': currentTallest}); }
		jQuery(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};


jQuery(document).ready(function($) {

	var animRate = 300;
	
	// menu fadein/fadeout animation
	
	$("#menu a").hover(function() {
		$(this).removeAttr("title").css('opacity', '0').stop().animate({opacity:1}, animRate);
	}, function() {
		$(this).stop().animate({opacity:0}, animRate);
	});
	
	/* ensure that the orange area on content pages covers properly. 
	*  Will work properly with CSS alone between 800 and 1920 window widths,
	*  but a little bulletproof-ness never hurt anyone.
	*/
	
	$.fn.correctRight = function() {
		var stretchRightOffset = jQuery("#wrapper").offset().left;
		var stretchRightWidth = stretchRightOffset + jQuery("#pullquote-outer").width() - 10;
		if (stretchRightWidth <= jQuery("#pullquote-outer").width() ) {
				stretchRightWidth = 0;
		}
		var $stretchRight = jQuery("body.page #stretch .right");

		$stretchRight.width(stretchRightWidth);
	};
	
	$("body.page").correctRight();
	
	$(window).bind("resize", function(){
		$("body.page").correctRight();
	} );
	
	$("#promo").equalHeights();
	
});

