/*
var isNN4=(document.layers)?true:false;
var isDOM=(document.getElementById)?true:false;
var isIE4=(document.all && !dom)?true:false;
var isIE5=(document.all && dom)?true:false;
*/

function render(list, lev){
	var str='';
	var str2='';
	var evn='';
	var evn2='';
	var target='';
	if (lev=='0') {
		for (i in list) {
			if (list[i].level==lev) {
				if (list[i].children.length!=0) {
					pMenus[pMenus.length]='mt'+list[i].id;
				}
				evn=(list[i].children.length!=0)?'onMouseOver="this.className=\'currenttopmenu2\'; ShowMenu(\'mt'+list[i].id+'\');HideAllSub();" onMouseOut="this.className=\'topmenu2\'; PreHide(\'mt'+list[i].id+'\');"':'onMouseOver="this.className=\'currenttopmenu2\';HideAll();HideAllSub();" onMouseOut="this.className=\'topmenu2\';"';
				target=(list[i].inNewWindow=="true")?"target=_blank":"";
				str+=(list[i].isFirst=='yes')?'':'<td width=1><img src=img/1x1.gif width=1 height=22></td>\n';
				str+='<td class=topmenu2 '+evn+'><div class=sub2><a class=menut '+target+' href="'+list[i].url+'">'+list[i].text+'</a></div>\n';
				str+='</td>\n';
			}
		}
		document.writeln(str);
	} else if (lev=='1') {
		for (var i in list) {
			if (list[i].level==0) {
				str+=(list[i].isFirst=='yes')?'<td>':'<td colspan=2>';
				if (list[i].children.length>0) {
					childList=list[i].children;
					rowS=childList.length*2+1;
					str+='\n<div id="mt'+list[i].id+'" class=level1><table border=0 cellspacing=0 cellpadding=0 width=161><tr>\n';
					str+='<td rowspan='+rowS+' width=1 class=borderLt><img src=img/1x1.gif width=1 height=1></td>\n';
					str+='<td height=1 class=borderTop><img src=img/1x1.gif width=1 height=1></td>\n';
					str+='<td rowspan='+rowS+' width=1 class=borderRt><img src=img/1x1.gif width=1 height=1></td></tr>\n';
					for (c=0;c<childList.length;c++) {
						if (list[childList[c]].children.length!=0) {
							sMenus[sMenus.length]='mt'+list[childList[c]].id;
						}
						evn=(list[childList[c]].children.length!=0)?'onMouseOver="this.className=\'currentsubmenu\'; HideAllSub();Show=true;Visible(\'mt'+list[i].id+'\',true);Visible(\'mt'+list[childList[c]].id+'\',true);" onMouseOut="this.className=\'submenu\';PreHide(\'mt'+list[i].id+'\');PreHide(\'mt'+list[childList[c]].id+'\');"':'onMouseOver="this.className=\'currentsubmenu\';ShowMenu(\'mt'+list[i].id+'\');HideAllSub();" onMouseOut="this.className=\'submenu\';PreHide(\'mt'+list[i].id+'\');"';
						target=(list[childList[c]].inNewWindow=="true")?"target=_blank":"";
						str+=(list[childList[c]].isFirst=="Yes")?'':'<tr><td height=1><img src=img/dot_line2.gif width=161 height=1></td></tr>';
						str+='\n<tr><td class=submenu '+evn+'>\n';
						str+=(list[childList[c]].children.length!=0)?'<table border=0 cellspacing=0 cellpadding=0><tr><td width=155><div class=sub><a class=menu3 '+target+' href="'+list[childList[c]].url+'">'+list[childList[c]].text+'</a></div></td><td width=6 valign=top><img src=img/sub.gif width=6 height=6></td></tr></table>':'<div class=sub><a class=menu3 '+target+' href="'+list[childList[c]].url+'">'+list[childList[c]].text+'</a></div>';
						str+='\n</td><td valign=top>\n';
						if (list[childList[c]].children.length!=0) str+=(renderSub(list[childList[c]].children, 'sub'));
						str+='</td></tr>\n';
					}
					str+='<tr><td height=1 class=borderBot><img src=img/1x1.gif width=161 height=1></td></tr></table></div>\n';
					str+='</td>\n';
				}
			}
		}
		document.write(str);
	}
}
function renderSub(list, lev){
	var str2='';
	var evn2='';
	var target='';
	if (lev=='sub') {
		rowS2=list.length*2+1;
		str2+='\n<div id="mt'+menuItemList[list[0]].parentId+'" class=level2><table border=0 cellspacing=0 cellpadding=0 width=161><tr>\n';
		str2+='<td rowspan='+rowS2+' width=1 class=borderLt><img src=img/1x1.gif width=1 height=1></td>\n';
		str2+='<td height=1 class=borderTop><img src=img/1x1.gif width=1 height=1></td>\n';
		str2+='<td rowspan='+rowS2+' width=1 class=borderRt><img src=img/1x1.gif width=1 height=1></td></tr>\n';
		for (var i=0;i<list.length;i++) {
			evn2='onMouseOver="this.className=\'currentsubmenu2\'; Visible(\'mt'+menuItemList[list[i]].parentId+'\',true);Show=true;clearTimeout(to);" onMouseOut="this.className=\'submenu2\';PreHide(\'mt'+menuItemList[list[i]].parentId+'\');"';
			target=(menuItemList[list[i]].inNewWindow=="true")?"target=_blank":"";
			str2+=(menuItemList[list[i]].isFirst=="yes")?'':'<tr><td height=1><img src=img/dot_line2.gif width=161 height=1></td></tr>';
			str2+='\n<tr><td class=submenu2 '+evn2+'>\n';
			str2+='<div class=sub><a class=menu3 '+target+' href="'+menuItemList[list[i]].url+'">'+menuItemList[list[i]].text+'</a></div></td></tr>\n';
		}
		str2+='<tr><td height=1 class=borderBot><img src=img/1x1.gif width=161 height=1></td></tr></table></div>\n';
		return str2;
	}
}

