//ajaxing archive

$(function()	{
	var $main = $("#main"),
		$eldre = $(".front_eldre a");
		$newURL = $eldre.attr('href');
		$loadURL = $newURL + " .post";

		$eldre.click(function(target){
		
		target.preventDefault();
		
		$main.fadeOut('slow');
		$('#wraper').animate({scrollTop:0}, 'slow', function(){
				
			console.log($loadURL);
			
			$(".post").load($newURL + " .post", function(){
			
				$main.fadeIn('slow', function()	{
					window.location.replace($newURL);
					return false;
				});
			});
		});
	});
});


$(function()	{
	var $article = $("#main"),
		$nyere = $(".front_nyere a"),
		$newURL = $nyere.attr('href');
		$loadURL = $newURL + " .post";
		
		$nyere.click(function(target){
		
		target.preventDefault();
		
		$main.fadeOut('slow');
		$('#wraper').animate({scrollTop:0}, 'slow', function(){
				
			console.log($loadURL);
			
			$(".post").load($newURL + " .post", function(){
			
				$main.fadeIn('slow', function()	{
					window.location.replace($newURL);
					return false;
				});
			});
		});
	});
});


//ajaxing post

$(function()	{
	var $article = $("#article"),
		$eldre = $(".eldre a");
		$newURL = $eldre.attr('href');
		$loadURL = $newURL + " .post";

		$eldre.click(function(target){
		
		target.preventDefault();
		
		$article.fadeOut('slow');
		$('#wraper').animate({scrollTop:0}, 'slow', function(){
				
			console.log($loadURL);
			
			$(".post").load($newURL + " .post", function(){
			
				$article.fadeIn('slow', function()	{
					window.location.replace($newURL);
					return false;
				});
			});
		});
	});
});


$(function()	{
	var $article = $("#article"),
		$nyere = $(".nyere a"),
		$newURL = $nyere.attr('href');
		$loadURL = $newURL + " .post";
		
		$nyere.click(function(target){
		
		target.preventDefault();
		
		$article.fadeOut('slow');
		$('#wraper').animate({scrollTop:0}, 'slow', function(){
				
			console.log($loadURL);
			
			$(".post").load($newURL + " .post", function(){
			
				$article.fadeIn('slow', function()	{
					window.location.replace($newURL);
					return false;
				});
			});
		});
	});
});


//ajaxing category

/*
$(function()	{
	var $article = $("#main"),
		$sort = $("#sort_list li a"),
		$newURL = $sort.attr('href');
		$loadURL = $newURL + " #main";
		
		$sort.click(function(target){
		
		target.preventDefault();
		
		$article.fadeOut('slow');
		$('#wraper').animate({scrollTop:0}, 'slow', function(){
				
			console.log($newURL);
			
			$("#main").load($loadURL, function(){
			
				$article.fadeIn('slow', function()	{
					window.location.replace($newURL);
					return false;
				});
			});
		});
	});
});
*/
