var howlong = 0; //used to set the width of the tables so text does not wrap
var usearrow="";
var arrow="<img src='/images/menu_arrow.gif' border=0 align=right>";

//start style declarations for menus
document.write("<style type=\"text/css\">");
for(n=0;n<items.length;n++){
	for(i=0;i<items[n].length;i++){
		document.write("#"+items[n][2]+"{position:absolute;top:"+items[n][0]+";left:"+items[n][1]+";visibility:hidden;}");
	}
}
document.write("</style>");
//end style declarations for menus

function writechild(x,inst){
chld="";
	if(x!=""){
	chld=inst+"IndvMenu('"+x+"');";
	}
	return(chld);
}

function writetarget(x){
target="";
	if(x!=""){
		target="target=\"_blank\""
	}
	return(target);
}

//start menu table creation
for(n=0;n<items.length;n++){
howlong=0;
	for(i=4;i<items[n].length;i++){
		i++//pushes i to name space
		//alert(items[n][i]);
			if(items[n][i].length>howlong){
				howlong = items[n][i].length; //number of characters of the longest array value
			}
		i++//pushes i past child space
		i++//pushes i past child space
	}
	howlong = howlong*fontsize //number of characters of longest array value is multiplied by a value to set table width
	if(howlong<menuwidth){
	howlong=menuwidth;//sets a minimum for the dropdown width for uniformity sake
	}
		document.write("<div id=\""+items[n][2]+"\">");
		document.write("<table cellpadding=0 cellspacing=0 border=0 width="+howlong+">");
		for(i=4;i<items[n].length;i++){
			if(items[n][i+2]!=""){usearrow=arrow}
			else{usearrow=""}
			document.write("<tr><td valign=middle align=left bgcolor=\"#"+color1+"\" onMouseover=\"this.style.backgroundColor='#"+color2+"';ShowMenu('"+items[n][2]+"');"+writechild(items[n][3],'Show')+""+writechild(items[n][i+2],'Show')+"\" onMouseout=\"this.style.backgroundColor='#"+color1+"';HideAll();\">"+usearrow);
			document.write("&nbsp;<span class=\"menu-links\"><a href=\""+items[n][i]+"\""+writetarget(items[n][i+3])+">");
			i++;//pushes i to name space
			document.write(items[n][i]+"</a></span>");
			document.write("</td></tr>");
			i++;//pushes i past child space
			i++;//pushes i past child space
		}
		document.write("</table></div>");
}
//end menu table creation