var newsPageClass = 'page-item-26';
var newsParentClass = 'page-item-92';
// equal column height function
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

$(document).ready(function() {

	/* Accessible input values */
	$("input.propagate").each(function(){
	var $this = $(this);
	var val = $('label[for=' + $this.attr('id') + ']').html();
	if($this.val() == '') $this.val(val);
	$this.focus(function(){
	  if($this.val() == val) $this.val('');
	}).blur(function(){
	  if($this.val() == '') $this.val(val);
	});
	});

	if (($('li.current_page_item').length == 0)&&($('h1#home-header').length == 0)) {
			$('li.'+newsPageClass+',li.'+newsParentClass).addClass('current_page_item');
	}
	// add .after class to list item that follows the .current list item
	/*
	$("#navigation .current_page_item").next().addClass("after");
	$("#navigation .current_page_item").prev().addClass("before");
	$("#navigation .current_page_parent").next().addClass("after");
	$("#navigation .current_page_parent").prev().addClass("before");
	$("#navigation .current_page_ancestor").next().addClass("after");
	$("#navigation .current_page_ancestor").prev().addClass("before");
	$("#navigation ul li:first-child").addClass("first");
	$("#navigation ul li:last-child").addClass("last");*/


	$('div#nav > ul > li.current_page_item').next().addClass('after');
	$('div#nav > ul > li.current_page_item').prev().addClass('before');
	$('div#nav > ul > li:first-child').addClass('first');
	$('div#nav > ul > li:last-child').addClass('last');




	// equal heights
	equalHeight($(".column"));

	// last class for subnav
	$(".subnav ul li:last-child").addClass("last");

	// check homepage image
	if ($('#home-photo')) {
		$('#home-photo').fadeIn(3000);
//		$('#home-photo').show('slow');
//		$('#debug').append('.');
	}

});