function getParent(id){
	if(id != '0'){
		return str_Nclass[id][1];
	}else{
		return null;
	}
}
function createClassbox(cat_id,str_all){
   if (cat_id==null) return;
   var str_searchbox=document.getElementById('Class_box');
   str_searchbox.innerHTML="<ul id='listnclass'>";
   var i=0;
   for(c in str_Nclass){
      fatherid = str_Nclass[c][1];
      if(fatherid==cat_id){
         if(i>=15 && str_all==null) break;
	 document.getElementById('listnclass').innerHTML=document.getElementById('listnclass').innerHTML+"<li><a href='market_showpro.asp?Class_id="+c+"'>"+str_Nclass[c][0]+"</a></li>";
         i++;
      }
   }
   if(i>=15 && str_all==null) str_searchbox.innerHTML=str_searchbox.innerHTML+"<div style='text-align:center;width:100%;'><div id='Class_box_button'><a href=\"javascript:createClassbox("+cat_id+",'all');\">显示全部目录</a></div></div>";
   else if (i>=15) str_searchbox.innerHTML=str_searchbox.innerHTML+"<div style='text-align:center;width:100%;'><div id='Class_box_button'><a href=\"javascript:createClassbox("+cat_id+");\">显示精简目录</a></div></div>";
}
function createSearchbox(cat_id){
   var str_searchbox=document.getElementById('list_searchbox');
   str_searchbox.innerHTML="<select id='searchbox' name='class_id' class='button' style='background-color: #FFFFFF'></select>";
   if (cat_id!=null) {
      var str_c="";
      var id=0;
      id=cat_id;
      do{
          if (id==0) break;
          if (cat_id!=id) str_c="└ "+str_Nclass[id][0]; else str_c=str_Nclass[id][0];
	  document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option(str_c,id);
      }while(id=getParent(id));
   }
   document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option("所有分类",0);
   document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option("------------------------",'');
   for(c in str_Nclass){
	if (c!=0){
	   if (str_Nclass[c][1]==0) {
	      document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option(str_Nclass[c][0],c);
	   }else break;
	}
  }
}
function createMybox(cat_str,c_id){
   if (!cat_str) return;
   var a=-1;
   var str_searchbox=document.getElementById('list_searchbox');
   str_searchbox.innerHTML="<select id='searchbox' name='class_id' class='button' style='background-color: #FFFFFF'></select>";
   document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option("所有",0);
   for(c in s_box) {
      document.getElementById('searchbox').options[document.getElementById('searchbox').options.length]=new Option(str_Nclass[s_box[c]][0],s_box[c]);
      if (c_id==s_box[c]) a=Math.round(c);
   }
   a=a+1;
   document.getElementById('searchbox').selectedIndex=a;
}