/*
** FileName:	menu.js
** Author:		Jia Yu
** Date:		18-Nov-2006
** Ver:			2.5.13
** Path:		
*/


/*
<modificationlog>
	 <item>
		<date>09-13-2007</date>
		<author>Jia</author>
		<description>fix menu without menubar</description>
		<ver>2.5.13</ver>
	</item>

	 <item>
		<date>12-01-2007</date>
		<author>Jia</author>
		<description>show the menu proprely in safari</description>
		<ver>2.5.12</ver>
	</item>

	 <item>
		<date>12-01-2007</date>
		<author>Jia</author>
		<description>change the menu button mouseonover function no menu flashing</description>
		<ver>2.5.11</ver>
	</item>
	 <item>
		<date>12-01-2007</date>
		<author>Jia</author>
		<description>change the menu item mouseonover function </description>
		<ver>2.5.10</ver>
	</item>
	
	 <item>
		<date>12-01-2007</date>
		<author>Jia</author>
		<description>change the getTop and getLeft function with while </description>
		<ver>2.5.9</ver>
	</item>
	 <item>
		<date>29-Nov-2006</date>
		<author>Jia</author>
		<description>fix the setOpacity for Menu class with IE. Test the attribute befor set the value.</description>
		<ver>2.5.8</ver>
	</item>
<modificationlog>

*/

var MENU_TIMOUT = 1000;


//class menu bar
function MenuBar( parent, ori )
{
	var _this = this;
	var timerID = 0;
	var orientation = ori || "h";
	var lastShowingButton = null;
	var zIndex = 5;
	
	
	//-- public prop
	this.isShow = true;
	this.parent = parent;
	this.thebody = document.createElement("TABLE");
	this.buttons = new Array();
	
	//- ini
	if( typeof parent == "string" )this.parent = document.getElementById( parent );
	this.parent.appendChild( this.thebody );
	
	this.thebody.name = "menubar";
	this.thebody.className  ="menubar";
	this.thebody.cellPadding  = 0;
	this.thebody.cellSpacing = 0;

	
	//Methods
	this.hideSub = function(){};

	this.hide = function()
	{
		this.setLastShowingButton();
	};
	
	this.setLastShowingButton = function ( button )
	{
		if( lastShowingButton != null )
		{
			if(   lastShowingButton != button )
			{
				lastShowingButton.thebody.className = "buttonOut";
				
				if(  lastShowingButton.submenu !=  null  ) 
				{
					lastShowingButton.submenu.hide();
				}
			}
		}
		lastShowingButton = button;
	};
	
	
	this.add = function( theMenu )
	{
 		var button = new MenuButton( _this , theMenu.disName, null , theMenu, orientation );
		_this.buttons[_this.buttons.length] = button;
		
		return button;
	};
	
	this.addButton = function( str, fun  )
	{
		var button = new MenuButton( _this , str , fun , null, orientation );
		_this.buttons[_this.buttons.length] = button;
		return button;
	};
	
	
	this.getTimerID = function()
	{
		return _this.timerID;
	};
	
	this.setTimerID = function( num )
	{
		_this.timerID = num;
	};
	
	this.getzIndex = function()
	{
		return zIndex;
	};
	
}
//end class menu bar

