﻿$(document).ready(function(){
	/**
	* 下拉菜单
	*/
	var strArr = ["index","source","video","tast","school","game"];
	var str = window.location.href;
	var curstr = 0;
	for(var s=0;s<strArr.length;s++){
		if(str.indexOf(strArr[s]) != -1){
			curstr = s;	
		}
	}
	$('.mli').each(function(i){
		if($(this).index()==curstr){
			$(this).css({"background-position":-curstr * 137 + "px bottom"});
		}
	})
	
	$('.mli').hover(function(){
		$(this).find('div').stop("true","false").slideDown();
		var num = $(this).index();
		var dest =-num * 137;
		if($(this).index() != curstr)$(this).css({"background-position":dest + "px bottom"})
	},
	function(){
		num = $(this).index();
		dest =-num * 137;
		$(this).find('div').stop("true","false").slideUp();
		if($(this).index() != curstr)$(this).css({"background-position":dest + "px top"})
	})
	
	
	
	/**
	* pro_a_right
	*/
	$('.pro_a_right li').hover(function(){
		$(this).find('div').stop("true","false").animate({top:"63px"});
	},
	function(){
		$(this).find('div').stop("true","false").animate({top:"87px"});
	})
	
	/**
	* 图片切换轮播部分
	*/
	var num = $(".show_content ul li").length;
	var curpoint = 0;
	var lastpoint;
	var cindex;
	var time = 5000;
	var speed = 600;
	//if(num>1){
		$(".showBox").append("<div class='show_button'><ul class='pngfix'></ul></div>");
		for(var i=0;i<num;i++){
			var id = "btn_li" + i;
			$(".show_button ul").append("<li id="+id+"></li>");
			$("#btn_li"+i).css({"background-position":(-i * 14) +"px 0px"});
			$("#btn_li"+i).bind({
				mouseover:function(){
					cindex = this.id.substr(6,7);
					if(cindex != curpoint){
						$(this).css({"background-position":(-cindex * 14) +"px 14px"})
					}
				},
				mouseout:function(){
					if(cindex != curpoint){
						$(this).css({"background-position":(-cindex * 14) +"px 0px"})
					}
				},
				click:function(){
					if(cindex != curpoint){
						$(".show_content").animate({left:-cindex * 720},speed);
						$("#btn_li"+lastpoint).css({"background-position":(-lastpoint * 14) +"px 0px"})
						curpoint = cindex;
						lastpoint = curpoint;
						
						//clearInterval(loop);
						//loop = setInterval(enterFrame,time);
					}
				}
			})
			if(i == 0){
				lastpoint = i;
				$("#btn_li"+i).css({"background-position":(-lastpoint * 14) +"px 14px"});	
			}	
		}
		/*var loop = setInterval(enterFrame,time);
		function enterFrame(){
			curpoint++;
			if(curpoint == num)curpoint = 0;
			$(".show_content").animate({left:-curpoint * 720},speed);
			$("#btn_li"+curpoint).css({"background-position":(-curpoint * 14) +"px 14px"})
			$("#btn_li"+lastpoint).css({"background-position":(-lastpoint * 14) +"px 0px"})
			lastpoint = curpoint;	
		}*/
	//}
	
	/**
	* largeShow
	*/
	largeShow();
	function largeShow()
	{
		var num = $(".largeShowImg ul li").length;
		var obj = $(".largeShowImg ul li");
		var c = 0;
		$(".largeShowPage").append("<ul></ul>");
		for(var i=0;i<num;i++){
			var id = "btnIcon_" + i;
			$(".largeShowPage ul").append("<li id="+id+">"+(i+1)+"</li>");
			$("#btnIcon_" + i).click(function(){
				$("#btnIcon_" + c).css({"background-position":"0px 0px","color":"#999"});
				$(obj[c]).hide();
				c = this.id.substr(8,9);
				$(this).css({"background-position":"-14px 0px","color":"#e4596d"});
				$(obj[c]).fadeIn(1000);
			});
			$("#btnIcon_" + c).css({"background-position":"-14px 0px","color":"#e4596d"});
		}
		$(".largeShow_last").click(function(){
			$("#btnIcon_" + c).css({"background-position":"0px 0px","color":"#999"});
			$(obj[c]).hide();
			if(c<1) c=num;
			c--;
			$("#btnIcon_" + c).css({"background-position":"-14px 0px","color":"#e4596d"});
			$(obj[c]).fadeIn(1000);
		})
		$(".largeShow_next").click(function(){
			$("#btnIcon_" + c).css({"background-position":"0px 0px","color":"#999"});
			$(obj[c]).hide();
			c++;
			if(c>num-1) c = 0;
			$("#btnIcon_" + c).css({"background-position":"-14px 0px","color":"#e4596d"});
			$(obj[c]).fadeIn(1000)
		})
		$(obj[c]).fadeIn(1000);
	}
	
	/**
	* 锚标记
	* 2 -- 1
	* 3 -- 2
	* 4 -- 3
	* 5 -- 4
	* 6 -- 5
	* 7 -- 6
	* 8 -- 7、9
	* 9 -- 8、10、11、14
	* 10 -- 12、13
	* 11 -- 15、17、19
	* 12 -- 16、18、20
	*/
	//goTag();
	function goTag()
	{
		var countArr = new Array(
		[1],
		[2],
		[3],
		[4],
		[5],
		[6],
		[7,9],
		[8,10,11,14],
		[12,13],
		[15,17,19],
		[16,18,20],
		[21,22],
		[23,24]);
		
		for(var i=0;i<countArr.length;i++){
			hrefTo(countArr[i],i+2);
		}
		function hrefTo(arr,num){
			for(var k=0;k<arr.length;k++){
				$("#radio"+arr[k]).click(function(){
					var topic = "#topic" + num;
					window.location.href = topic;
				})
			}
		}
		
	}
	
})


var jiathis_config = {
    title:"“Diamonds are a girl’s best friends!”还在为如何挑选心水的钻饰而发愁吗？赶紧来这里 " + document.location.href + "，璀璨美钻、在线试戴、饕餮大片……#钻石专家周大福#只有你想不到，没有你找不到。每月都有好礼相送。",
	url:" "
}
