// global collection containing all menus on current page
var LA_MENUS = [];
var ItemCollection;
var LeftitemTop=0;
var i_top = 0;
// --------------------------------------------------------------------------------
// menu class
function Leftmenu (a_items, a_tpl) {
	
	// browser check
	if (!document.body || !document.body.style){
		return;
	}
	// store items structure
	this.Lefta_config = a_items;

	// store template structure
	this.a_tpl = a_tpl;

	// get menu id
	this.Leftn_id = LA_MENUS.length;

	// declare collections
	this.a_index = [];
	this.Lefta_children = [];

	// assigh methods and event handlers
	this.expand      = Leftmenu_expand;
	this.collapse    = Leftmenu_collapse;

	this.onclick     = Leftmenu_onclick;
	this.onmouseout  = Leftmenu_onmouseout;
	this.onmouseover = Leftmenu_onmouseover;
	this.onmousedown = Leftmenu_onmousedown;

	// default level scope description structure 
	this.a_tpl_def = {
		'block_top'  : 116,
		'block_left' : 16,
		'top'        : 20,
		'left'       : 4,
		'width'      : 120,
		'height'     : 40,
		'hide_delay' : 0,
		'expd_delay' : 0,
		'css'        : {
			'Linner' : '',
			'Louter' : ''
		}
	};
	
	// assign methods and properties required to imulate parent item
	this.getprop = function (s_key) {
		return this.a_tpl_def[s_key];
	};

	this.o_root = this;
	this.n_depth = -1;
	this.n_x = 0;
	this.n_y = 0;
	// 	init items recursively

	for (Leftn_order = 0; Leftn_order < a_items.length; Leftn_order++){
		new Leftmenu_item(this, Leftn_order);

	}

	// register self in global collection
	LA_MENUS[this.Leftn_id] = this;
	

	// make root level visible
	for (var Leftn_order = 0; Leftn_order < this.Lefta_children.length; Leftn_order++){
		this.Lefta_children[Leftn_order].e_oelement.style.visibility = 'visible';//Making the Root Level Element Visible
		
		var childCollection= this.Lefta_children[Leftn_order].Lefta_children;//Finding out the children each of the root level element
		if (childCollection != null)
		{

			var total_Height=0;
			for (var y = 0; y < childCollection.length; y++) {
				var o_curritemY, o_currLeftitemHeight;
					o_curritemY = childCollection[y];
					total_Height = total_Height + o_curritemY.e_oelement.style.height;
			}
			var o_item1 = childCollection[0];	
			var o_LeftitemTop = o_item1.e_oelement.style.top;
			o_LeftitemTop = o_LeftitemTop.substring(0,o_LeftitemTop.indexOf("px"));

			var o_item_Position=parseInt(o_LeftitemTop) + parseInt(total_Height);
			var diff = o_item_Position - (document.body.offsetHeight - 48) ;
			if( diff > 0)
			{		
				for (var x = 0; x < childCollection.length; x++) {
					var o_curritemX = childCollection[x];
					var o_currLeftitemTop = o_curritemX.e_oelement.style.top;
					o_currLeftitemTop = o_currLeftitemTop.substring(0,o_currLeftitemTop.indexOf("px"));
					o_curritemX.e_oelement.style.top = (parseInt(o_currLeftitemTop) - parseInt(diff)) + "px";			
				}
			}
		}
	}
}

// --------------------------------------------------------------------------------
function Leftmenu_collapse (Leftn_id) {
	// cancel item open delay
	clearTimeout(this.o_showtimer);

	// by default collapse to root level
	var n_tolevel = (Leftn_id ? this.a_index[Leftn_id].n_depth : 0);
	
	// hide all items over the level specified
	for (Leftn_id = 0; Leftn_id < this.a_index.length; Leftn_id++) {
		var o_curritem = this.a_index[Leftn_id];
		if (o_curritem.n_depth > n_tolevel && o_curritem.b_visible) {
			o_curritem.e_oelement.style.visibility = 'hidden';
			if(document.all["day_num"]){
				var day_numCtrl=document.all["day_num"];
				day_numCtrl.style.visibility = 'visible';
			}
			o_curritem.b_visible = false;
		}
	}

	// reset current item if mouse has gone out of items
	if (!Leftn_id)
		this.o_current = null;
}

