
/*首页广告效果*/
jQuery(function(){
     var len  = jQuery(".num > li").length;
	 var index = 0;
	 var adTimer;
	 jQuery(".num li").mouseover(function(){
		index  =   jQuery(".num li").index(this);
		showImg(index);
	 }).eq(0).mouseover();	
	 //滑入 停止动画，滑出开始动画.
	 jQuery('.ad').hover(function(){
			 clearInterval(adTimer);
		 },function(){
			 adTimer = setInterval(function(){
			    showImg(index)
				index++;
				if(index==len){index=0;}
			  } , 10000);
	 }).trigger("mouseleave");
})
// 通过控制top ，来显示不同的幻灯片
function showImg(index){
        var adHeight = jQuery(".content_right .ad").height();
		jQuery(".slider").stop(true,false).animate({bottom : -adHeight*index},1000);
		jQuery(".num li").removeClass("on")
			.eq(index).addClass("on");
}
	
/*********************************/
jQuery(document).ready(function($){
    var firstThumb = $(".list-link").eq(0).next().html();
	$("#pic").html(firstThumb);    
    $(".list-link").hover(
        function(){
            var thumb = $(this).next().html();
            $("#pic").html(thumb)
        },
        function(){}
    );
    
	$("ul#slideshows li:first").addClass("active");
});



	function slideSwitch() {
		var $active = jQuery('#slideshows li.active');

		if ( $active.length == 0 ) $active = jQuery('#slideshows li:last');

		// use this to pull the images in the order they appear in the markup
		var $next =  $active.next().length ? $active.next()
			: jQuery('#slideshows li:first');

		
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );


		$active.addClass('last-active');

		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
			});
	}
	
	jQuery(function() {
		setInterval( "slideSwitch()", 15000 );
	});
	
	
