/*****************************************************************************************************************************************************************************/
/* PAGINATION INFO (home) ****************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************************/
 var pagination_infos_options = {
  /*If this number is set to 1, links to the first and the last page are always 
  shown, independent of the current position and the visibility constraints 
  set by num_display_entries. You can set it to bigger numbers to show more 
  links. Default: 0*/
  num_edge_entries: 2,
  /*Maximum number of pagination links that are visible. Set to 0 to display a 
  simple "Previous/Next"-Navigation. Default: 10*/
  num_display_entries: 8,
  callback: pageselectInfoCallback,
  items_per_page:2,
  prev_text:"< Précédent",
  next_text:"Suivant >"
}
/*
 * Callback function that displays the content.
 * Gets called every time the user clicks on a pagination link.
 *
 * @param {int} page_index New Page index
 * @param {jQuery} jq the container with the pagination links as a jQuery object
 */
function pageselectInfoCallback(page_index, jq){
	var items_per_page = pagination_infos_options.items_per_page;
  	var offset = page_index * items_per_page;
	var new_content = $('#hiddenInfos div.article').slice(offset, offset + items_per_page).clone();
	$('#searchresult').empty().append(new_content);

	return false;
}

/** 
 * Initialisation function for pagination
 */
function initInfoPagination() {
	// count entries inside the hidden content
	var num_entries = jQuery('#hiddenInfos div.article').length;
	//alert(num_entries)
	// Create content inside pagination element
	$("#pagination").pagination(num_entries, pagination_infos_options);
}





/*****************************************************************************************************************************************************************************/
/* PAGINATION BRAND **********************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************************/
var pagination_brand_options = {
  /*If this number is set to 1, links to the first and the last page are always 
  shown, independent of the current position and the visibility constraints 
  set by num_display_entries. You can set it to bigger numbers to show more 
  links. Default: 0*/
  num_edge_entries: 2,
  /*Maximum number of pagination links that are visible. Set to 0 to display a 
  simple "Previous/Next"-Navigation. Default: 10*/
  num_display_entries: 6,
  callback: pageselectBrandCallback,
  items_per_page:12,
  prev_text:"< Précédent",
  next_text:"Suivant >"
}
/*
 * Callback function that displays the content.
 * Gets called every time the user clicks on a pagination link.
 *
 * @param {int} page_index New Page index
 * @param {jQuery} jq the container with the pagination links as a jQuery object
 */
function pageselectBrandCallback(page_index, jq){
	var items_per_page = pagination_brand_options.items_per_page;
  	var offset = page_index * items_per_page;
	var new_content = $('#hiddenInfos div.brand_img').slice(offset, offset + items_per_page).clone();
	$('#searchresult').empty().append(new_content);
	return false;
}

/** 
 * Initialisation function for pagination
 */
function initBrandPagination() {
	// count entries inside the hidden content
	var num_entries = jQuery('#hiddenInfos div.brand_img').length;
	//alert(num_entries)
	// Create content inside pagination element
	$("#pagination").pagination(num_entries, pagination_brand_options);
 }




/*****************************************************************************************************************************************************************************/
/* PAGINATION CASHCORA *******************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************************/
var pagination_cashcora_options = {
  /*If this number is set to 1, links to the first and the last page are always 
  shown, independent of the current position and the visibility constraints 
  set by num_display_entries. You can set it to bigger numbers to show more 
  links. Default: 0*/
  num_edge_entries: 2,
  /*Maximum number of pagination links that are visible. Set to 0 to display a 
  simple "Previous/Next"-Navigation. Default: 10*/
  num_display_entries: 6,
  callback: pageselectCashcoraCallback,
  items_per_page:4,
  prev_text:"< Précédent",
  next_text:"Suivant >"
}
/*
 * Callback function that displays the content.
 * Gets called every time the user clicks on a pagination link.
 *
 * @param {int} page_index New Page index
 * @param {jQuery} jq the container with the pagination links as a jQuery object
 */
function pageselectCashcoraCallback(page_index, jq){
	var items_per_page = pagination_cashcora_options.items_per_page;
  	var offset = page_index * items_per_page;
	var new_content = $('#hiddenInfos div.product').slice(offset, offset + items_per_page).clone();
	$('#searchresult').empty().append(new_content);
	return false;
}

/** 
 * Initialisation function for pagination
 */
function initCashcoraPagination() {
	// count entries inside the hidden content
	var num_entries = jQuery('#hiddenInfos div.product').length;
	//alert(num_entries)
	// Create content inside pagination element
	$("#pagination").pagination(num_entries, pagination_cashcora_options);
 }
 
 
 
 
/*****************************************************************************************************************************************************************************/
/* PAGINATION SEARCHRESULT ***************************************************************************************************************************************************/
/*****************************************************************************************************************************************************************************/
var pagination_searchresult_options = {
  /*If this number is set to 1, links to the first and the last page are always 
  shown, independent of the current position and the visibility constraints 
  set by num_display_entries. You can set it to bigger numbers to show more 
  links. Default: 0*/
  num_edge_entries: 2,
  /*Maximum number of pagination links that are visible. Set to 0 to display a 
  simple "Previous/Next"-Navigation. Default: 10*/
  num_display_entries: 6,
  callback: pageselectSearchresultCallback,
  /*REWRITE IN displayResultSuccess.jsp*/
  items_per_page:10,
  prev_text:"< Précédent",
  next_text:"Suivant >"
}
/*
 * Callback function that displays the content.
 * Gets called every time the user clicks on a pagination link.
 *
 * @param {int} page_index New Page index
 * @param {jQuery} jq the container with the pagination links as a jQuery object
 */
function pageselectSearchresultCallback(page_index, jq){
	var items_per_page = pagination_searchresult_options.items_per_page;
  	var offset = page_index * items_per_page;
	var new_content = $('#hiddenInfos div.article').slice(offset, offset + items_per_page).clone();
	$('#searchresult').empty().append(new_content);
	return false;
}

/** 
 * Initialisation function for pagination
 */
function initSearchResultPagination(items_display) {
	// count entries inside the hidden content
	var num_entries = jQuery('#hiddenInfos div.article').length;
	//alert(num_entries)
	// Create content inside pagination element
	$("#pagination").pagination(num_entries, pagination_searchresult_options);
}
 
