var currentId = "#p1";
var timer_scroll = null ;
var timer_setDrag = null ;
var speed = 2000 ;//3000
var isDrag = false ;
var isFirst = true ;
var isScroll = false ;
//video obj
var myManyPlayers_1;
var myManyPlayers_2;
var myManyPlayers_3;
var videoFlag ;
var cssFlag = 0;
var tipTimer = null ;

var product_slide_state = 0 ;
				   //http://china.dell.com/cn/p/alienware-laptops.aspx?c=cn&cs=cndhs1&l=zh&s=dhs&~ck=mn
var product_report_index = 0;
var product_detail_report = ["M11X_SEE_DETAIL","M14X_SEE_DETAIL","M17X_SEE_DETAIL","M18X_SEE_DETAIL","AREA-51_ALX_SEE_DETAIL",
"AURARA_ALX_SEE_DETAIL","AURORA_SEE_DETAIL","MONITOR_SEE_DETAIL","BACKPACK_SEE_DETAIL","MOUSE_SEE_DETAIL"];
var product_buy_report = ["M11X_BUY","M14X_BUY","M17X_BUY","M18X_BUY","AREA-51_ALX_BUY",
"AURARA_ALX_BUY","AURORA_BUY","MONITOR_BUY","BACKPACK_BUY","MOUSE_BUY"];
var product_promotions_report = ["M14X_PROMOTIONS","INSTALLMENT_PROMOTIONS","NAMEPLATE_PROMOTIONS"];
var product_more = ['http://china.dell.com/cn/p/alienware-m11x-r3/pd',
					'http://china.dell.com/cn/p/alienware-m14x/pd',
					'http://china.dell.com/cn/p/alienware-m17x-r3/pd',
					'http://china.dell.com/cn/p/alienware-m18x/pd',
					'http://china.dell.com/cn/p/alienware-area51-alx/pd',
					'http://china.dell.com/cn/p/alienware-aurora-alx/pd',
					'http://china.dell.com/cn/p/alienware-aurora-r4/pd?oc=alwad-11&model_id=alienware-aurora-r4',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=230-11304',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=A5042223#Overview',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=570-10871'];
var product_detail = ['http://china.dell.com/cn/p/alienware-m11x-r3/pd',
					'http://china.dell.com/cn/p/alienware-m14x/pd',
					'http://china.dell.com/cn/p/alienware-m17x-r3/pd',
					'http://china.dell.com/cn/p/alienware-m18x/pd',
					'http://china.dell.com/cn/p/alienware-area51-alx/pd',
					'http://china.dell.com/cn/p/alienware-aurora-alx/pd',
					'http://china.dell.com/cn/p/alienware-aurora-r4/pd?oc=alwad-11&model_id=alienware-aurora-r4',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=230-11304',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=A5042223#Overview',
					'http://accessories.ap.dell.com/sna/productdetail.aspx?c=cn&l=zh&s=dhs&cs=cndhs1&sku=570-10871'];
/*Share Picture*/
var share_pic = {current:0,pics:[]};
/* Scroll Function*/

var pageSpeed = {"#p1":2400,"#p2":2400,"#p3":2000,"#p4":2000,"#p5":2000,"#p6":2000,"#p7":2000,"#p8":2000};
var page = {
	"#p1":"MAIN_1_PAGE","#p2":"MAIN_2_PAGE","#p3":"PRODUCT_PAGE","#p4":"NEWS_PAGE",
	"#p5":"VIDEO_PAGE","#p6":"BRAND_PAGE","#p7":"SHARE_PAGE","#p8":"COMMUNITY_PAGE","#p9":"FOOTER_PAGE",
	".btn_shopcart_buy":"SHOPCART_BUTTON",".btn_shopcart_list_1":"SHOPCART_PHONE",
	".btn_shopcart_list_2":"SHOPCART_QQ_ONLINE",".btn_shopcart_list_3":"SHOPCART_DELL_ONLINE",
	".btn_shopcart_list_4":"SHOPCART_SALE_CHANNEL"
};
//google analytics
	var _gaq = _gaq || [];
  	_gaq.push(['_setAccount', 'UA-1345389-3']);
  	_gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
//video param
window.isVideo1Playing  = false;
window.isVideo2Playing  = false;
window.isVideo3Playing  = false;


function tryStopPlaying (videoId)
{

	var _player = document.getElementById(videoId);
	if(_player && jQuery.isFunction(_player.is_playing))
	{
		try
		{
			if(_player.is_playing())
			{
				_player.videoControl("pause");
			}
		}
		catch (_e)
		{
			setTimeout("tryStopPlaying('"+videoId+"');",100);
		}
	}
}
/*function isSupportVideo(){
	return 	!!-[1,]||($.browser.msie && parseInt($.browser.version)>=9);
}*/

//VideoJS.setupAllWhenReady();
$().ready(function(e) {

	//createVideo_1();
	//createVideo_2();
	//video play - story
	/*if(isSupportVideo){
	  myManyPlayers_1 = VideoJS.setup(["example_video_1"]);
	  myManyPlayers_2 = VideoJS.setup(["example_video_2"]);
	}*/
	if(!isSupportVideo){//ie7,8 init video
		createVideo_1();
		createVideo_2();
		//createVideo_3("list_m11x_4");
		createIEShare();
	}
	//图片错层
	$(window).scroll(function(e){
		/*$("#debug").html("scrollTop:"+$(window).scrollTop()
			+"<br>bc_2_logo:"+$("#bc_2_logo").css("top")
			+"<br>bc_2_feiji:"+$("#bc_2_feiji").css("top")
			+"<br>p3_body:"+$("#p3_body").css("top")
			+"<br>flash_fallback_3 : "
			+"<br>currentId:"+currentId
			);*/
		var delay = 0;
		var animate = 'easeOutCirc';
		var bg_speed = 0.3;
		var object_speed = 0.5; 			 		
		var container_offset = 0;//-300
		var scroll_position = $(window).scrollTop();
		//lastDivHeigth + top - start - wantTop = weiyi ;
		//end - lastDivHeigth + wantTop = changedTop
		//if weiyi = 0 , changeTop = end - start - lastChangeTop
		$("#bg_content").stop().animate({ top : 0 - scroll_position}, delay);
		
		if(scroll_position >= 0 && scroll_position < 950){
			if(scroll_position<550){
				if($("#bc_2_logo").css("top") != "50px"){
					$("#bc_2_logo").css("top","50px");
				}
			}
			
			doAnimate("#bc_1_logo",0,950,scroll_position,850,0,"line","top",delay);
			doAnimate("#bc_1_bg",0,800,scroll_position,1050,400,"sin","top",delay); // bc_1_bg  400 -->300
			doAnimate("#bc_1_bg",800,950,scroll_position,0,150,"line","top",delay); 
			//doAnimate("#bc_2_logo",0,450,scroll_position,450,530,"line","top",delay);
			//doAnimate("#bc_2_logo",450,650,scroll_position,710,530,"line","top",delay);//20
			
			doAnimate("#bc_2_bg",0,100,scroll_position,0,-200,"line","top",delay);//bc_2_bg -200 -335
			doAnimate("#bc_2_bg",100,800,scroll_position,1085,-100,"sin","top",delay);
			doAnimate("#bc_2_bg",800,950,scroll_position,0,-485,"line","top",delay);
			
			doAnimate("#bc_2_logo",500,890,scroll_position,480,50,"sin","top",delay);// bc_2_logo 终止 20
			doAnimate("#bc_2_logo",890,950,scroll_position,0,-40,"line","top",delay);
			
			doAnimate("#bc_2_feiji",550,920,scroll_position,470,400,"sin","top",delay);//bc_2_feiji   终止 300 -->330
			doAnimate("#bc_2_feiji",920,950,scroll_position,0,300,"line","top",delay);

			doAnimate("#bc_2_zhanjian",700,950,scroll_position,480,500,"sin","top",delay);//bc_2_zhanjian 终止 300/270
			
		}
		if(scroll_position >= 950 && scroll_position < 2450){
			if($("#bc_1_logo").css("top") != "-100px"){
				$("#bc_1_logo").css("top","-100px");
			}
			doAnimate("#bc_1_bg",950,1600,scroll_position,500,300,"line","top",delay);
			doAnimate("#bc_2_logo",950,1350,scroll_position,400,20,"line","top",delay);
			//doAnimate("#bc_2_logo",1250,1750,scroll_position,500,20,"line","top",delay);
			if(scroll_position >= 1550 ){
				if($("#bc_2_logo").css("top") != "20px"){
					$("#bc_2_logo").css("top","20px");
				}
			}
			
			doAnimate("#bc_2_feiji",950,1600,scroll_position,500,330,"line","top",delay);//300-->330
			//doAnimate("#bc_2_feiji",1300,1750,scroll_position,450,500,"line","top",delay);
			if(scroll_position >= 1600 ){
				if($("#bc_2_feiji").css("top") != "480px"){
					$("#bc_2_feiji").css("top","480px");
				}
			}
			doAnimate("#bc_2_zhanjian",950,2100,scroll_position,600,270,"line","top",delay);//1150-600 = 450 +270 = 820
			//doAnimate("#bc_2_zhanjian",1200,1600,scroll_position,200,650,"line","top",delay);
			//doAnimate("#bc_2_zhanjian",1800,2000,scroll_position,200,950,"line","top",delay);
			if(scroll_position >= 2100 ){
				if($("#bc_2_zhanjian").css("top") != "820px"){
					$("#bc_2_zhanjian").css("top","820px");
				}
			}
			
			doAnimate("#bc_2_bg",950,2450,scroll_position,800,-335,"line","top",delay);
			
			//doAnimate("#bc_3_tizi",900,1500,scroll_position,600,100,"line","top",delay);
			if(scroll_position <1800){
				if($("#bc_3_tizi").css("top") != "100px"){
					$("#bc_3_tizi").css("top","100px");
				}
			}
			doAnimate("#bc_3_tizi",1800,2300,scroll_position,800,100,"line","top",delay);
			
			//doAnimate("#p3_body",1350,1650,scroll_position,300,500,"line","top",delay,p3callback);
			//doAnimate("#p3_body",1650,2000,scroll_position,850,500,"line","top",delay,p3callback);
			if(scroll_position <1950){
				if($("#p3_body").css("top") != "500px"){
					$("#p3_body").css("top","500px");
				}
			}
			//doAnimate("#p3_body",1350,1650,scroll_position,300,500,"line","top",delay);
			doAnimate("#p3_body",1950,2300,scroll_position,850,500,"line","top",delay);
			
			//doAnimate("#bc_3_bg",1100,2000,scroll_position,900,0,"line","top",delay);//0->600px
			
			/*doAnimate("#bc_4_content",1800,2000,scroll_position,200,200,"line","top",delay,function(e){
				//$("#bc_4_news_list").css(transition_property("left 0.3s ease 0.8s"));
				//$(".bc_4_news_list").css("left",824);
			});*/
			
			if(scroll_position < 2150){
				if($("#p3_product_list").css("top")!="200px"){
					$("#p3_product_list").css("top",200);
				}
			}
			doAnimate("#p3_product_list",2150,2300,scroll_position,350,200,"line","top",delay);
			
			
			if(scroll_position >=2100){
				if($("#bc_4_content").css("top") != "200px"){
					$("#bc_4_content").css("top","200px");
				}
				if($("#bc_4_news_list").css("top") != "330px"){
					$("#bc_4_news_list").css("top",330);
				}
			}
		}
		
		if(scroll_position >= 2300 && scroll_position < 3100){
			//doAnimate("#bc_2_bg",2150,2350,scroll_position,200,1035,"line","top",delay);
			if(scroll_position >=2450){
				if($("#bc_2_bg").css("top") != "1035px"){
					$("#bc_2_bg").css("top","1035px");
				}
			}
			//doAnimate("#bc_3_tizi",2000,2600,scroll_position,600,-200,"line","top",delay);
			if(scroll_position < 2800){
				if($("#bc_3_tizi").css("top") != "-200px"){
					$("#bc_3_tizi").css("top","-200px");
				}
				if($("#p3_product_list").css("top") != "0px"){
					$("#p3_product_list").css("top","0px");
				}
			}
			
			//doAnimate("#p3_body",2000,2800,scroll_position,1100,0,"line","top",delay,p3callback);
			doAnimate("#p3_body",2300,3100,scroll_position,1100,0,"line","top",delay);
			
			doAnimate("#bc_3_bg",2300,3100,scroll_position,550,0,"line","top",delay);//0->600px
		
			doAnimate("#bc_4_bg",2300,3100,scroll_position,900,-250,"line","top",delay);//-250->-270
			
			doAnimate("#bc_4_content",2300,3100,scroll_position,1100,200,"line","top",delay);
			
			doAnimate("#bc_4_news_list",2700,3100,scroll_position,600,330,"line","top",delay);
			
			if(scroll_position >= 2800){
				if($("#bc_5_content").css("top") != "400px"){
					$("#bc_5_content").css("top","400px");
				}
			}
		}
		
		if(scroll_position >= 3100 && scroll_position < 4100){
			doAnimate("#bc_4_bg",3100,3900,scroll_position,900,-350,"line","top",delay);//-350
			
			doAnimate("#bc_4_content",3100,3700,scroll_position,900,-100,"line","top",delay);
			//doAnimate("#bc_4_content",3400,3800,scroll_position,200,-400,"line","top",delay);
			if(scroll_position >= 3700 && scroll_position < 4100){
				if($("#bc_4_content").css("top") != "-400px"){
					$("#bc_4_content").css("top","-400px");
				}
			}
			if(scroll_position < 3700){
				if($("#bc_4_news_list").css("top") != "130px"){
					$("#bc_4_news_list").css("top","130px");
				}	
			}

			doAnimate("#bc_5_content",3100,3900,scroll_position,1200,400,"line","top",delay,function(e){
					if(scroll_position > 3700){
						$("#bc_5_vedio_content").css(transition_property("all 0.8s ease 0.2s"));
						$("#bc_5_vedio_content").css("top",126);
					}else{
						$("#bc_5_vedio_content").css(transition_property("all 0.5s ease 0.2s"));
						$("#bc_5_vedio_content").css("top",680);
					}
					if(scroll_position > 3700){
						if(isSupportVideo&&$("#video_1").html() == null){
							createVideo_1();
						}
					}else{
						if(isSupportVideo&&$("#video_1")&&$("#video_1").html() != null){
							//document.getElementById("example_video_1").stop();
							destroyVideo_1();
						}	
					}
			});
			//doAnimate("#bc_5_bg",3200,3600,scroll_position,400,-340,"line","top",delay,function(e){});
			if(scroll_position >=3500){
				if($("#bc_5_bg").css("top") != "-340px"){
					$("#bc_5_bg").css("top","-340px");
				}
			}
		}
		if(scroll_position >= 3900 && scroll_position < 4720){
			//doAnimate("#bc_4_bg",3600,3900,scroll_position,300,-450,"line","top",delay);
			if(scroll_position < 4200){
				if($("#bc_4_bg").css("top") != "-450px"){
					$("#bc_4_bg").css("top","-450px");
				}
			}
			doAnimate("#bc_5_content",3900,4720,scroll_position,500,0,"line","top",delay,function(e){
				if(scroll_position > 4500){
						$("#bc_5_vedio_content").css(transition_property("all 0s ease 0.2s"));
						$("#bc_5_vedio_content").css("top",680);	
					}else{
						//$("#bc_5_vedio_content").css("top",680);
						$("#bc_5_vedio_content").css(transition_property("all 0.8s ease 0.2s"));
						$("#bc_5_vedio_content").css("top",126);
					}
				if(scroll_position > 4100){
					if(isSupportVideo&&$("#video_1")&&$("#video_1").html() != null){
						destroyVideo_1();
					}	
				}else{
					if(isSupportVideo&&$("#video_1").html() == null){
						createVideo_1();
					}
				}
			});
			
			doAnimate("#bc_5_bg",3900,4720,scroll_position,350,-340,"line","top",delay);
			
			//doAnimate("#bc_5_content",4250,4750,scroll_position,500,100,"line","top",delay,function(e){});
			if(scroll_position < 4320){
				if($("#bc_6_content").css("top") != "200px"){
					$("#bc_6_content").css("top","200px");
				}
				if($("#brand_list").css("top") != "270px"){
					$("#brand_list").css("top","270px");
				}
			}
			doAnimate("#bc_6_content",4320,4720,scroll_position,600,200,"line","top",delay);
			doAnimate("#brand_list",4470,4720,scroll_position,450,270,"line","top",delay);//70
			
			if(scroll_position >= 4400 ){
				if($("#bc_6_bg_1").css("top") != "-178px"){
					$("#bc_6_bg_1").css("top","-178px");
				}
			}
		}
		if(scroll_position >= 4720 && scroll_position < 5670){
			//doAnimate("#bc_5_bg",4420,4720,scroll_position,300,130,"line","top",delay);
			if(scroll_position < 5020){
				if($("#bc_5_bg").css("top") != "130px"){
					$("#bc_5_bg").css("top","130px");
				}
				if($("#brand_list").css("top") != "70px"){
					$("#brand_list").css("top","70px");
				}
			}
			
			//doAnimate("#bc_6_bg_1",4220,4520,scroll_position,300,-178,"line","top",delay);
			if(scroll_position < 4820){
				if($("#bc_5_bg").css("top") != "130px"){
					$("#bc_5_bg").css("top","130px");
				}
			}
			if(scroll_position < 5020){
				if($("#bc_7_content").css("top") != "400px"){
					$("#bc_7_content").css("top","400px");
				}
				if($("#share_list").css("top") != "310px"){
					$("#share_list").css("top","310px");
				}
			}
			
			doAnimate("#bc_6_bg_1",4820,5620,scroll_position,372,-178,"line","top",delay);
			doAnimate("#bc_7_bg",4870,5560,scroll_position,780,-50,"line","top",delay);
			
			doAnimate("#bc_7_content",5020,5520,scroll_position,900,400,"line","top",delay);
			doAnimate("#share_list",5220,5520,scroll_position,550,310,"line","top",delay);//60
		}
		if(scroll_position >= 5420 && scroll_position < 6620){
			doAnimate("#bc_7_bg",5560,6560,scroll_position,750,-140,"line","top",delay);
			//doAnimate("#bc_6_bg_1",5370,5670,scroll_position,300,250,"line","top",delay,function(e){});
			if(scroll_position >= 5670 && scroll_position < 6170){
				if($("#bc_6_bg_1").css("top") != "250px"){
					$("#bc_6_bg_1").css("top","250px");
				}
				if($("#share_list").css("top") != "60px"){
					$("#share_list").css("top","60px");
				}
			}
			if(scroll_position < 5720){
				if($("#bc_6_content").css("top") != "0px"){
					$("#bc_6_content").css("top","0px");
				}	
			}
			
			
			doAnimate("#bc_7_content",5520,5920,scroll_position,600,0,"line","top",delay);
			
			
			//doAnimate("#bc_8_content",5120,5420,scroll_position,300,200,"line","top",delay,function(e){
				//$("#bc_8_bg").css(transition_property("left 0s ease 0s"));
				//$("#bc_8_bg").css("left",824);	
			//});
			if(scroll_position < 5720){
				if($("#bc_8_content").css("top") != "200px"){
					$("#bc_8_content").css("top","200px");
				}
				if($("#bc_8_community_body").css("top") != "250px"){
					$("#bc_8_community_body").css("top","250px");
				}
			}
			
			doAnimate("#bc_8_content",5720,6520,scroll_position,1000,200,"line","top",delay);
			doAnimate("#bc_8_community_body",6120,6520,scroll_position,650,250,"line","top",delay);
			//doAnimate("#bc_8_bg",5260,5860,scroll_position,600,200,"line","top",delay,function(e){});
			//doAnimate("#bc_8_bg",5860,6260,scroll_position,490,200,"line","top",delay,function(e){});
		}
		if(scroll_position >= 6520){
			//doAnimate("#bc_7_bg",6260,6560,scroll_position,300,160,"line","top",delay,function(e){});
			if(scroll_position >= 6560 && scroll_position < 6860){
				if($("#bc_7_bg").css("top") != "100px"){
					$("#bc_7_bg").css("top","100px");
				}
			}
			//doAnimate("#bc_8_content",6220,6720,scroll_position,700,0,"line","top",delay);
			if(scroll_position < 6860){
				if($("#bc_8_content").css("top") != "0px"){
					$("#bc_8_content").css("top","0px");
				}
				if($("#bc_8_community_body").css("top") != "0px"){
					$("#bc_8_community_body").css("top","0px");
				}
			}
			
		}

		//video style
		if(scroll_position >= 4300 || scroll_position < 3600 ){
			if(!isSupportVideo) 
			{
				if($("#flash_fallback_1") && jQuery.isFunction($("#flash_fallback_1")[0].is_playing) && jQuery.isFunction($("#flash_fallback_1")[0].videoControl)){
					if(window.isVideo1Playing){
						tryStopPlaying("flash_fallback_1");
						window.isVideo1Playing = false;
					}
				}
			}
			/*else
			{
				var video_1 = document.getElementById("example_video_1")
				if(!video_1.paused){
					video_1.pause();
				}
			}*/
		}
		if(scroll_position >= 5000 || scroll_position < 4500 ){
			if(!isSupportVideo) 
			{
				if($("#flash_fallback_2") && jQuery.isFunction($("#flash_fallback_2")[0].is_playing) && jQuery.isFunction($("#flash_fallback_2")[0].videoControl)){
					if(window.isVideo2Playing){
						tryStopPlaying("flash_fallback_2");
						window.isVideo2Playing = false;
					}
				}
			}
			else
			{
				/*var video_2 = document.getElementById("example_video_2")
				if(!video_2.paused){
					video_2.pause();
				}*/
				if(isSupportVideo&&$("#video_2")&&$("#video_2").html() != null){
					destroyVideo_2();
				}
			}
		}
		if(scroll_position >= 6100 || scroll_position < 5000 ){
			if(isSupportVideo && $("#list_1_aw").css("z-index") != 5 ){
				$("#list_1_aw").find(".clearfix_1_in_4").children("a").click();
			}
			if(!isSupportVideo)
			{
				/*if($("#flash_fallback_3") && jQuery.isFunction($("#flash_fallback_3")[0].is_playing) && jQuery.isFunction($("#flash_fallback_3")[0].videoControl)){
					if(window.isVideo3Playing){
						tryStopPlaying("flash_fallback_3");
						window.isVideo3Playing = false;
					}
				}*/
				destroyIEShare();
			}
			else
			{
				if(isSupportVideo&&$("#video_3")&&$("#video_3").html() != null){
					destroyVideo_3();
				}
				
			}
		}
		if(scroll_position >3600 && scroll_position <= 4300){
			if(cssFlag != 2 ){
				cssFlag = 2 ;
				setVideoStyle(2);
			}
			if(!isSupportVideo && document.getElementById("flash_fallback_1") && jQuery.isFunction(document.getElementById("flash_fallback_1").is_playing))
			{
				//alert(document.getElementById("flash_fallback_1").is_playing());
				window.isVideo1Playing = document.getElementById("flash_fallback_1").is_playing();
			}
		}
		if(scroll_position > 4500 && scroll_position <= 5000 ){
			if(cssFlag != 3 ){
				cssFlag = 3 ;
				setVideoStyle(3);
			}
			if(isSupportVideo&&$("#video_2").html() == null){
				createVideo_2();
			}
			if(!isSupportVideo && document.getElementById("flash_fallback_2") && jQuery.isFunction(document.getElementById("flash_fallback_2").is_playing))
			{
				//alert(document.getElementById("flash_fallback_1").is_playing());
				window.isVideo2Playing = document.getElementById("flash_fallback_2").is_playing();
			}
		}
		if(scroll_position < 6100 && scroll_position >= 5000 ){
			if(cssFlag != 1 ){
				cssFlag = 1 ;
				setVideoStyle(1);
			}
			/*if(!isSupportVideo && document.getElementById("flash_fallback_3") && jQuery.isFunction(document.getElementById("flash_fallback_3").is_playing))
			{
				window.isVideo3Playing = document.getElementById("flash_fallback_3").is_playing();
			}*/
			if(!isSupportVideo){
				if($("#share_list").html() == ""){
					createIEShare();
				}
			}
		}
		
		setScrollCurrent(scroll_position,isDrag);
	});
		
	//菜单
	$("ul",".menu_left").children("li").each(function(index, element) {
		var className = $(this).attr("class");
        $("a",this).click(function(e) {
			
			var currentId;
			if(className == 'menu_1_1'){
				currentId = "#p1";
				//alert(className);
			}else{
        		currentId = "#p"+(parseInt(className.substring(className.lastIndexOf("_")+1,className.length))+1);
			}
			var speed_1 = 2000;
			isScroll = true ;
			if($.preLoader.option.moduleAjaxStatus == 1 && $.preLoader.option.allDown == 0){
				$.each($.preLoader.option.moduleList,function(index,value){
					//alert($(this).name + " -- "+currentId);
					if(this.name == currentId && !this.isCompleted && !this.isRunning){
						$.preLoader.loadingModuleByName(currentId);
						speed_1 = 0 ;
					}
				});
			}
			$(currentId).ScrollTo(speed_1);
			
			_gaq.push(['_trackEvent', 'CLICK', 'PAGEVIEW_LEFT_MENU',page[currentId]]);
			
			setTimeout(function(){isScroll = false ;},speed_1+100);
			return false;
        });
    })
	window.scrollTo(0,0);
	//右侧购买菜单 
	//菜单条闪动
	flash_timer = setTimeout(shopcartFlash,4100);
	/*$(".btn_shopcart_buy").mouseenter(function(e) {
		$(".btn_shopcart").stop().animate({width:538},500,"easeOutCirc");
		$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm_hover.png");
		$(".btn_shopcart_buy").find("img:eq(1)").fadeOut(200,'easeOutBounce');
    });*/
	$(".btn_shopcart_buy").click(function(e){
		
		_gaq.push(['_trackEvent', 'CLICK', 'SHOPCART',page[".btn_shopcart_buy"]]);
		
		$(".btn_shopcart").stop().animate({width:538},500,"easeOutCirc");
		$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm_hover.png");
		$(".btn_shopcart_buy").find("img:eq(1)").fadeOut(200,'easeOutBounce');
    });
	$(".btn_shopcart_buy").mouseleave(function(e) {
		$(".btn_shopcart").stop().animate({width:134},500,"easeOutCirc");
		$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm.png");
		$(".btn_shopcart_buy").find("img:eq(1)").fadeIn(200,'easeInBounce');
		//$(".btn_shopcart_detail").stop().animate({"left":404},500,"easeOutCirc");
    });
	$(".btn_shopcart_detail").mouseenter(function(e){
		$(".btn_shopcart").stop().animate({width:538},500,"easeOutCirc");
		$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm_hover.png");
		$(".btn_shopcart_buy").find("img:eq(1)").fadeOut(200,'easeOutBounce');
		//$(".btn_shopcart_detail").stop().animate({"left":0},500,"easeOutCirc");
	});
	$(".btn_shopcart_detail").mouseleave(function(e){
		$(".btn_shopcart").stop().animate({width:134},500,"easeOutCirc");
		$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm.png");
		$(".btn_shopcart_buy").find("img:eq(1)").fadeIn(200,'easeInBounce');
		//$(".btn_shopcart_detail").stop().animate({"left":404},500,"easeOutCirc");
	});
	$(".btn_shopcart_list").find("li").click(function(e) {
		
		_gaq.push(['_trackEvent', 'CLICK', 'SHOPCART',page["."+$(this).attr("class")]]);
		
        $(".btn_shopcart_buy").mouseleave();
    });
	//上下按键滚动
	$(document).keydown(function (evt) {
		evt.returnValue = false;
		//if(e.preventDefault) e.preventDefalut();
		if (evt.keyCode == 38 ){
			evt.preventDefault();
			if(timer_scroll == null){
				scrollPrev();
			}
	  	} else if (evt.keyCode == 40){
			evt.preventDefault();
			if(timer_scroll == null){
				scrollNext();
			}
	  	}
		//alert($(currentId).prev("div",".content").attr("id"));
	});
	
	if(document.addEventListener){   
		document.addEventListener('DOMMouseScroll',scrollFunc,false);   
	}//W3C   
		//window.onmousewheel=
		document.onmousewheel=scrollFunc;//IE/Opera/Chrome/Safari   
	
	//Product Slides
	// Initialize Slides
	//新闻slides
	$("#bc_4_news_body").slides({
		preload: true,
		generatePagination: false,
		generateNextPrev: false,
		extraPaginationClass:"",
		slideEasing:'easeOutCirc',
		container:"bc_4_news_list",
		paginationClass:"bc_4_news_header"
	});
	
	//产品slides
	$('#p3_product').slides({
		preload: true,
		generatePagination: false,
		generateNextPrev: false,
		extraPaginationClass:"p3_extra",
		slideEasing:'easeOutCirc',
		start:11
		/* Get the starting slide*/
	});
	//product report
	$("#p3_more").click(function(e){
		_gaq.push(['_trackEvent', 'CLICK', 'PRODUCT_BUY',product_buy_report[product_report_index]]);	
	});
	$(".p3_product_view_detail_in").click(function(e){
		_gaq.push(['_trackEvent', 'CLICK', 'PRODUCT_BUY',product_buy_report[product_report_index]]);	
	});
	
	$("#p3_detail").click(function(e){
		_gaq.push(['_trackEvent', 'CLICK', 'PRODUCT_DETAIL',product_detail_report[product_report_index]]);	
	});
	
	$("a","#p3_product_menu_10_list").click(function(e) {
        _gaq.push(['_trackEvent', 'CLICK', 'PRODUCT_PROMOTIONS',product_promotions_report[$("a","#p3_product_menu_10_list").index(this)]]);	
    });
	
	//促销信息
	$("a","#p3_product_menu_10_menu").click(function(e) {
        $(this).parent().parent().find("a").removeClass("current");
		$(this).addClass("current");
		clear_menu_10_Flash($("a","#p3_product_menu_10_menu").index(this));
		//alert($(this).parent().parent().index($(this).parent("li")));
		//$('#p3_product_menu_10_list').stop().animate({'left':-1*$(this).parent().parent().index($(this).parent("li"))*514},500);
    });
	menu_10_timer = setTimeout(menu_10_Flash,3000);
	//浮动-精彩分享	p3_product_float
	
	$("#p3_product_float").mouseenter(function(e) {
        $("#p3_product_float").stop();//.css({"display":"block","opacity":1});
		//showTip(e);
    });
	$("#p3_product_float").css("display","none");
	$("#p3_product_float").css("opacity","0");
	
	$(".p3_product_menu_content").each(function(index) {
		if(index < 4){
			$(this).css("cursor","pointer");
			$(this).mouseenter(function(e) {
				$("#p3_product_float").css("display","block");
                $("#p3_product_float").stop().animate({"opacity":1},0,"easeOutCirc");
            }).mouseleave(function(e) {
                $("#p3_product_float").stop().animate({"opacity":0},350,"easeOutCirc",function(){
					$("#p3_product_float").css("display","none");
				});
            }).mousemove(function(e) {
				$("#debug").html("X:"+e.pageX+",Y:"+e.pageY+"<br>scrollLeft:"+$("#p3_product_float").offset().left+",ScrollTop:"+$("#p3_product_float").offset().top);
				showTip(e);
            }).click(function(e) {
                $("#p3_product_float").click();
            });
		}
    });
	
	$("#p3_product_float").click(function(e) {
        if($("#p3_product_menu_val").find(".current").children("a").attr("id") == "p3_s_0"){
			$("#p7").ScrollTo(2000);//speed
			isScroll=true;
			if(isSupportVideo){
				setTimeout(function(){$("#list_1_m11x").find("a").click();isScroll=false;},2500);
			}
			return false;
		}else if($("#p3_product_menu_val").find(".current").children("a").attr("id") == "p3_s_1"){
			$("#p7").ScrollTo(2000);//speed
			isScroll=true;
			if(isSupportVideo){
				setTimeout(function(){$("#list_1_m14x").find("a").click();isScroll=false;},2500);
			}
			return false;
		}else if($("#p3_product_menu_val").find(".current").children("a").attr("id") == "p3_s_2"){
			$("#p7").ScrollTo(2000);//speed
			isScroll=true;
			if(isSupportVideo){
				setTimeout(function(){$("#list_1_m17x").find("a").click();isScroll=false;},2500);
			}
			return false;
		}else if($("#p3_product_menu_val").find(".current").children("a").attr("id") == "p3_s_3"){
			$("#p7").ScrollTo(2000);//speed
			isScroll=true;
			if(isSupportVideo){
				setTimeout(function(){$("#list_1_m18x").find("a").click();isScroll=false;},2500);
			}
			return false;
		}else{
			return false;	
		}
    });
	
	/*产品 intel商标显示  */
	$("#p3_product_menu_val").children("li").each(function(index, element) {
		if(index == 10){
			$(this).find("a").click(function(e){
				$("#logo_product").css("display","block");
                $("#logo_product").stop().animate({"opacity":1},500,"easeOutCirc");
			});
		}else{
			$(this).find("a").click(function(e) {
				if($("#logo_product").css("display")!="none"){
					$("#logo_product").stop().animate({"opacity":0},500,"easeOutCirc",function(){
						$("#logo_product").css("display","none");
					});
				}
			});
		}
    });
	
	//故事 视频
	$("#bc_5_vedio_header").children("li").click(function(e) {
		if($(this).hasClass("selected")){
			return false ;
		}
        $("#bc_5_vedio_header").children("li").removeClass("selected");
		$(this).addClass("selected");
		video_2_title = $(this).attr("id");
		$("#bc_5_vedio_content_bg_5").find("img").attr("src","video/"+video_2_title+".jpg");
		destroy_create_Video_1();
		return false ;
    }); 
	//品牌 - 品牌slides
	
	$('#brand_list_brand').slides({
		preload: true,
		generatePagination: false,
		generateNextPrev: false,
		extraPaginationClass:"",
		slideEasing:'easeOutCirc',
		container:"brand_list_brand_list",
		paginationClass:"brand_list_brand_menu"
	});
	
	
	//Brand Script
	//header切换
	//left: 213px;
	$("#brand_scroll_bar").stop().animate({left:213},500,"easeOutBounce");
	//brandNav($("#brand_list_brand").children("ul").children(".current"));
	$("#bc_6_brand_header").find("a").click(function(){
//		alert($(this).attr("href"));
		$("#bc_6_brand_header").children("li").removeClass("current");
		$(this).parent("li").addClass("current");
		$("debug").html($("#brand_list_brand").css("left"));
		if($(this).attr("href") == "#1"){
			$("#brand_list_container").stop().animate({left:0},500,"easeOutCirc",function(e){
				$(".bc_6_brand_line_scroll").fadeIn(350,'easeInBounce',function(){
					brandNav($("#brand_list_brand").children("ul").children(".current"));
				});
				if(isSupportVideo&&$("#video_2").html() == null){
					createVideo_2();
				}
			});
		}else{
			/*if(isSupportVideo){
				var video_2 = document.getElementById("example_video_2")
				if(!video_2.paused){
					video_2.pause();
				}
			}*/
			if(isSupportVideo&&$("#video_2")){
					destroyVideo_2();
			}
			else{
				if($("#flash_fallback_2") && jQuery.isFunction($("#flash_fallback_2")[0].is_playing) && jQuery.isFunction($("#flash_fallback_2")[0].videoControl)){
					if(document.getElementById("flash_fallback_2").is_playing()){
						document.getElementById("flash_fallback_2").videoControl("pause");
						window.isVideo2Playing = false;
					}
				}
			}
			if($(this).attr("href") == "#2"){
				$("#brand_list_container").stop().animate({left:-824},500,"easeOutCirc",function(e){
					$(".bc_6_brand_line_scroll").fadeIn(350,'easeInBounce',function(){
						brandNav($("#brand_list_history").children("ul").children(".current"));	
					});
				});
			}else{
				$("#brand_list_container").stop().animate({left:-1648},500,"easeOutCirc",function(e){
					//brandNav($("#brand_list_history").children("ul").children(".current"));
					$(".bc_6_brand_line_scroll").fadeOut(350,"easeOutBounce");
				});
			}
		}
		return false;
	});

	
	//brand_list_brand_menu BrandNav
	$(".brand_list_brand_menu").children("li").mouseover(function(e) {
		brandNav(this);
    });
	$(".brand_list_brand_menu").children("li").mouseout(function(e) {
		brandNav($(this).parent("ul").children(".current"));
    });
	$(".brand_list_history_menu").children("li").mouseover(function(e) {
		brandNav(this);
    });
	$(".brand_list_history_menu").children("li").mouseout(function(e) {
		brandNav($(this).parent("ul").children(".current"));
    });
	$(".brand_list_history_menu").children("li").click(function(e) {
		$(this).parent("ul").children("li").removeClass("current");
		$(this).addClass("current");
		if($(this).children("a").attr("href") == "#history"){
			$("#brand_list_history_list").stop().animate({left:0},500,"easeOutCirc");
		}else if($(this).children("a").attr("href") == "#lang"){
			$("#brand_list_history_list").stop().animate({left:-824},500,"easeOutCirc");
		}else{
			$("#brand_list_history_list").stop().animate({left:-1648},500,"easeOutCirc");
		}
		return false;
	});
	$('#history_history').slides({
		preload: true,
		generatePagination: false,
		generateNextPrev: false,
		extraPaginationClass:"",
		slideEasing:'easeOutCirc',
		container:"history_history_list",
		paginationClass:"history_history_menu"
	});
	$('#history_lang').slides({
		preload: true,
		generatePagination: false,
		generateNextPrev: false,
		extraPaginationClass:"",
		slideEasing:'easeOutCirc',
		container:"history_lang_list"
/*		paginationClass:"history_history_menu"*/
	});
	//brand_list_brand_menu BrandNav end
	
	
	
	if(isSupportVideo){
	//share list
		$(".clearfix_1_in").mouseover(function(e) {
			//$(this).parent("div").css("z-index",100);
			$(this).prev(".clearfix_1_in").css("opacity",1);
		});
		$(".clearfix_1_in").mouseout(function(e) {
			$(this).prev(".clearfix_1_in").css("opacity",0);
			//$(this).parent("div").css("z-index",1);
		});
		$(".clearfix_2_in").mouseover(function(e) {
			//$(this).parent("div").css("z-index",100);
			$(this).prev(".clearfix_2_in").css("opacity",1);
		});
		$(".clearfix_2_in").mouseout(function(e) {
			$(this).prev(".clearfix_2_in").css("opacity",0);
			//$(this).parent("div").css("z-index",1);
		});
		
		//share_content
		setTimeout(function(){$('#share_content').slides({
			preload: true,
			generatePagination: false,
			generateNextPrev: false,
			extraPaginationClass:"share_extra",
			slideEasing:'easeOutCirc',
			container:"share_list" });},3000);
		//share list end
		$("#share_img_1_prev").click(function(e) {
			share_pic.current = share_pic.current-1<0?6:share_pic.current-1;
			//$("#share_img_1_body").stop().find("img").fadeOut(300,function(){
				$("#share_img_1_body").find("img").attr("src",share_pic.pics[share_pic.current]);
				//$("#share_img_1_body").find("img").fadeIn(100);
			//});
        });
		$("#share_img_1_next").click(function(e) {
            share_pic.current = share_pic.current+1>6?0:share_pic.current+1;
            //$("#share_img_1_body").stop().find("img").fadeOut(300,function(){
				$("#share_img_1_body").find("img").attr("src",share_pic.pics[share_pic.current]);
				//$("#share_img_1_body").find("img").fadeIn(100);
			//});
        });
	}
/*	$("#bc_3").css("display","none");
	$("#bc_4").css("display","none");
	$("#bc_5").css("display","none");
	$("#bc_6").css("display","none");
	$("#bc_7").css("display","none");
	$("#bc_8").css("display","none");*/
	$("a").focus(function(){
		this.blur();
	});
	/*setTimeout(function(){
		$(window.frames["sina_weibo"].document).append("<link href='http:\/\/timg.sjs.sinajs.cn\/t35\/style\/css\/common\/public.css' rel='stylesheet' type='text\/css' \/>");
		//Asset.css("http://timg.sjs.sinajs.cn/t35/style/css/common/public.css");
	},5000);*/
	setTimeout(function(){
		if(self.location.href.indexOf("#")>-1&&$(self.location.href.substring(self.location.href.indexOf("#")))){
			$(self.location.href.substring(self.location.href.indexOf("#"))).ScrollTo(2000);
		}else{
			//$("#p1").ScrollTo(2000);
		}
	},2000);
	setScrollCurrent($(window).scrollTop(),isDrag);
});

//scroll

function goto(id) {
	$("#" + id).ScrollTo(speed);
}
function scrollFunc(evt){
	evt=evt || window.event;
	evt.returnValue = false;
	if(!!-[1,]){//ie
		evt.preventDefault();
	}
	if(timer_scroll == null){
		if(evt.wheelDelta){
			if(evt.wheelDelta>0){
				scrollPrev();
			}else{
				scrollNext();
			}
		}else if(evt.detail){
			if(evt.detail>0){
				scrollNext();	
			}else{
				scrollPrev();
			}
		}
	}
}

function nullfun(){
	clearTimeout(timer_scroll);
	timer_scroll = null ;
}
function setDrag(){
	isDrag = true ;
	isFirst = false ;
	clearTimeout(timer_setDrag);
	timer_setDrag = null ;
}
function scrollPrev(){
	if($(currentId).prev("div",".content").attr("id")!= undefined){ 
		//alert(pageSpeed["#"+$(currentId).prev("div").attr("id")]);
		var t = pageSpeed["#"+$(currentId).prev("div").attr("id")]?pageSpeed["#"+$(currentId).prev("div").attr("id")]:2000 ;
		timer_scroll=setTimeout(nullfun,t);
		$(currentId).prev("div").ScrollTo(t);//speed
		currentId = "#"+$(currentId).prev("div",".centent").attr("id");
		
		_gaq.push(['_trackEvent', 'CLICK', 'PAGEVIEW_SCROLL',page[currentId]]);
		
		isDrag = false ;
		timer_setDrag = setTimeout(setDrag,t);
	}else if($(window).scrollTop()>0){
		$("#content_start").ScrollTo(1000);
		clearTimeout(timer_scroll);
		timer_scroll = null ;
	}
}

function scrollNext(){
	if($(currentId).next("div",".content").attr("id") != undefined) {
		var t = pageSpeed[currentId]?pageSpeed[currentId]:2000;
		timer_scroll=setTimeout(nullfun,t);
		$(currentId).next("div").ScrollTo(t);//
		currentId = "#"+$(currentId).next("div",".centent").attr("id");

		_gaq.push(['_trackEvent', 'CLICK', 'PAGEVIEW_SCROLL',page[currentId]]);
		
		isDrag = false ;
		timer_setDrag = setTimeout(setDrag,t);
	}else{
		$("#content_end").ScrollTo(1000);
		clearTimeout(timer_scroll);
		timer_scroll = null ;
	}
}

/* Left menu*/
function setScrollCurrent(scroll_position,init){
	$("ul li a",".menu_left").removeClass("selected");
	if(scroll_position>=0&&scroll_position<750){
		if(isFirst||init){
			currentId = "#p1";
		}
		$("ul .menu_1_1 a",".menu_left").addClass("selected");
	}else if(scroll_position<2100){
		if(isFirst||init){
			currentId = "#p2";
		}
		$("ul .menu_1_1 a",".menu_left").addClass("selected");
	}else if(scroll_position<2900){
		if(isFirst||init){
			currentId = "#p3";
		}
		$("ul .menu_1_2 a",".menu_left").addClass("selected");
	}else if(scroll_position<3700){
		if(isFirst||init){
			currentId = "#p4";
		}
		$("ul .menu_1_3 a",".menu_left").addClass("selected");
	}else if(scroll_position<4520){
		if(isFirst||init){
			currentId = "#p5";
		}
		$("ul .menu_1_4 a",".menu_left").addClass("selected");
	}else if(scroll_position<5320){
		if(isFirst||init){
			currentId = "#p6";
		}
		$("ul .menu_1_5 a",".menu_left").addClass("selected");
	}else if(scroll_position<6320){
		if(isFirst||init){
			currentId = "#p7";
		}
		$("ul .menu_1_6 a",".menu_left").addClass("selected");
	}else if(scroll_position<6930){
		if(isFirst||init){
			currentId = "#p8";
		}
		$("ul .menu_1_7 a",".menu_left").addClass("selected");
	}else if(scroll_position>6887){
		if(isFirst||init){
			currentId = "#p9";
		}
	}
	hiddenBody();
}
function hiddenBody(){
	var i = currentId.substring(2,currentId.length);
	/*$("#debug").html("i : "+i+"<br>display:"+$("#bc_5").css("display")+"<br> scrollTop :"+$(window).scrollTop()
			+"<br>isFirst : "+isFirst
			+"<br>example_video_1 :"+$("#example_video_1").css("display"));*/
	if(!isScroll && $.preLoader.option.moduleAjaxStatus == 1 && $.preLoader.option.allDown == 0){
		$.each($.preLoader.option.moduleList,function(index,value){
			//alert($(this).name + " -- "+currentId);
			if(this.name == currentId && !this.isCompleted && !this.isRunning){
				$.preLoader.loadingModuleByName(currentId);
			}
		});
	}
	$(".bg_img").each(function(index, element){
		if(index == (i-1) || index== i || index == (i-2) || (i==3 && index == 4) ){
			if($(this).css("display")=="none"){
				$(this).css("display","block");
			}
		}else{
			if($(this).css("display")=="block"){
				if($(this).attr("id")!="bc_1")
					$(this).css("display","none");
				}
			}
    	});
	
}
/*Animate function*/
function doAnimate(obj,sta,end,cur,lon,own,type,attr,delay,callback){
	var property = {};
	
	if(cur>=sta&&cur<end){
		switch(type){
			case "line":
				property[attr] = curveLine(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
				
			break;
			case "cos":
				property[attr] = curveCos(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "sin":
				property[attr] = curveSin(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "inout":
				property[attr] = curveInOut(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "tan":
				property[attr] = curveTan(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "ctan":
				property[attr] = curveCtan(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "InOutQuad":
				//$("#debug").append("<br>"+curveInOutQuad(sta,end,cur,lon,own));
				property[attr] = curveInOutQuad(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "OutSine":
				property[attr] = curveOutSine(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
			case "OutExpo":
				property[attr] = curveOutExpo(sta,end,cur,lon,own) ;
				$(obj).stop().animate(property,delay,callback);
			break;
		}
	}
}
function curveLine(s,e,c,d,o){
	return o + Math.floor(( - d + e - s) * (c - s) / (e - s));
}
function curveCos(sta,end,cur,lon,own){
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return -c * Math.cos(t/d * (Math.PI/2)) + c + b;	
}
function curveSin(sta,end,cur,lon,own){
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return c * Math.sin(t/d * (Math.PI/2)) + b;
}
function curveInOut(sta,end,cur,lon,own){
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;	
}
function curveTan(sta,end,cur,lon,own){
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return c * Math.tan(t/d * (Math.PI/4)) + b;
}
function curveCtan(sta,end,cur,lon,own){
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return c *(1-(Math.cos((t/d +1)*(Math.PI/4)))/(Math.sin((t/d +1)*(Math.PI/4)))) + b;
}
function curveOutSine(sta,end,cur,lon,own){//先快后慢
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return c * Math.sin(t/d * (Math.PI/2)) + b;	
}
function curveInOutQuad(sta,end,cur,lon,own){//慢快慢
    var speed=cur-sta;
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta -speed;
	var b = own ;
	var h = cur - end ;
	if ((t/=d/2) < 1) return c/2*t*t + b+speed;
		return -c/2 * ((--t)*(t-2) - 1) + b +speed;	
}
function curveOutExpo(sta,end,cur,lon,own){ //expo
	var t = cur - sta ;
	var d = end - sta ;
	var c = - lon + end - sta ;
	var b = own ;
	var h = cur - end ;
	return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;	
}
function getOffsetY(startLocation,startScroll,endLocation){
	return startLocation-startScroll-endLocation;
}
function getTop(endScroll,prevAllDivHeight,endLocation){
	return endScroll-prevAllDivHeight + endLocation ;
}

function transition_property(val){
	return {
		"-moz-transition":val,
		"-webkit-transition":val,
		"-o-transition":val,
		"-ms-transition":val,
		"transition":val
		};
}

/* Brand Nav Function*/
function brandNav(obj){
	$("#brand_scroll_bar").stop().animate({left:$(obj).offset().left+$(obj).width()/2-$(".bc_6_brand_line_scroll").offset().left-$("#brand_scroll_bar").width()/2},500,"easeOutBounce");
}

/*** share function *****/
function returnToPage(obj){
	//alert($(obj).parent().parent().parent(".share_list_div").attr("id"));
	if($(obj).parent().parent().parent(".share_list_div").attr("id").indexOf("m11x")>-1){
		return "#1";		
	}else if($(obj).parent().parent().parent(".share_list_div").attr("id").indexOf("m14x")>-1){
		return "#2";		
	}else if($(obj).parent().parent().parent(".share_list_div").attr("id").indexOf("m17x")>-1){
		return "#3";		
	}else if($(obj).parent().parent().parent(".share_list_div").attr("id").indexOf("m18x")>-1){
		return "#4";		
	}else{
		return "#0";	
	}
}
function setShareBody(obj,showbody){
	if(showbody == "#share_img_1_body"){
		var id = $(obj).parent().parent().attr("id");
		var type = id.substring(5,9);
		var path = "images/share/view/product_img/"+type+"/";
		$(showbody).html("").html("<img style='width:822px;height:508px;' src='images/share/view/product_img/"+id+".jpg' />");
		share_pic.current = 0 ;
		share_pic.pics = ["images/share/view/product_img/"+id+".jpg",path+"01.jpg",path+"02.jpg",path+"03.jpg",path+"04.jpg",path+"05.jpg",path+"06.jpg"];
		$("#share_img_1_download").attr("href",self.location.href.substring(0,self.location.href.indexOf('index.html'))+"images/share/view/product_img/"+type+".zip");
	}else if(showbody == "#share_img_2_body"){
		$(showbody).html("").html("<img style='margin-top:11px;margin-left:12px;width:541px;height:319px;' src='images/share/view/product_img/"+$(obj).parent().parent().attr("id")+".jpg' />");
	}
}
function setVideoBody(obj,showbody){
	var name = $(obj).parent().parent().attr("id");
	if(isSupportVideo){
		if($("#video_3")){
			destroyVideo_3();	
		}
		if($("#video_3").html() == null ){
			createVideo_3(name);
		}
	}else{

	}
}
/***********************************/
function setVideoStyle(flag){
	//if(flag != videoFlag){
		//Asset.css("css/video"+flag+".css");
		$("#videoCss").attr("href","css/video"+flag+".css");
	//}
}

/***********************************/
var flash_timer = null ;

function shopcartFlash(){
	//$(".btn_shopcart_buy").find("img:eq(0)").attr("src","images/pop/btn_jkgm_hover.png");
	//if($(".btn_shopcart_buy").css("opacity"))
	//if($(".btn_shopcart_buy").find("img:eq(1)").css("display")=='none'){
		$(".btn_shopcart_buy").find("img:eq(1)").fadeIn(1000,'easeOutCirc',function(){
			$(".btn_shopcart_buy").find("img:eq(1)").fadeOut(1000,'easeOutCirc');
		});
	//}else{
	//}
	flash_timer = setTimeout(shopcartFlash,2100);
}
/****************Tips*****************/
function showTip(e){
	$("#p3_product_float").animate({
		"left":($("#p3_product_float").offset().left-e.pageX-20>0)?"-="+($("#p3_product_float").offset().left-e.pageX-20):"+="+(e.pageX-$("#p3_product_float").offset().left+20),
		"top":($("#p3_product_float").offset().top-e.pageY -20>0)?"-="+($("#p3_product_float").offset().top-e.pageY -20):"+="+(e.pageY-$("#p3_product_float").offset().top +20)
		},0);
}
/*****************促销信息轮播*****************/
var menu_10_timer = null ;
var menu_10_index = 0 ;
var menu_10_speed = 2500 ;
function menu_10_Flash(){
	
	$("a","#p3_product_menu_10_menu").eq(menu_10_index).click();
	/*menu_10_index ++ ;
	if(menu_10_index = 3){
		menu_10_index = 0;
	}*/
	//menu_10_timer = setTimeout(menu_10_Flash,menu_10_speed);
}
function clear_menu_10_Flash(index){
	//alert(index);
	menu_10_index = index + 1 ;
	if(menu_10_index == 3){
		menu_10_index = 0;
	}
	//alert(menu_10_index);
	clearTimeout(menu_10_timer);
	menu_10_timer = null ;
	menu_10_timer = setTimeout(menu_10_Flash,menu_10_speed);
}

