$(
function() {
$('div.main-text table').each(function() {
$(this).addClass('table_st');
$(this).attr('border', '0');
var first = $(this).find('tr:first td');
for(var i = 0;i<first.length;i++) {
if (i==0) {first[i].id = "th_left";
} else {
  if (i==first.length-1) {
first[i].id = "th_right";
} else {
first[i].id = "th_center";
}
}
}
});
}
);
function MyCarousel(name, options) {
    var $name = name;
    var $options = {
        num: 5,
        step: 1
    };
    var $el = $('#'+$name);

    $options.from = 0;
    $options.count = $el.children().length;
    $.extend($options, options);
    $options.to = $options.from + $options.num - 1;

    run();

    $('#'+$name+'-next').click(function() {
        if ($options.to+$options.step >= $options.count) {
            if (!$options.nextOnly) return false;
            $options.from = 0;
            $options.to = $options.num-1;
        } else {
            $options.from += $options.step;
            $options.to += $options.step;
        }
        run();
        return false;
    });
    $('#'+$name+'-prev').click(function() {
        if ($options.from-1 < 0) return false;
        $options.from -= $options.step;
        $options.to -= $options.step;
        run();
        return false;
    });
    function run () {
        $el.children().each(function(i) {
            if (i < $options.from || i > $options.to) {
                $(this).hide();
            } else {
                $(this).show();
            }
        });
    }
}
