

var distributeHoriz = function(listId) {
	var totalItemWidth = 0;
	var totalItemCount = 0;
	//CALCULATE WIDTH OF THE UL
	var listWidth = $(listId).width();
	//alert(listWidth);
	//COUNT THE NUMBER OF LIST ITEMS & ADD UP THEIR TOTAL WIDTH
	$(listId + " > li").each(function (i) {
		var thisWidth = $(this).width();
		
		totalItemWidth += thisWidth;
		totalItemCount ++;
    });
	//FIGURE OUT THE AMOUNT OF SPACE WE HAVE TO PLAY WITH
	var gap = (listWidth - totalItemWidth) / (totalItemCount - 1);
	gap = gap / 2;
	
	var remainder = (gap - Math.floor(gap)) * 2 * (totalItemCount - 1);
	remainder = Math.floor(remainder);
	//alert(remainder);
	gap = Math.floor(gap) - 1;
	
	//APPLY A NEW MARGIN TO EVERY LIST ITEM
	$(listId + " > li").each(function (i) {
		var thisGap = gap;
		if(remainder > 1) {
			thisGap += 2;
			remainder -=2;
		} else if(remainder > 0) {
			thisGap += 1;
			remainder -=1;
		}
		$(this).css({'padding-right' : thisGap + "px", 'padding-left' : thisGap + 1 + "px", 'margin-right' : '0px'});
    });
	//TAKE OFF THE LEFT MARGIN OF THE FIRST LIST ITEM
	$(listId + " li:first-child").css({'padding-left' : '0px'});
	//TAKE OFF THE MARGIN OF THE LAST LIST ITEM
	$(listId + " li:last-child").css({'padding-right' : '0px', 'border-right' : 'none', 'margin-right' : '0px', 'margin-left' : '0px'});
}



$(document).ready(function() {
	
	//distributeHoriz("#nav");
	$('.panel p:empty').remove();
	
	$('.panel p').each(function() {
            if ($(this).html() == "" || $(this).html() == "&nbsp;"){
                $(this).remove();
            }
    });

	// -------------------------
	// Open new window for external link urls	
	// -------------------------
	
	$('.panel a[href^="http://"]').attr({
	    target: "_blank", 
	    title: "Opens in a new window"
	});

	$(".panel a[href*=.pdf]").attr({
	    target: "_blank", 
	    title: "Opens in a new window"
	});
	
	
	


		
	$('input#search').focus(function(){
		$(this).val('');
	});

	$("tr:even").addClass("even"); 
	


	

	

// - end

});