{$jsarr$}
function initSorts(os1, os2) {    //初始化选项，主类别
    var s = "";
	s = s + "<select onchange=\"setSorts(this, '" + os1 + "', '" + os2 + "');\">";
	s = s + "<option value=\"\">Please Select→</option>";
	for (var i = 0; i < arrSorts.length; i++) {
	    if (arrSorts[i][2] == 0) {
		    s = s + "<option value=\"" + arrSorts[i][0] + "\">" + arrSorts[i][1] + "</option>";
		}
	}
	s = s + "</select>";
	
	document.getElementById(os2).innerHTML = s;
}

function setSorts(o, os1, os2) {
	//清除下级选项
	while (o.nextSibling) {
	    o.parentNode.removeChild(o.nextSibling);
	}
	
	//获取当前选项 ID ，并设置选择值
    var iValue = o.options[o.selectedIndex].value;
	if (iValue == "") {
		if (o.previousSibling) {
		    document.getElementById(os1).value = o.previousSibling.options[o.previousSibling.selectedIndex].value;
		}
		else {
		    document.getElementById(os1).value = 0;
		}
		return false;
	}
	document.getElementById(os1).value = iValue;
	
	//去掉原来的选择状态
	var ss1 = o.innerHTML;
	var ss2 = "";
	ss2 = ss1.replace(" selected=\"selected\"", "");
	
	//将选中的选项对应代码更改为 selected
	var s = document.getElementById(os2).innerHTML;
	s = s.replace(ss1, ss2);
	s = s .replace("<option value=\"" + iValue + "\">", "<option value=\"" + iValue + "\" selected=\"selected\">");
	
	//新的下拉列表代码
	var s1 = "";
	for (var i = 0; i < arrSorts.length; i++) {
	    if (arrSorts[i][2] == iValue) {
		    if (s1 == "") {
			    s1 = s1 + "<select onchange=\"setSorts(this, '" + os1 + "', '" + os2 + "');\">";
				s1 = s1 + "<option value=\"\">Please Select→</option>";
				s1 = s1 + "<option value=\"" + arrSorts[i][0] + "\">" + arrSorts[i][1] + "</option>";
			}
			else {
			    s1 = s1 + "<option value=\"" + arrSorts[i][0] + "\">" + arrSorts[i][1] + "</option>";
			}
		}
	}
	if (s1 != "") s1 = s1 + "</select>";
	
	//显示代码
	document.getElementById(os2).innerHTML = s + s1;
}

function newInit(os1, os2, sID) {
	if (sID == 0) {
	    initSorts(os1, os2);
		return false;
	}
	
    var pID;
	var s1 = "<select onchange=\"setSorts(this, '" + os1 + "', '" + os2 + "');\">";
	s1 = s1 + "<option value=\"\">Please Select→</option>";
	
	for (var i = 0; i < arrSorts.length; i++) {
	    if (sID == arrSorts[i][0]) {
		    pID = arrSorts[i][2];
			break;
		}
	}
	
	for (var i = 0; i < arrSorts.length; i++) {
	    if (arrSorts[i][2] == pID) {
		    if (arrSorts[i][0] == sID) {
			    s1 = s1 + "<option value=\"" + arrSorts[i][0] + "\" selected=\"selected\">" + arrSorts[i][1] + "</option>";
			}
			else {
			    s1 = s1 + "<option value=\"" + arrSorts[i][0] + "\">" + arrSorts[i][1] + "</option>";
			}
		}
	}
	
	s1 = s1 + "</select>";
	
	document.getElementById(os2).innerHTML = s1 + document.getElementById(os2).innerHTML;
	
	if (pID > 0) {
	    newInit(os1, os2, pID);
	}
}