//banner焦点图
var t = n = count = 0;
function showAuto()
{
	n = n >= (count - 1) ? 0 : n + 1;
	$("#slide_text li").eq(n).trigger('click');
}


$(document).ready(function () {
	
	//banner焦点图
	$banner=$('#banner').size();
	if($banner > 0){
		count = $("#slide_list a").size();
		$("#slide_list a:not(:first-child)").hide();
		$("#slide_info").html($("#slide_list a:first-child").find("img").attr('alt'));
		$("#slide_text li:first-child").css({"background":"url(<?php bloginfo( 'template_url' ); ?>/images/banner_btn.gif) no-repeat right",'color':'#000'});
		$("#slide_info").click(function(){window.open($("#slide_list a:first-child").attr('href'), "_blank")});
		$("#slide_text li").click(function() {
			var i = $(this).text() - 1;
			n = i;
			if (i >= count) return;
			$("#slide_info").html($("#slide_list a").eq(i).find("img").attr('alt'));
			$("#slide_info").unbind().click(function(){window.open($("#slide_list a").eq(i).attr('href'), "_blank")})
			$("#slide_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
			$(this).css({"background":"url(<?php bloginfo( 'template_url' ); ?>/images/banner_btn.gif) no-repeat right",'color':'#000'}).siblings().css({"background":"url(<?php bloginfo( 'template_url' ); ?>/images/banner_btn.gif) no-repeat",'color':'#fff'});
		});
		t = setInterval("showAuto()", 5000);
		$("#banner").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 5000);});
	}//endif

	//随滚动条滚动广告
	$ad=$('.scrollAD').size();
	if($ad > 0){
			var oldTopValue = parseInt($('.scrollAD').css('top'));
			var showInfo = function() {
			$('.scrollAD').animate({
				'top': oldTopValue + $(window).scrollTop()
				}, 500);
				var handScroll = setTimeout(showInfo, 500);
			};
			showInfo();
			
			//关闭对联
			$('.scrollAD .close').click( function () {
			$('.scrollAD').hide();
		 });
			
		}//endif
	
});//end ready;
