// Bahetle-1
// Petr Malakhaltsev (c) 2010
// Sidescroll control library

var sideGoLeft = 0;
var sideGoRight = 0;

$(document).ready(function(){

    var currentScrollTop = 0;
    
        $('#sidescroll-left').click(function(){
            if (sideGoLeft==0){
                if ($('.sidecontrol-item:first-child').position().left<0){
                    $('.sidecontrol-item').animate({
                        'left': '+=150'
                      },{
                        'duration' : 500,
                        step : function() {
                            sideGoLeft = 1;
                        },
                        complete : function () {
                            sideGoLeft = 0;
                        }
                    });
                }
            }
        });
        
        $('#sidescroll-right').click(function(){
            if (sideGoRight==0){
                if ($('.sidecontrol-item:last-child').position().left>0){
                    $('.sidecontrol-item').animate({
                            'left': '-=150'
                          },{
                            'duration' : 500,
                            step : function() {
                                sideGoRight = 1;
                            },
                            complete : function () {
                                sideGoRight = 0;
                            }
                        });
                }
            }
        });
        
    
});

