jQuery(document).ready(function() {
	// Modified from http://jameswragg.com/labs/auto-generating-table-of-contents-using-jquery
	if(jQuery("#faqlist").length > 0) {
		jQuery("#faqlist").append('<ul id="genTOC"></ul>');
	
		jQuery("#page_content_block h3").each(function(i) {
			
			if(!jQuery(this).attr("id")){
				newId = jQuery.trim(jQuery(this).html().toLowerCase());
				jQuery(this).attr("id", newId.replace(/ /g,'-'));
			}
	
			jQuery("#genTOC").append("<li><a href=\"#" + jQuery(this).attr("id") + "\">" + jQuery(this).html() + "<\/a><\/li>");
		});
		
		// Add link before each h3
		jQuery("#page_content_block h3").before('<p class="gt"><a href="#" >Back to Top</a></p>');
		// Add one after the last item
		jQuery("#page_content_block h3:last").after('<p class="gt"><a href="#" >Back to Top</a></p>');
		// Remove first link
		jQuery("#page_content_block p.gt:first").remove();
	}
	
	// http://jeroencoumans.nl/journal/simple-accessible-jquery-menu
	var path = location.pathname.substring(1);
	if(path == "") {
		jQuery('#nav_moe #nHome').addClass('current_page');
	}
  else {
  	jQuery('#nav_moe a[href$="' + path + '"]').addClass('current_page');
  }
  
  // Fix up pricing table
  jQuery("#prices tr:odd").addClass("odd");
  jQuery("#prices tr:first-child td:first-child").css("width","8em")
  jQuery("#prices tr:first-child td:last-child").css("width","4em")

	
});