/**
 * @author Timo 9.09.2005
 */ 
menu={
		A_ROOT:{
			_aParent:null,
			_iIndex:0,
			_iInput:0,
			_sCaption:'root',
			_sName:'root',
			_sValue:'root',
			_sClassName:'',
			_sFunction:'root'
		},
		A_ROOT:new Array() // ?? overrides
}//CONSTANTS //menu=new Tree_Handler();

/**
 * Node
* /
function Node(){
  this=new Array();//error
}
//Node.prototype=new Array();
//Node.prototype=new Object();//can't be a separate class any more
Node.prototype.toString=function(){
  return 
  this._sCaption+' =s_caption, '+
  this._sDemo+' =s_demo \n ';
}

/**
 * new Node
 */
menu.newNode=function(a_parent, s_caption, i_input, s_name, s_value, s_className, s_id, s_checked, s_function, s_event, s_href, s_demo){
	var i_length=a_parent.length;
	var a_node=new Array();
	//var a_node=new Node();
	a_node._iIndex=i_length;
	a_node._aParent=a_parent;
	a_parent[i_length]=a_node;
	menu.setNode(a_node, s_caption, i_input, s_name, s_value, s_className, s_id, s_checked, s_function, s_event, s_href, s_demo);
	return a_node;
}//newNode

/**
 * set Node
 */
menu.setNode=function(a_node, s_caption, i_input, s_name, s_value, s_className, s_id, s_checked, s_function, s_event, s_href, s_demo){
	a_node._sCaption=s_caption;
	a_node._iInput=i_input;
	a_node._sName=s_name;
	a_node._sValue=s_value;
	a_node._sClassName=s_className;
	a_node._sId=s_id;
	a_node._sChecked=s_checked;
	a_node._sFunction=s_function;
	a_node._sEvent=s_event;
	a_node._sHref=s_href;
	a_node._sDemo=s_demo;
}//setNode

/**
 * if the menu HTML elements have been created
 */
menu.isMissing=function(){
	return document.getElementById(page.id._sTreeId).innerHTML.toLowerCase().indexOf('<div')==-1;
}//isMissing

/**
 * Create the menu first time, when it's opened
 */
menu.initialize=function(){
	// if it's not done already
	if(menu.isMissing()==true){
		menu.html.setAbreviations();
		menu.html.setHtmlTags();
		var aMenuTree=menu.tree(null);
		if(aMenuTree==null){return;}
		var sHtml=new MenuBuilder().createGenerations(aMenuTree);
		document.getElementById(page.id._sTreeId).innerHTML=sHtml;
	}
}//main
