var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);

function initMenu() {
	if (!isDOM && !isIE4 && !isNS4)
		return;

	for (currMenu = 0; currMenu < mymenu.length; currMenu++) with (mymenu[currMenu][0]) {
		var str = '', itemX = 0, itemY = 0;
		for (currItem = 1; currItem < mymenu[currMenu].length; currItem++) with (mymenu[currMenu][currItem]) {
			var itemID = 'mymenu' + currMenu + 'infoitem' + currItem;
			//var w = width;
			var w = (isVert ? width : length);
			//var h = length;
			var h = (isVert ? length : width);
			if (isDOM || isIE4) {
				str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
				if (backCol)
					str += 'background: ' + backCol + '; ';
				str += '" ';
			}
			if (isNS4) {
				str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
				if (backCol)
					str += 'bgcolor="' + backCol + '" ';
			}
			str += 'onMouseOver="popOn(mymenu, ' + currMenu + ',' + currItem + ')" onMouseOut="popOut(mymenu, ' + currMenu + ',' + currItem + ')">';
			//if (currItem == 1 && currMenu == 0)
				//str += '<table border="0" cellpadding="0" cellspacing="0" width="' + w + '" height="1"><tr><td bgcolor="#0099ff" colspan="3"><img src="images/white_dot.gif" width="1" height="1" border="0"></td>';
			//} else if (currMenu == 0 && currItem == (mymenu[currMenu].length -1)) {
				//str += '<table border="0" cellpadding="0" cellspacing="0" width="' + w + '" height="9"><tr><td colspan="3" height="9"><img src="images/curvebttm.gif" width="134" height="9" border="0"></td>';
			//} else {
				if(href != '') {
					str += '<table border="0" cellpadding="0" cellspacing="0" width="' + w + '" height="' + h + '"><tr><td width="2"></td><td width="' + (w-7) + '" height="' + (h-1) + '" align="left" onClick="' + href + '"><span class="' + textClass + '">' + text + '</td>';
				} else {
					str += '<table border="0" cellpadding="0" cellspacing="0" width="' + w + '" height="' + h + '"><tr><td width="2"></td><td width="' + (w-7) + '" height="' + (h-1) + '" align="left">' + '<span class="' + textClass + '">' + text + '</span></td>';
				}
			//}

			if (target > 0) {
				mymenu[target][0].parentMenu = currMenu;
				mymenu[target][0].parentItem = currItem;
				if (popInd)
					str += '<td class="' + textClass + '" width="7" align="right">' + popInd + '</td>';
				else
					str += '<td width="7"></td>';
			}
			//if (currMenu == 0 && currItem > 1 && currItem < (mymenu[currMenu].length -1))
			//if (currMenu == 0 && currItem < (mymenu[currMenu].length -1))
				//str += '</tr><tr><td bgcolor="#666633" colspan="3"><img src="images/olive1_dot.gif" width="1" height="1" border="0"></td>';
			//if (currMenu > 0)
				str += '</tr><tr><td bgcolor="#0099ff" colspan="3"><img src="images/white_dot.gif" width="1" height="1" border="0"></td>';
			//if (isVert) itemY += length + spacing;
			//else itemX += length + spacing;
			str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');

			itemY += length;
		}
		if (isDOM) {
			var newDiv = document.createElement('div');
			document.getElementsByTagName('body').item(0).appendChild(newDiv);
			newDiv.innerHTML = str;
			ref = newDiv.style;
			ref.position = 'absolute';
			ref.visibility = 'hidden';
		}
		if (isIE4) {
			document.body.insertAdjacentHTML('beforeEnd', '<div id="mymenu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
			ref = getSty('mymenu' + currMenu + 'div');
		}
		if (isNS4) {
			ref = new Layer(0);
			ref.document.write(str);
			ref.document.close();
		}
		for (currItem = 1; currItem < mymenu[currMenu].length; currItem++) {
			itemName = 'mymenu' + currMenu + 'infoitem' + currItem;
			if (isDOM || isIE4)
				mymenu[currMenu][currItem].ref = getSty(itemName);
			if (isNS4)
				mymenu[currMenu][currItem].ref = ref.document[itemName];
		}
	}
	with(mymenu[0][0]) {
		ref.left = x;
		ref.top = y;
		ref.visibility = 'visible';
   }
}



