function hideItems() {
	var list = document.getElementById("subNav").getElementsByTagName("ul");
	for(i=0;i<list.length;i++) {
		list[i].style.display="none";
	}
}

function getUrlVars(){    
	var vars = [], hash;    
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');     
	for(var i = 0; i < hashes.length; i++) {        
			hash = hashes[i].split('=');        
			vars.push(hash[0]);        
			vars[hash[0]] = hash[1];    
	}     
	return vars;
}

function navMenu() {
	
	var getvars = getUrlVars();

	
	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName('a');
	
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
			
		var relAttribute = String(anchor.getAttribute('rel'));
		
		if (relAttribute.toLowerCase().match('menutrigger')){
			anchor.onclick = function() { 
				var nameAttribute = this.getAttribute('name') + "Nav";
				var thismenu = document.getElementById(nameAttribute);
				hideItems();
				thismenu.style.display="inline";
				location.href(this.getAttribute('href'));
				return false;
			}
		}
	}
	var id = getvars['selection']+"Nav";
	
	document.getElementById(id).style.display="inline";

}
