// set up drop downs anywhere in the body of the page. I think the bottom of the page is better.. 
	// but you can experiment with effect on loadtime.
	if (TransMenu.isSupported()) {

		//==================================================================================================
		// create a set of dropdowns
		//==================================================================================================
		// the first param should always be down, as it is here
		//
		// The second and third param are the top and left offset positions of the menus from their actuators
		// respectively. To make a menu appear a little to the left and bottom of an actuator, you could use
		// something like -5, 5
		//
		// The last parameter can be .topLeft, .bottomLeft, .topRight, or .bottomRight to inidicate the corner
		// of the actuator from which to measure the offset positions above. Here we are saying we want the 
		// menu to appear directly below the bottom left corner of the actuator
		//==================================================================================================
		var ms = new TransMenuSet(TransMenu.direction.down, 1, 0, TransMenu.reference.bottomLeft);

		//==================================================================================================
		// create a dropdown menu
		//==================================================================================================
		// the first parameter should be the HTML element which will act actuator for the menu
		//==================================================================================================
		
		var mind = 1;
		var elem = document.getElementById("menu"+mind);
		
		while(elem)
		{
			var m = ms.addMenu(elem);
			addchildrenmenu(m, "m"+mind);
			++mind;
			elem = document.getElementById("menu" + mind);
		}
		
		//==================================================================================================
		// write drop downs into page
		//==================================================================================================
		// this method writes all the HTML for the menus into the page with document.write(). It must be
		// called within the body of the HTML page.
		//==================================================================================================
		TransMenu.renderAll();
	}
	
	function haschildren(ind)
	{
		return document.getElementById(ind + "x1") != null;
	}
	
	function addchildrenmenu(menu, mind)
	{
		var cind = 1;
		var celem = document.getElementById(mind+"x"+cind);
		
		while(celem)
		{
				if(document.getElementById(celem.name + "l")) menu.addItem(celem.value, document.getElementById(celem.name + "l").value);
				else menu.addItem(celem.value, document.getElementById(celem.name + "t").value);
				if(haschildren(mind + "x" + cind))
				{
					var submenu = menu.addMenu(menu.items[cind-1]);
					addgrandchildrenmenu(submenu, mind+"x"+cind);
				}
				++cind;
				celem = document.getElementById(mind+"x"+cind);
		}
	}
	
	function addgrandchildrenmenu(menu, mind)
	{
		var cind = 1;
		var celem = document.getElementById(mind+"x"+cind);
		
		while(celem)
		{
				menu.addItem(celem.value, "http://google.pl/");
				++cind;
				celem = document.getElementById(mind+"x"+cind);
		}
	}
	