jQuery(document).ready(function ($) { init_buttons_width(); var layoutBoth = $('acp_layout_both').length; var buttons = []; var buttonsCount = $('ul.paging_btns:first li.button_style').size(); var secondButton = $('ul.paging_btns li#item2'); var bool = true; var hasClassNbox = $('ul.paging_btns li.button_style').hasClass('nbox'); $('ul.paging_btns:first li.button_style').each(function (i) { if (i == 1 && bool) { buttons[i] = secondButton; buttons[i + 1] = $(this); bool = false; } else { if (bool) { buttons[i] = $(this); } else { buttons[i + 1] = $(this); } } }); buttons.pop(); $('ul.paging_btns li.button_style').live('click', function () { var itemId = $(this).attr('id'); var clickedItemId = parseInt(itemId.substring(4)); var prev = 0; var next = 0; if (clickedItemId == 1) { prev = buttonsCount - 1; next = 1; } else if (clickedItemId == buttonsCount) { prev = buttonsCount - 2; next = 0; } else { prev = clickedItemId - 2; next = clickedItemId; } var nBox = hasClassNbox ? 'nbox' : ''; var buttonsHtml = "