function listProduct(cid, type) {
		var s = "";
		switch (type)
		{
			case 1:
				s = cid + "-0-0-" + typeFilter;
				break;
			case 2:
				s = "0-" + cid + "-0-" + typeFilter;
				break;
		
		}
		location.href = "/zh-CN/products/category/" + s + "/default.aspx";
}

function listProductByPlatform(cid, type) {
		var s = "0-" + cid + "-0-" + type;
		location.href = "/zh-CN/products/category/" + s + "/default.aspx";
}

function relistProduct() {
	var s = location.href;
	var re = new RegExp("category/(.+?)/", "ig");
	re.exec(s);
	var arr = RegExp.$1;
	var ids = arr.split("-");
	if (ids.length != 4) return;
	ids[0] = functionList.options[functionList.selectedIndex].value;
	ids[1] = platformList.options[platformList.selectedIndex].value;
	ids[2] = populateNodesValue(tree.Nodes[0]);	
	ids[3] = populateNodesValue(tree.Nodes[1]);	
	location.href = "/zh-CN/products/category/" + ids.join("-") + "/default.aspx";
}

function populateNodesValue(node) {

		var arr = new Array();
		for (var i = 0; i < node.Nodes.length; i++)
		{
			if ( node.Nodes[i].Checked)
			{
				arr.push(node.Nodes[i].Value);
			}
			
			for (var j = 0; j < node.Nodes[i].Nodes.length; j++)
			{
				if (node.Nodes[i].Nodes[j].Checked)
				{
					arr.push(node.Nodes[i].Nodes[j].Value);
				}
				
			}
		}
		var s = arr.join(",");
		return s == "" ? "0": s;
}

function changeFunction() {
	var s = location.href;
	var re = new RegExp("category/(.+?)/", "ig");
	re.exec(s);
	var arr = RegExp.$1;
	var ids = arr.split("-");
	if (ids.length != 4) return;
	ids[0] = functionList.options[functionList.selectedIndex].value;
	//ids[1] = platformList.options[platformList.selectedIndex].value;
	//ids[2] = populateNodesValue(tree.Nodes[0]);	
	//ids[3] = populateNodesValue(tree.Nodes[1]);	
	location.href = "/zh-CN/products/category/" + ids.join("-") + "/default.aspx";
}

function changeLanguage() {
	var s = location.href;
	var re = new RegExp("category/(.+?)/", "ig");
	re.exec(s);
	var arr = RegExp.$1;
	var ids = arr.split("-");
	if (ids.length != 4) return;
	ids[0] = functionList.options[functionList.selectedIndex].value;
	ids[1] = platformList.options[platformList.selectedIndex].value;
	ids[2] = populateNodesValue(tree.Nodes[0]);	
	ids[3] = populateNodesValue(tree.Nodes[1]);	
	location.href = "/zh-CN/products/category/" + ids.join("-") + "/default.aspx";
}

function applyCommonFilter() {
	var s = location.href;
	var re = new RegExp("category/(.+?)/", "ig");
	re.exec(s);
	var arr = RegExp.$1;
	var ids = arr.split("-");
	if (ids.length != 4) return;
	var inputs = document.getElementById("commonFilter").getElementsByTagName("input");
	var checkedValue = new Array();
	for (var i = 0; i < inputs.length; i++)
	{
		if (inputs[i].checked)
		{
			checkedValue.push(inputs[i].value);
		}
	}
	
	if (checkedValue.length > 0)
	{
		ids[3] = checkedValue.join(",");
	}
	else {
		ids[3] = "0";
	}
	location.href = "/zh-CN/products/category/" + ids.join("-") + "/default.aspx";
}

function hideDisabledCheckbox() {
	var inputs = document.getElementById("typeFilter").getElementsByTagName("input");
	var sign = false;
	for (var i = 0; i < inputs.length - 1; i++)
	{
		if (inputs[i].parentNode.tagName != "SPAN")
		{
			sign = true;
		}
	}
	if (!sign)
	{
		document.getElementById("typeFilter").style.display = "none";
		document.getElementById("typeFilter").previousSibling.style.display = "none";
	}
}
