/*
 JAVASCRIPT  XML
 @ style: Style # 1,2,3
 @ names: xml The largest category of nodes
 @  smallname :small Xml nodes of categoty name
 @  samlls : Can be empty 
Emplame linkadd(style,names,smallname,samlls)
----------------------------------------------------------------------*/

 if(!document.all)
	Node.prototype.__defineGetter__
	(
		"xml",
		function()
		{
			return (new XMLSerializer).serializeToString(this);
		}
	);
/////////////////////////////////////////////////////////////////////////////////////////
if(!document.all)
	Node.prototype.selectNodes=function(xPath)
	{
		var xresult=this.evaluate(xPath,this,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
		var nod=null,nods=[],k=0;
		while((nod=xresult.iterateNext())!=null)
		{
			nods[k++]=nod;
		}
		return nods;
	}
/////////////////////////////////////////////////////////////////////////////////////////
if(!document.all)
	Node.prototype.selectSingleNode=function(xPath)
	{
		var xresult=this.evaluate(xPath,this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
		if(xresult&&xresult.snapshotLength>0)
		{
			return xresult.snapshotItem(0);
		}
		else
		{
			return null;
		}
		return nods;
	}
/////////////////////////////////////////////////////////////////////////////////////////


var xmlfile="../pan.xml";
var XmlDom=document.all?
document.createElement("xml"):
document.implementation.createDocument('','',null);
XmlDom.async=0;
XmlDom.load(xmlfile);


//alert(XmlDom.selectNodes("//jinguan")[0].lastChild.nodeName);
//alert(XmlDom.selectSingleNode("//jinguan/pr1").firstChild.nodeValue);
//alert(XmlDom.selectSingleNode("//jinguan/pr").getAttribute("url"));

function linkadd(style,names,smallname,samlls){
	   var bigurl=XmlDom.selectNodes("//"+names)[0].getAttribute("url");
	   var bigtitle=XmlDom.selectNodes("//"+names)[0].getAttribute("title");
	 
	 if(smallname!=""){
      var samlltitle=XmlDom.selectNodes("//"+smallname)[0].getAttribute("title");
	   var smallurl=XmlDom.selectNodes("//"+smallname)[0].getAttribute("url");
	 }
	
 if(style==1){
		   //document.getElementById("pan").innerHTML="<a href=\"../index.html\">HOME</a> ><a href=\""+bigurl+"\">"+bigtitle+"</a>";
		    document.getElementById("pan").innerHTML="<a href=\"../index.html\">首页</a>&nbsp;>&nbsp;"+bigtitle;
		  }
	 if(style==2){
		 //document.getElementById("pan").innerHTML="<a href=\"../index.html\">HOME</a> ><a href=\""+bigurl+"\">"+bigtitle+"</a>><a href=\""+smallurl+"\">"+samlltitle+"</a>";
		 document.getElementById("pan").innerHTML="<a href=\"../index.html\">首页</a>&nbsp;><a href=\"../"+bigurl+"\">&nbsp;"+bigtitle+"</a>>&nbsp"+String(samlltitle);
		  }
	if(style==3){
		  var smallsurl=XmlDom.selectNodes("//"+samlls)[0].getAttribute("url");
		  var samllstitle=XmlDom.selectNodes("//"+samlls)[0].getAttribute("title");
	     //var samllstitle=XmlDom.selectSingleNode("//"+names+"/"+smallname+"/"+samlls).firstChild.nodeValue;
		  document.getElementById("pan").innerHTML="<a href=\"../index.html\">首页</a>&nbsp;>&nbsp;<a href=\"../"+bigurl+"\">"+bigtitle+"</a>&nbsp;>&nbsp;<a href=\"../"+smallurl+"\">"+samlltitle+"</a>&nbsp;>&nbsp;"+samllstitle;
	 }
	
	
	
	}