function article_ajax_request(page, extra_params, output_sel, type) {
	
	var ret = false;
	
	if (type.length == 0)
	{
		type = "html";	
	}

	if (output_sel.length > 0)
	{
		$(output_sel).html('<img src="./images/status_loading.gif" alt="Loading" id="loading" />Loading...').fadeIn('normal');
	}
	$.ajax({
		   type: "GET",
		   url: "./article_ajax.php", 
		   //cache: false, 
		   data: "p=" + page + "&" + extra_params,
		   dataType: type,
		   success: function(data) {
						if (output_sel.length > 0)
						{
							$(output_sel).html(data);
							$(output_sel).show();
						}
						ret = true;
					}
		   });
	return ret;
}

function onpage_delete_article(article_id, result_selector, tr_selector) {

	var confirm_msg = "You are about to remove this article and everything attached to it. Click 'Cancel' to stop, 'OK' to delete";
	var response = false;

	if (confirm(confirm_msg)) 
	{
		article_ajax_request("articles", "do=delete&id=" + article_id , result_selector, "html");
		$(tr_selector).fadeOut('normal');
	}
}

function onpage_delete_category(category_id, result_selector, tr_selector) {

	var confirm_msg = "You are about to remove this category and its articles. All subcategories will be deleted as well, including their articles.\nClick 'Cancel' to stop, 'OK' to delete";
	var response = false;

	if (confirm(confirm_msg)) 
	{
		article_ajax_request("categories", "do=delete&id=" + category_id , result_selector, "html");
		$(tr_selector).fadeOut('normal');
	}
}
