

//$(function(){
//	$("#login_type").get(0).selectedIndex=0;
//	$("#top-nav .login-info dl").hover(function(){
//		$("dd",this).show();
//	},function(){
//		$("dd",this).hide();
//	});
//	$("#top-nav .login-info dl dd").each(function(i){
//	$(this).click(function(){
//		$(this).prevAll("dt").html(this.innerHTML);
//		$("#login_type").get(0).selectedIndex=i+1;
//		$("#top-nav .login-info dl dd").hide();
//	})
//	})
//	
//});

	var arrScrollPWrap=[];
	var currScrollNews=0;
	var scrollNewsTimer;
	function scrollnews(){

	if($("#scroll_news_content p").length==0){
		$("#scroll_news_content").append("<p style='float:left;visibility:hidden;overflow:hidden;height:30px;line-height:30px;'></p>");
	}else{
		$("#scroll_news_content p").css({"float":"left","visibility":"hidden","overflow":"hidden","height":"30px","line-height":"30px"});
		$("#scroll_news_content p").empty();
		$("#scroll_news_content p").width("auto");
	}
		$("#scroll_news_content p").append(arrScrollPWrap[currScrollNews]);
		if($("#flash_point").length==0){
			$("#scroll_news_content").append("<img src='images/v2_0/tickerCursor.gif' style='float:left;margin-top:10px;' id='flash_point'/>")
		}else{
			$("#flash_point").show();
		}
		var pWidth=$("#scroll_news_content p").width();
		$("#scroll_news_content p").width(5);
		$("#scroll_news_content p").css("visibility","visible");		
		$("#scroll_news_content p").animate({"width":pWidth},{duration:parseInt(msecond=pWidth/417*1000), easing:"linear",complete:function(){
			$("#scroll_news_content img").hide();
		}});
	}
	
$(function(){

	$("#scroll_news_content li").each(function(i){
		arrScrollPWrap[i]=$(this).find("a").get();	

	})
	scrollNewsTimer=setInterval(function(){
			if($("#scroll_news_content ul").length!=0){
				$("#scroll_news_content").html("");
			}
			currScrollNews=currScrollNews<arrScrollPWrap.length-1?(currScrollNews+1):0;
			scrollnews();
		},5000);
	$("#scroll-news").hover(function(){clearInterval(scrollNewsTimer)},function(){
		scrollNewsTimer=setInterval(function(){
			currScrollNews=currScrollNews<arrScrollPWrap.length-1?(currScrollNews+1):0;
			scrollnews();
		},5000);
	});
	$("#scroll_news_prev").click(function(){
		if($("#scroll_news_content p:animated").length!=0){return;}									  
		clearInterval(scrollNewsTimer);
		if(currScrollNews>0){
			currScrollNews-=1;	
		}else{
			currScrollNews=5;
		}
		scrollnews();
	});
	
	$("#scroll_news_next").click(function(){
		if($("#scroll_news_content p:animated").length!=0){return;}									  										  
		clearInterval(scrollNewsTimer);
		if(currScrollNews<5){
			currScrollNews+=1;	
		}else{
			currScrollNews=0;
		}
		scrollnews();
	});
	
});

$(function(){
	setInterval(function(){
		$("#top_banner .banner-l").find("a:last").prependTo($("#top_banner .banner-l"));
		},5000);
	$("#top_banner").hover(function(){
		var $this=$(this);
		$(".close",this).fadeIn().click(function(){
			$this.hide()
		});
	},function(){
		$(".close",this).fadeOut();
	})	
});

	var log_CookieVilue = RequestCookies("www.ec.com.cn", "");
	var log_CookieVilue1 = RequestCookies("ec_user",'');
	$(function(){
		if(log_CookieVilue == null || log_CookieVilue == '' || log_CookieVilue == 'www.ec.com.cn'){
			$("#nologin").show();
			$("#logined").hide();
		}else{
			$("#nologin").hide();
			$("#logined").show().find(".username").text(log_CookieVilue1);
		}
	});

	var snavactiveChildMenu,snavMenuTimer;
	
	$(function(){
	
	$("#quick_link .allservice>a,#quick_link .allplantform>a,#quick_link .allecwebsite>a").mouseover(function(){
			var $this=$(this);
			clearTimeout(snavMenuTimer);
			snavMenuTimer=setTimeout(function(){
				if(snavactiveChildMenu!="undefind"){
					$("#quick_link li>a.active").removeClass("active").next().hide();
				}
				$this.addClass("active");
				$this.next().show();
				snavactiveChildMenu=$this.get(0);
			},500);
            $this.blur();
			return false;
			
	})
	$("#quick_link .allservice a,#quick_link .allplantform a,#quick_link .allecwebsite a,#quick_link .childmenu,#quick_link .childmenu a").mouseout(function(event){
		clearTimeout(snavMenuTimer);		
		var related = (typeof event.relatedTarget != "undefined" ? event.relatedTarget : event.toElement);
		if(!($(related).parents("li").get(0)==$(snavactiveChildMenu).parents("li").get(0))){
			$("#quick_link li>a.active").removeClass("active").next().hide();			
			activeChildMenu=null;
		}
	}) 
	
	});


