/* calendar BLOCK PAGINATION */
function generatePagination(hideContainerId, showContainerId, paginatorId, items) {
$(document).ready(function () {
//Arguments provided in function call
var hideContainer = $('#' + hideContainerId);
var showContainer = $('#' + showContainerId);
var paginator = $('#' + paginatorId);
var itemsPerPage = 1;
if (items && !(items == 0) && !(isNaN(items))) { itemsPerPage = items };
if (!(hideContainer.length && showContainer.length && paginator.length)) {
//Debugging messages
var errorMessage = 'Pagination plugin initialization error.';
if (!(hideContainer.length)) {
errorMessage += '
Make sure that the ID of the container to hide you\'ve provided is correct.';
} else if (!(showContainer.length)) {
errorMessage += '
Make sure that the ID of the container to show you\'ve provided is correct.';
} else if (!(paginator.length)) {
errorMessage += '
Make sure that the ID of the paginator you\'ve provided is correct.';
} else {
errorMessage += '
Unknown mistake.';
}
errorMessage += '';
$('.cp-pagination-list-show').html(errorMessage);
return false;
}
//Default variables
var previous_page = 0;
var list_position = 0;
var elementWidth = 0;
function paginationCallback(page_index, jq) {
var elementsArray = $('li', hideContainer);
var items_per_page = itemsPerPage;
var max_elem = Math.min((page_index + 1) * items_per_page, elementsArray.length);
var newcontent = '';
var allElements = '';
var counter = 0;
allElements = '