// --------------------------------------------------------------------------------
function Leftmenu_expand (Leftn_id) {
	var scrollAmount=0;
	// expand only when mouse is over some menu item
	if (this.o_hidetimer)
		return;

	// lookup current item
	var o_item = this.a_index[Leftn_id];

	// close previously opened items
	if (this.o_current && this.o_current.n_depth >= o_item.n_depth)
		this.collapse(o_item.Leftn_id);
	this.o_current = o_item;

	// exit if there are no children to open
	if (!o_item.Lefta_children)
		return;

		var childCollection= o_item.Lefta_children;//Finding out the children each of the root level element

		var total_Height=0;
			for (var y = 0; y < childCollection.length; y++) {
					var o_curritemY, o_currLeftitemHeight;
					o_curritemY = childCollection[y];
					o_currLeftitemHeight = o_curritemY.e_oelement.style.height;
					o_currLeftitemHeight =o_currLeftitemHeight.substring(0,o_currLeftitemHeight.indexOf("px"));
					total_Height = total_Height + parseInt(o_currLeftitemHeight);
				}
		var o_item1 = childCollection[0];	
		var o_LeftitemTop = o_item.e_oelement.style.top;
		
		o_LeftitemTop = o_LeftitemTop.substring(0,o_LeftitemTop.indexOf("px"));

		var o_item_Position=parseInt(o_LeftitemTop) + parseInt(total_Height);
		var diff = o_item_Position - (document.body.offsetHeight - 48) ;
		if( diff >= 0)
		{	
			for (var x = 0; x < childCollection.length; x++) {
				var o_prevItem, o_prevItemHt, o_curritemX, o_currLeftitemTop, o_prevLeftitemTop;
				if( x!=0){
					o_prevItem = childCollection[x - 1];
					o_prevLeftitemTop = o_prevItem.e_oelement.style.top;
					o_prevLeftitemTop = o_prevLeftitemTop.substring(0,o_prevLeftitemTop.indexOf("px"));
					o_prevItemHt = o_prevItem.e_oelement.style.height;
					o_prevItemHt = o_prevItemHt.substring(0,o_prevItemHt.indexOf("px"));
					o_curritemX = childCollection[x];
					o_currLeftitemTop = (parseInt(o_prevLeftitemTop) + parseInt(o_prevItemHt)) + "px";;
					o_curritemX.e_oelement.style.top = o_currLeftitemTop;
				}
				else{					
					o_curritemX = childCollection[x];
					o_currLeftitemTop =o_item.e_oelement.style.top;
					o_currLeftitemTop = o_currLeftitemTop.substring(0,o_currLeftitemTop.indexOf("px"));
					
					if(document.body.scrollTop > 0){						
					var z = parseInt(o_currLeftitemTop) - parseInt(diff) + parseInt(document.body.scrollTop);
						if(z >= o_currLeftitemTop){
							o_curritemX.e_oelement.style.top = o_item.e_oelement.style.top;
						}
						else{
							o_curritemX.e_oelement.style.top = z +"px";
						}
					}
					else{
						o_curritemX.e_oelement.style.top = (parseInt(o_currLeftitemTop) - parseInt(diff) ) + "px";			
					}
				}				
			}
		}
		else
		{
			var tempTop = o_item.e_oelement.style.top;
			for (var x = 0; x < childCollection.length; x++) {
				var o_prevItem, o_prevLeftitemTop, o_curritemZ = childCollection[x];
				if( x!=0){
					o_prevItem = childCollection[x - 1];
					o_prevLeftitemTop = o_prevItem.e_oelement.style.top;
					o_prevLeftitemTop = o_prevLeftitemTop.substring(0,o_prevLeftitemTop.indexOf("px"));
					o_prevItemHt = o_prevItem.e_oelement.style.height;
					o_prevItemHt = o_prevItemHt.substring(0,o_prevItemHt.indexOf("px"));
					o_curritemZ = childCollection[x];
					o_currLeftitemTop = (parseInt(o_prevLeftitemTop) + parseInt(o_prevItemHt)) + "px";
					o_curritemZ.e_oelement.style.top = o_currLeftitemTop;	
				}
				else{
					o_curritemZ.e_oelement.style.top = tempTop;	
				}
			}
		}
	var txtLevel1Elm = o_item.e_oelement.innerHTML;
	var toBeHidden='No';
	if((txtLevel1Elm.indexOf("About Us")>0) || (txtLevel1Elm.indexOf("Offerings")>0) || (txtLevel1Elm.indexOf("Industry Solutions")>0) || (txtLevel1Elm.indexOf("Our Clients")>0) ){		
		toBeHidden = 'Yes';
	}
	else{
		toBeHidden = 'No';
	}

	// show direct child items
	for (var Leftn_order = 0; Leftn_order < o_item.Lefta_children.length; Leftn_order++) {
		var o_curritem = o_item.Lefta_children[Leftn_order];
		o_curritem.e_oelement.style.visibility = 'visible';
		if(document.all["day_num"]){
			if(toBeHidden == 'Yes'){
				var day_numCtrl=document.all["day_num"];
				day_numCtrl.style.visibility = 'hidden';
			}
			else{
				var day_numCtrl=document.all["day_num"];
				day_numCtrl.style.visibility = 'visible';
			}
		}
		o_curritem.b_visible = true;
	}
}