var activeChildMenu,childMenuTimer;
$(function(){
	$("#nav .link .mianmenu a").mouseover(function(){
			var $this=$(this);
			clearTimeout(childMenuTimer);			
			childMenuTimer=setTimeout(function(){
			$("#nav .link .mianmenu a").removeClass("active").parent().next().hide();
			$this.addClass("active");
			$this.parent().next().css("z-index","100");
			$this.parent().next().show();
			activeChildMenu=$this.get(0);
			},200);
	})
	$("#nav .link .mianmenu a").focus(function(){
		$(this).mouseover();
	})
	$("#nav .link .mianmenu a,#nav .childmenu").mouseout(function(event){
		clearTimeout(childMenuTimer);			
		var related = (typeof event.relatedTarget != "undefined" ? event.relatedTarget : event.toElement);		
		if(!($(related).parents(".link").get(0)==$(activeChildMenu).parents(".link").get(0))){
			$("#nav .link .mianmenu a").removeClass("active").parent().next().hide();			
			activeChildMenu=null;
		}
	});
});

	$(function(){
			   
		var imgbanner=new Image();

		imgbanner.src="images/v2_0/banner-all.png";
		$(imgbanner).load(function(){
			$(this).css("position","absolute").attr("id","banner_img").click(function(){				
                window.open("http://ecproducts.ec.com.cn/");
			});
			$("#extend-banner").prepend(this).fadeIn(500);
            bannerScroll();
            $("#banner_img_close").click(function(){
                clearTimeout(bannerScrollTimer);
                $("#extend-banner").slideUp(250);				
            })			
			
		})
        var bannerScrollTimer;
        function bannerScroll(){
            bannerScrollTimer=setTimeout(function(){
            $(imgbanner).animate({opacity:0},500)
                            .animate({"bottom":0},0).parent(".banner")
                            .animate({"height":"49px"},500).find("#banner_img")
                            .animate({opacity:1},500);
            },10000);
        }
})		
	
	
var imporatant_timer,imporatant_scroll;
$(function(){
$("#important-sign").hover(function(){clearInterval(imporatant_timer)				
},function(){imporatant_scroll()})
imporatant_scroll=function(){
imporatant_timer=setInterval(function(){
	$("#important-sign ul").animate({top:"-21px"},{duration:300,complete:function(){
	$("li:first",this).appendTo(this)
	$(this).css("top","0");
	}})
	},4000);
}

imporatant_scroll();
});



			
$(function(){
var curr_block=6;
$(".focus_news_content").eq(0).css("margin-left","0");
var focus_news_content_width=parseInt($(".focus_news_content").eq(0).width());
var focus_news_content_count=$(".focus_news_content").length;
var focus_news_content_marginleft=parseInt($(".focus_news_content").eq(1).css("margin-left"));
$("#focus_news_scroll").css("width",focus_news_content_width*focus_news_content_count+focus_news_content_marginleft*(focus_news_content_count-1));
function curr_block_time(){
	$("#focus_news_time").html($("#focus_news_scroll .focus_news_content").eq(curr_block).attr("title"));
}
function focus_news_move(s){
	$("#focus_news_prev,#focus_news_next").unbind("click");
	$("#focus_news_scroll").animate({"right":s},{duration: 300,easing:"linear",complete:function(){
		focus_news_btn();
		}

	})
}

function focus_news_btn(){
	if(parseInt($("#focus_news_scroll").css("right"))>=0){
		$("#focus_news_next").css("background-position","-183px -11px");
		$("#focus_news_next").unbind("click");
	}else{
		$("#focus_news_next").css("background-position","-183px 0");
		$("#focus_news_next").bind("click",function(){
		right_move();
		})
	}

	if(parseInt($("#focus_news_scroll").css("right"))<=-2430){
		$("#focus_news_prev").css("background-position"," -171px -11px");
		$("#focus_news_prev").unbind("click");
	}else{
		$("#focus_news_prev").css("background-position","-171px 0");	
		$("#focus_news_prev").bind("click",function(){
		left_move();
		})
	}
	curr_block_time();	
}
function left_move(){
	focus_news_move(parseInt($("#focus_news_scroll").css("right"))-(focus_news_content_width+focus_news_content_marginleft)+"px")
	curr_block-=1;
}
function right_move(){
	focus_news_move(parseInt($("#focus_news_scroll").css("right"))+(focus_news_content_width+focus_news_content_marginleft)+"px")
	curr_block+=1;
}
$("#focus_news_prev").bind("click",function(){
	left_move();
});
focus_news_btn();
curr_block_time(6);
});