//class menu button
function MenuButton( parent , html, mouseclick ,sub_menu, orientation )
{
	//ini
	var _this = this;
	var theRow = "";
	
	//public prop
	this.parent = parent;
	this.on_Click = mouseclick || new Function();
	this.submenu = sub_menu || null;
	this.orientation = orientation || "h";
	this.isDisabled = false;
	this.isVisible = true;
	
	
	if( this.submenu != null )
	{
		this.submenu.parent = this.parent;
	}
	
	if( this.orientation == "v" ) 
	{
		theRow = this.parent.thebody.insertRow(-1);
		this.thebody = theRow.insertCell(-1);
//  	var arrow = theRow.insertCell( -1 );
//		arrow.className = "buttonOut";
//		arrow.align = "right";
//		arrow.innerHTML = "&raquo;"; 
	}
	else
	{
		if( this.parent.thebody.rows.length == 0 ) 
		{
			theRow = this.parent.thebody.insertRow(-1);
		}
		else
		{
			theRow = this.parent.thebody.rows[0];
		}
		
		this.thebody = theRow.insertCell(-1);
	}
	
		this.thebody.innerHTML = html;
		this.thebody.className = "buttonOut";
		this.thebody.id = "menuButton";

	//Events
	this.thebody.onclick = function(event)
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible  )
		{
			if( _this.submenu != null )
			{
				//_this.submenu.show();
			}
			else
			{
				if( typeof _this.on_Click == "function"  )
				{	
					_this.on_Click();
				}
				else if( typeof _this.on_Click == "string" )
				{
					eval( _this.on_Click );	
				}
			}
		}
		event.cancelBubble = true;
	};
	
	this.thebody.onmouseover = function( event )
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible )
		{
			//_this.parent.hide();
			_this.parent.setLastShowingButton( _this );
			
			_this.thebody.className = "buttonOver";
			window.clearTimeout( _this.parent.getTimerID() );

			var top ,left;
			
			if ( _this.orientation == "v" )
			{
				top = getTop( _this.thebody );
				left = getLeft( _this.thebody ) + _this.parent.thebody.offsetWidth -3;
			}
			else
			{
				top = getTop( _this.thebody ) + _this.thebody.offsetHeight;
				left = getLeft( _this.thebody );
			}
			
			//if( typeof _this.parent.hideSub == "function" ){  _this.parent.hideSub(); }

			if( _this.submenu != null )
			{ 
				if(  _this.submenu.isShow == false )
				{
					_this.submenu.show( top , left )
				}
			};
			
		}
		event.cancelBubble = true;
	};
	
	this.thebody.onmouseout = function( event )
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible)
		{
			if( _this.submenu == null )
			{
				_this.thebody.className = "buttonOut";
			}
			else
			{
				_this.parent.setTimerID( setTimeout( _this.submenu.hideAll , MENU_TIMOUT ));
			}
		}
		event.cancelBubble = true;
	};
	
	
	// Methods
	this.setDisabled = function( b )
	{
		_this.isDisabled = b;
 		_this.thebody.disabled = b;
	};//end disabled
	
	this.setVisible = function( b )
	{
		if(b){
			_this.thebody.style.display = "";
		}
		else{
			_this.thebody.style.display = "none";
		}
		_this.isVisible = b;
	};//end visible
	
	/*
	this.hideSubmenu = function()
	{
		if( _this.submenu != null )
		{
			_this.submenu.hide();
		}
	};
	*/
}