// --------------------------------------------------------------------------------
//
// --------------------------------------------------------------------------------
function Leftmenu_onclick (Leftn_id) {
	// don't go anywhere if item has no link defined
	return Boolean(this.a_index[Leftn_id].Lefta_config[1]);
}

// --------------------------------------------------------------------------------
function Leftmenu_onmouseout (Leftn_id) {

	// lookup new item's object	
	var o_item = this.a_index[Leftn_id];

	// apply rollout
	o_item.e_oelement.className = o_item.getstyle(0, 0);
	o_item.e_ielement.className = o_item.getstyle(1, 0);
	
	// update status line	
	o_item.upstatus(7);

	// run mouseover timer
	this.o_hidetimer = setTimeout('LA_MENUS['+ this.Leftn_id +'].collapse();',
		o_item.getprop('hide_delay'));
}

// --------------------------------------------------------------------------------
function Leftmenu_onmouseover (Leftn_id) {

	// cancel mouseoute menu close and item open delay
	clearTimeout(this.o_hidetimer);
	this.o_hidetimer = null;
	clearTimeout(this.o_showtimer);

	// lookup new item's object	
	var o_item = this.a_index[Leftn_id];

	// update status line	
	o_item.upstatus();
	// apply rollover
	o_item.e_oelement.className = o_item.getstyle(0, 1);
	o_item.e_ielement.className = o_item.getstyle(1, 1);
	
	// if onclick open is set then no more actions required
	if (o_item.getprop('expd_delay') < 0)
		return;

	// run expand timer
	this.o_showtimer = setTimeout('LA_MENUS['+ this.Leftn_id +'].expand(' + Leftn_id + ');',
		o_item.getprop('expd_delay'));

}

// --------------------------------------------------------------------------------
// called when mouse button is pressed on menu item
// --------------------------------------------------------------------------------
function Leftmenu_onmousedown (Leftn_id) {
	
	// lookup new item's object	
	var o_item = this.a_index[Leftn_id];

	// apply mouse down style
	o_item.e_oelement.className = o_item.getstyle(0, 2);
	o_item.e_ielement.className = o_item.getstyle(1, 2);

	this.expand(Leftn_id);
//	this.items[id].switch_style('onmousedown');
}


