jQuery(document).ready(function() {
    var t = false;
    var str = '';
    var speed = 500;
    var w = 1000;
    var n = jQuery('#actor li').length;
    var numWidth = n * 18;
    var _left = (w - (numWidth + 26)) / 2;
    var c = 0; jQuery('#actor').width(w * n);
    jQuery('#actor li').each(function(i) { str += '<span></span>' });
    jQuery('#numInner').width(numWidth).html(str);
    jQuery('#imgPlay .mc').width(numWidth);
    jQuery('#imgPlay .num').css('left', _left);
    jQuery('#numInner').css('left', _left + 13);
    jQuery('#numInner span:first').addClass('on');
    function cur(ele, currentClass) {
        ele = jQuery(ele) ? jQuery(ele) : ele;
        ele.addClass(currentClass).siblings().removeClass(currentClass)
    }
    jQuery('#imgPlay .next').click(function() { slide(1) });
    jQuery('#imgPlay .prev').click(function() { slide(-1) });
    function slide(j) {
        if (jQuery('#actor').is(':animated') == false) {
            c += j;
            if (c != -1 && c != n) {
                jQuery('#actor').animate({ 'marginLeft': -c * w + 'px' }, speed)
            }
            else if (c == -1) {
                c = n - 1; jQuery("#actor").css({ "marginLeft": -(w * (c - 1)) + "px" });
                jQuery("#actor").animate({ "marginLeft": -(w * c) + "px" }, speed)
            } else if (c == n) { c = 0; jQuery("#actor").css({ "marginLeft": -w + "px" }); jQuery("#actor").animate({ "marginLeft": 0 + "px" }, speed) } cur(jQuery('#numInner span').eq(c), 'on')
        }
    }
    jQuery('#numInner span').click(function() { c = jQuery(this).index(); fade(c); cur(jQuery('#numInner span').eq(c), 'on') });
    function fade(i) {
        if (jQuery('#actor').css('marginLeft') != -i * w + 'px') {
            jQuery('#actor').css('marginLeft', -i * w + 'px'); jQuery('#actor').fadeOut(0, function() {
                jQuery('#actor').fadeIn(500)
            })
        }
    } function start() { t = setInterval(function() { slide(1) }, 5000) } function stopt() { if (t) clearInterval(t) } jQuery("#imgPlay").hover(function() { stopt() }, function() { start() }); start()
});
