
function VScroll(width, height, btnLeft, btnRight, otherNum) {
    var curIndex = 1;
    var max = $('.wScroll img').size();
    $('.wScroll').wrap($('<div/>').css({ 'width': width + 'px', 'height': height + 'px', 'overflow': 'hidden', 'position': 'relative' }));
    $('.wScroll').css({ 'height': '30000px', 'position': 'absolute' });
    $('.' + btnLeft).click(function () {
        if (curIndex <= 1)
            return false;
        curImg = $('.wScroll').find('img:first:visible');
        $('.wScroll').animate({ 'top': '+=' + (curImg.parent().parent().height() + otherNum) }, 'slow');
        curIndex--;
        return false;
    });
    $('.' + btnRight).click(function () {
        if (curIndex >= max)
            return false;
        curImg = $('.wScroll').find('img:first:visible');
        $('.wScroll').animate({ 'top': '-=' + (curImg.parent().parent().height() + otherNum) }, 'slow');
        curIndex++;
        return false;
    });
}

function HScroll(width, height, btnLeft, btnRight, otherNum, id, type) {
    if (!id)
        id = 'wScroll';
    var curIndex = 1;
    var max = $('.' + id + ' img').size();
    $('.' + id + '').wrap($('<div/>').css({ 'width': width + 'px', 'height': height + 'px', 'overflow': 'hidden', 'position': 'relative' }));
    $('.' + id + '').css({ 'width': '30000px', 'position': 'absolute' });
    $('.' + btnLeft).click(function () {
        if (curIndex <= 1)
            return false;
        curImg = $('.' + id + '').find('img:first:visible');
        $('.' + id + '').animate({ 'left': '+=' + (curImg.parent().width() + otherNum) }, 'slow');
        curIndex--;
        if (type == 1) {
            if (curIndex <= 1) {
                $('.' + btnLeft + ' img').attr("src", "imges/button_pic02.jpg");
                $('.' + btnRight + ' img').attr("src", "imges/button_pic01.jpg");
            }
            else {
                $('.' + btnRight + ' img').attr("src", "imges/button_pic01.jpg");
            }
        }
        return false;
    });
    $('.' + btnRight).click(function () {
        if (curIndex >= max)
            return false;
        curImg = $('.' + id + '').find('img:first:visible');
        $('.' + id + '').animate({ 'left': '-=' + (curImg.parent().width() + otherNum) }, 'slow');
        curIndex++;
        if (type == 1) {
        if (curIndex >= max) {
            $('.' + btnLeft + ' img').attr("src", "imges/button_pic03.jpg");
            $('.' + btnRight + ' img').attr("src", "imges/button_pic04.jpg");
        }
        else {
            $('.' + btnLeft + ' img').attr("src", "imges/button_pic03.jpg");
        }
        }
        return false;
    });
}
