function __nav(id) {
	this.id										= id;
	this.init									= init;
	this.navid								= '';
	this.getBlocks						= getBlocks;
	this.findFirstNodeOfName	= findFirstNodeOfName;
	this.blocks								= new Array();
	this.hideSubMenus					= hideSubMenus;
	this.displaySubMenus			= displaySubMenus;
	this.navTo								= navTo;
	this.getLoc								= getLoc;
	this.displayType					=(document.all)?'block':'table-row';
	this.navFill							= navFill;
	this.getPtHtml						= getPtHtml;
	this.setNavPt							= setNavPt;;
	
	function init(){
		this.oMenu	= document.getElementById(this.id);
		this.getBlocks();
		this.hideSubMenus();
		//this.navFill();
		this.navid		= oUrl.getVar('nav');
		if(!this.navid){this.navid='nav_home';}
		if(this.navid){
			this.displaySubMenus( document.getElementById(this.navid) );
			var c=this.navid.split('_');
			var loc=document.getElementById('loc');
			var pt_head = this.getPtHtml(); 
			loc.innerHTML=this.getLoc(pt_head);
			this.setNavPt(pt_head);
		}
	}

	function setNavPt(pt){
		pt=pt.replace(/class="[^"]*"\s+/,'');
		document.getElementById('nav_pt_bg').innerHTML = pt;
		document.getElementById('nav_pt_fg').innerHTML = pt;
	}

	function getPtHtml(){
			var el=document.getElementById('ftr_'+pageType)
			el.className += ' active';
			if(!el){return pageType;}
			return el.innerHTML;
	}

	function navFill(){
		document.getElementById('nav_fill').style.height = (
			document.getElementById('nav_sep').offsetHeight -
			document.getElementById('nav_menu').offsetHeight
			- 60 ) + 'px';
	}

	function getLoc(base){
		var l_el;
		var out=(base?base:'');
		for(var bi=0;bi<this.blocks.length;bi++){

			if(this.blocks[bi][0].id!=this.navid){continue;}
			out +=' &gt; '+this.blocks[bi][0].cells[1].innerHTML;

			for(var ri=1;ri<this.blocks[bi].length;ri++){

				l_el=this.blocks[bi][ri].getElementsByTagName('a');
				if(!l_el.length){continue;}

				l_el=l_el[0];
				if( l_el && unescape(document.location)==l_el.href){
					out +=' &gt; '+this.blocks[bi][ri].cells[1].innerHTML;
				}
			}
			var id=oUrl.getVar('id');
			var mod=oUrl.getVar('mod');
			if(id && mod){
				var els = document.getElementById(mod+'_'+id).getElementsByTagName('h1');
				if(els && els.length){
					out +=' &gt; '+els[0].innerHTML;
				}
			}
		}
		return out;
	}

	function findFirstNodeOfName(root_el, name){
		var el;
		for(i=0;i<root_el.childNodes.length;i++){
			el = root_el.childNodes[i];	
			if(el.nodeType!=this.oMenu.ELEMENT_NODE){continue;}
			if(el.nodeName==name){return el;}
			return this.findFirstNodeOfName(el,name);
		}
		return false;
	}

	function hideSubMenus(){
		for(var bi=0;bi<this.blocks.length;bi++){
			if(this.blocks[bi][0].className=='h1_open'){
				this.blocks[bi][0].className='h1';
			}
			for(var ri=1;ri<this.blocks[bi].length;ri++){
				this.blocks[bi][ri].style.display = 'none';
			}
		}	
	}
	
	function navTo(el){
		document.location=(el.href+'&nav='+oUrl.getVar('nav'));
		return false;
	}

	function display(el){
		el.style.display='table-row'; 
	}

	function displaySubMenus(el){
		if(el){
			this.hideSubMenus();
			oUrl.setVar('nav',el.id);
			if(el.innerHTML.match(/href="[^"]+"/)){
				el.style.cursor='pointer';
			}
			else{
				el.className='h1_open';
			}
		}
		else{ return;	}
		for(var bi=0;bi<this.blocks.length;bi++){
			if(el && el!=this.blocks[bi][0] ){ continue; }
			
			for(var ri=0;ri<this.blocks[bi].length;ri++){
				this.blocks[bi][ri].style.display = this.displayType;
			}
		}	
	}

	function getBlocks(){
		var bid=0;
		var el;
		for(var i=0;i<this.oMenu.rows.length;i++){
			el=this.oMenu.rows[i];
			if( (' '+el.cells[1].className+' ').match(/ spcr /) ){
				bid++;
				continue;
			}

			if(!this.blocks[bid]){this.blocks[bid] = new Array();}

			this.blocks[bid][this.blocks[bid].length]	= el; 
		}
	}
}

var oNav = new __nav('nav_menu');
oOnload.addEvent('oNav.init();');

