var oVertmenuManager = new ckVertmenuManager()

function ckVertmenuManager() {
	this.type = "ckVertmenuManager";
	this.version = "12.12.2009 [ckVertmenuManager; ckVertmenuManager.js]";
	this.aMenus = new Array();

	this.separatorImageURL = "";
	this.gapImageURL="";	
	this.gapImageHeight=10;
	this.gapCount = 0;
	this.bOperaBrowser = false;
	this.bAnyMenus = false;
	this.sDebug = "";
}
	
ckVertmenuManager.prototype.addMenu = function(oMenu) {
	this.sDebug += "\n" + oMenu.uniqueID;
	this.aMenus[oMenu.uniqueID] = oMenu;
	this.bAnyMenus = true;
	return this.aMenus[oMenu.uniqueID];
}
ckVertmenuManager.prototype.addGap = function() {
	this.sDebug += "\n[gap]";
	this.gapCount++;
	this.aMenus["vm.gap." + this.gapCount] = null;
}
ckVertmenuManager.prototype.hasAnyMenus = function() {
	return this.bAnyMenus;
}
ckVertmenuManager.prototype.find = function(item) {
	if( this.bOperaBrowser ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

ckVertmenuManager.prototype.setSelected = function(sPageID) {
	var oMenu;
	for (var key in this.aMenus) {
		if (oMenu = this.aMenus[key]) oMenu.setSelected(sPageID)
	}
}
/*
ckVertmenuManager.prototype.setSeparatorImage= function(sURL) {
	this.separatorImageURL = sURL;
}
*/
/*-----------------------------------------------------------------
writeMenus
-----------------------------------------------------------------*/
/*ckVertmenuManager.prototype.getSeparatorHTML = function() {
	var sHTML = '';
	//if (this.separatorImageURL != '') sHTML = '<img src="' + this.separatorImageURL + '" style="width:100%"/>';
	//sHTML = '<div class="separator">' + sHTML + '</div>';
	return sHTML;
}
*/

ckVertmenuManager.prototype.toggleExpand = function(sUniqueID) {
	var oMenu;
	var oEl,oImg;
	if (oMenu = this.aMenus[sUniqueID]) {
		oMenu.toggleExpand();
		
		
	}
}

ckVertmenuManager.prototype.writeMenus = function(containerID) {
	var oMenuContainer = document.getElementById(containerID); //"ckVertmenu.container");
	if (!oMenuContainer) throwConsoleError("ckvertmenuManager.writeMenus()","Menu container '" + containerID + "' was not found");

	var oMenu, oDivRoot;
	var sHTML = "";
	
	oDivRoot = document.createElement("DIV");
	oDivRoot.className="ckVertmenu";
	
	for (var key in this.aMenus) {
		if (key.indexOf("vm.gap.")==0) {
			sHTML += '<div class="gap">&nbsp;</div>';
		} else if (oMenu = this.aMenus[key]) {
				
			sHTML += oMenu.getItemHTML();
			//sHTML += this.getSeparatorHTML();
		}
	}	
	oDivRoot.innerHTML = sHTML;
	
	oMenuContainer.appendChild(oDivRoot);
}

