

(function($){ 


$.fn.navigationSuperNews = function(coloredImage, grayscaleImage, title, file, sideMenuFile, hideDivs) {

	$(this).click(function () {
							
							
		// change the title
		$("span#menuHeaders").html(title);
			
		// change the background image to grayscale
		$("div#changingImages > img").attr({  
			  src: grayscaleImage
		}); 
		
		// Empty the content div
		$("#contentNoSidemenu").html("");
		
		// Reveal the menu and cotent area
		$('div#menu,div#contentNoSidemenu').slideDown('slow', function () {
												  
			// add new content
			$.ajax({ 
			  url: file,
			  cache: false,
			  success: function(html){ 
			  	$("#contentNoSidemenu").html("");
				$("#contentNoSidemenu").html(html); 
				
			  }
			});		
			
			// add new side menu
			$.ajax({ 
			  url: sideMenuFile,
			  cache: false,
			  success: function(html){ 
			  	$("#sideNavigation").html("");
				$("#sideNavigation").html(html); 
				// This is where i tried binding the click event to an alert
				$(".menu_nav_links").bind("click", function () {
					$("a#" + this.id).sideNav($(this).text(),this.href,sideMenuFile);
					 $("a#" + this.id).removeAttr('href');
					 event.preventDefault();
					 return false;

     			});

			  },
			  
			  error: function () { return false; }
			  
			  
			});		
			

		
												  
		});

		// Hide DIVs
		$(hideDivs).each(function () {
			$(this).fadeOut('fast'); 
		});
		
		
		
		 // change background image back to colored
		 $("#close").click(function () {
			$("#contentNoSidemenu").html("");				 
			$("div#changingImages > img").attr({  
				  src: coloredImage
			}); 
			$('div#menu').slideUp('slow')
		  });
		});
	
	return this;

}

// Bindings


})(jQuery); 
