//Scrolling advertisement
var len = $(".num > li").length;
var index = 0; //Picture serial number
var adTimer;
$(".num li").mouseover(function() {
index = $(".num li").index(this); //Get the index of mouseover li
showImg(index);
}).eq(0).mouseover();
//Slide in to stop animation, slide out to start animation.
$('#scrollPics').hover(function() {
clearInterval(adTimer);
}, function() {
adTimer = setInterval(function() {
showImg(index)
index ;
if (index == len) // After the last picture, go to the first one
index = 0;
function showImg(index) {
var adHeight = $("#scrollPics>ul>li:first").height();
$(".slider").stop(true, false) .animate({ "marginTop": -adHeight * index "px" //Change the value of the marginTop attribute to achieve the effect of carousel
}, 1000);
$(".num li"). removeClass("on")
.eq(index).addClass("on");
}