(function($){
	$.fn.equalHeight = function() {
		tallest = 0;
		this.each(function(){
			thisHeight = $(this).height();
			if( thisHeight > tallest)
				tallest = thisHeight;

		});
		this.each(function(){
			$(this).height(tallest);
		});
	}
})(jQuery);

$(document).ready(function(){


//STORIES CAROUSEL
	$("#storiescarousel").jcarousel({
		scroll: 1
    });
    
//FORMS
	$("#contactForm").validate();
	$("#newsletterForm").validate();
	$("#petitionForm").validate();

// THUMB HOVER
	$(".module.imgblock img, #storiescarousel img").hover(function(){
		$(this).fadeTo("fast", 0.7); // mouseover
	},function(){
		$(this).fadeTo("slow", 1.0); // mouseout
	});
	
// SET ACTIVE MENUS
	$("#lnav li a").each(function() {
		if(this.href == window.location.href.split("#")[0]) {
			$(this).addClass("active");
			$(this).parents("li:last").addClass("current");
		}
	});
		
// ADD CLASSES
	$("li:first-child,dl:first-child").addClass("first");
	$("li:last-child,dl:first-child").addClass("last");
	$(".clippingimage img").addClass("reflect");
	
	$("hr").replaceWith("<div class=\"hr\"></div>");
    
	$(".airfieldmore h3").prepend("<span>&#47;&#47;</span>  ");
	
// REFLECT
	if (document.location.href.indexOf("/press.php") > -1) {
		$('img.reflect').reflect();
	}
	else if (document.location.href.indexOf("/press-archive-2008/") > -1) {
		$('img.reflect').reflect();
	}
		
$("#lnav li.current ul li a").prepend("// ");
//$("#lnav li a.subnav-sel:not(li li a)").prepend("&#8744; ");	
	
// SET ACTIVE
	var path = location.pathname.substring(1).toLowerCase();
		
		if(path.search('news/') > -1){
			$("#lnav li:eq(12)").addClass("current");
		}
		else if(path.search('memorials/') > -1){
			$("#lnav li:eq(9)").addClass("current");
		}
		
// SET TALLEST
	$('.nheadlines li').equalHeight();
	
});
// END JQUERY