// --------------------------------------------------------------------------------
// menu item Class
function Leftmenu_item (o_parent, Leftn_order) {

	// store parameters passed to the constructor
	this.n_depth  = o_parent.n_depth + 1;
	this.Lefta_config = o_parent.Lefta_config[Leftn_order + (this.n_depth ? 3 : 0)];

	// return if required parameters are missing
	if (!this.Lefta_config) return;

	// store info from parent item
	this.o_root    = o_parent.o_root;
	this.o_parent  = o_parent;
	this.Leftn_order   = Leftn_order;

	// register in global and parent's collections
	this.Leftn_id = this.o_root.a_index.length;
	this.o_root.a_index[this.Leftn_id] = this;
	o_parent.Lefta_children[Leftn_order] = this;

	// calculate item's coordinates
	var o_root = this.o_root;
		a_tpl  = this.o_root.a_tpl;

	// assign methods
	this.getprop  = Leftmitem_getprop;
	this.getstyle = Leftmitem_getstyle;
	this.upstatus = Leftmitem_upstatus;

	this.n_x = Leftn_order
		? o_parent.Lefta_children[Leftn_order - 1].n_x + this.getprop('left')
		: o_parent.n_x + this.getprop('block_left');

	this.n_y = Leftn_order
		? o_parent.Lefta_children[Leftn_order - 1].n_y + this.getprop('top')
		: o_parent.n_y + this.getprop('block_top');
	// generate item's HMTL
//	alert(this.Lefta_config[0] + "\n"+ this.getstyle(0, 0) );
	if(this.getstyle(0, 0)=='lm0l1oout'){//If it is the level 1 item
		var itemHeight=0;
		
		if(this.Lefta_config[0].length >= 25){
			itemHeight = 14 * Math.ceil(this.Lefta_config[0].length/20) + 9;	
		}
		else{
		
			itemHeight = this.getprop('height') ;
		}
		if(this.Lefta_config[0]=='e-Learning' || this.Lefta_config[0]=='School Curriculum Support' ){
			var lefta_config_SubMenu = 'No' ;
			if(this.Lefta_config[2]=='SubMenu')
			{
				lefta_config_SubMenu = 'Yes';
			}
			if(lefta_config_SubMenu=='No'){			
				document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
					+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
					+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
					+ LeftitemTop + 'px; left: ' + this.n_x + 'px; width: '
					+ this.getprop('width') + 'px; height:'+ itemHeight + 'px; visibility: hidden;'
					+' z-index: ' + this.n_depth + ';" '
					+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
					+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
					+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
					+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
					+ this.Leftn_id + ');" target="_blank"><div  id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
					+ this.Lefta_config[0] + "</div></a>\n"
				);
			}else{
				document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
					+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
					+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
					+ LeftitemTop + 'px; left: ' + this.n_x + 'px; width: '
					+ this.getprop('width') + 'px; height:'+ itemHeight + 'px; visibility: hidden;'
					+' z-index: ' + this.n_depth + ';" '
					+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
					+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
					+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
					+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
					+ this.Leftn_id + ');" target="_blank"><div  id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
					+ this.Lefta_config[0] + "&nbsp;<b>></b></div></a>\n"
				);
			}
		}else{
			var lefta_config_SubMenu = 'No' ;
			if(this.Lefta_config[2]=='SubMenu')
			{
				lefta_config_SubMenu = 'Yes';
			}
			if(lefta_config_SubMenu=='No'){			
				document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
					+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
					+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
					+ LeftitemTop + 'px; left: ' + this.n_x + 'px; width: '
					+ this.getprop('width') + 'px; height:'+ itemHeight + 'px; visibility: hidden;'
					+' z-index: ' + this.n_depth + ';" '
					+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
					+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
					+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
					+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
					+ this.Leftn_id + ');"><div  id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
					+ this.Lefta_config[0] + "</div></a>\n"
				);
			}else{
				document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
					+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
					+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
					+ LeftitemTop + 'px; left: ' + this.n_x + 'px; width: '
					+ this.getprop('width') + 'px; height:'+ itemHeight + 'px; visibility: hidden;'
					+' z-index: ' + this.n_depth + ';" '
					+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
					+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
					+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
					+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
					+ this.Leftn_id + ');"><div  id="Le' + o_root.Leftn_id + '_'
					+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
					+ this.Lefta_config[0] + "&nbsp;<b>></b></div></a>\n"
				);
			}
		}
			if( this.Lefta_config[0].length >= 25){
				LeftitemTop = LeftitemTop + itemHeight +8 ;
			}		
			else
			{
				LeftitemTop = LeftitemTop + 24;
			}
}else {
	if(this.Lefta_config[0].length>=19)
	{
		var t=0;
		if(this.Lefta_config[0].length >= 19){
			t = 14 * Math.ceil(this.Lefta_config[0].length/20) + 8;	
		}
		else{
			t = this.getprop('height') ;
		}	
	}
//	alert(this.Lefta_config[0]+"\n"+i_top);
	if(i_top == 0){
		i_top=this.n_y;
	}

	if(this.Lefta_config[0]=='Locate a Center'){
		var lefta_config_SubMenu = 'No' ;
		if(this.Lefta_config[2]=='SubMenu')
		{
			lefta_config_SubMenu = 'Yes';
		}
		if(lefta_config_SubMenu=='No'){			
			document.write (
			'<a id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
				+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
				+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
				+ i_top + 'px; left: ' + this.n_x + 'px; width: '
				+ this.getprop('width') + 'px; height: '
				+ t + 'px; visibility: hidden;'
				+' z-index: ' + this.n_depth + ';" '
				+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
				+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
				+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
				+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
				+ this.Leftn_id + ');" target="_blank"><div  id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
				+ this.Lefta_config[0] + "</div></a>\n"
				);
		}else{
			document.write (
			'<a id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
				+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
				+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
				+ i_top + 'px; left: ' + this.n_x + 'px; width: '
				+ this.getprop('width') + 'px; height: '
				+ t + 'px; visibility: hidden;'
				+' z-index: ' + this.n_depth + ';" '
				+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
				+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
				+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
				+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
				+ this.Leftn_id + ');" target="_blank"><div  id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
				+ this.Lefta_config[0] + "&nbsp;<b>></b></div></a>\n"
				);
		}
	}else{
		var lefta_config_SubMenu = 'No' ;
		if(this.Lefta_config[2]=='SubMenu')
		{
			lefta_config_SubMenu = 'Yes';
		}
		if(lefta_config_SubMenu=='No'){			
				document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
				+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
				+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
				+ i_top + 'px; left: ' + this.n_x + 'px; width: '
				+ this.getprop('width') + 'px; height: '
				+ t + 'px; visibility: hidden;'
				+' z-index: ' + this.n_depth + ';" '
				+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
				+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
				+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
				+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
				+ this.Leftn_id + ');"><div  id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
				+ this.Lefta_config[0] + "</div></a>\n"
				);
		}else{
			document.write (
				'<a id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'o" class="' + this.getstyle(0, 0) + '" href="' + this.Lefta_config[1] + '"'
				+ (this.Lefta_config[2] && this.Lefta_config[2]['tw'] ? ' target="'
				+ this.Lefta_config[2]['tw'] + '"' : '') + ' style="position: absolute; top: '
				+ i_top + 'px; left: ' + this.n_x + 'px; width: '
				+ this.getprop('width') + 'px; height: '
				+ t + 'px; visibility: hidden;'
				+' z-index: ' + this.n_depth + ';" '
				+ 'onclick="return LA_MENUS[' + o_root.Leftn_id + '].onclick('
				+ this.Leftn_id + ');" onmouseout="LA_MENUS[' + o_root.Leftn_id + '].onmouseout('
				+ this.Leftn_id + ');" onmouseover="LA_MENUS[' + o_root.Leftn_id + '].onmouseover('
				+ this.Leftn_id + ');" onmousedown="LA_MENUS[' + o_root.Leftn_id + '].onmousedown('
				+ this.Leftn_id + ');"><div  id="Le' + o_root.Leftn_id + '_'
				+ this.Leftn_id +'i" class="' + this.getstyle(1, 0) + '">'
				+ this.Lefta_config[0] + "&nbsp;<b>></b></div></a>\n"
				);
		}
		}
		if(this.Lefta_config[0].length >= 19){
			i_top = i_top + t;
		}
		else{
			i_top =  i_top + this.getprop('height') + 2;
		}


}
	this.e_ielement = document.getElementById('Le' + o_root.Leftn_id + '_' + this.Leftn_id + 'i');
	
	this.e_oelement = document.getElementById('Le' + o_root.Leftn_id + '_' + this.Leftn_id + 'o');
	this.b_visible = !this.n_depth;
	if (this.Lefta_config.length < 4)
		return;

	// node specific methods and properties
	this.Lefta_children = [];

	// init downline recursively
	for (var Leftn_order = 0; Leftn_order < this.Lefta_config.length - 3; Leftn_order++){
		new Leftmenu_item(this, Leftn_order);
	}
}

