function cMenu(id){
	this.catMenu = document.getElementById(id);
	this.catChildDivs = new Array();

	for(var i in this.catMenu.childNodes){
		if(this.catMenu.childNodes[i].nodeName == 'DIV'){
			this.catChildDivs.push(this.catMenu.childNodes[i]);
		}
	}

}

cMenu.prototype.show = function(cat){
	for(var i in this.catChildDivs){
		if(this.catChildDivs[i].id == cat){
			this.catChildDivs[i].style.display = 'block';
		}else{
			this.catChildDivs[i].style.display = 'none';
		}
	}	
}

cMenu.prototype.loadDefault = function(){
	var hash = location.hash.substr(1);
	parts = hash.split('=');
	if(parts[0] == 'menu'){
		if(parts[1]){
			this.show(parts[1]);
		}
	}else{
		this.show('BL');
	}
}

//////////////////////////////
/*function OLDcMenu(categoryTree, divMenu, divTitle, callback, isFrontPage){//console.dir(categoryTree);
	
	this.categoryTree = categoryTree;
	this.divMenu = divMenu;
	this.divTitle = divTitle;
	this.callback = callback;
	this.isFrontPage = isFrontPage || false;
	
	this.level = 0;
	
	this.ul = document.createElement('ul');
	this.divMenu.appendChild(this.ul);
	
	var self = this;
	//this.eventCategoryClick = function(e){self.categoryClick(e);};
	
	//addEvent(this.divMenu, 'click', this.eventCategoryClick);

	
}

OLDcMenu.prototype.loadDefault = function(){
	var hash = location.hash.substr(1);
	parts = hash.split('=');
	if(parts[0] == 'menu'){
		if(parts[1]){
			this.show(parts[1], cattitles[parts[1].toUpperCase()]);
		}
	}else{
		this.show('bl', 'All books');
	}
}

OLDcMenu.prototype.show = function(menuname, title){
	this.level=0;	
	
	this.currentMenu = menuname;
	this.origMenu = menuname;
	//this.source = this.categoryTree[menuname];
	//this.showTreeNode(this.source);
	this.showTreeNode(menuname);
	this.divTitle.innerHTML = title;
	this.divMenu.style.display='block';
}

OLDcMenu.prototype.showTreeNode = function(menuname){ 

	var node = this.categoryTree[menuname];


	this.ul.innerHTML = '';

	for(var i in node){
		var li = document.createElement('li');
		li.setAttribute('rel',i);
		li.className = 'subcat';
		var fullName = node[i].name;
		var a = document.createElement('a');
		var self = this;
		var currentMenu = this.currentMenu;
		var currentVal = i.substr(1);		
		a.href = '/books/index.php?bid='+currentVal+'#menu='+menuname;
		var img = document.createElement('img');
		img.src = RESOURCES + '/img/ico/book.png';
		img.title = 'View book page';
		a.appendChild(img);
		var aText = document.createTextNode(fullName);
		a.appendChild(aText);
		li.appendChild(a);
		this.ul.appendChild(li);
	}
}*/

