$(document).ready(function() {

	//add submit functionality to search 'links'
	$('.search-link')
    .click(function(e){
        e.preventDefault();
        $(this).closest('form')
            .submit();
    });
	
	var htmlpath = window.location.pathname;
	
	//disable links to this page that appear on this page
	$("div.sectionmenu a").each(function(i){
					
		if(this.href.indexOf(htmlpath) >= 0 && this.href.indexOf("#") == -1)
		{
			 $(this).replaceWith( "<span class=\"inactivelink\">" + $(this).text() + "</span>" ); 
					
		}
	});
	
	//remove the empty <p> tags that Contribute sprinkles through out the markup
	$('p[style="margin-top: 0; margin-bottom: 0;"]').each(
		  function() {
			var elem = $(this);
			if (elem.children().length == 0) {
			  elem.remove();
			}
		  }
	);
});
