// JavaScript Document

function update_news_list(page)
{
	//Vars
	var topic = news_topic;
	var page = (page) ? page : 1;
	
	$("#news_list").hide('slow', function(){
		$("#ajax_loader").show('slow', function(){
			$.ajax({
				async: true,
				cache: false,
				url: phpbb_root_path + '../index.php',
				data: "m=news&mode=ajax&topic=" + topic + "&page=" + page,
				success: function(response)
				{			
					$("#news_list").html(response);
					$("#ajax_loader").hide('slow', function(){
						$("#news_list").show('slow');												 
					});					
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					$("#news_list").html('Ha ocurrido un error mientras se cargaba la lista de noticias');
					$("#ajax_loader").hide('slow', function(){
						$("#news_list").show('slow');										 
					});
					
				}
			});														 
		});
	});
}

$(function(){
	var current_page = document.location.hash;
	current_page.substr(4, current_page.length);
	update_news_list(current_page);											   
});
