//Ready Global Functions
$(document).ready(function() {

	//Categories/Archives Navigation
		//Hide categories/archives navigation
		$('.subnav').addClass('nodisplay');
		
		//Function to hide/show categories/archives on click
		$('#nav a').click(function(){
			
			// clear all link highlights and add a highlight to the clicked section link
			$('#nav a.sub_item').removeClass('sub_item');
			$(this).addClass('sub_item');
			
			// assign to variable ID attribute of the <a> tag that was clicked on
			// appending strings for use in statements below
			var whichSection = '#' + $(this).attr("id") + '_sect';
			
			// if the selected section is visible...
			if ($(whichSection).is(':visible')) {
				// ...hide it and remove the link highlight.
				$(whichSection).hide("blind", { direction: "vertical" }, 250);
				$('#nav a.sub_item').removeClass('sub_item');
			}
			
			// if this selected section is hidden...
			if ($(whichSection).is(':hidden')) {
				// if any other subnav sections are visible...
				if ($('.subnav').is(':visible')) {
					// ...hide them...
					$('.subnav:visible').hide("blind", { direction: "vertical" }, 250, function(){
						// ...and then show the selected section
						$(whichSection).show("blind", { direction: "vertical" }, 250);
					});
				} else {
					// ...otherwise, just show the selected section
					$(whichSection).show("blind", { direction: "vertical" }, 250);
				}
			}
		});
		
		// RSS button tweaking because I'm lazy
		var tempHtml = $('<div>').append($('#rss_sidebar').clone()).remove().html();
		$('#rss_sidebar').remove();
		$('#twitter-tools').after(tempHtml);
});