$(document).ready(function(){
	$("#sub_nav01 li a").mouseover(function(){
		while($("#more001 a").length > 0){
			$("#more001 a:last").remove();
			$("#more001 img:last").remove();
		}
		while($("#sub_nav02 a").length > 0){
			$("#sub_nav02 a:last").remove();
		}
		while($("#sub_nav03 li").length > 0){
			$("#sub_nav03 li:last").remove();
		}
		var p = $(this).attr("id");
		$("<a href='product.php?pid="+p+"'>更多</a> <img src='image/icon01.gif'/>").appendTo($("#more001"));
		//二级分类
		var data = {cmd:'product_two',pid:p};
		$.ajax({
			type:'GET',
			dataType:'json',
			url:'ajax.php',
			data:data,
			success:function(msg){
				var len = msg.length;
				for(i=0;i<len;i++){
					if(i==len-1){
						$("<a href='product.php?pid="+p+"&poid="+msg[i].poid+"'>&nbsp;"+msg[i].name+"</a>").appendTo($("#sub_nav02"));
					}else{
						$("<a href='product.php?pid="+p+"&poid="+msg[i].poid+"'>&nbsp;"+msg[i].name+"&nbsp;|</a>").appendTo($("#sub_nav02"));
					}	
				}
			}
		});
		//产品
		var data1= {cmd:'product',pid:p};
		$.ajax({
			type:'GET',
			dataType:'json',
			url:'ajax.php',
			data:data1,
			success:function(msg1){
				var len1 = msg1.length;
				for(i=0;i<len1;i++){
					$("<li><strong><a href='product.php?pid="+p+"&poid="+msg1[i].poid+"&ptid="+msg1[i].ptid+"&id="+msg1[i].id+"'>"+msg1[i].product_name+"</a></strong><p></p></li>").appendTo($("#sub_nav03"));
				}
			}
		});
	})
})

