function isIE()
{
  return (navigator.appName=="Microsoft Internet Explorer")?true:false;
}

function eHandler(evnt, handl)
{
  (isIE())?this.setAttribute(evnt, handl):this.addEventListener(evnt.substring(2,evnt.length), handl, false);
		//this.setAttribute used due to "attachEvent" doesn´t work with multiple reference 
		//(here and in the handler function) of "this" statement
}

function genMenu(mStyle,							 //className...
				 				 mDirection)					 //0-vertical, 1-horizontal
{
  var tTbl=document.createElement("table");
      tTbd=document.createElement("tbody");
						
			(mStyle!="")?tTbl.className=mStyle:null;
			
			document.body.appendChild(tTbl);
			tTbl.appendChild(tTbd);
						
			if (mDirection==0)
			{
			  tTbd.addMenuItem=addMenuItem;
			  return tTbd;
			}
      else
			{
			  tTr=document.createElement("tr");
			  tTr.addMenuItem=addMenuItem;
				tTbd.appendChild(tTr);			
  			return tTr;
			}
}

function addMenuItem(mCaption,					 //Visible text  
				 						 mReference,				 //<a href...>  
										 mTarget,						 //<a target...> 		 
										 mStNorm,						 //TD className inactive
										 mStAct)						 //TD className active (mouseover)
{
 	var tTr;
	    tTd=document.createElement("td");
			tAnch=document.createElement("a");
			
			tTd.appendChild(tAnch);
			if(this.tagName=="TBODY")
				{		  
		  				tTr=document.createElement("tr");
							this.appendChild(tTr);
				}
		  else
	  		{
		  	 			tTr=this;
				}
			tTr.appendChild(tTd);
	
	    tAnch.innerHTML=mCaption;
			tAnch.setAttribute("href", mReference);
			tAnch.setAttribute("target", mTarget);
			tTd.className=mStNorm;
			
			tTd.eHandler=eHandler;
			tTd.eHandler("onmouseover",function(){this.className=mStAct;});
		  tTd.eHandler("onmouseout",function(){this.className=mStNorm;});
}