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

	//Categories/Archives Navigation
		//Hide categories/archives navigation
		$('.subnav').addClass('nodisplay');
		
		//Function to hide/show categories/archives
		$('#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);
				}
			}
		});
	
	//Auto-clear Search Box Using Plugin:clearingInput 
	$('#search_button').addClass('nodisplay');
	$('#s').clearingInput(); // Input value 'The label text'
	$('#s').focus(function() {
		$('#search_button').fadeIn('regular');
	});
	$('#s').blur(function() {
		$('#search_button').fadeOut('regular');
	});
	
	//Social Networking - open links in a new window
	$('#social a, #credits a').click(function(){
		window.open(this.href);
		return false;
	});
	
	//Admin/Author Editing
	/*
	$('.post_edit').addClass('nodisplay');
	$('.post').hover(
		function(){
        	$(this).find('.post_edit').fadeIn('regular');
      	}, 
      	function(){
        	$(this).find('.post_edit').fadeOut('fast');
		}
	);
	*/
});