//Preloading imagesvar _PreloadedImages = new Array();function PreloadImages(){	for (var i=0; i<PreloadImages.arguments.length; i++)	{		_PreloadedImages[_PreloadedImages.length] = new Image();		_PreloadedImages[_PreloadedImages.length-1].src = PreloadImages.arguments[i];	}}//CTreeNodefunction CTreeNode(pTree, pParent, stName, stURL){	this.pTree = pTree;	this.pParent = pParent;	this.stName = stName;	this.stURL = stURL;	if ((this.stURL == document.URL || this.stURL + 'index.html' == document.URL || this.stURL == document.URL + 'index.html') && !this.pTree.bMenuExpanded) 		{this.bOpen = true; this.pParent.OpenParent(); this.pTree.bMenuExpanded = true;} 		else this.bOpen = false;	this.bFolder = false;	this.nArrIndex = 0;	this.Children = new Array;	if (pParent)		pParent.AddChild(this);}CTreeNode.prototype.AddChild = function(pNode){	this.bFolder = true;	this.Children[this.Children.length] = pNode;}CTreeNode.prototype.GetChildrenHTMLCode = function(nLevel){	var st = '';	for (var i=0; i<this.Children.length; i++)		st += this.Children[i].GetHTMLCode(nLevel);	return st;}CTreeNode.prototype.GetHTMLCode = function(nLevel){	var st = '';	var bCurrPage = (this.stURL == document.URL || this.stURL + 'index.html' == document.URL || this.stURL == document.URL + 'index.html');		//Select background colour for links.  Different for the link to the current page	if (bCurrPage) stCellSty = 'Sel'; else stCellSty = 'NoSel';	//Shift spaces	var nIndent = nLevel * this.pTree.nIndent + 1;  //Note we need a cell width of at least 1	if (nIndent > this.pTree.nMaxIndent) nIndent = this.pTree.nMaxIndent;		st += '<div align="center" class="'+stCellSty+'" style="padding-left: ' + nIndent + 'px;">';	//Add spacer between menu items, but not in front of first item	// if (this.pTree.bFirstMenuItem) {		// this.pTree.bFirstMenuItem = false;	// } else {		// st += ' border-top: 1px solid #3399cc;';	// }			//Sign or extra space	if (this.bFolder)	{		st += '<a href="javascript:void(0)" onclick="javascript: ' + this.pTree.stName + '.OnNodeClick(' + this.nArrIndex + ',true);">';		st += '<img id="sign' + this.pTree.stName + this.nArrIndex + '" src="';		st += this.bOpen ? this.pTree.Files.imgMinus : this.pTree.Files.imgPlus;		st += '" ' + this.pTree.Files.stIconProps + '></a>';	}	else		st += '<img src="' + this.pTree.Files.imgEmpty + '" ' + this.pTree.Files.stIconProps + '>';	//General link code	var stHref = this.stURL;	if (bCurrPage) stHref = 'javascript:void(0)';	var stA = '<a class="nav" href="' + stHref + '"';	if (this.pTree.stTarget)		stA += ' target="' + this.pTree.stTarget + '"';	if (this.bFolder)		//Note - second .OnNodeClick param determines whether the list will hide on a second click		stA += ' onclick="javascript: this.blur(); ' + this.pTree.stName + '.OnNodeClick(' + this.nArrIndex + ',true);"';	stA +='>';	//Icon	if (this.pTree.bShowIcons)	{		st += stA;		st += '<img id="icon' + this.pTree.stName + this.nArrIndex + '" src="';		st += (!this.bFolder) ? this.pTree.Files.imgNode : (this.bOpen ? this.pTree.Files.imgOpenFolder : this.pTree.Files.imgClosedFolder);		st += '" ' + this.pTree.Files.stIconProps + '>';		st += "</a>";	}	//Text	st += stA;	st += this.stName;	st += '</a>'	st += '</div>\n';	//Children	if (this.bFolder)	{		st += '<div id="div' + this.pTree.stName + this.nArrIndex + '" style="display:' + (this.bOpen ? 'block' : 'none') + ';">';		st += this.GetChildrenHTMLCode(nLevel+1);		st += '</div>';	}	return st;}CTreeNode.prototype.SetOpen = function(bOpen){	document.getElementById('sign' + this.pTree.stName + this.nArrIndex).src = bOpen ? this.pTree.Files.imgMinus : this.pTree.Files.imgPlus;	if (this.pTree.bShowIcons)		document.getElementById('icon' + this.pTree.stName + this.nArrIndex).src =			(!this.bFolder) ? this.pTree.Files.imgNode : (bOpen ? this.pTree.Files.imgOpenFolder : this.pTree.Files.imgClosedFolder);	document.getElementById('div' + this.pTree.stName + this.nArrIndex).style.display = bOpen ? 'block' : 'none';	this.bOpen = bOpen;}CTreeNode.prototype.CloseNeighbors = function(){	if (!this.pParent)		return;	for (var i=0; i<this.pParent.Children.length; i++)		if ((this.pParent.Children[i] != this) && this.pParent.Children[i].bFolder && this.pParent.Children[i].bOpen)		{			this.pParent.Children[i].SetOpen(false);			this.pParent.Children[i].CloseChildren();		}}CTreeNode.prototype.CloseChildren = function(){	for (var i=0; i<this.Children.length; i++)		if (this.Children[i].bFolder && this.Children[i].bOpen)		{			this.Children[i].SetOpen(false);			this.Children[i].CloseChildren();		}}CTreeNode.prototype.OpenParent = function(){	if (!this.pParent)		return;		this.bOpen = true;	this.pParent.OpenParent();}//CTreefunction CTree(stName){	this.stName = stName;	this.stTarget = null;	this.bShowIcons = true;	this.bAutoClose = true;	this.bMenuExpanded = false;	this.bFirstMenuItem = true; //Flag to allow us to treat the first menu item differently	this.nIndent = 10; //Menu level indent size in px	this.nMaxIndent = 50; //Maximum indent in px	this.Files =	{		imgClosedFolder: 'http://www.halvin.co.uk/blank.gif',		imgOpenFolder: 'http://www.halvin.co.uk/blank.gif',		imgEmpty: 'http://www.halvin.co.uk/blank.gif',		imgNode: 'http://www.halvin.co.uk/blank.gif',		imgPlus: 'http://www.halvin.co.uk/blank.gif',		imgMinus: 'http://www.halvin.co.uk/blank.gif',		stIconProps: 'alt="" width="1" height="1" style="border: 0px;"'	};	PreloadImages(this.Files.imgOpenFolder, this.Files.imgMinus);	this.NodeArr = new Array();	this.NodeArr[0] = new CTreeNode(this, null);}CTree.prototype.AddNode = function(pParent, stName, stURL){	if (!pParent)		pParent = this.NodeArr[0];	var pNode = new CTreeNode(this, pParent, stName, stURL);	this.NodeArr[this.NodeArr.length] = pNode;	pNode.nArrIndex = this.NodeArr.length-1;	return pNode;}CTree.prototype.GetHTMLCode = function(){	return '<div class="jsMenu">'+this.NodeArr[0].GetChildrenHTMLCode(0)+'</div>';}CTree.prototype.OnNodeClick = function(nArrIndex, bFromSign){	var pNode = this.NodeArr[nArrIndex];	if (!pNode.bOpen || bFromSign)	{		pNode.SetOpen(!pNode.bOpen);		if (this.bAutoClose)			pNode.CloseNeighbors();	}}