
(function($){
	$(document).ready(function(){
		//点击某一分类导航 
		$(".FrontProductCategory_showLadderTree-02 h3").click(function(){	
		//分类导航展开，同时缩回已经打开的分类导航													   
			if ($(this).next("ul").css("display")=="block"){
				$(".sort ul:visible").hide();
				$(this).next("ul").hide();
			} else {//显示已经展开的分类导航
				$(".sort ul:visible").hide();
				$(this).next("ul").show();
			}
		});
	});
})(jQuery);
//定位已经打开的一级分类列表
(function($){
	$(document).ready(function(){
		var categoryid = "#"+getUrlParam();
		$(categoryid).css("display","block");
	});
})(jQuery);
//获得一级分类的分类id
function getUrlParam(){   
	try
	{
		//得到URL
          var url = window.location.href;
          //分组，得到  id
          var urlArray = url.split("&");
          var strArray = urlArray[2].split("=");
          if(strArray[1]!=null) 
            return  strArray[1];   
            
            return   null; 

	}catch (e){
		 return   null; 
      }
}
// JavaScript Document
(function($){
	$(document).ready(function(){
		//判断是否有二级菜单，一级菜单的图片变化
		$("#nav .tit").each(function(i){
			if($(this).nextAll("ul").children().length==0){
				$(this).children("img").attr("src","../../images/product/tb2_tree.gif");
			}
			else{
				$(this).children("img").attr("src","../../images/product/tb1_tree.gif");
			};
		});
		//隐藏二级
		$("#nav>ul ul").hide();	
		//点击展开图片
		$("#nav .tit").click(function(){
			$("#nav #opened").hide();
			$("#nav #opened").removeAttr("id");
			//判断其它一级菜单的图片
			$("#nav .tit").each(function(i){
				if($(this).nextAll("ul").children().length==0){
					$(this).children("img").attr("src","../../images/product/tb2_tree.gif");
				}
				else{
					$(this).children("img").attr("src","../../images/product/tb1_tree.gif");
				};
			});
			//一级菜单图片打开，二级菜单展开
			$(this).children("img").attr("src","../../images/product/tb2_tree.gif");
			$(this).nextAll("ul").attr("id","opened");
			$(this).nextAll("ul").show();
		})
		//一级当前状态
		$("#nav .tit").next().click(function(){
			$(".firstnav").attr("class","");
			$("#now").attr("id","");
			$(this).attr("class","firstnav");
		})
		//二级当前状态
		$("#nav li li").click(function(){
			$(".firstnav").attr("class","");
			$("#now").attr("id","");
			$(this).attr("id","now");
		})
	});
})(jQuery);