// Title: Tigra Menu PRO
// Description: Tigra Menu PRO is flexible menu solution for commercial
//	applications offering high reliability and wide browsers support.
//	See URL for complete feature list.
// URL: http://www.softcomplex.com/products/tigra_menu_pro/
// Version: 3.0d
// Date: 03-12-2002 (mm-dd-yyyy)
// Notes: Registration needed to use this script legally.
//	Visit official site for details.

var A,A_MENUS=[];C=['mout','mover','mdown'];
function D()
{
	this.inner_width=window.innerWidth!=null?
	function()
	{
		return window.innerWidth
	}:
	function()
	{
		return document.body.clientWidth
	};

	this.inner_height=window.innerHeight!=null?
	function()
	{
		return window.innerHeight
	}:
	function()
	{
		return document.body.clientHeight
	};
	
	this.page_x_offset=window.pageXOffset!=null?
	function()
	{
		return window.pageXOffset
	}:
	function()
	{
		return document.body.scrollLeft
	};
	
	this.page_y_offset=window.pageYOffset!=null?
	function()
	{
		return window.pageYOffset
	}:
	function()
	{
		return document.body.scrollTop
	};
	this.J=document.all?
	function(i)
	{
		return document.all[i]
	}:
	function(i)
	{
		return document.getElementById(i)
	};
	this.K=L;
	this.show_menu=N;
//	for(var i=0;i<O.length;i++)
//		document.write(String.fromCharCode(O.charCodeAt(i)-1))
}

function L()
{
	var p_temp,Q;
	if(this.width!=(p_temp=this.inner_width()))
	{
		this.width=p_temp;
		Q=true
	}
	if(this.height!=(p_temp=this.inner_height()))
	{
		this.height=p_temp;
		Q=true
	}
	if(this.page_offset_x!=(p_temp=this.page_x_offset()))
	{
		this.page_offset_x=p_temp;
		Q=true
	}
	if(this.page_offset_y!=(p_temp=this.page_y_offset()))
	{
		this.page_offset_y=p_temp;
		Q=true
	}
	if(Q)
	{
		if(this.T)
			clearTimeout(this.T);
			this.T=setTimeout('A.show_menu()',200)
	}
	window.setTimeout('A.K()',50)
}

function N()
{
	for(var i=0;i<A_MENUS.length;i++)
		if(A_MENUS[i].U)
			A_MENUS[i].show_menu()
}

function menu(a_items,align_behaviour)
{

	this.menu_items_structured=a_items;
	this.align_behaviour=align_behaviour;
	this.menu_items_array=[];
	this.children=[];
	this.menu_position=[];
	this.mouse_over_level=0;
	this.collapse=collapse;
	this.onclick=menu_onclick;
	this.onmouseout=menu_onmouseout;
	this.onmouseover=menu_onmouseover;
	this.onmousedown=menu_onmousedown;
	this.o=p;
	this.show_menu=display_menu;
	if(!A)
	{
		A=new D();
		A.K()
	}
	this.id=A_MENUS.length;
	A_MENUS[this.id]=this;
	for(var i=0;i<this.menu_items_structured.length;i++)
		new add_menu_item(i,this,this);
	var s=0,t=0,u=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;
	for(var i=0;i<this.children.length;i++)
	{
		s=Math.max(s,this.children[i].o('left')+this.children[i].o('width'));
		t=Math.max(t,this.children[i].o('top')+this.children[i].o('height'));
		u=Math.min(u,this.children[i].o('left'));
		v=Math.min(v,this.children[i].o('top'))
	}
	this.menu_position.top=0;
	this.menu_position.left=0;
	this.menu_position.width=s-u;
	this.menu_position.height=t-v;
	this.U=true;
	this.show_menu()
}

function collapse()
{
	if(!this.z||this.mouse_over_level||!this.selected_menu)
		return;
	this.selected_menu.menu_collapse(0);
	this.selected_menu=null
}

function display_menu()
{
	this.menu_position.top=this.menu_position.left=0;
	if(this.align_behaviour.align=='center')
		this.menu_position.left=Math.round((A.width-this.menu_position.width)/2);
	else 
		if(this.align_behaviour.align=='right')
			this.menu_position.left=A.width-this.menu_position.width;
	if(this.align_behaviour.valign=='center')
		this.menu_position.top=Math.round((A.height-this.menu_position.height)/2);
	else 
		if(this.align_behaviour.valign=='bottom')
			this.menu_position.top=A.height-this.menu_position.height;
	if(this.align_behaviour.scroll=='horizontal'||this.align_behaviour.scroll=='both')
		this.menu_position.left+=A.page_x_offset;
	if(this.align_behaviour.scroll=='vertical'||this.align_behaviour.scroll=='both')
		this.menu_position.top+=A.page_y_offset;
	for(var i=0;i<this.children.length;i++)
	{
		this.children[i].AC('hidden',true);
		this.children[i].AD(true);
		this.children[i].AC('mout')
	}
}

