var BaseView = Class.extend({
		init: function(){
		    trace('BaseView loaded');
		},
		
		render: function(){
		    
		},
		gallery: function(scope, max, width){
		    this.max = max;
		    this.w = width || 81;
		    if(scope.hasClass('holder_slider')){
		        this.nav_holder = scope;
		    } else {
		        this.nav_holder = $('.holder_slider', scope);
		    }
            this.nav = $('ul', this.nav_holder);
            this.items = $('li', this.nav);
            this.total_items = $('li', this.nav).length;
            this.current_product = 0;
            this.current_item = 0;
            
            this.nav.width(this.w * this.total_items);
            
            if(this.total_items <= this.max){
                $('.prev, .next', scope).hide();
                return;
            } else {
                $('.prev, .next', scope).show();
            }
            
            $('.prev', scope).bind('click', $.proxy(this.goto_preview, this));
            $('.next', scope).bind('click', $.proxy(this.goto_next, this));
		},
		goto_preview: function(e){
            if(this.current_item < 1){
                return false;
            }
            this.current_item--;
            this.animate();
            e.preventDefault();
        },
        goto_next: function(e){
            if(this.current_item >= this.items.length - this.max){
                return false;
            }
            this.current_item++;
            this.animate();
            e.preventDefault();
        },
        animate: function(){
            var w = this.w;
            this.nav.animate({ marginLeft: -(w * this.current_item).toString() }, 600, 'easeInOutExpo');
        }
});
