function divover()
	{
	over = true;
	}
function menu_init()
	{
	var d = '';
	for(i=0; i<men['length']; i++)
		{
		if (men[i]['length']) d = d + menu_b(men[i], '_' + i);
		}
	document.getElementById('men_place').innerHTML = d;
//	alert (document.getElementById('men_place').innerHTML);
	}
function myContains(fin, fwhat)
	{
	var ret = false;
	var i = 0;
	for (i=0; i<fin.getElementsByTagName("*").length; i++)
		{
		if (fin.getElementsByTagName("*")[i] == fwhat) ret = true;
		}
	return ret;
	}
function menu_out (e, item_name)
	{
	var ev = window.event ? window.event : e;
	var toe;
	if (ev.toElement) toe = ev.toElement;
	if (ev.relatedTarget) toe = ev.relatedTarget;
	if (document.getElementById(item_name))
		{
		if ((!myContains(document.getElementById('men_place'), toe)) || (toe.tagName == 'DIV'))
			{
//				alert (toe.name);
				document.getElementById(item_name).style.visibility = 'hidden';
			}
		}
//	if ((window.event.toElement.background != 'img/men_bg_b.gif') && (window.event.toElement.name != 'firdt'))
//		{
//		alert(window.event.toElement.innerHTML);
//		document.getElementById(item_name).style.visibility = 'hidden';
//		}
	}
function menu_out_a (e, item_name)
	{
	var ev = window.event ? window.event : e;
	var toe;
	if (ev.toElement) toe = ev.toElement;
	if (ev.relatedTarget) toe = ev.relatedTarget;
	var i = 0;
	var alldivs = document.getElementById('men_place').getElementsByTagName('DIV');
	if (toe)
		{
		if (((!myContains(document.getElementById(item_name), toe)) || (toe == document.getElementById(item_name))))
			{
			document.getElementById(item_name).style.visibility = 'hidden';
			if ((toe.tagName == 'DIV') || (!myContains(document.getElementById('men_place'), toe)))
				{
				for (i=0; i<alldivs.length; i++)
					{
					alldivs[i].style.visibility = 'hidden';
					}
				}
	//alert (document.getElementById('men_place').getElementsByTagName('DIV'));
			}
		}
	else
		{
		for (i=0; i<alldivs.length; i++)
			{
			alldivs[i].style.visibility = 'hidden';
			}
		}
	}
function menu_out_c (item_name)
	{
	if (((!document.getElementById(item_name).contains(window.event.toElement)) || (window.event.toElement == document.getElementById(item_name))))
		{
		document.getElementById(item_name).style.visibility = 'hidden';
		}
	}

function menu_over (item_name, src_item)
	{
	var tag_name = '';
	var men_top = 0;
	var men_left = 0;
	var element = src_item;
	var div_e = 'it' + item_name;
	var top_e = 'tp' + item_name;
	var top_e2 = 'tp2' + item_name;
	if ((document.getElementById(div_e)) || (document.getElementById(top_e)) || (document.getElementById(top_e2)))
		{
		while (tag_name != 'BODY')
			{
			men_top = men_top + element.offsetTop;
			men_left = men_left + element.offsetLeft;
			element = element.offsetParent;
			tag_name = element.tagName;
			}
	//	alert (src_item.height);
		document.getElementById(div_e).style.visibility = '';
		document.getElementById(div_e).style.top = men_top + src_item.offsetHeight;
		document.getElementById(div_e).style.left = men_left;
		document.getElementById(top_e).width = src_item.offsetWidth;
		if (document.getElementById(top_e2).width < src_item.offsetWidth + 7) document.getElementById(top_e2).width = src_item.offsetWidth + 7;
		}
	}
function menu_over_a (item_name, src_item)
	{
	var tag_name = '';
	var men_top = 0;
	var men_left = 0;
	var element = src_item;
	var div_e = 'it' + item_name;
	var top_e = 'tp' + item_name;
	while (tag_name != 'DIV')
		{
		men_top = men_top + element.offsetTop;
		men_left = men_left + element.offsetLeft;
		element = element.offsetParent;
		tag_name = element.tagName;
		}
//	alert (src_item.height);
	document.getElementById(div_e).style.visibility = '';
	document.getElementById(div_e).style.top = men_top;
	document.getElementById(div_e).style.left = men_left + src_item.offsetWidth;
//	document.getElementById(top_e).width = src_item.offsetWidth;
	}
