$(document).ready(function() 
{
	$('#previous').click(function () { getNews("previous"); });
	$('#next').click(function () { getNews("next"); });
});


function getNews(type)
{
	$.ajax({
		type: 'POST',
		async: false,
		url: 'news/ajaxNews.php',
		data: "id=" + $('a.actual').attr("id") + "&action=" + type,
		dataType: 'text',
		success: retourGetNews,
		error: function() {alert('Erreur serveur');}
		});
}

function retourGetNews(reponse) 
{
	var reg = new RegExp("(erreur)", "gi");
	if(reponse.match(reg, reponse))
	{
	}
	else
	{
		/*$('.texte').html(reponse);
		$('a.actual').attr("id", $('.texte_news').attr("id"));
		$('span.actual').html($('.Titre').attr("id"));
		document.title = "Depan\'PC Express - Les news - " + $('.Titre').attr("id") + " - " + $('.titre_news').text();*/
		$(location).attr('href',reponse);
	}
}
