function appendMenu(node,style)
{
	var parent_separator = '';
	var separator = '';
	var html_return = '';
	switch(style)
	{
		case 'inline':
			if(node["-name"]!='' && node["-name"]!=' ')
				parent_separator = '<br />';
			if(node["-deploy_separator"]!='' && node["-deploy_separator"]!=undefined)
				separator = node["-deploy_separator"];
			break;
	}
	var name = node["-name"]; //.replace(/'/,'’');
	html_return += name.replace(/#n/,'<br />')+parent_separator;
	
	var CNodes = node.tab;
	if(CNodes!=undefined)
	{
		var nbCNodes = CNodes.length;
		if(nbCNodes!=undefined)
		{
			for(var i=0;i<nbCNodes;i++)
			{
				cName = CNodes[i]["-name"]; //.replace(/'/,'’');
				switch(CNodes[i]["-type"])
				{
					case 'site_search':
						html_return += '<form name="fsearch_'+CNodes[i]["-id"]+'"';
						html_return += ' id="fsearch_'+CNodes[i]["-id"]+'" method="post"';
						html_return += ' action="'+CNodes[i]["-url"]+'">';
						html_return += '<input type="text" name="search_'+CNodes[i]["-id"]+'"';
						html_return += ' id="search_'+CNodes[i]["-id"]+'" />';
						html_return += '<a href="javascript:void(0);"';
						html_return += ' onclick="document.forms[\'fsearch_'+CNodes[i]["-id"]+'\'].submit();">';
						html_return += '<img src="/img/'+_Theme+'/ok2.gif" name="sbmt_'+CNodes[i]["-id"]+'"';
						html_return += ' id="sbmt_'+CNodes[i]["-id"]+'" align="absmiddle" />';
						html_return += '</a>';
						html_return += '</form>';
						break;
					default:
						html_return += '<a href="'+CNodes[i]["-url"]+'" id="link_'+CNodes[i]["-id"]+'">'+cName.replace(/#n/,'<br />')+'</a>';
						break;
				}
				if(i<(nbCNodes-1)) html_return += separator;
			}
		}
		else
		{
			cName = CNodes["-name"]; //.replace(/'/,'’');
			switch(CNodes["-type"])
			{
				case 'site_search':
					html_return += '<form name="fsearch_'+CNodes["-id"]+'"';
					html_return += ' id="fsearch_'+CNodes["-id"]+'" method="post"';
					html_return += ' action="'+CNodes["-url"]+'">';
					html_return += '<input type="text" name="search_'+CNodes["-id"]+'"';
					html_return += ' id="search_'+CNodes["-id"]+'" />';
					html_return += '<a href="javascript:void(0);"';
					html_return += ' onclick="document.forms[\'fsearch_'+CNodes["-id"]+'\'].submit();">';
					html_return += '<img src="/img/'+_Theme+'/ok2.gif" name="sbmt_'+CNodes["-id"]+'"';
					html_return += ' id="sbmt_'+CNodes["-id"]+'" align="absmiddle" />';
					html_return += '</a>';
					html_return += '</form>';
					break;
				default:
					html_return += '<a href="'+CNodes["-url"]+'" id="link_'+CNodes["-id"]+'">'+cName.replace(/#n/,'<br />')+'</a>';
					break;
			}
		}
	}
	return html_return;
}
function initXML()
{
	var nodeTab, nodesSubTab, nodeSubTab;
	var menu_string = "";
	var oTable = createTable(menu_width,'menu_1rst_lvl');
	var nodesTabs = xml_source.Tabs.tab;
	if(_Menu_Style == 'horiz')
	{
		is_row = false;
		row = addRow(oTable);
		destObj = row;
		first_lvl = addCell;
	}
	else
	{
		is_row = true;
		destObj = oTable;
		first_lvl = addCellRow;
	}
	if(nodesTabs!=undefined)
	{
		for(var iNode=0;iNode<nodesTabs.length;iNode++)
		{
			nodeTab = nodesTabs[iNode];
			nodesSubTab = nodeTab.tab;
			checkArbo = new RegExp("0"+nodeTab["-id"]+";");
			tmp_name = nodeTab["-name"].replace(/#n/,'<br />');
			deploy_method = nodeTab["-deploy_method"];
			deploy_style = nodeTab["-deploy_style"];
			switch(deploy_style)
			{
				case 'inline_down':
					innertxt = appendMenu(nodeTab,'inline');
					break;
				default:
					innertxt = tmp_name;
					break;
			}
			
			this_obj = first_lvl(destObj,'mn_'+nodeTab["-id"],innertxt);
			
			
			if(nodeTab["-url"]!='' && nodeTab["-url"]!=null)
			{
				this_obj.setAttribute('url',nodeTab["-url"]);
				this_obj.onclick = goTo;
			}
			switch(deploy_method)
			{
				case 'mouseover':
					this_obj.onmouseover = showDynMenu;
					this_obj.onmouseout = makeOut;
					break;
			}
		}
	}
	document.getElementById('menu').appendChild(oTable);
	include('/js/shared/menu/getMenuStyle.js.php');
}