$(document).ready(function() {
	var num_results = 10;
	if ( $('.downloadsorter').length > 0 )
	{
		$('.downloadsorter').each(function(){
			var id = splitGetID($(this).attr('id'));

			$(this).tablesorter({
				widthFixed: true,
				widgets: ['zebra']
			}).tablesorterPager({
				size: num_results,
				container: $("#pager_"+id),
				positionFixed: false
			});
			
			if ( $('#entries_'+id).attr('value') <= num_results )
			{
				$('#pager_'+id).hide();
			}
			
		});
	}
	
});


function splitGetID( string )
{
	var array = string.split('_');
	return array.pop();
}

