var tblStart = '<table width="190" border="0" cellspacing="0" cellpadding="0" height="17"> \n';
var tblRowStart = '<tr><td width="20" height="17"><img src="../images/pixel1x1.gif" width="20" height="17" border="0" alt=""></td>';
var tblRowStartGrey = '<tr bgColor="#CCCCCC"><td valign="top" width="20" height="17" bgColor="#FFCC00"><img src="../images/square_bulletv2.gif" width="20" height="17" border="0"></td>';
var tblDataStart = '<td width="5" height="20"><img src="../images/pixel1x1.gif" width="5" height="20" border="0" alt=""></td><td width="136" height="17">';
var tblDataEnd = '</td>';
var tblRowEnd = '</tr> \n';
var tblEnd = '</table>';

var divHeight,content,setMenu = 0;

var menuStructure = new Array();

menuStructure[0] = {hasChildren:0, main:'<a class="lhsmenulink" href="index.html">Upcoming Events</a><br>'};


var show = new Array(0,0,0,0,0,0,0,0);

function writeSideMenu(i){
	if(!setMenu){
		currentMenu = i;
		setMenu = 1;
	}
	content = tblStart;
	(show[i])? show[i] = 0 : show[i] = 1;
	for(x in menuStructure){
		if(parseInt(x) == parseInt(currentMenu)){
			content += tblRowStartGrey + tblDataStart + menuStructure[x].main + tblDataEnd + tblRowEnd;
		}else{
			content += tblRowStart + tblDataStart + menuStructure[x].main + tblDataEnd + tblRowEnd;
		}
		if(show[x] && menuStructure[x].hasChildren) content += tblRowStart + tblDataStart + writeSubMenus(x) + tblDataEnd + tblRowEnd;
	}
	if(document.all)writeIE(content);
	if(document.layers)writeNS4(content);
	if(!document.all && document.getElementById)writeNS6(content);
	content = null;
}

function writeSubMenus(j){
	var content = '';
	for(y in menuStructure[j].urls){
		content += menuStructure[j].urls[y];
	}
	show[j] = 1;
	return content;
}

function writeIE(content){
	document.all.myDiv.innerHTML = content + tblEnd;
	positionRelInfo();
}

function writeNS6(content){
	document.getElementById("myDiv").innerHTML = content;
	positionRelInfo();
}

function writeNS4(content){
	document.layers.myDiv.document.open();
	document.layers.myDiv.document.write(content + tblEnd);
	document.layers.myDiv.document.close();
	positionRelInfo();
}

function positionRelInfo(){
	if(document.all)positionIE();
	if(document.layers)positionNS4();
	if(!document.all && document.getElementById)positionNS6();
}

function positionIE(){
	divHeight = parseInt(document.all.myDiv.clientHeight);
	document.all.relInfo.style.top = 222 + divHeight + 30 + "px";
}

function positionNS4(){
	divHeight = parseInt(document.layers.myDiv.document.height);
	document.layers.relInfo.top = 222 + divHeight + 30;
}

function positionNS6(){
	divHeight = parseInt(document.getElementById("myDiv").offsetHeight);
	document.getElementById("relInfo").style.top = 222 + divHeight + 30;
}
