
$(function () {
    function blog_load(file){
        
        $.get(file,function(data) {
        
            $("#blog_wrapper").fadeOut('fast',function(){
                    
                $(this).html(data).fadeIn('slow');
            });
        });
    }

	function ajax_nav(path){
		
		$.get(path, function(data) {
			$("#textfield").fadeOut('fast',function(){
				$(this).html(data).fadeIn('slow');
				updateIntercept();
			});
			
		});
	}
	
	function updateIntercept()
	{
		$("#textfield").find(".ajax").click(function()
		{
			ajax_nav($(this).attr("href"));
			
			return false;
		});
	}
	
	function intercept(){
		$(".ajax").click(function(){
			ajax_nav($(this).attr("href"));
			
			return false;
		});
	}
    
    $(document).ready(function(){
        
        blog_load('/ajax/blogs/');

		intercept();
        
        return false;
    });
});
