<html>
 <head>
  <title>$title</title>
  <LINK rel="Stylesheet" type="text/css" href="arch_css.css">
</head>

<body onload="setInterval('getLoc()', 500);">    
<script>
var lastDoc;
var contents = $contents;

var w=window,d=document
var icons={'0'  : 'icons/0.gif','1'  : 'icons/90.gif',
        '2'  : 'icons/91.gif', '3'  : 'icons/92.gif', '4'  : 'icons/99.gif',
        '18' : 'icons/93.gif', '19' : 'icons/94.gif', '20' : 'icons/97.gif',
        '26' : 'icons/95.gif', '27' : 'icons/96.gif', '28' : 'icons/98.gif'}

var dhtml=true
try{if(d.body.innerHTML.length<=0)dhtml=false}
catch(e){dhtml=false;}
var tree=[];

get_element=d.all ? 
     function(id){return d.all[id]}
     : 
     function(id){return d.getElementById(id)}

function get_img1(){
    return icons[((this.childs.length ? 16 : 0)+(this.childs.length && this.opened ? 8 : 0)+(this.is_last()? 1 : 0)+(this.is_first()? 2 : 0)+2)]
}
function get_img2(){
    n=this.cnt[2]
    if(n<9){    
	n=(this.opened ? ( n%2 ? parseInt(n)+1 : n ) : ( n%2 ? n : parseInt(n)-1 ))
    }
    return 'icons/'+n+'.gif'
}
function node(tree,n){
    this.ind=tree.ind+1
    this.cnt=tree.cnt[n+(this.ind ? 3 : 0)]
    if(!this.cnt)return
    this.tree=tree.tree
    this.parent=tree
    this.opened=!dhtml
    this.nind=this.tree.nodes.length
    this.tree.nodes[this.nind]=this
    tree.childs[n]=this
    this.childs=[]
    for(var i=0;i < this.cnt.length - 2;i++)
	new node(this,i)
    this.get_img1=get_img1
    this.get_img2=get_img2
    this.open=open
    this.select=select
    this.init=init
    this.is_last=function(){
	return n==this.parent.childs.length - 1
    }
    this.is_first=function(){
	return(this.ind==0)&&(n==0)&&(!this.is_last())
    }
}

function open(){
    var childs=[]
    var el=get_element('divCont'+this.nind)
    if(!el)return
    if(!dhtml){
	d.write(childs.join(''))
	    for(var i=0;i < this.childs.length;i++){
	    d.write(this.childs[i].init())
	    this.childs[i].open()
	}
    }
    else{
	if(!el.innerHTML){
	    for(var i=0;i < this.childs.length;i++)
		childs[i]=this.childs[i].init()
	    el.innerHTML=childs.join('')
	}
	el.style.display=(this.opened ? 'none' : 'block')
	this.opened=!this.opened
	var img1=d.images['img1_'+this.nind],img2=d.images['img2_'+this.nind]
	if(img1)img1.src=this.get_img1()
	if(img2)img2.src=this.get_img2()
    }
}


function select(nind){
    if(!nind){
	var sel=this.tree.sel
	this.tree.sel=this
	if(sel)sel.select(true)
    }
    var img2=d.images['img2_'+this.nind]
    if(img2)img2.src=this.get_img2()
    get_element('el'+this.nind).style.fontWeight=nind ? 'normal' : 'bold'
    return Boolean(this.cnt[1])
}

function init(){
    var temp=[],par=this.parent
    for(var i=this.ind;i>0;i--){
	temp[i]='<img src="'+icons[par.is_last()? 0 : 1]+'" border="0" align="absbottom">'
	par=par.parent
    }
    r='<table cellpadding="0" cellspacing="0" border="0">'
    r+='<tr><td nowrap>'
    r+=temp.join('')
    r+=(this.childs.length ?(!dhtml ? '' : '<a href="javascript: tree.toggle('+this.nind+')" >')+'<img src="'+this.get_img1()+'" border="0" align="absbottom" name="img1_'+this.nind+'">'+(!dhtml ? '' : '</a>'): '<img src="'+this.get_img1()+'" border="0" align="absbottom">')
    r+='<a href="'+this.cnt[1]+'" target="'+'content'+'"'+' title="'+this.cnt[0]+'" onclick="return tree.select('+this.nind+')" '+(!dhtml ? '' : ' ondblclick="tree.toggle('+this.nind+')"')+' class="small" id="el'+this.nind+'"><img src="'+this.get_img2()+'" border="0" align="absbottom" name="img2_'+this.nind+'">&nbsp;'+this.cnt[0]+'</a>'
    r+='</td></tr></table>'
    r+=(this.childs.length ? '<div id="divCont'+this.nind+'" style="display:none"></div>' : '')
    return r
}

function draw_contents(cnt){
    tree=this;
    tree.cnt=cnt;
    tree.tree=this;
    tree.nodes=[];
    tree.sel=null;
    tree.ind=-1;
    
    tree.select=function(i){
	return tree.nodes[i].select();
    };
    tree.toggle=function(i){
	tree.nodes[i].open()
    };
    tree.childs=[]
    for(var i=0;i<cnt.length;i++){
	new node(tree,i)
    }
    tree.nind=0;
    
    for(var i=0;i < tree.childs.length;i++){
	d.write(tree.childs[i].init());
	if(!dhtml)tree.childs[i].open();
    }
}


function getLoc(){
var doc = ""+parent.frames[1].location;
if(doc != lastDoc){
        var keyVals = new Array();
        keyVals = doc.split("\/");
        var targetPage = ""+keyVals[(keyVals.length-1)];

        if(targetPage.indexOf("\#") > 0){
                targetPage = targetPage.substr(0,targetPage.indexOf("\#"));
        }

        nodeCount = 0;
        while( (""+tree.nodes[nodeCount].cnt[1]).lastIndexOf(targetPage) < 0){
                nodeCount++;
        }
        parentNode = tree.nodes[nodeCount].parent;
                if(parentNode != tree && parentNode.opened == false){
                        parentNode.open();
                }
        tree.nodes[nodeCount].select();
        lastDoc = doc;
        }
}
new draw_contents(contents);
</script>
 </body>
</html>
