

<!--
/**
 * @author tomasztu
 */
(function($){
    jQuery.fn.conciergeTeam = function(){
        $(this).find("ol.pages > li li").each(function(){
            $(this).css("cursor", "pointer").click(function(){
                var trgt = $(this).find("p > a").attr("href");
                document.location.href = trgt + "#" + current;
                return false;
            })
        })
  
        return this.each(function(){
            var el = $(this);
            pages = pages || getPages(el);
            pageWidth = pageWidth || getPageWidth(el);
            current = current || getCurrentPage(el);
            bind(el);
        });
    }
 
    var pages;
    var pageWidth;
    var current;
 
    function bind(el){
        $('p.next', el).click(function(e){
            e.preventDefault();
            goToNext(el);
        });
        $('p.prev', el).click(function(e){
            e.preventDefault();
            goToPrev(el);
        });
        goToPageAfterLoad(el);
    };
 
    function goToPageAfterLoad(el){
        nr = document.location.href.split('#');
        if (nr[1] > 1) {
            current = nr[1];
   $('ol.pages', el).css('marginLeft',-(current - 1) * pageWidth + 'px'); 
        }
        else {
            current = 1
        }
        updatePage(el);
    };
 
    function goToNext(el){
        if ($('ol.pages:animated', el).length > 0) 
            return false;
        if (current == pages) {
            animation = 0;
            current = 1;
        }
        else {
            animation = '-=' + pageWidth + 'px';
            current++;
        }
        $('ol.pages', el).animate({
            'marginLeft': animation
        }, 'slow');
        updatePage(el)
    };
 
    function goToPrev(el){
        if ($('ol.pages:animated', el).length > 0) 
            return false;
        if (current != 1) {
            animation = '+=' + pageWidth + 'px';
            current--;
        }
        else {
            animation = -pageWidth * (pages - 1);
            current = pages;
        }
        $('ol.pages', el).animate({
            'marginLeft': animation
        }, 'slow');
        updatePage(el)
    };
 
    function getPages(el){
        return $('ol.pages > li', el).length;
    };
 
    function getPageWidth(el){
        return $('ol.pages > li:first', el).width();
    };
 
    function getCurrentPage(el){
        updatePage(el);
        return $('ol.pages > li', el).index($('li.current')[0]) + 1;
    };
 
    function updatePage(el){
        $('p.current span', el).text(current);
    };
 
})(jQuery);
//-->
