function articles(json)
{
		document.getElementById('titleleft').innerHTML = json.cluster_title+ " »";
		$("#pickeddatebegin").val(json.query.from_date);
		$("#pickeddateend").val(json.query.to_date);
		$("#recherche_id").val(json.query.text);
		$('input[name=categories1]').attr('checked', false);
		$('input[name=categories2]').attr('checked', false);
		$('input[name=categories3]').attr('checked', false);
		$('input[name=categories4]').attr('checked', false);
		//document.getElementById('affichage').style.display = "none";
		for (j = 0; j < json.query.categories.length; j++)
		{
			if(json.query.categories[j] == "International")
			{
				$('input[name=categories1]').attr('checked', true);
			}
			else if(json.query.categories[j] == "France")
			{
				$('input[name=categories2]').attr('checked', true);
			}
			else if(json.query.categories[j] == "Economie")
			{
				$('input[name=categories3]').attr('checked', true);
			}
			else if(json.query.categories[j] == "Culture")
			{
				$('input[name=categories4]').attr('checked', true);
			}
		}

		content = "<div class=\"articles\">";
		for (i = 0; i < json.documents.length; i++)
		{
			
			content += "<div class=\"article\"><div class=\"inner-article clearfix\"><h2><a id=\""+json.documents[i].id+"\" title=\"Lire l\'article\" href=\"http://localhost:8000/article/"+json.cluster_title+"/"+json.documents[i].id+"\">";
			content += json.documents[i].title;
			content += " »</a></h2><p class=\"author\"><a href=\"#\">";
			content += json.documents[i].date;
			content += " </a><br/> by <a href=\"#\">";
			content += json.documents[i].author[0].name;
			content += "</a></p><div class=\"article-content\"><div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div><p class=\"resume\">";
			content += json.documents[i].abstract;
			content += " </p></div></div></div>";
		}
		content +="</div>";
		$("#right").empty();
		$(content).appendTo("#right");
}


		
$(function(){
				
		// Formulaire POST AJAX
		$("#ajax3").submit( function() 
		{
			var urlSubmit = $(this).attr('action');
			currentcategories = [];
			/*var data = { 'categories' : []};*/
			$("input:checked").each(function() {
					/*data['categories'].push($(this).val());*/
					currentcategories.push($(this).val());
			});
			currentfromdate= $("#pickeddatebegin").val();
			currenttodate= $("#pickeddateend").val();
						
			$.ajax(
			{  
				type: "POST",
				url: urlSubmit,
				data      : $(this).serializeArray(),
				success: function(data) {
					
					var json = jQuery.parseJSON(data);
					
					content = "<div class=\"articles\">";
					for (i = 0; i < json.documents.length; i++)
					{
						content += "<div class=\"article\"><div class=\"inner-article clearfix\"><h2><a id=\""+json.documents[i].id+"\" title=\"Lire l\'article\" href=\""+json.documents[i].url_document+"\">";
						content += json.documents[i].title;
						content += " »</a></h2><p class=\"author\"><a href=\"#\">";
						content += json.documents[i].date;
						content += " </a><br/> by <a href=\"#\">";
						content += json.documents[i].author[0].name;
						content += "</a></p><div class=\"article-content\"><div class=\"article-visuel-wrap\"><img class=\"article-visuel\" src=\"/static/img/visuel-article.jpg\" alt=\"\" /></div><p class=\"resume\">";
						content += json.documents[i].abstract;
						content += " </p></div></div></div>";
					}
					content +="</div>";
					$("#right").empty();
					$(content).appendTo("#right");	
				}
			});
			return false;
		});
		
		$('#ajaxfiltretreemapdoc').click(function() 
	{
		$('#ajaxfiltretreemapdoc').submit();
	});
		
		 $('.checkbox_category').click(function(){
			  /*var theValue = $(this).val();*/
			 $('#ajax3').submit();
  		});
	
});//jQuery