$(function(){
	var $x = 15;  
	var $y = 16;
	$("a,img").mouseover(function(e){
		if(this.title!=""){
			if(navigator.userAgent.match(/mobile/i)){
				this.title = "";
			}else{
				this.myTitle = this.title;
				this.title = "";
				var tooltip = "<div class='tooltip'>"+this.myTitle+"</div>";
				$("body").append(tooltip);
				$(".tooltip").css({"top": (e.pageY+$y)+"px","left":(e.pageX+$x)+"px"}).show("fast");
				$(this).mouseout(function(){
					this.title = this.myTitle;
					$(".tooltip").remove();
				})
				$(this).mousemove(function(e){$(".tooltip").css({"top":(e.pageY+$y)+"px","left":(e.pageX+$x)+"px"});});
			}
		}
	});
	var plateNum = $(".article").find(".plate").length;
	for(i=0;i<plateNum;i++){
		$(".platePage").append("<span></span>");
	};
	// $(".proType li").hover(function(){
	// 	$(this).find(".proType2").show();
	// },function(){
	// 	$(this).find(".proType2").hide();
	// });
	// $(".proType2 ol").hover(function(){
	// 	$(this).find(".proType3").show();
	// },function(){
	// 	$(this).find(".proType3").hide();
	// });
	$(".proType li").hover(function(){
		$(this).find(".more-type").show();
		$(this).find(".type-name").each(function(){
			$nameh=$(this).height();
			$listh=$(this).find(".name-list").height();
			if($nameh<$listh){
				$(this).find(".type-more").html("更多");
			}
		})
	},function(){
		$(this).find(".more-type").hide();
	});
	var showmore = $(".showMore").text();
	$(".showMore").click(function(){
		if(!$(".listMore").is(':visible')){
			$(".listMore").slideDown();
			$(".showMore").html("收起");
		}else{
			$(".listMore").slideUp();
			$(".showMore").html(showmore);
		}
	});
	$(".platePage span").click(function(){
		plateIndex = $(this).index();
		$(this).css({"background":"#FFF"});
		$(this).siblings("span").css({"background":"#DFDFF0"});
		$(".plate").eq(plateIndex).siblings(".plate").css("display","none");
		$(".plate").eq(plateIndex).fadeIn("fast");
	});
	var bnIndex = 0;
	var bnPg = $(".banner ul li").length;
	var bnWt = $(".banner ul li").width();
//	$(".banner ul").css("width",bnPg*bnWt);
//	$(".banner ul li").css("width",bnWt);
	function bnmove(bnIndex){
		$(".banner ul").stop().animate({"left":-bnIndex*bnWt});
	};
	$(".bnNext").click(function(){
		bnIndex++;
		if(bnIndex == bnPg){
			bnIndex = 0;
		}
		bnmove(bnIndex);
	});
	$(".bnPrev").click(function(){
		bnIndex--;
		if(bnIndex < 0){
			bnIndex = bnPg-1;
		}
		bnmove(bnIndex);
	});
	setInterval(function(){
		bnIndex++;
		if(bnIndex == bnPg){
			bnIndex = 0;
		}
		bnmove(bnIndex);
	},3000)
	$(".bannerBox .checkTitle span").click(function(){
		var checkIndex = $(this).index();
		$(this).css({"background":"rgba(15,15,99,.3)"});
		$(this).siblings("span").css({"background":"rgba(15,15,99,0)"});
		$(".checkTitle a").eq(checkIndex).css({"display":"block"});
		$(".checkTitle a").eq(checkIndex).siblings("a").css("display","none");
		$(".bannerBox .side ul").eq(checkIndex).siblings("ul").css("display","none");
		$(".bannerBox .side ul").eq(checkIndex).fadeIn("fast");
	});
	$(".type-name").each(function(){
		$listh=$(this).find(".name-list").height();
		if($listh>62){
			$(this).find(".type-more").html("更多");
		}
	})
	$(".type-more").click(function(){
		$name = $(this).parent(".type-name");
		$nameh = $name.height();
		$listh = $name.find(".name-list").height();
		if($nameh<$listh){
			$(this).html("收起");
			$name.css("max-height","1000%");
		}else{
			$name.css("max-height","50px");
			$(this).html("更多");
		}
	})
	$(".online li").hover(function(){
		$(this).find("span").stop().show("fast");
		$(this).siblings("li").stop().find("a").hide();
	},function(){
		$(".online li span").hide();
	});
/*
	$(".insHome").click(function(){
		window.location.href="http://localhost/";
	});
*/
	$(".iconOnline").click(function(){
		$(".online ul").toggle("fast");
	})
	$(".insQq1").click(function(){
		window.open("http://wpa.qq.com/msgrd?v=1&uin=2853572813&site=qq&menu=yes");  
	});
	$(".insQq2").click(function(){
		window.open("http://wpa.qq.com/msgrd?v=1&uin=2853572810&site=qq&menu=yes");  
	});
	$(".insQq3").click(function(){
		window.open("http://wpa.qq.com/msgrd?v=1&uin=2853572814&site=qq&menu=yes");  
	});
	$(".insQq4").click(function(){
		window.open("http://wpa.qq.com/msgrd?v=1&uin=2853572812&site=qq&menu=yes");  
	});
	$(".insQq5").click(function(){
		window.open("http://wpa.qq.com/msgrd?v=1&uin=2853572811&site=qq&menu=yes");  
	});
})