(function($){


	//$('table tr:odd').addClass('odd');
	
	$("p:contains('&')").each(function(){
    	$(this).html($(this).html().replace(/&amp;/, "<span class='ampersand'>&amp;</span>"))
  	});
	
	
	$('.tooltip').tipsy({gravity: 's'}); // nw | n | ne | w | e | sw | s | se
		
	// Tabs 
	jQuery('.tab-nav ul li a').click(function() {
		var href = jQuery(this).attr("href");
		jQuery('.tab').hide();
		jQuery('.tab-nav ul li').removeClass('active');
		jQuery(this).parent().addClass('active');
		jQuery(href).show();
		jQuery.cookie('open_tab', href);
		return false;
	});
	if (jQuery('.tab-nav ul li.active').size() > 0) {
		jQuery('.tab-nav ul li.active a').click();
	} else {
		jQuery('.tab-nav ul li:first a').click();
	}	
	
	// Avoid widows in headings
  	jQuery("h1.title a, .single h1.title").each(function(){var wordArray=jQuery(this).text().split(" ");var finalTitle="";for(i=0;i<=wordArray.length-1;i++){finalTitle+=wordArray[i];if(i==(wordArray.length-2)){finalTitle+="&nbsp;"}else{finalTitle+=" "}}jQuery(this).html(finalTitle)});
	
})(window.jQuery); 