$(function(){
	setInterval(function(){	$("#fr-com").find("a:last").prependTo($("#fr-com"))},7000)
	setInterval(function(){	$("#index_adv2_r").find("a:last").prependTo($("#index_adv2_r"))},7000)	
});

$(function(){
setInterval(function(){
	$("#product-sign ul").animate({top:"-24px"},{duration:300,complete:function(){
		$("li:first",this).appendTo(this)
		$(this).css("top","0");
	}})
	},5000);
});

var product_scroll={};
var imgscroll;

$(function(){
	imgscroll=function(){
	$("#productScroll_block .scroll").animate({left:"-"+product_scroll.childWidth+"px"}, "slow",function(){
		$("#productScroll_block .scroll .scroll_block:first").appendTo($("#productScroll_block .scroll"));
		$("#productScroll_block .scroll").css("left",0);
		});
	}

	
	product_scroll.child=$("#productScroll_block .scroll .scroll_block").length;
	product_scroll.childWidth=$("#productScroll_block .scroll .scroll_block:first").outerWidth();
	product_scroll.scroll=$("#productScroll_block .scroll");
	product_scroll.scroll.width(product_scroll.childWidth*product_scroll.child);

		
	product_scroll.timer=setInterval("imgscroll()",3000);
	 
	 $("#productScroll_prev a,#productScroll_next a").focus(function(){$(this).blur();})
	 
	 $("#productScroll_prev,#productScroll_next").hover(function(){
			clearInterval(product_scroll.timer);
	 },function(){
			product_scroll.timer=setInterval("imgscroll()",3000);
	 })
	
	$("#productScroll_prev a").click(function(){
		if($("#productScroll_block div:animated").length==0){
		imgscroll();
			}
		return false;
		});
	$("#productScroll_next a").click(function(){
		if($("#productScroll_block div:animated").length==0){
			$("#productScroll_block .scroll").css("left","-"+product_scroll.childWidth+"px");																				
			$("#productScroll_block .scroll .scroll_block:last").prependTo($("#productScroll_block .scroll"));																
			$("#productScroll_block .scroll").animate({left: "0"}, "slow",function(){
			});
		}
		return false;					
	});
	})
        
$(function(){
	$("#topic-nav a").each(function(i){
		$(this).click(function(){
		$("#topic-nav a.active").removeClass("active");
		$(this).addClass("active");
		$("#hot-topic .topic").each(function(j){
			if(i!=j){
				$(this).hide();
			}else{
				$(this).show();
			}
		})
		return false;
		});
	});

})


//$(function(){
// $("#bbs-block").jscroll({
//   W:"15px"
//  ,BgUrl:"url(images/v2_0/s_bg.gif)"
//  ,Bg:"right 0 repeat-y"
//  ,Bar:{Bd:{Out:"#ebe27e",Hover:"#ffe800"}
//		,Bg:{Out:"-45px 0 repeat-y",Hover:"-58px 0 repeat-y",Focus:"-71px 0 repeat-y"}}
//		,Btn:{btn:true
//			  ,uBg:{Out:"0 0",Hover:"-15px 0",Focus:"-30px 0"}
//			  ,dBg:{Out:"0 -15px",Hover:"-15px -15px",Focus:"-30px -15px"}}
//  ,Fn:function(){}
// });
//});