function renderLeft() {
	var str='<tr><td height=1><img src=img/dot_line1.gif width=161 height=1></td></tr>\n';
	var evn='';
	var target='';
	for (var i in menuLeftList) {
		if (menuLeftList[i].level==0) {
			if (menuLeftList[i].children.length!=0) {
				pMenus[pMenus.length]='mt'+menuLeftList[i].id;
			}
			evn=(menuLeftList[i].children.length>0)?'onMouseOver="this.className=\'currentleftmenu\'; ShowMenu(\'mt'+menuLeftList[i].id+'\');HideAllSub();" onMouseOut="this.className=\'leftmenu\';PreHide(\'mt'+menuLeftList[i].id+'\');"':'onMouseOver="this.className=\'currentleftmenu\';HideAll();HideAllSub();" onMouseOut="this.className=\'leftmenu\';"';
			target=(menuLeftList[i].inNewWindow=="true")?"target=_blank":"";
			str+='<tr><td width=161 class=leftmenu valign=top '+evn+'>\n';
			str+=(menuLeftList[i].children.length>0)?'<table border=0 cellspacing=0 cellpadding=0 background=img/1x1.gif><tr><td width=155>\n':'';
			str+='<div class=sub><a class=menu2 '+target+' href="'+menuLeftList[i].url+'">'+menuLeftList[i].text+'</a></div>\n';
			str+=(menuLeftList[i].children.length>0)?'</td><td width=6 valign=top><img src=img/sub.gif width=6 height=6></td></tr></table>\n':'';
			str+='</td><td valign=top>\n';
			if (menuLeftList[i].children.length>0) str+=renderLeftSub(menuLeftList[i].children);
			str+='</td></tr>\n';
			str+='<tr><td height=1><img src=img/dot_line1.gif width=161 height=1></td></tr>';
		}
	}
	document.writeln(str);
}

function renderLeftSub(list) {
	var evn2='';
	var str2='';
	var row=list.length*2+1;
	var target='';
	str2+='\n<div id="mt'+menuLeftList[list[0]].parentId+'" class=left><table border=0 cellspacing=0 cellpadding=0 width=161><tr>\n';
	str2+='<td rowspan='+row+' width=1 class=borderLt><img src=img/1x1.gif width=1 height=1></td>\n';
	str2+='<td height=1 class=borderTop><img src=img/1x1.gif width=1 height=1></td>\n';
	str2+='<td rowspan='+row+' width=1 class=borderRt><img src=img/1x1.gif width=1 height=1></td></tr>\n';
	for (var i=0;i<list.length;i++) {
		if (menuLeftList[list[i]].children.length!=0) {
			sMenus[sMenus.length]='mt'+menuLeftList[list[i]].id;
		}
		evn2=(menuLeftList[list[i]].children.length>0)?'onMouseOver="this.className=\'currentsubmenu2\';HideAllSub();Show=true; Visible(\'mt'+menuLeftList[list[i]].parentId+'\',true); Visible(\'mt'+menuLeftList[list[i]].id+'\',true);clearTimeout(to);" onMouseOut="this.className=\'submenu2\';PreHide(\'mt'+menuLeftList[list[i]].parentId+'\');PreHide(\'mt'+menuLeftList[list[i]].id+'\');"':'onMouseOver="this.className=\'currentsubmenu2\'; ShowMenu(\'mt'+menuLeftList[list[i]].parentId+'\');HideAllSub();" onMouseOut="this.className=\'submenu2\';PreHide(\'mt'+menuLeftList[list[i]].parentId+'\');"';

		if (menuLeftList[list[i]].level==2) evn2='onMouseOver="this.className=\'currentsubmenu2\';Show=true;" onMouseOut="this.className=\'submenu2\';PreHide(\'mt'+menuLeftList[list[i]].parentId+'\');"';
		target=(menuLeftList[list[i]].inNewWindow=="true")?"target=_blank":"";
		str2+=(menuLeftList[list[i]].isFirst=="yes")?'':'<tr><td height=1><img src=img/dot_line2.gif width=161 height=1></td></tr>\n';
		str2+='<tr><td class=submenu2 '+evn2+'>\n';
		str2+=(menuLeftList[list[i]].children.length>0)?'<table border=0 cellspacing=0 cellpadding=0 background=img/1x1.gif><tr><td width=155><div class=sub><a class=menu3 '+target+' href="'+menuLeftList[list[i]].url+'">'+menuLeftList[list[i]].text+'</a></div></td><td width=6 valign=top><img src=img/sub.gif width=6 height=6></td></tr></table>':'<div class=sub><a class=menu3 '+target+' href="'+menuLeftList[list[i]].url+'">'+menuLeftList[list[i]].text+'</a></div>';
		str2+='</td><td valign=top>\n';
		if (menuLeftList[list[i]].children.length>0) str2+=renderLeftSub(menuLeftList[list[i]].children);
		str2+='</td></tr>\n';
	}
	str2+='<tr><td height=1 class=borderBot><img src=img/1x1.gif width=161 height=1></td></tr></table></div>\n\n';
	return str2;
}
