function doSorting(type,sorting,el){
//
var pageType = type;
var sortType = sorting;
var targetEl = el;
var prevPageID = pageType+"_0";
var thisPageID = pageType+"_1";
var nextPageID = pageType+"_2";

	function showLoading(el){
		$("#loading_"+el)
			.css({visibility:"visible"})
			.css({opacity:"1"})
			.css({display:"block"})
		;
		$("#"+el+"_entries").fadeTo('fast', 0.3);
	}
	//hide loading bar
	function hideLoading(el){
		$("#loading_"+el).fadeTo('slow', 0);
		$("#"+el+"_entries").fadeTo('fast', 1);
	};
//
var loadList = pageType+"_entries";
//show the loading bar
showLoading(pageType);
//
		 $.ajax({
		   type: "POST",
		   url: "ajax_page.php",
		   data: "page=1&type="+pageType+"&sorting="+sortType,
		   success: function(data){
			 $("#"+pageType+"_current_page").html('1');
			 $("#"+loadList).html(data);
			 hideLoading(pageType);
			 // higlight sort type
			 $("#"+pageType+"_paginate_counter").find('span').removeClass(pageType+'_sort_on');
			 $("#"+el).addClass(pageType+'_sort_on');
			// do buttons
			 $(".next_"+pageType).attr('id',nextPageID);
			 $(".prev_"+pageType).attr('id',prevPageID);
			// match column heights
			if ($("#life").height()>$("#death").height()){
			$("#death").height($("#life").height());	
			} else {
			$("#life").height($("#death").height());
			}
			//
		   }
		 });
//

} // END SORTING FUNCTION