﻿function MainMenu(Name, Address, span_id)
{
	var i, main_loc, td_class, html = '';
	if (document.getElementById('page_maintitle') != null) 
		main_loc = document.getElementById('page_maintitle').innerHTML;
	else
		main_loc = '';
	
	html += '<div style="height:26px">&nbsp;</div>';
	html += '<table border=0 cellspacing=0 cellpadding=0 style="margin-left:9px"><tr>';
	for (i=0; i<Address.length; i++) {
		td_class = (i < Address.length - 1) ? 'MainMenuCell' : 'MainMenuCellLast';
		if (Address[i].split("/")[Address[i].split("/").length-1] != main_loc) {
			html += '<td class="' + td_class + '"><a class="MainMenuLink" href="' + Address[i] + '" ';
			html += 'onMouseOver="this.className=\'MainMenuLinkSelect\'" ';
			html += ' onMouseOut="this.className=\'MainMenuLink\'">' + Name[i] + '</a></td>';
		}
		else
			html += '<td class="' + td_class + '"><a class="MainMenuLinkSelect" href="' + Address[i] + '">' + Name[i] + '</a></td>';
	}
	html += '</tr></table>';
	
	document.getElementById(span_id).innerHTML = html;	
}

function MainMenu_ViewHTML(Name, Address, span_id)
{
	var i, main_loc, td_class, html = '';
	if (document.getElementById('page_maintitle') != null) 
		main_loc = document.getElementById('page_maintitle').innerHTML;
	else
		main_loc = '';
	
	html += '<div style="height:26px">&nbsp;</div>';
	html += '<table border=0 cellspacing=0 cellpadding=0 style="margin-left:9px"><tr>';
	for (i=0; i<Address.length; i++) {
		td_class = (i < Address.length - 1) ? 'MainMenuCell' : 'MainMenuCellLast';
		if (Address[i].split("/")[Address[i].split("/").length-1] != main_loc) {
			html += '<td class="' + td_class + '"><a class="MainMenuLink" href="' + Address[i] + '" ';
			html += 'onMouseOver="this.className=\'MainMenuLinkSelect\'" ';
			html += ' onMouseOut="this.className=\'MainMenuLink\'">' + Name[i] + '</a></td>';
		}
		else
			html += '<td class="' + td_class + '"><a class="MainMenuLinkSelect" href="' + Address[i] + '">' + Name[i] + '</a></td>';
	}
	html += '</tr></table>';
	
	var html_textarea = '<textarea id="my_textarea" rows=20 cols=80>' + html + '</textarea>';
	
	document.getElementById(span_id).innerHTML = html + html_textarea;
}