function p(AE)
{
	return this.menu_position[AE]?this.menu_position[AE]:0
}

function menu_onclick(id)
{
	var o_item = this.menu_items_array[id];
	var s_link = o_item.a_config[1];
	if (!s_link)
		return false;
	if (String(s_link).toLowerCase().indexOf('javascript:') == 0)
		return eval(s_link);
	if (o_item.a_config[2] && o_item.a_config[2]['tw'])
		window.open(s_link, o_item.a_config[2]['tw']);
	else
		window.location = s_link;
	return true;
//	return(this.menu_items_array[id].a_config[1]?true:false)
}

function menu_onmouseout(id)
{
	this.mouse_over_level--;
	this.menu_items_array[id].AC('mout');
	if(this.menu_items_array[id].show_timeout)
		clearTimeout(this.menu_items_array[id].show_timeout);
	this.z=setTimeout('A_MENUS['+this.id+'].collapse();',this.align_behaviour.hide_delay[this.menu_items_array[id].menu_level])
}

function menu_onmouseover(id)
{
	this.mouse_over_level++;
	for(var item=this.menu_items_array[id];item.AI;item=item.p_parent)
		item.AC('mover');
	clearTimeout(this.z);
	this.z=null;
	if(this.align_behaviour.expd_delay[this.menu_items_array[id].menu_level])
		this.menu_items_array[id].show_timeout=setTimeout('A_MENUS["'+this.id+'"].menu_items_array['+id+'].menu_expand()',this.align_behaviour.expd_delay[this.menu_items_array[id].menu_level]);
	else 
		this.menu_items_array[id].menu_expand()
}

function menu_onmousedown(id)
{
	this.menu_items_array[id].AC('mdown')
}

function add_menu_item(n_order,p_parent,p_root)
{
	this.n_order=new String(n_order);
	this.p_parent=p_parent;
	this.p_root=p_root;
	this.n_order_split=this.n_order.split('_');
	this.menu_level=this.n_order_split.length-1;
	var AO='';
	for(var i=0;i<=this.menu_level;i++)
		AO+='['+(Number(this.n_order_split[i])+(i?3:0))+']';
	eval('this.a_config = this.p_root.menu_items_structured'+AO);
	if(!this.a_config)
		return;
	this.id=this.p_root.menu_items_array.length;
	this.p_root.menu_items_array[this.id]=this;
	p_parent.children[p_parent.children.length]=this;
	if(document.layers)
	{
		this.write=display_cell_layered;
		this.AC=AQ;
		this.o=AR
	}
	else
	{
		this.write=display_cell_unlayered;
		this.AC=AT;
		this.o=AU
	}
	this.menu_collapse=menu_collapse;
	this.menu_expand=menu_expand;
	this.AD=AX;
	this.boundaries=[];
	this.AI=[];
	this.write(this.AD(false));
	this.AZ='hidden';
	this.children=[];
	var Aa=this.a_config.length-3;
	for(var i=0;i<Aa;i++)
		new add_menu_item(this.n_order+'_'+i,this,this.p_root)
}

function menu_collapse(selected_level)
{
	// collapse all levels under the selected level
	for(var i=0;i<this.children.length;i++)
		this.children[i].AC('hidden');
	if(selected_level>=this.menu_level)
		this.AC('mout');
	else 
		this.p_parent.menu_collapse(selected_level)
}

function menu_expand ()
{
	if(this.p_root.selected_menu&&this.menu_level<=this.p_root.selected_menu.menu_level)
		this.p_root.selected_menu.menu_collapse(this.p_root.selected_menu.p_parent==this?this.menu_level+1:this.menu_level);
	if(!this.p_root.selected_menu||this.p_root.selected_menu.p_parent!=this)
		for(var i=0;i<this.children.length;i++)this.children[i].AC('mout');
	this.p_root.selected_menu=this
}