// --------------------------------------------------------------------------------
// reads property from template file, inherits from parent level if not found
// ------------------------------------------------------------------------------------------
function Leftmitem_getprop (s_key) {

	// check if value is defined for current level
	var s_value = null,
		a_level = this.o_root.a_tpl[this.n_depth];

	// return value if explicitly defined
	if (a_level)
		s_value = a_level[s_key];

	// request recursively from parent levels if not defined
	return (s_value == null ? this.o_parent.getprop(s_key) : s_value);
}
// --------------------------------------------------------------------------------
// reads property from template file, inherits from parent level if not found
// ------------------------------------------------------------------------------------------
function Leftmitem_getstyle (n_pos, n_state) {

	var a_css = this.getprop('css');

	var a_oclass = a_css[n_pos ? 'Linner' : 'Louter'];

	// same class for all states	
	if (typeof(a_oclass) == 'string')
		return a_oclass;

	// inherit class from previous state if not explicitly defined
	for (var n_currst = n_state; n_currst >= 0; n_currst--)
		if (a_oclass[n_currst])
			return a_oclass[n_currst];
}

// ------------------------------------------------------------------------------------------
// updates status bar message of the browser
// ------------------------------------------------------------------------------------------
function Leftmitem_upstatus (b_clear) {
	window.setTimeout("window.status=unescape('" + (b_clear
		? ''
		: (this.Lefta_config[2] && this.Lefta_config[2]['sb']
			? escape(this.Lefta_config[2]['sb'])
			: escape(this.Lefta_config[0]) + (this.Lefta_config[1]
				? ' ('+ escape(this.Lefta_config[1]) + ')'
				: ''))) + "')", 10);
}

