/*send inquiry*/
	$("#JS_btnSend").click(function(){
		offsetTop=$("#product_detail").offset().top;
		$("html,body").animate({scrollTop:offsetTop},300);
		$("#JS_sendInquiryTab").click();
		return false;
	})
	
	$("#JS_btnAdd").click(function(){
		$(this).hide();
		$("#JS_btnEnter").css({"display":"block"});
	});
	
/*product_detail tab*/
	$("#product_detail .btn_item").each(function(index){
		$(this).click(function(){
			var _this=this;
			$(_this).addClass("current").siblings().removeClass("current");
			$(_this).parent(".detail_btn").siblings(".pro_bd").find(".bd_item").eq(index).show().siblings().hide();
		})
	});
	$("#product_detail .btn_item:first").click();
	
	/*validate*/
	$("#form_validate").validate();
	
	/*.pro_sma*/
	$(".pro_sma li").hover(function(){
		$(this).addClass("hover");
		},function(){
			$(this).removeClass("hover");
			}
		
		);
		
	/*inquiry_basket_1 滑过效果*/
	$(".inquiry_data_table tr").hover(function(){
		$(this).addClass("hover");
		 },function(){$(this).removeClass("hover")
	});
	
	
	/*-----------product search-------*/
	var SearchValue1=$(".nav_form input").val();
	$(".nav_form input").focus(function(){
		if($(this).val()==SearchValue1)
		{$(this).val("")}
		});
		
	$(".nav_form input").blur(function(){
		if($(this).val()=="")
		{$(this).val(SearchValue1)}
		});
		
	/*-----------search error-------*/
	var SearchValue2=$(".search_form input").val();
	$(".search_form input").focus(function(){
		if($(this).val()==SearchValue2)
		{$(this).val("")}
		});
		
	$(".search_form input").blur(function(){
		if($(this).val()=="")
		{$(this).val(SearchValue2)}
		});
	
	
	/*nav_categories*/
	/*$(".normal_target").first().toggleClass("normal_target_selected");
	$(".normal_sublist").first().show();*/	
	$(".normal_target, .normal_subtarget").hover(function(){
		$(this).addClass("normal_target_hover").parent(".normal_item").siblings(".normal_item").removeClass("normal_target_hover");
	},function(){
		$(this).removeClass("normal_target_hover");
	});
	$(".normal_target").click(function(){
		_this = $(this);
		if(_this.next(".normal_sublist").length > 0){		
			_this.toggleClass("normal_target_selected").next(".normal_sublist").slideToggle(0)
			.parent(".normal_item").siblings(".normal_item")
			.find(".normal_target").removeClass("normal_target_selected").end()
			.find(".normal_sublist").slideUp(0);
			return false;
		}else{
			_this.toggleClass("normal_target_selected")
			.parent(".normal_item").siblings(".normal_item")
			.find(".normal_target_selected").removeClass("normal_target_selected").next(".normal_sublist").slideUp(0);
			
		};
	});
	/*normal_subtarget*/
	$(".normal_subtarget").click(function(){
		$(this).addClass("normal_subtarget_selected").parent(".normal_subitem").siblings(".normal_subitem").find(".normal_subtarget").removeClass("normal_subtarget_selected");
	});	
	
	/*filter*/	
	var timeFilterHover;
	$(".filter_select").hover(function(){
		_this = $(this);
		timeFilterHover = setTimeout(function(){
			_this.find(".select_list").show().parents(".filter_item").siblings().find(".select_list").hide()
		},100);
	},function(){
		_this = $(this);
		clearTimeout(timeFilterHover);
		_this.find(".select_list").hide();
	});
	
	
	/*privacy 隐私条款*/	
    $(".privacy input").click(function(){$(this).toggleClass("selected");});
	$(".btn_submit").click(function(){
		if(!$(".privacy input").hasClass("selected")){
		/*alert("please click the privacy policy!!");*/
		$(this).parents("#form_validate").next(".privacy_tips").show();
		/*$(".privacy input").html("checked","unchecked");*/
		return false;
		}
	else{
		$(this).parents("#form_validate").validate();}
	})
	
	/*textarea 多行文本输入框字数控制*/
	var MessageObj = $(".message_length");
	MessageObj.keyup(function(){
		var _len=$(this).val().length;
		if(_len > -1 && _len<=1000){
			var _remain=parseInt(1000-_len)>'0'?parseInt(1000-_len):'0';
			var _str = '<div class="message_length_tips"><em> ' + _remain + '</em>characters left.</div>'
			$(".message_tips_wrap").html(_str);
		}else{
			$(this).val($(this).val().substr(0,1000));  
			$(".message_tips_wrap").html("<div class='message_length_tips'>0 characters left</div>");
		}
	});
	
	
	var imgshowThumbItem = $("#JS_imgshowThumbSlide .list_item");
	/*change picture*/
	var _small_img = 100;
	var imgshowPic = $("#JS_imgshowPic");
	var imgshowPicBox = $("#JS_imgshowPicBox");
	var imgshowPicId = "JS_imgshowPic";
	var imgshowPicBoxId = "JS_imgshowPicBox";
	imgshowPic.loadthumb({"src":imgshowPicBox.find("img").attr("src"),"imgId":imgshowPicId,"parentId":imgshowPicBoxId});
	imgshowThumbItem.click(function(){
		var _this=$(this);
		_this.addClass("hover").siblings().removeClass("hover");
		imgshowPic.attr("src",_this.find('img').attr("src").replace("_" + _small_img + "x" + _small_img,""));
		imgshowPicBox.find("a").attr("href",_this.find('img').attr("src").replace("_" + _small_img + "x" + _small_img,""));
		imgshowPic.loadthumb({"src":imgshowPicBox.find("img").attr("src"),"imgId":imgshowPicId,"parentId":imgshowPicBoxId});
		return false;
    });
