/* aqPaging v2.0
   Paging function with next and previous ranges.
   Copyright (C) 2011 paul pham <http://aquaron.com/jquery/aqPaging>

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
(function($){$.fn.aqPaging=function(o){var _0=$.extend({border:'#eeeeee',fg:'#444444',bg:'#eeeeee',padding:'2px 5px',margin:'0 2px',pages:0,max:10,current:1},o);var _6=function(o){o.empty();var _4=1,_5=_0.pages,_2,_3=(_0.current>_0.max)?1:0;if(_0.pages>_0.max){if(_0.current>_0.max){_4=_0.max*parseInt((_0.current-_3)/_0.max,10)}if(_0.current-_3+_0.max<_0.pages){_5=_4+_0.max+_3}}for(_2=_4;_2<=_5;_2++){$('<a\/>').attr('href','#'+_2).text(Math.round(_2)).appendTo(o)}if(_0.current>=_4&&_0.current-_0.max>0){o.prepend('<a href="#1">1<\/a><i>...<\/i>')}if((_0.current-_3+_0.max)<=_0.pages&&_5!==_0.pages){o.append('<i>...<\/i>'+'<a href="#'+_0.pages+'">'+Math.round(_0.pages)+'<\/a>')}$('<br\/>').css({float:'none',clear:'both'}).appendTo(o);$('A, I',o).css({padding:_0.padding,margin:_0.margin}).filter('A').css({border:'1px solid '+_0.border,textDecoration:'none',color:_0.fg,backgroundColor:_0.bg}).hover(function(){$(this).css({backgroundColor:_0.fg,color:_0.bg})},function(){if($(this).attr('href')!=='#'+_0.current){$(this).css({backgroundColor:_0.bg,color:_0.fg})}}).unbind('click').bind('click',function(){_0.current=$(this).text();o.trigger('highlight');if($.isFunction(_0.cb)){_0.cb(_0.current)}return false})};return this.each(function(){if(_0.pages<=1){return false}var _1=$('.aqPaging',this);if(!_1.length){_1=$('<div\/>').addClass('aqPaging').appendTo(this)}_1.bind('highlight',function(){_6(_1);$('A',_1).css({backgroundColor:_0.bg,color:_0.fg}).filter('A[href="#'+_0.current+'"]').css({backgroundColor:_0.fg,color:_0.bg})}).trigger('highlight')})}})(jQuery);