//class menu
function Menu( disName )
{
	var _this = this;
	var iframeEl = document.createElement("IFRAME");
	var shadow = document.createElement("div");
	
	//public prop
	this.parent = null;
	this.disName = disName;
	this.items = new Array();
	this.lastOverItem = null;
	this.isShow = false;
	this.thebody = document.createElement("TABLE");
	
	//ini
	document.body.appendChild( shadow );
	shadow.style.visibility="hidden";
	shadow.style.position="absolute";
	shadow.className = "shadow";
	//shadow.border = 0;
	//shadow.src = "../menu/shadow.png";
	
	var timerid = 0;
	
	//this.parent.appendChild( this.thebody );
	document.body.appendChild( this.thebody );
	this.thebody.appendChild( document.createElement("tBody"));
	this.thebody.style.left = "0px";
	this.thebody.style.top = "0px";
	this.thebody.style.position = "absolute";
	this.thebody.style.visibility = "hidden";
	this.thebody.className = "menu";
	this.thebody.name ="menu";
	//this.thebody.unselectable = "on";
	this.thebody.cellPadding  = 0;
	this.thebody.cellSpacing = 0;

	iframeEl.frameBorder = 0;
	iframeEl.style.width  = "0px";
	iframeEl.style.height = "0px";
	iframeEl.src = "javascript:;";
	iframeEl.style.display = "none";
	iframeEl.style.position = "absolute";
	iframeEl.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
	iframeEl = this.thebody.parentNode.insertBefore(iframeEl, this.thebody);	
	
	//Methods

	//0-100
	this.setOpacity = function( value )
	{
		if( document.all ){
			if( _this.thebody.filters.alpha ) _this.thebody.filters.alpha.opacity = value;
		}
		else{
			value = value * 0.01;
			_this.thebody.style.opacity = value;
		}	
	};
	
	this.setMinwidth = function( intNum )
	{
		_this.minWidth = intNum;
		_this.thebody.style.minWidth = intNum +"px";
	};

	this.hide = function()
	{
		if( _this.isShow )
		{
			_this.hideSub();
			_this.isShow = false;
			//_this.thebody.style.display = "none";
			shadow.style.visibility = "hidden";
			_this.thebody.style.visibility="hidden";
			iframeEl.style.dispaly = "none";
			if( _this.lastOverItem != null ) _this.lastOverItem.itemOut();
		}
	};

	//Hide all supermenus
	this.hideSup = function()
	{
		var obj = _this;
		
		if( obj.parent )
		{
			while( typeof obj.parent.thebody != "undefined" )
			{
				if( typeof obj.parent.hide == "function"  )
				{
					if( obj.parent.isShow ) obj.parent.hide();
				}
				obj = obj.parent;
			}
		}
		
	};
	
	
	this.hideSub = function()
	{
		for( i=0;i<_this.items.length;i++ )
		{
			if(  _this.items[i].submenu != null  )  _this.items[i].submenu.hide();
		}
	};
	
	
	this.hideAll = function()
	{
		_this.hideSub();
		_this.hide();
		_this.hideSup();
	};
	
	this.add = function( mItem )
	{
		_this.items[ _this.items.length ] = mItem;
		
		if( _this.thebody.offsetWidth < _this.minWidth ) 
		{
			_this.thebody.style.width = _this.minWidth+"px";
		}
	};
	
	this.addItem = function( html, mouseclick ,sub_menu, iconHTML )
	{
		var mItem = new MenuItem( _this , html, mouseclick ,sub_menu, iconHTML );
		
		_this.items[ _this.items.length ] = mItem;
		
		if( _this.thebody.offsetWidth < _this.minWidth ) 
		{
			_this.thebody.style.width = _this.minWidth+"px";
		}
		return mItem;
	};
	
	this.addSubMenu = function( submenu, iconHTML )
	{
		return _this.addItem( submenu.disName, null, submenu, iconHTML );
	};
	
	this.addSeparatebar = function()
	{
		_this.items[ _this.items.length ] =  new Separatebar( _this );
	};
	
	this.showpop = function( obj ,offsetX, offsetY )
	{
		var offsetX = offsetX || 0;
		var offsetY = offsetY || 0;
		
		_this.show( getTop( obj ) + obj.offsetHeight +offsetY , getLeft( obj ) +offsetX );
	};
	
	this.show = function( top, left )
	{
		var thetop = top;
		var theleft = left;
		var maxW = document.documentElement.clientWidth;
		var maxH = document.documentElement.clientHeight;
		
		var thisW = _this.thebody.offsetWidth;
		var thisH = _this.thebody.offsetHeight;
		
		if( theleft + thisW > maxW )
		{
			if( _this.parent.thebody.name == "menu" )
			{
				if( _this.parent != null )
				{
					theleft = _this.parent.thebody.offsetLeft - thisW +3;
				}
				else
				{
					theleft = maxW - thisW; 
				}
			}
			else 
			{
				theleft = maxW - thisW - 3; 
			}
		}
		
		if( thetop + thisH > ( maxH - 2 ))
		{
			thetop = maxH - thisH - 4; 
			if( _this.parent == null ) theleft += 30;
		}
		
		if( theleft < 0 ) theleft = 0;
		
		_this.thebody.style.top = thetop+"px";
		_this.thebody.style.left = theleft+"px";
		
		if( _this.parent )
		{
			_this.thebody.style.zIndex = _this.parent.getzIndex() + 2;
		}
		else
		{
			_this.thebody.style.zIndex = 0;
		}
		_this.thebody.style.visibility = "visible";
		
		
		if ( iframeEl != null )
		{
		  iframeEl.style.left = theleft+"px";
		  iframeEl.style.top  = thetop+"px";
		  iframeEl.style.display = "";
		}
		
		//shadow
		if ( shadow != null)
		{
			shadow.style.width = _this.thebody.offsetWidth  + "px";
			shadow.style.height = _this.thebody.offsetHeight + "px";
			shadow.style.top = ( thetop + 2 )+"px";
			shadow.style.left = ( theleft + 2 )+"px";
			
			shadow.style.visibility = "visible";
			
			if( _this.parent )
			{
				shadow.style.zIndex = _this.parent.getzIndex() + 1;
			}
			else
			{
				shadow.style.zIndex = 0;
			}
		}
		_this.isShow = true;
	};
	
	this.getTimerID = function()
	{
		if( _this.parent != null )
		{
			return _this.parent.getTimerID();
		}
		else
		{
			return timerid;
		}
	};
	
	this.setTimerID = function( num )
	{
		if( _this.parent != null )
		{
			return _this.parent.setTimerID( num );
		}
		else
		{
			timerid = num;
		}
	};
	
	this.getzIndex = function()
	{
		return this.thebody.style.zIndex;
	};
	
//event
	this.thebody.onmouseover =  function( event )
	{
		if( document.all ) event = window.event;

		window.clearTimeout( _this.getTimerID() );
		event.cancelBubble = true;
	};
	
	this.thebody.onmouseout = function( event )
	{

		if( _this.lastOverItem != null ) 
		{
			if(  _this.lastOverItem.submenu == null )
			{
				_this.lastOverItem.itemOut();
			}
		}
		_this.setTimerID( setTimeout( _this.hideAll , MENU_TIMOUT ) ); 
		if( document.all ) event = window.event;

		event.cancelBubble = true;
	};
}