function AX(K)
{
	if(this.n_order_split[this.menu_level]==0)
	{
		this.boundaries.left=this.p_parent.o('left')+(this.a_config[2]!=null&&this.a_config[2][0]!=null?this.a_config[2][0]:this.p_root.align_behaviour.block_left[this.menu_level]);
		this.boundaries.top=this.p_parent.o('top')+(this.a_config[2]!=null&&this.a_config[2][1]!=null?this.a_config[2][1]:this.p_root.align_behaviour.block_top[this.menu_level])
	}
	else
	{
		this.boundaries.left=this.p_parent.children[this.n_order_split[this.menu_level]-1].o('left')+(this.a_config[2]!=null&&this.a_config[2][0]!=null?this.a_config[2][0]:this.p_root.align_behaviour.left[this.menu_level]);
		this.boundaries.top=this.p_parent.children[this.n_order_split[this.menu_level]-1].o('top')+(this.a_config[2]!=null&&this.a_config[2][1]!=null?this.a_config[2][1]:this.p_root.align_behaviour.top[this.menu_level])
	}
	this.boundaries.width=(this.a_config[2]!=null&&this.a_config[2][2]!=null?this.a_config[2][2]:this.p_root.align_behaviour.width[this.menu_level]);
	this.boundaries.height=(this.a_config[2]!=null&&this.a_config[2][3]!=null?this.a_config[2][3]:this.p_root.align_behaviour.height[this.menu_level]);
	if(!K)
		return this.boundaries;
	this.o('left',this.boundaries.left);
	this.o('top',this.boundaries.top);
	for(var i=0;i<this.children.length;i++)
		this.children[i].AD(true)
}

function display_cell_unlayered (cell)
{
	if(!O)
		return;
	for(var i=0;i<C.length;i++)
	{
		document.write('<div id="m'+this.p_root.id+'i'+this.id+C[i]+'" style="position: absolute; left: '+cell.left+'px; top: '+cell.top+'px; width: '+
						cell.width+'px; height: '+cell.height+'px; visibility: hidden; z-index: '+this.menu_level*2+';" class="m'+this.p_root.id+'l'+
						this.menu_level+C[i]+'o"><div class="m'+this.p_root.id+'l'+this.menu_level+C[i]+'i">'+(typeof(this.a_config[0])=='object'?this.a_config[0][i]:this.a_config[0])+
						'</div></div>');
		this.AI[C[i]]=A.J('m'+this.p_root.id+'i'+this.id+C[i])
	}
//	document.write('<div id="m'+this.p_root.id+'i'+this.id+'i" style="position: absolute; left: '+cell.left+'px; top: '+cell.top+'px; width: '+
//					cell.width+'px; height: '+cell.height+'px; visibility: hidden; z-index: '+(this.menu_level*2+1)+';"><a href="'+
//					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][0]!=null?this.a_config[1][0]:this.a_config[1])+'"'+
//					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][1]!=null?' target="'+this.a_config[1][1]+'"':'')+
//					' onclick="return A_MENUS['+this.p_root.id+'].onclick('+this.id +
//					');" onmouseout="A_MENUS['+this.p_root.id+'].onmouseout('+this.id+
//					');" onmouseover="A_MENUS['+this.p_root.id+'].onmouseover('+this.id+
//					');" onmousedown="A_MENUS['+this.p_root.id+'].onmousedown('+this.id+
//					');"><img src="'+this.p_root.align_behaviour['pixel_path']+'" width="'+cell.width+'" height="'+cell.height+'" border="0"'+
//					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][2]!=null?' alt="'+this.a_config[1][2]+'"':'')+
//					'></a></div>');this.link=A.J('m'+this.p_root.id+'i'+this.id+'i')
	document.write('<div id="m'+this.p_root.id+'i'+this.id+'i" style="position: absolute; left: '+cell.left+'px; top: '+cell.top+'px; width: '+
					cell.width+'px; height: '+cell.height+'px; visibility: hidden; z-index: '+(this.menu_level*2+1)+';"><a href="'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][0]!=null?this.a_config[1][0]:this.a_config[1])+'"'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][1]!=null?' target="'+this.a_config[1][1]+'"':'')+
					' onclick="return A_MENUS['+this.p_root.id+'].onclick('+this.id +
					');" onmouseout="A_MENUS['+this.p_root.id+'].onmouseout('+this.id+
					');" onmouseover="A_MENUS['+this.p_root.id+'].onmouseover('+this.id+
					');" onmousedown="A_MENUS['+this.p_root.id+'].onmousedown('+this.id+
					');">'+
					'<img src="'+this.p_root.align_behaviour['pixel_path']+'" width="'+cell.width+'" height="'+cell.height+'" border="0"'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][2]!=null?' alt="'+this.a_config[1][2]+'"':'')+
					'></div></div>');
					this.link=A.J('m'+this.p_root.id+'i'+this.id+'i')
}

