jQuery(document).ready(function(){
/* 
	Bind the click event of each li element to the anonymous function 
*/
jQuery("#submenu li").bind('click', function() {
	
	// This simply adds and removes the class 'clicked' for styling purposes 
	jQuery(".clicked").removeClass("clicked");
	
	var listItem = jQuery(this);
	var listSpan = jQuery(this).find("span");
	var listA = jQuery(this).find("a");
	
	jQuery(listItem).addClass("clicked");
	jQuery(listSpan).addClass("clicked");
	jQuery(listA).addClass("clicked");
	
	// Get the link of the a-element in the li that was clicked.	 
	var linkHref = jQuery(this).find("a").attr("href");
	/* 
		This is the full url, i've added the string #post_container because that's the 
		only div I'm interested in loading
	*/
	var url = linkHref + " #postwithsidebartest";
	
	// display the loader in the upper right corner	
	jQuery("#image-container").fadeIn(200);		

	/* Finds the url and loads it into the content div through ajax */
	jQuery("#testcontent").load(url, function() {
	jQuery(this).append('<div class="clear">');
			// this is run when it's done loading the url
			jQuery("#image-container").fadeOut(200);
		
	});
	// returning false prevents the browser from following the link 
	return false;
});
});