//the functions in this document update the DOM after an AJAX call.


function page_update_add_new_file_category(category_id, category_title, what)
{
	var new_category = document.createElement('li');

	new_category.innerHTML = "<a href='JavaScript: //' onclick=\"var confirm_delete = confirm('You are about to delete this!'); if(confirm_delete == true) ajax_delete_category(" + category_id + ", '" + what + "');\"><img src='" + root_directory + "/images/icons/cross.png' alt='Delete' class='icon'></a>";

	if(what == "registered_user_group")
	{
		new_category.innerHTML = new_category.innerHTML + "<a href='" + root_directory + "/registered_users/group/" + category_id + "/'>" + category_title + "</a>";
	}
	else
	{
		new_category.innerHTML = new_category.innerHTML + "<a href='" + root_directory + "/file_manager/show_category/" + category_id + "/'>" + category_title + "</a>";
	}

	new_category.style.display = 'none';

	new_category.id = 'li_categories-' + category_id;

	document.getElementById('li_categories').appendChild(new_category);

	$(document).ready(function(){
		$("#li_categories-" + category_id).fadeIn("slow");
	});
}


function page_update_delete_content_item(content_item_id, section_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#content_list_" + section_id + "-" + content_item_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}

function page_update_delete_page(page_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#page_" + page_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}

function page_update_delete_file_item(file_item_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#file_list-" + file_item_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}

function page_update_delete_registered_user(registered_user_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#user_list-" + registered_user_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}

function page_update_delete_pdf_item(pdf_item_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#pdf_list-" + pdf_item_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}


function page_update_delete_category(category_id)
{
	//remove the item from the page
	//fancy
	$(document).ready(function(){
		$("#li_categories-" + category_id).fadeOut("slow");
	});
	//non-fancy
	//document.getElementById('content_list_' + content_item_id).style.display = 'none';
}