function menu_b(arr, item_name)
	{
	var i, j;
	var html_menu;
	var submenu = '';
	html_menu = '<div bgcolor="#E7E7E7" style="z-index:3;position:absolute;left:0px;top:0px;visibility:hidden;" id="' + 'it' + item_name + '">\n' + 
	'<table onMouseOut="menu_out(event, \'it' + item_name + '\')" height="21"  border="0" cellspacing="0" cellpadding="0" style="font-size: 1px" id="tp' + item_name + '">' + 
	'<tr>' +
	'<td style="border-left: 1px solid #8D8D8D;" width="5" height="16" background="img/men_con_left_b.gif">&nbsp;</td>' +
	'<td height="16" background="img/men_bg_b.gif">&nbsp;</td>' +
	'<td width="5" height="16" background="img/men_con_right_b.gif">&nbsp;</td>' +
	'</tr>' +
	'<tr>' +
	'<td bgcolor="#E7E7E7" colspan=3 style="font-size: 1px; border-left: 1px solid #8D8D8D;" height="5">&nbsp;</td>' +
	'</tr>' +
	'</table>' +
	'<table id="tp2' + item_name + '" onMouseOut="menu_out_a(event, \'it' + item_name + '\')" bgcolor="#E7E7E7" style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082; border-bottom: 1px solid #8D8D8D; border-left: 1px solid #8D8D8D; border-right: 1px solid #8D8D8D" cellspacing=0 cellpadding=4>';
	for(i=0; i<arr['length']; i++)
		{
		if (arr[i]['length'] != 0)
			{
			if (arr[i]['link'] != '')
				{
				html_menu = html_menu + '<tr onMouseOut="menu_out_a(event, \'it' + item_name + '_' + i + '\')" name="firdt"><td onMouseOver="menu_over_a(\'' + item_name + '_' + i + '\', this)" style="cursor: pointer" align=left name="firdt" onClick="window.location.href=\''+arr[i]['link']+'\'"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" name="firdt" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;&nbsp;</td><td style="border-bottom: 1px solid #D5D5D5;" align=right><img src="img/arrow_right2.gif"></td></tr></table></td></tr>';
				}
			else
				{
				html_menu = html_menu + '<tr onMouseOut="menu_out_a(event, \'it' + item_name + '_' + i + '\')" name="firdt"><td onMouseOver="menu_over_a(\'' + item_name + '_' + i + '\', this)" style="cursor: pointer" align=left name="firdt"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" name="firdt" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;&nbsp;</td><td style="border-bottom: 1px solid #D5D5D5;" align=right><img src="img/arrow_right2.gif"></td></tr></table></td></tr>';
				}
			submenu = submenu + menu_a(arr[i], item_name + '_' + i);
			}
		else
			{
			if (arr[i]['link'] != '')
				{
				html_menu = html_menu + '<tr name="firdt"><td name="firdt" style="cursor: pointer" onClick="window.location.href=\''+arr[i]['link']+'\'"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" name="firdt" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td></tr></table></td></tr>';
				}
			else
				{
				html_menu = html_menu + '<tr name="firdt"><td name="firdt" style="cursor: pointer"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" name="firdt" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td></tr></table></td></tr>';
				}
			}
		}
	html_menu = html_menu + '</table>\n' + submenu + '</div>';
	return html_menu;
	}
function menu_a(arr, item_name)
	{
	var i, j;
	var html_menu;
	var submenu = '';
	html_menu = '<div bgcolor="#E7E7E7" style="z-index:3;position:absolute;left:0px;top:0px;visibility:hidden;" id="' + 'it' + item_name + '">\n' + 
	'<table onMouseOut="menu_out_a(event, \'it' + item_name + '\')" bgcolor="#E7E7E7" style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082; border-bottom: 1px solid #8D8D8D; border-left: 1px solid #8D8D8D; border-right: 1px solid #8D8D8D" cellpadding=4 cellspacing=0>';
	for(i=0; i<arr['length']; i++)
		{
		if (arr[i]['length'])
			{
			if (arr[i]['link'] != '')
				{
				html_menu = html_menu + '<tr onMouseOut="menu_out_a(event, \'it' + item_name + '_' + i + '\')"><td onMouseOver="menu_over_a(\'' + item_name + '_' + i + '\', this)" style="cursor: pointer" onClick="window.location.href=\''+arr[i]['link']+'\'"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td><td style="border-bottom: 1px solid #D5D5D5;" align=right><img src="img/arrow_right2.gif"></td></tr></table></td></tr>';
				}
			else
				{
				html_menu = html_menu + '<tr onMouseOut="menu_out_a(event, \'it' + item_name + '_' + i + '\')"><td onMouseOver="menu_over_a(\'' + item_name + '_' + i + '\', this)" style="cursor: pointer"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td><td style="border-bottom: 1px solid #D5D5D5;" align=right><img src="img/arrow_right2.gif"></td></tr></table></td></tr>';
				}
			submenu = submenu + menu_a(arr[i], item_name + '_' + i);
			}
		else
			{
			if (arr[i]['link'] != '')
				{
			html_menu = html_menu + '<tr><td onClick="window.location.href=\''+arr[i]['link']+'\'" style="cursor: pointer"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td></tr></table></td></tr>';
				}
			else
				{
			html_menu = html_menu + '<tr><td style="cursor: pointer"><table width=100% align=left cellspacing=0 style="font-size: 12px; font-weight: 700; font-family:Arial, Helvetica, sans-serif; color: #003082;" cellspacing=0 cellpadding=0><tr><td style="border-bottom: 1px solid #D5D5D5;" nowrap>&nbsp;&nbsp;' + arr[i]['title'] + '&nbsp;</td></tr></table></td></tr>';
				}
			}
		}
	html_menu = html_menu + '</table>\n' + submenu + '</div>';
	return html_menu;
	}