﻿(function($) {
    $.fn.slider = function() {

        function scroll(page, obj) {
            var multiplier = -1;
            var itemWidth = obj.find("ul li:eq(0)").outerWidth();
           
            var scrollLength = (page-1) * itemWidth * multiplier;


                obj.find("ul").animate({ right: scrollLength }, { duration: 1000 });

//            if (obj.find('#Language').html() == 1) {
//                obj.find("ul").animate({ left: scrollLength }, { duration: 1000 });
//            }
//            else {
//                obj.find("ul").animate({ right: scrollLength }, { duration: 1000 });

//            }
        };
        return this.each(function() {
            obj = $(this);
            obj.find('.pagers a').click(function() {
                if (!$(this).hasClass('lnkview')) {
                    obj.find('.pagers a').removeClass("selected");
                    $(this).addClass("selected");
                    scroll($(this).attr('rel'), obj);
                }
            });
        });
    };
})(jQuery);