(function($){
	$.fn.textSlider = function(settings){    
            settings = jQuery.extend({
                speed : "normal",
                line : 2,
                timer : 3000
            }, settings);
            return this.each(function() {
                $.fn.textSlider.scllor( $( this ), settings );
            });
        };
	$.fn.textSlider.scllor = function($this, settings){
            var ul = $("ul:eq(0)",$this );
            var timerID;
            var li = ul.children();
            var liHight=$(li[0]).height();
            var upHeight=0-settings.line*liHight;//滚动的高度；
            var scrollUp=function(){
                ul.animate({marginTop:upHeight},settings.speed,function(){
                    for(i=0;i<settings.line;i++){
                        ul.find("li:first",$this).appendTo(ul);
                    }
                    ul.css({marginTop:0});
                });
            };
            var autoPlay=function(){
                timerID = window.setInterval(scrollUp,settings.timer);
            };
            var autoStop = function(){
                window.clearInterval(timerID);
            };
            //事件绑定
            ul.hover(autoStop,autoPlay).mouseout();
	};
})(jQuery);

$(function(){
	$("#scroll").textSlider({line:1,speed:800,timer:3000});
	$(".banner_no a").eq(0).addClass("press");
	var v;
	var y;
	var z;
	var x;
	var member_time;
	var member_time1;
	var v_length = $(".banner_no > a").length;
	tc_index()
	$(".banner_no a").each(function(t){								
		$(this).mouseover(function(){
				clearTimeout(member_time);
				$(".banner_no a").removeAttr("class");
				$(".banner_no a").eq(t).addClass("press");
				$(".banner_list > li").hide();
				$(".banner_list > li").eq(t).show();
				v = t;
			});				
	});
	$(".banner_no a").bind("mouseleave", function() { 
				member_time = setTimeout(tc_index , 6000);
            }); 
		function tc_index()
		{
			
			if (v == null)
			{
				$(".banner_list > li").eq(0).fadeIn(700);
				member_time = setTimeout(tc_index , 6000);
				v=0;
			}
			else
			{
			if (v >= v_length-1)
			{
				v = 0;
			}
			else
			{
				v++;
			}
			$(".banner_no a").removeAttr("class");
			$(".banner_no a").eq(v).addClass("press");
			$(".banner_list > li").hide();
	
				$(".banner_list > li").eq(v).fadeIn(700);
			
			member_time = setTimeout(tc_index , 6000);
			}
		}
		
$(".banner_nos a").eq(0).addClass("press");
	var y_length = $(".banner_nos > a").length;
	tc_index1()
	$(".banner_nos a").each(function(c){								
		$(this).mouseover(function(){
				clearTimeout(member_time1);
				$(".banner_nos a").removeAttr("class");
				$(".banner_nos a").eq(c).addClass("press");
				$(".banner_lists > li").hide();
				$(".banner_lists > li").eq(c).show();
				y = c;
			});				
	});
	$(".banner_nos a").bind("mouseleave", function() { 
				member_time1 = setTimeout(tc_index1 , 6000);
            }); 
		function tc_index1()
		{
			
			if (y == null)
			{
				$(".banner_lists > li").eq(0).fadeIn(700);
				member_time1 = setTimeout(tc_index1 , 6000);
				y=0;
			}
			else
			{
			if (y >= y_length-1)
			{
				y = 0;
			}
			else
			{
				y++;
			}
			$(".banner_nos a").removeAttr("class");
			$(".banner_nos a").eq(y).addClass("press");
			$(".banner_lists > li").hide();
	
				$(".banner_lists > li").eq(y).fadeIn(700);
			
			member_time1 = setTimeout(tc_index1 , 6000);
			}
		}

	
	$(".banner_nos1 a").eq(0).addClass("press");
	var z_length = $(".banner_nos1 > a").length;
	tc_index2()
	$(".banner_nos1 a").each(function(cc){								
		$(this).mouseover(function(){
				clearTimeout(member_time2);
				$(".banner_nos1 a").removeAttr("class");
				$(".banner_nos1 a").eq(cc).addClass("press");
				$(".banner_lists1 > li").hide();
				$(".banner_lists1 > li").eq(cc).show();
				z = cc;
			});				
	});
	$(".banner_nos1 a").bind("mouseleave", function() { 
				member_time2 = setTimeout(tc_index2 , 6000);
            }); 
		function tc_index2()
		{
			
			if (z == null)
			{
				$(".banner_lists1 > li").eq(0).fadeIn(700);
				member_time2 = setTimeout(tc_index2 , 6000);
				z=0;
			}
			else
			{
			if (z >= z_length-1)
			{
				z = 0;
			}
			else
			{
				z++;
			}
			$(".banner_nos1 a").removeAttr("class");
			$(".banner_nos1 a").eq(z).addClass("press");
			$(".banner_lists1 > li").hide();
	
				$(".banner_lists1 > li").eq(z).fadeIn(700);
			
			member_time2 = setTimeout(tc_index2 , 6000);
			}
		}
	
	var bb;
	$(".banner_nos2 a").eq(0).addClass("press");
	var z_length2 = $(".banner_nos2 > a").length;
	tc_index3()
	$(".banner_nos2 a").each(function(aa){								
		$(this).mouseover(function(){
				clearTimeout(member_time3);
				$(".banner_nos2 a").removeAttr("class");
				$(".banner_nos2 a").eq(aa).addClass("press");
				$(".banner_lists2 > li").hide();
				$(".banner_lists2 > li").eq(aa).show();
				bb = aa;
			});				
	});
	$(".banner_nos2 a").bind("mouseleave", function() { 
				member_time3 = setTimeout(tc_index3 , 6000);
            }); 
		function tc_index3()
		{
			if (bb == null)
			{
				$(".banner_lists2 > li").eq(0).fadeIn(700);
				member_time3 = setTimeout(tc_index3 , 6000);
				bb=0;
			}
			else
			{
			if (bb >= z_length2-1)
			{
				bb = 0;
			}
			else
			{
				bb++;
			}
			$(".banner_nos2 a").removeAttr("class");
			$(".banner_nos2 a").eq(bb).addClass("press");
			$(".banner_lists2 > li").hide();
	
				$(".banner_lists2 > li").eq(bb).fadeIn(700);
			
			member_time3 = setTimeout(tc_index3 , 6000);
			}
		}
	
	
	var uu;
	$(".banner_nos3 a").eq(0).addClass("press");
	var z_length3 = $(".banner_nos3 > a").length;
	tc_index6()
	$(".banner_nos3 a").each(function(aa){								
		$(this).mouseover(function(){
				clearTimeout(member_time3);
				$(".banner_nos3 a").removeAttr("class");
				$(".banner_nos3 a").eq(pp).addClass("press");
				$(".banner_lists3 > li").hide();
				$(".banner_lists3 > li").eq(pp).show();
				uu = pp;
			});				
	});
	$(".banner_nos3 a").bind("mouseleave", function() { 
				member_time6 = setTimeout(tc_index6 , 6000);
            }); 
		function tc_index6()
		{
			if (uu == null)
			{
				$(".banner_lists3 > li").eq(0).fadeIn(700);
				member_time6 = setTimeout(tc_index6 , 6000);
				uu=0;
			}
			else
			{
			if (uu >= z_length3-1)
			{
				uu = 0;
			}
			else
			{
				uu++;
			}
			$(".banner_nos3 a").removeAttr("class");
			$(".banner_nos3 a").eq(uu).addClass("press");
			$(".banner_lists3 > li").hide();
	
				$(".banner_lists3 > li").eq(uu).fadeIn(700);
			
			member_time6 = setTimeout(tc_index6 , 6000);
			}
		}
	
	
	

	/*$(".banner_nos2 a").eq(0).addClass("press");
	$(".banner_nos2 a").each(function(e){								
		$(this).click(function(){
				$(".banner_nos2 a").removeAttr("class");
				$(".banner_nos2 a").eq(e).addClass("press");
				$(".banner_lists2 > li").hide();
				$(".banner_lists2 > li").eq(e).fadeIn(700);
				return false;
			});				
	});
	$(".banner_nos3 a").eq(0).addClass("press");
	$(".banner_nos3 a").each(function(f){								
		$(this).click(function(){
				$(".banner_nos3 a").removeAttr("class");
				$(".banner_nos3 a").eq(f).addClass("press");
				$(".banner_lists3 > li").hide();
				$(".banner_lists3 > li").eq(f).fadeIn(700);
				return false;
			});				
	});*/
	var nav_values = $(".nav_value").val();
	$(".nav a").removeAttr("class");
	$(".nav a").eq(nav_values).addClass("on");
	
	var x_length = $(".banner_nos4 > a").length;
	$(".banner_nos4 a").eq(0).addClass("press");
	function tc_index4()
		{
			if (x == null)
			{
				x=0;
			}
			if (x == x_length - 1)
			{
				x = 0;
			}
			else
			{
				x++;
			}
			$(".banner_nos4 a").removeAttr("class");
			$(".banner_nos4 a").eq(x).addClass("press");
			$(".banner_lists4 > li").hide();
			if (x==0)
			{
				$(".banner_lists4 > li").eq(0).fadeIn(700);
			}
			else
			{
				$(".banner_lists4 > li").eq(x-1).fadeIn(700);
			}
		}
		
	$(".tc_brand_img4").hover(function(){
                 clearInterval(member_time4);
            },function(){
                member_time4 = setInterval(tc_index4 , 6000);
            }).trigger("mouseleave");
	
	$(".banner_nos4 a").each(function(t){								
		$(this).click(function(){
				$(".banner_nos4 a").removeAttr("class");
				$(".banner_nos4 a").eq(t).addClass("press");
				$(".banner_lists4 > li").hide();
				$(".banner_lists4 > li").eq(t).fadeIn(700);
				x = t;
				return false;
			});
		});
	$(".p_small a").each(function(k){
		$(this).click(function(){
			//var psmall_img = $(this).children("img").attr("src");
		$(".productdetails").hide();
		$(".productdetails").eq(k).show();
		return false;
		});
		
	});
	$(".left_c dl dt").each(function(m){
		$(this).click(function(){
		if ($(".left_c dd").eq(m).css("display") == "none")
		{
			$(this).css("background","url(style/img/icon06.jpg) no-repeat 0px 5px");
			$(".left_c dd").eq(m).show();
		}
		else
		{
			$(this).css("background","url(style/img/icon04.jpg) no-repeat 0px 2px");
			$(".left_c dd").eq(m).hide();
		}
	});	
	});

		$(".guoqi a").eq(0).css("background","url(style/img/language01.jpg)");
		$(".guoqi a").eq(1).css("background","url(style/img/language02.jpg)");
		$(".guoqi a").eq(2).css("background","url(style/img/language03.jpg)");
		
			
			var obj=$("#tc_imdex_warp ul");
            var object=$("#tc_imdex_warp ul li");
			var number = 0;
            if (object.length <= 3)
			{
				 $(".box02_small_left b").hide();
				 $(".box02_small_right b").hide();
			}
			else
			{
				$(".box02_small_left b").hide();
				var time = $(object).length-3;
				$(".box02_small_left b").click(function(){

					if (number == 1)
					{
						number--;
						$(obj).animate({left: -187*number}, 1000);
						$(".box02_small_left b").hide();
						$(".box02_small_right b").show();
					}
					else
					{
						$(".box02_small_right b").show();
						number--;
						$(obj).animate({left: -187*number}, 1000);
					}

				
				});
				
				$(".box02_small_right b").click(function(){

							if (number == time-1)
							{
								number++;
								$(obj).animate({left: -185*number}, 1000);
								$(".box02_small_right b").hide();
								$(".box02_small_left b").show();
							}
							else
							{
								number++;
								$(obj).animate({left: -187*number}, 1000);
								$(".box02_small_left b").show();
								
							}

				});
			}
				
			var obj1=$("#tc_imdex_warp1 ul");
            var object1=$("#tc_imdex_warp1 ul li");
			var number1 = 0;
            if (object1.length <= 3)
			{
				 $(".box02_small_left1 b").hide();
				 $(".box02_small_right1 b").hide();
			}
			else
			{
				$(".box02_small_left1 b").hide();
				var time1 = $(object1).length-3;

				$(".box02_small_left1 b").click(function(){	

					if (number1 == 1)
					{
						number1--;
						$(obj1).animate({left: -185*number1}, 1000);
						$(".box02_small_left1 b").hide();
						$(".box02_small_right1 b").show();
					}
					else
					{
						$(".box02_small_right1 b").show();
						number1--;
						$(obj1).animate({left: -185*number1}, 1000);
					}
				
				
				});
				$(".box02_small_right1 b").click(function(){
					
							if (number1 == time1-1)
							{
								
								number1++;
								$(obj1).animate({left: -185*number1}, 1000);
								$(".box02_small_right1 b").hide();
								$(".box02_small_left1 b").show();
							}
							else
							{
								number1++;
								$(obj1).animate({left: -187*number1}, 1000);
								$(".box02_small_left1 b").show();
								
							}


				});
				}
				
			var obj2=$("#tc_imdex_warp2 ul");
            var object2=$("#tc_imdex_warp2 ul li");
			var number2 = 0;
            if (object2.length <= 3)
			{
				$(".box02_small_left2 b").hide();
				 $(".box02_small_right2 b").hide();
			}
			else
			{
				$(".box02_small_left2 b").hide();
				var time2 = $(object2).length-3;
				$(".box02_small_left2 b").click(function(){

					if (number2 == 1)
					{
						number2--;
						$(obj2).animate({left: -185*number2}, 1000);
						$(".box02_small_left2 b").hide();
						$(".box02_small_right2 b").show();
					}
					else
					{
						$(".box02_small_right2 b").show();
						number2--;
						$(obj2).animate({left: -185*number2}, 1000);
					}

				});
				$(".box02_small_right2 b").click(function(){
					
							if (number2 == time2-1)
							{
								number2++;
								$(obj2).animate({left: -185*number2}, 1000);
								$(".box02_small_right2 b").hide();$(".box02_small_left2 b").show();
							}
							else
							{
								number2++;
								$(obj2).animate({left: -187*number2}, 1000);
								$(".box02_small_left2 b").show();
								
							}
				});
				}

			$(".left_c dt").each(function(yy){
				if ($(".left_c dt").eq(yy).attr("class") == "presson" )
				{
					$(".left_c dt").eq(yy).css("background","url(style/img/icon06.jpg) no-repeat 0px 5px");
					$(".left_c dd").eq(yy).show();
				}
			})
			$(".left_c dd a").each(function(){
				if ($(this).attr("class")=="press")
				{
					$(this).parent("dd").show();
					$(this).parent("dd").siblings("dt").css("background","url(style/img/icon06.jpg) no-repeat 0px 5px");
				}
			});
			
			if($('#jr_search').val() == '' || $('#jr_search').val() == '输入产品') {
					$('#jr_search').css({color:"#a3a3a3"}).val('输入产品');
				}
	
	$('#jr_search').focus(
			function() {
				if($(this).val() == '输入产品') {
					$(this).css({color:"#a3a3a3"}).val('');
				}
			}
		).blur(
			function(){
				if($(this).val() == '') {
					$(this).css({color:"#a3a3a3"}).val('输入产品');
				}
			}
		);
		$('#jr_search').click(
			function() 
			{
				if($('#jr_search').val() == '' || $('#jr_search').val() == '输入产品') {
					return false;
				} else {
					$(this).submit();
				}
			}
		);

		
		if($('#tc_seatch').val() == '' || $('#tc_seatch').val() == '输入产品') {
					$('#tc_seatch').css({color:"#a3a3a3"}).val('输入产品');
				}
	
	$('#tc_seatch').focus(
			function() {
				if($(this).val() == '输入产品') {
					$(this).css({color:"#a3a3a3"}).val('');
				}
			}
		).blur(
			function(){
				if($(this).val() == '') {
					$(this).css({color:"#a3a3a3"}).val('输入产品');
				}
			}
		);
		$('#tc_seatch').click(
			function() 
			{
				if($('#tc_seatch').val() == '' || $('#tc_seatch').val() == '输入产品') {
					return false;
				} else {
					$(this).submit();
				}
			}
		);
		
		if($('#tt_search').val() == '' || $('#tt_search').val() == '输入品牌') {
					$('#tt_search').css({color:"#a3a3a3"}).val('输入品牌');
				}
	
	$('#tt_search').focus(
			function() {
				if($(this).val() == '输入品牌') {
					$(this).css({color:"#a3a3a3"}).val('');
				}
			}
		).blur(
			function(){
				if($(this).val() == '') {
					$(this).css({color:"#a3a3a3"}).val('输入品牌');
				}
			}
		);
		$('#tt_search').click(
			function() 
			{
				if($('#tt_search').val() == '' || $('#tt_search').val() == '输入品牌') {
					return false;
				} else {
					$(this).submit();
				}
			}
		);
});