//class menu item
function MenuItem( parent , html, mouseclick ,submenu, iconHTML )
{
	//ini
	var _this = this;
	this.parent = parent;
	
	this.on_Click = mouseclick || new Function();
	this.submenu = submenu || null;
	if( this.submenu != null ) 
	{
		this.submenu.parent = this.parent;
	}
	
	this.thebody = document.createElement("TR");
	this.parent.thebody.tBodies[0].appendChild( this.thebody );
	
	//this.parent.tBodies[0].appendChild( this.thebody );
	this.thebody.unselectable ="on";
	this.thebody.className = "itemOut";
	this.thebody.id = "menuItem";
	this.isDisabled = false;
	this.isVisible = true;
	// Methods
	this.setDisabled = disabled;
	this.setVisible = visible;
	
	//Events
	this.thebody.onclick = onClick;
	this.thebody.onmouseover = onOver;
	this.thebody.onmouseout = onOut;
	

	var theIcon = this.thebody.insertCell( -1 );
	theIcon.className = "icon";
	
	
	
	if( typeof iconHTML == "string" || iconHTML == "" )
	{
		theIcon.innerHTML = iconHTML;
	}
	else if( typeof iconHTML == "object" )
	{
		theIcon.appendChild( iconHTML );
	}

	var theCell = this.thebody.insertCell( -1 );
	//theCell.unselectable ="on";
	theCell.className = "menucell";
	theCell.id = "menucell";
	theCell.innerHTML = html;
	

	var arrow = this.thebody.insertCell( -1 );
	arrow.className = "menuArrow";
	//arrow.unselectable ="on";
	
	if( this.submenu != null )
	{
		arrow.align = "right";
		arrow.innerHTML = "&raquo;"; //&raquo; &raquo;
		this.submenu.parent = this.parent;
	}

	function onClick( event )
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible  )
		{
			if( _this.submenu != null )
			{
				
			}
			else
			{
				_this.parent.hideAll();
				if( typeof _this.on_Click == "function"  )
				{	
					_this.on_Click();
				}
				else if( typeof _this.on_Click == "string" )
				{
					eval( _this.on_Click );	
				}
			}
		}
		//event.cancelBubble = true;
	}
	
	function onOver( event )
	{
		if( document.all ) event = window.event;
		

			if(  _this.parent.lastOverItem != null && _this.parent.lastOverItem != _this ) _this.parent.lastOverItem.itemOut();
			
			_this.parent.lastOverItem = _this;
			
			if( !_this.isDisabled && _this.isVisible  )
			{
				_this.thebody.className = "itemOver";
				theCell.className = "menucellOver";
				arrow.style.color = "#333333";
				//if( typeof _this.parent.hideSub == "function" )  _this.parent.hideSub();
				if( _this.submenu != null )
				{
					if( _this.submenu.isShow == false )
					{
						var top = getTop ( theCell ) +1;
						var left = getLeft ( _this.thebody ) + _this.parent.thebody.offsetWidth -3;			
						_this.submenu.show( top , left );
					}
				}
			}
		//event.cancelBubble = true;
	}
	
	this.itemOut = function()
	{
		_this.thebody.className = "itemOut";
		theCell.className = "menucell";
		arrow.style.color = "";
		if( _this.submenu != null  )
		{
			if( _this.submenu.isShow )	
			{
				_this.submenu.hide();
			}
		}
	};
	
	
	function onOut( event )
	{
		if( document.all) event = window.event;
		if( !_this.isDisabled && _this.isVisible )
		{
			//if( _this.submenu == null )
//			{
//				_this.itemOut();
//			}
//			else
//			{
//				
//				
//			}
		}
		//event.cancelBubble = true;
	}
	
	
	function disabled(b)
	{
		_this.isDisabled = b;
 		_this.thebody.disabled = b;
	}//end disabled
	
	function visible(b){
		if(b){
			_this.thebody.style.display = "";
		}
		else{
			_this.thebody.style.display = "none";
		}
		_this.isVisible = b;
	}//end visible
	
}



