//
//
//载入分类的下拉select，可取多个
//
var zin_editor_class_1 = true;
function in_zindeclass(counts,thisc,ipath){
		var nv,ncount,thisorder;
		ncount = (counts)?counts:1;
		thisorder = (thisc)?thisc:0;
		if (ncount == 1)xmlposthtml = false;
		if (xmlposthtml !== false){
				window.setTimeout(function (){in_zindeclass(counts,thisc,ipath);xmlposthtml = false;},100);
		}else{
				if (xmlposthtml == false && thisorder < ncount){
						nv = at.d("loadclass_divs_" + thisorder);
						if (nv){
								nhtms = nv.value.split("‖");
								load_lsunclass(nhtms[0],nhtms[1],'',nhtms[3],nhtms[4],nhtms[5],nhtms[6],nhtms[7],'',nhtms[9],nhtms[10],nhtms[11],ipath);
								xmlposthtml = false;
								window.setTimeout(function (){
										in_zindeclass(ncount,parseInt(thisorder) + 1,ipath);
								},100);
						}
				}
		}
}

//无限级分类处理：
//当前页面需要加载无限级分类，需要页面中存在：<div id='un_class_1'></div><script>load_unclass(0,‘un_class_1’,'../');< /script>之类的代码
//如果一个页面中有多个无级限分类调用，请给un_class_1类的ID分别编号
//classid：当前的默认类ID；thisname：当前页面如果有多处调用无限级分类，此为当前的编号；pagepath当前页面的目录；
//load_lsunclass(nhtms[0],nhtms[1],'',nhtms[3],nhtms[4],nhtms[5],nhtms[6],nhtms[7],'',nhtms[9],nhtms[10],nhtms[11]);
//0‖un_class_1‖‖0‖eg_file_class‖class‖classsup‖classorder‖‖{{$classpath}}‖{{$classorder}}‖{{$classtype}}'
function load_lsunclass(classid,thisname,pagepath,orderid,tablesql,fieldsql,currinput,ls_currorder,thiselect,currpaths,cuorderold,cuordtypest,ipath){
		var n_div,ndiv,nselect,cuorder,neworderid,thisvalues,curorders;
		var ls_currclass,ls_currorder,ls_cruoldorder,ls_cruclass,ls_inload_pdiv,ls_inload_cuit,ls_inload_cord,loadurlto = "loadclass";
		ls_inload_pdiv = at.d(thisname);
		ls_inload_cuit = at.d(currinput);
		ls_inload_cord = at.d(ls_currorder);
		ls_cruclass = 0;
		if (currpaths !== "" && currpaths !== "undefined"){
				ls_cruclass = 1;
				ls_cruoldorder = cuorderold;
				loadurlto = "loadpath";
		}
		xmlposthtml = at.xmlhttps(((!ipath)?"../":ipath) + "inc/class.load.php?type=" + loadurlto + "&ipath=" + ((!ipath)?"../":ipath) + "&id=" + classid,true,"content=" + thisname + "___" + pagepath + "___" + orderid + "___" + tablesql + "___" + fieldsql + "___" + currinput + "___" + ls_currorder + "___" + currpaths);
		xmlclass = nsyhtml = function (){
				//alert(thisname + "___" + pagepath + "___" + orderid + "___" + tablesql + "___" + fieldsql + "___" + currinput + "___" + ls_currorder + "___" + currpaths);
				  if (!xmlposthtml)xmlposthtml = "";
				n_div = document.createElement("span");
				n_div.innerHTML = xmlposthtml;
				//alert(xmlposthtml);
				if (ls_cruclass == 0){
						for (var oi = 0;oi < 20;oi ++){
								ndiv = at.d(thisname + "_div_" + oi);
								if (ndiv){
										if (parseInt(oi) > parseInt(orderid*1)){
												at.zindexcloseclear(ndiv);
										}else{
												nselect = nselect + "___" + oi;
										}
								}
						}
						//生成div
						//alert(ls_classorders);
						ls_inload_pdiv.appendChild(n_div);
						//在添加、修改分类信息时，有当前类排序，此处实现当前类排序的select选择方式
						//if (classid && ls_classorders !== false){
						if (classid){
								thisvalues = classid;
								neworderid = orderid + 1;
						}else if (!classid || ls_classorders == false){
								if (orderid == 0){
										orderid = 1;thisvalues = 0;
								}
								//如果选择为空（“请选择..）时，当前ID值与排序都为上一级菜单的选中值
								var higherorderid = parseInt(orderid) - 1;
								if (higherorderid > 0){
										var inselect = at.d(thisname + "_select_" + higherorderid);
										for(i = 0;i < inselect.options.length;i ++){
												if(inselect.options[i].selected == true){
														thisvalues = inselect.options[i].value;
												}
										}
								}else{
										thisvalues = 0;
								}
								neworderid = orderid;
						}
						cuorder = at.d(thisname + "_select_" + neworderid);
						if (cuorder){
								curorders = cuorder.options.length;
						}else{
								curorders = 1;
						}
						ls_classorders = ls_inload_cuit.value = thisvalues;
				}else{
						ls_inload_pdiv.appendChild(n_div);
						curorders = parseInt(at.d("bcount_this").value);
				}
				if (ls_inload_cord){
						//开始本类的排序，构建select中的option，先删除原列表项的内容
						for(i = 0;i < 50;i ++){ls_inload_cord.options[i] = null;}
						for(i = 0;i < curorders;i ++){
								ls_inload_cord.options[i] = new Option(i + 1,i + 1);
						}
						if (ls_cruclass == 0){
								ls_inload_cord.options[curorders - 1].selected = true;
						}else{
								if (ls_cruoldorder)ls_inload_cord.options[ls_cruoldorder - 1].selected = true;
						}
				}
				xmlposthtml = false;
		}
		if (zin_editor_class == true && zin_editor_class_1 == true){
				zin_editor_class_1 = false;
				at.xmlposts("nsyhtml()");
		}else{
				at.xmlposts(xmlclass());
		}
}

//
//隐藏选择的第一个
function in_zindeclass_one(divs){
		var div = at.d(divs + "_div_1");
		if (div){
				div.style.display = "none";
		}else{
				window.setTimeout(function (){in_zindeclass_one(divs)},100);
		}
}
