jQuery(function($){
    var _nextId = 0;
    var _prevId = 0;

    var myTarget = $('#display_smart_table');

    myTarget.scrollLeft 	= 0;
	myTarget.scrollTop 		= 0;

/*
    $.localScroll.hash({
        target: myTarget,
        axis:'xy',
        queue:true,
        duration:1500
    });
*/

    $('#scrolls_smart_table').localScroll({
        target: myTarget,
        axis:'x',
        queue:true,
        duration:1000,
        hash:true,
        //event:'mouseover',
        onBefore:function(e, anchor, $target){
            var a = $(this);

            if(a.attr('id') == 'nextDev_smart_table') {
                var thisId = parseInt(a.attr('href').slice(13));
                if($('#smart_table_' + (thisId + 5))) {
                    _nextId = thisId + 5;
                    _prevId = thisId - 5;
                }
            }

            if(a.attr('id') == 'prevDev_smart_table') {
                var thisId = parseInt(a.attr('href').slice(13));
                if($('#smart_table_' + (thisId - 5))) {
                    _nextId = thisId + 5;
                    _prevId = thisId - 5;
                }
            }
        },
        onAfter:function(anchor){
            if(_nextId) {
                $('#nextDev_smart_table').attr('href', '#smart_table_' + _nextId);
            }
            if(_prevId) {
                $('#prevDev_smart_table').attr('href', '#smart_table_' + _prevId);
            }
        }
    });
});