var tplMenuRoot=new Array();
var tplMenuChild=new Array();

tplMenuRoot.Top=function (arg)
{

    if(arg.length) var wd=Math.ceil(wwidth/(arg.length/3))-20;
	else var wd=100;
    var subId, evn, id, url, txt, isActive, subChr, alt;

	var str='';
    var crd=(isNN4)?'(event.pageX-15),(event.pageY-3)' : '0,"p.h"';
	var wwidth = (window.innerWidth)?window.innerWidth: ((document.all)?document.body.offsetWidth:null);

	if(arg.length) var wd=Math.ceil(wwidth/(arg.length/3))-20;
	else var wd=100;

	for(var i=0; i<arg.length; i++)
	{
		url=arg[i++];
		txt=arg[i++];
		id=arg[i][0];
		isPop=arg[i][1];
		isActive=(CurrPart==url);
		subId=subIdPref+id;

		evn=' onmouseover=overMen(0,0,'+id+','+crd+') onclick="return clickMen(this)" onmouseout=outMen('+id+')';
		str+='<td class=tbr>';
        str+='<div class=TopMenParent id='+subId+evn+'><a'+url+'>'+txt+'</a></div></td>';
	}

	return str;
}

tplMenuChild.Top=function (topId, emb, arg)
{
    var subId, evn, id, url, txt, isPop;
	var wd=170;

    var str='<div id="'+topIdPref+topId+'" class=popMenu onselectstart="return false" ondragstart="return false" style="Z-index:'+(seqItems--)+'" style="background-color : #6F83CF">';
	str+='<table border=0 cellspacing=1 cellpadding=0 width="'+wd+'">';

    var crd=(isNN4)?'(event.pageX+(169-event.layerX)),(event.pageY-4)' : '"p.w",-1';

	for(var i=0; i<arg.length; i++)
	{
		url=arg[i++];
		txt=arg[i++];
		id=arg[i][0];
		isPop=arg[i][1];

		subId=subIdPref+id;
		evn=' onmouseover=overMen('+topId+','+emb+','+id+','+crd+') onclick="return clickMen(this)" onmouseout=outMen('+id+')';

		str+='<tr><td'+evn+' id='+subId;
		if (isPop)
		{
			str+=' class=SubMenParent';
		}
		else
    		str+=' class=SubMen';
        
		str+='><a'+url+'>';
		str+=txt;
		str+='</a></td></tr>';
	}
	str+='</table>';
	str+='</div>';
	return str;
}

tplMenuRoot.Left=function (arg)
{
	var subId, evn, id, url, txt, subChr, alt, href;
	var str='<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#D2E3F7><tr>';
	var crd=(isNN4)?'(event.pageX+(169-event.layerX)),(event.pageY-4)' : '"p.w",-1';
	if(arg.length) var wd=Math.ceil(560/(arg.length/3))-20;
	else var wd=100;

	for(var i=0; i<arg.length; i++)
	{
		url=arg[i++];
		txt=arg[i++];
		id=arg[i][0];
		isPop=arg[i][1];
   		isActive=(CurrPart==url);
		subId=subIdPref+id;

   		evn=' onmouseover=overMen(0,0,'+id+','+crd+') onclick="return clickMen(this)" onmouseout=outMen('+id+')';
		str+='<td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td background="../data/img/1x1.gif" bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
		str+='<tr><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td>';
		str+='<td id='+subId+evn;
		str+=' width=100% class=rowMen1 valign=top>';
		str+='<table width=100% border=0 cellspacing=0 cellpadding=0><tr>';
		str+='<td><img src=../data/img/1x1.gif width=6 height=22></td>';
        str+='<td width=100% style="padding-left: 5"><a '+url+'>'+txt+'<br><img border=0 src=../data/img/1x1.gif width=1 height=3></a></td>';
		str+='</tr></table></td>';
		str+='<td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
		str+='<tr><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td background="../data/img/1x1.gif" bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
		str+='<tr><td bgcolor=#DBEBFB><img src=../data/img/1x1.gif width=1 height=3></td><td background="../data/img/1x1.gif" bgcolor=#DBEBFB><img src=../data/img/1x1.gif width=1 height=3></td><td bgcolor=#DBEBFB><img src=../data/img/1x1.gif width=1 height=3></td></tr>';		
	}

	str+='</table>';
	return str;

}

tplMenuChild.Left=function (topId, emb, arg)
{

	var subId, evn, id, url, txt, isPop;
	var wd=170;

	var str='<div id="'+topIdPref+topId+'" class=popMenu onselectstart="return false" ondragstart="return false"  style="Z-index:'+(seqItems++)+'" >';
	str+='<table border=0 cellspacing=0 cellpadding=0 bgcolor=#D2E3F7><tr><td>';
	str+='<table border=0 cellspacing=0 cellpadding=0 width="'+wd+'">';

	var crd=(isNN4)?'(event.pageX+(169-event.layerX)),(event.pageY-4)' : '"p.w",-1';
	//var lstRel=','+listTop.join(',')+',';

	for(var i=0; i<arg.length; i++)
	{
		url=arg[i++];
		txt=arg[i++];
		id=arg[i][0];
		isPop=arg[i][1];
		subId=subIdPref+id;
	        evn=' onmouseover=overMen('+topId+','+emb+','+id+','+crd+') onclick="return clickMen(this)" onmouseout=outMen('+id+')';

		str+='<tr><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td background="../data/img/1x1.gif" bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
		str+='<tr><td  bgcolor=#C8D7E5></td><td id='+subId+' class=rowMen2 '+evn+'>';
		str+='<table border=0 cellspacing=0 cellpadding=0 width=100%><tr>';
		str+='<td></td><td'+evn+' style="padding: 1 2 1 12">';

		str+='<a'+url+'>';
		str+=txt;
		str+='</a></td>';

		str+='<td align=right valign=center><img src=../data/img/1x1.gif width=1 height=22></td></tr></table></td><td  bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
     }
    str+='<tr><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td background="../data/img/1x1.gif" bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td><td bgcolor=#C8D7E5><img src=../data/img/1x1.gif width=1 height=1></td></tr>';
	str+='</table></td></tr></table></div>';
	return str;


}