$(function(){
var len  = $(".num > li").length;
var index = 0;
var adTimer;
$(".num li").mouseover(function(){
index  =   $(".num li").index(this);
showImg(index);
}).eq(0).mouseover();	

$('.ad').hover(function(){
clearInterval(adTimer);
},function(){
adTimer = setInterval(function(){
index++;
if(index==len){index=0;}
showImg(index);	
} , 5000);
}).trigger("mouseleave");
})

function showImg(index){
var adHeight = $(".ad").height();
$(".slider").stop(true,false).animate({top : -adHeight*index},1000);
$(".num li").removeClass("on")
.eq(index).addClass("on");
}