//class separatebar
function Separatebar( parent )
{
//ini the class====================================================
	var _this = this;
	
	this.parent = parent;
	this.isVisible = true;
	
	this.thebody = document.createElement("TR");
	this.parent.thebody.tBodies[0].appendChild( this.thebody );
		this.thebody.unselectable ="on";
//		this.thebody.className = "separatebar";
		this.thebody.name = "separatebar";		
		this.thebody.insertCell(-1);
		var cell = this.thebody.insertCell(-1);
		cell.className = "separatebar";
		this.thebody.insertCell(-1);
	
	// Methods
	
/*=================================================================
** set the visibility 
**
*/
	this.setVisible = function(b){
		if(b){
			_this.thebody.style.display = "";
		}
		else{
			_this.thebody.style.display = "none";
		}
		_this.isVisible = b;
	}


}//end class separatebar


//class Color Pad
function ColorPad( parent , mouseclick )
{
	//ini
	var _this = this;
	

	this.isDisabled = false;
	this.isVisible = true;
	this.parent = parent;
	this.on_Click = mouseclick || new Function();
	this.thebody = this.parent.thebody.tBodies[0];
	//this.parent.thebody.tBodies[0].appendChild( this.thebody );
	this.parent.setOpacity(100);
	
	var therow = this.parent.thebody.insertRow( -1 );
	var icon = therow.insertCell( -1 );
	icon.className = "icon";
	
	var theCell = therow.insertCell( -1 );
	var arrow = therow.insertCell( -1 );
	
	arrow.className = "menuArrow";
	
	var theTable = document.createElement("TABLE");
	theCell.appendChild( theTable );
	theTable.style.width = "145px";
	theTable.cellPadding = 0;
	theTable.cellSpacing = 0;
	theTable.style.padding = "2px";
	
	
	for(var k=0;k<3;k++ )
	{
		for(var i=0;i<6;i++)
		{
		var row = theTable.insertRow( -1 );
			
			for( var j=0;j<12;j++ )	
			{
				var cell = row.insertCell( -1 );
				cell.onmouseover = onOver;
				cell.onmouseout = onOut;
				cell.onclick = onClick;
				cell.className = "colorCell";
				if( j < 6 )
				{
					cell.style.backgroundColor = "#"+twoDigs(tohex(k*51))+twoDigs(tohex(i*51))+twoDigs(tohex(j*51));
				}
				else
				{
					cell.style.backgroundColor = "#"+twoDigs(tohex((k+3)*51))+twoDigs(tohex(i*51))+twoDigs(tohex((j-6)*51));
				}
				
				cell.title = cell.style.backgroundColor;
			}
		}
	}
	lastRow = theTable.insertRow( -1 );
	
	for(var i=0;i<12;i++)
	{
		var cell = lastRow.insertCell( -1 );
		cell.onmouseover = onOver;
		cell.onmouseout = onOut;
		cell.onclick = onClick;
		cell.className = "colorCell";		
		cell.style.backgroundColor = "#"+twoDigs(tohex(i*21.25))+twoDigs(tohex(i*21.25))+twoDigs(tohex(i*21.25));
		cell.title = cell.style.backgroundColor;
	}


	// Methods
	//this.hideSubmenu = hide_sub_menu;
	this.setDisabled = disabled;
	this.setVisible = visible;
	
	//Events
	//this.thebody.onclick = onClick;
	//this.thebody.onmouseover = onOver;
	//this.thebody.onmouseout = onOut;

	function onClick( event )
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible )
		{
			_this.on_Click();
			alert( this.style.backgroundColor );
			_this.parent.hideAll();
		}
		//event.cancelBubble = true;
	}
	
	function onOver( event )
	{
		if( document.all) event = window.event;
		
		if( !_this.isDisabled && _this.isVisible )
		{
			this.className = "colorCellOver";
			//alert( this.style.backgroundColor );
			//this.style.borderColor="#000000";
		}
		//event.cancelBubble = true;
	}
	
	function onOut( event )
	{
		if( document.all) event = window.event;
		if( !_this.isDisabled && _this.isVisible )
		{
//			_this.thebody.className = "colorCell";
			this.className = "colorCell";
			//this.style.borderColor="#DDDDDD";
		}
		//event.cancelBubble = true;
	}
	
	function disabled(b)
	{
		_this.isDisabled = b;
 		_this.thebody.disabled = b;
	}//end disabled
	
	function visible(b){
		if(b){
			_this.thebody.style.display = "";
		}
		else{
			_this.thebody.style.display = "none";
		}
		_this.isVisible = b;
	}//end visible

}


