/* date-modified : 2009-10-16 */

function pageselectCallback(page_index, jq) {
	var new_content =  '';
	var items_per_page = 6;
	var page_num = page_index * items_per_page;
	
	for(var i=0; i< items_per_page; i++) {
		var sb = $('#hiddenresult div.result:eq('+page_num+')').html();
		if ( sb != null) {
			new_content += sb;
		}
		page_num++;
   }
	$('#Searchresult').empty().append(new_content);
	return false;
}
function speakerpageselectCallback(page_index, jq) {
	var new_content =  '';
	var items_per_page = 8;
	var page_num = page_index * items_per_page;
	var start_idx = page_num + 1;
	var end_idx = (page_num + items_per_page);
	var total_idx = $('#hiddenresult div.result').size();
	
	if (end_idx > total_idx ) {
		end_idx = total_idx;
	}
	var status_message = '<span class="small">showing ' + start_idx + ' to ' + end_idx + ' of ' + total_idx + '</span>';
	for(var i=0; i< items_per_page; i++) {
		var sb = $('#hiddenresult div.result:eq('+page_num+')').html();
		if ( sb != null) {
			new_content += sb;
		}
		page_num++;
   }
	$('#SpeakersGroup').empty().append(new_content);
	$('.speaker_pagination').append(' pages');
	$('#SpeakerPagination_copy').empty();
	
	    $(".speaker_pagination").clone().appendTo("#SpeakerPagination_copy");

	return false;
}

/** 
 * Callback function for the AJAX content loader.
 */
function initPagination() {
	var num_entries = $('#hiddenresult div.result').length;
	// Create pagination element
	$("#Pagination").pagination(num_entries, {
		num_edge_entries: 1,
		num_display_entries: 5,
		callback: pageselectCallback,
		items_per_page:6,
		prev_text:'',
		next_text:'',
		ellipse_text:' ... | '
	});
	$('.pagination').append(' pages');
	$("#pagination_bottom").pagination(num_entries, {
		num_edge_entries: 1,
		num_display_entries: 5,
		callback: pageselectCallback,
		items_per_page:6,
		prev_text:'',
		next_text:'',
		ellipse_text:' ... | '
	});
	$('#pagination_bottom').append(' pages');
 }
function initSpeakerPagination() {
	var num_entries = $('#hiddenresult div.result').length;
	// Create pagination element
	$("#SpeakerPagination").pagination(num_entries, {
		num_edge_entries: 1,
		num_display_entries: 5,
		callback: speakerpageselectCallback,
		items_per_page:8,
		prev_text:'',
		next_text:'',
		ellipse_text:' ... '
	});
	$("#SpeakerPagination2").pagination(num_entries, {
		num_edge_entries: 1,
		num_display_entries: 5,
		callback: speakerpageselectCallback,
		items_per_page:8,
		prev_text:'',
		next_text:'',
		ellipse_text:' ... '
	});
 }
