function parseXML(curId,ispc,url)
{
_url=url+"menu.xml";
var xmlDoc = loadXmlFile(_url);
if (xmlDoc == null) {
alert("浏览器不支持xml读取");
return;
}
if(ispc){document.write("<h3><a href='/index.html'>全部软件</a></h3>");}
else{document.write("<h3><a href='/mobilesort/0000.html'>全部软件</a></h3>");}
for(var i=0;i<xmlDoc.getElementsByTagName("item").length;i++){
var name = xmlDoc.getElementsByTagName("sort_name")[i].childNodes[0].nodeValue;
var id = xmlDoc.getElementsByTagName("sort_id")[i].childNodes[0].nodeValue;
var level = xmlDoc.getElementsByTagName("sort_level")[i].childNodes[0].nodeValue;
var num = xmlDoc.getElementsByTagName("sort_num")[i].childNodes[0].nodeValue;
var lnk = url+id+".html";
if(level<2){
if(i>0){document.write("</ul>");}
document.write("<h3 id="+id+" onclick='show(this.id)'><a href="+lnk+">"+name+"("+num+")"+"</a></h3>");
var shorId = id.substring(0,2);
if(i!=xmlDoc.getElementsByTagName("item").length){document.write("<ul id="+shorId+">");}
}else{
document.write("<li href="+lnk+" id="+id);
if(curId==id){var current = "cur";document.write(" class="+current);}
document.write("><a href="+lnk+">"+name+"("+num+")</a></li>");
}
}
show(curId);
}
function show(id){
var shorId = id.substring(0,2);
var d = document.getElementById("left").getElementsByTagName("ul")
for(i = 0;i<d.length;i++){
d[i].style.display = "none";
if(shorId == d[i].id){
d[i].style.display = "block";
}
}
}
function loadXmlFile(xmlFile) {
var xmlDom = null;
if (window.ActiveXObject) {
xmlDom = new ActiveXObject("Microsoft.XMLDOM");
xmlDom.async = false;
xmlDom.load(xmlFile); //如果用的是xml文件。
} else if (document.implementation && document.implementation.createDocument) {
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET", xmlFile, false);
xmlhttp.send(null);
xmlDom = xmlhttp.responseXML;
} else {
xmlDom = null;
}
return xmlDom;
}