//public function contains
//A contains B
function contains(a , b)
{
	while(b) 
	{
		if (a == b) return true;
		b = b.parentNode;
	}
	return false;
}

function getLeft( obj ) 
{
	var x = 0;
	// Return the x coordinate of an element relative to the page.	
	while (obj.offsetParent)
	{
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	
	return x;
}

function getTop( obj ) 
{
	// Return the y coordinate of an element relative to the page.
	var y =  0;
	
	while (obj.offsetParent)
	{
		//document.getElementById( "t" ).innerHTML += obj.offsetTop+"-";
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return y;
}


function twoDigs( num )
{
	num = num+"";
	if( num.length <=1 ) num = "0"+num;
	if( num.length >2 ) num = num.substring( 0,2 );
	return num;
}


function tohex( num )
{
	return Number( num ).toString(16); 
}
function todec( num )
{
	return  parseInt( num ,16);
}





function Bulid_Menu( menudata , orientation  )
{
	var _this = this;
	var orientation = orientation || "h";
	
	if( typeof menudata == "object" ) this.menudata = menudata;
	else if( typeof menudata == "string" )this.menudata = document.getElementById( menudata );

	this.parentNode = this.menudata.parentNode;
	this.menudata.style.display = "none";
	

	var menubar = new MenuBar( this.parentNode , orientation );
	//setOpacity( menubar.thebody , 0 );
	
	var add = function( parent, submenu )
	{
		var text = submenu.getElementsByTagName("A")[0].innerHTML;
		
		var subs = submenu.getElementsByTagName("UL");
		
		if( subs.length > 0 )
		{
			var m = new Menu( text );
	
	
			for(var i=0; i< subs[0].childNodes.length; i++ )
			{
				
				if( subs[0].childNodes[i].tagName == "LI" )
				{
					add( m, subs[0].childNodes[i] );
				}
				 
			}
			
			if( parent == menubar )
			{	
				menubar.add( m );
			}
			else
			{
				parent.addSubMenu( m  );	
			}
		}
		else
		{
			if( parent == menubar )
			{
				menubar.addButton( text, function(){  
					
					window.location = submenu.getElementsByTagName("A")[0].href;
					
				 } );
			}
			else
			{
				parent.addItem( text , "window.location='"+submenu.getElementsByTagName("A")[0].href+"';" , null   );
			}
		}
		
	}
	
	var menus = this.menudata.getElementsByTagName("UL");
	
	for(var i=0; i< menus[0].childNodes.length;i++  )
	{
		if( menus[0].childNodes[i].tagName == "LI" )
		{
			add( menubar,menus[0].childNodes[i] );
		}
	}
	
	
//ini
/*

	var showing = new transform( 
	function( intv ){
		
		setOpacity( menubar.thebody , intv );
					
	} , 
	function(){
	setOpacity( menubar.thebody , 100 );

} , 10,  150 );
showing.run();

	
	
	*/
	
	
}