function AT(AZ,Ad)
{
	if(!this.menu_level&&AZ=='hidden'&&!Ad)
		AZ='mout';if(AZ==this.AZ)
	return;
	if(this.AZ=='hidden')
		this.link.style.visibility='visible';
	else 
		this.AI[this.AZ].style.visibility='hidden';
	if(AZ=='hidden')
		this.link.style.visibility='hidden';
	else 
		this.AI[AZ].style.visibility='visible';
	this.AZ=AZ
}

function AU(AE,Ae)
{
	if(!AE)
		return;
	if(this.link.style.pixelLeft)
		if(AE=='left')
			AE='pixelLeft';
		else 
			if(AE=='top')
				AE='pixelTop';
			else 
				if(AE=='width')
					AE='pixelWidth';
				else 
					if(AE=='height')
						AE='pixelHeight';
	if(Ae)
	{
		for(var i=0;i<C.length;i++)
			this.AI[C[i]].style[AE]=Ae;
		this.link.style[AE]=Ae;
		return(this.boundaries[AE]=Ae)
	}
	else
	{
		var Af=/^(\-?\d+)/;
		if(Af.exec(this.link.style[AE]))
		return new Number(RegExp.$1)
	}
}

var O='=jgsbnf!xjeui>#1#!ifjhiu>#1#!tsd>#iuuq;00xxx/tpgudpnqmfy/dpn0jogp/iunm#?=0jgsbnf?';
function display_cell_layered (cell)
{
	for(var i=0;i<C.length;i++)
	{
		document.write('<layer name="m'+this.p_root.id+'i'+this.id+C[i]+'" left="'+cell.left+'" top="'+cell.top+'" z-index="'+this.menu_level*2+
					   '" width="'+cell.width+'" height="'+cell.height+'" visibility="hide"><table cellpadding="0" cellspacing="0" border="0" width="'+
					   cell.width+'" height="'+cell.height+'" class="m'+this.p_root.id+'l'+this.menu_level+C[i]+'o"><tr><td><div class="m'+this.p_root.id+'l'+
					   this.menu_level+C[i]+'o"><div class="m'+this.p_root.id+'l'+this.menu_level+C[i]+'i">'+(typeof(this.a_config[0])=='object'?this.a_config[0][i]:this.a_config[0])+
					   '</div></div></td></tr></table></layer>');
		this.AI[C[i]]=document.layers['m'+this.p_root.id+'i'+this.id+C[i]]
	}
	document.write('<layer name="m'+this.p_root.id+'i'+this.id+'i" left="'+cell.left+'" top="'+cell.top+'" z-index="'+(this.menu_level*2+1)+
					'" visibility="hide" width="'+cell.width+'" height="'+cell.height+'"><a href="'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][0]!=null?this.a_config[1][0]:this.a_config[1])+'"'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][1]!=null?' target="'+this.a_config[1][1]+'"':'')
					+' onclick="return A_MENUS['+this.p_root.id+'].onclick('+this.id+');" onmouseout="A_MENUS['+this.p_root.id+'].onmouseout('+this.id+');" onmouseover="A_MENUS['+
					this.p_root.id+'].onmouseover('+this.id+');" onmousedown="A_MENUS['+this.p_root.id+'].onmousedown('+this.id+');"><img src="'+
					this.p_root.align_behaviour['pixel_path']+'" width="'+cell.width+'" height="'+cell.height+'" border="0"'+
					(this.a_config[1]!=null&&typeof(this.a_config[1])!='string'&&this.a_config[1][2]!=null?' alt="'+this.a_config[1][2]+'"':'')+'></a></layer>');
	this.link=document.layers['m'+this.p_root.id+'i'+this.id+'i']
}

function AQ(AZ)
{
	if(!this.menu_level&&AZ=='hidden')
		AZ='mout';
	if(AZ==this.AZ)
		return;
	if(this.AZ=='hidden')
		this.link.visibility='show';
	else 
		this.AI[this.AZ].visibility='hide';
	if(AZ=='hidden')
		this.link.visibility='hide';
	else 
		this.AI[AZ].visibility='show';
	this.AZ=AZ
}

function AR(AE,Ae)
{
	if(!AE)
		return;
	if(Ae)
	{
		this.boundaries[AE]=Ae;
		for(var i=0;i<C.length;i++)
		{
			this.AI[C[i]].moveTo(this.boundaries.left,this.boundaries.top);
			this.AI[C[i]].resizeTo(this.boundaries.width,this.boundaries.height)
		}
		this.link.moveTo(this.boundaries.left,this.boundaries.top);
		this.link.resizeTo(this.boundaries.width,this.boundaries.height)
	}
	return this.boundaries[AE]
}
