/*
// Reachpoint AnaMenu javascript v 1.1.1 (c) 2006, Reachpoint.com
*/

var _done = 0;
var _div = 'dv';
var _lvl=0;
var _curr = null;
var _close=null;
var _time=1;
var _zIndex=100;

onload = amLoad;

function getElement(id) 
{ 
    if (document.getElementById) 
        return document.getElementById(id) 
    else 
        return eval('document.all.' + id) 
} 
function amLoad()
{
	try
	{
		if (_done != 0)
			return;
		_done = 0;
		_time = 1;
		_top = amCalcTop(_id, _top);
		_left = amCalcLeft(_id, _left);
		if (_id2.length > 0)
		{
			_top2 = amCalcTop(_id2, _top2);
			_left2 = amCalcLeft(_id2, _left2);
		}
		amInit("", _count, _high0 - 2, 0, 100); 
		onunload=amUnload;
		_done = 1;
	}
	catch (err)
	{
	}
}
function amUnload()
{
	if(_close)
		clearTimeout(_close);
}

function amInit(code, count, t, l, w0)
{
	_lvl++;
	var t2 = t - (_lvl > 2 ? _high0 - 4 : 0);
	var l2 = l + (_lvl > 2 ? w0 : 0);
	var hoz = -1;
	for (var i = 1; i <= count; i++)
	{
		var code2 = code + eval(i);
		var h = _high1;
		var w1 = 0;
		var obj = getElement(_div + code2);	
		if (obj != null)
		{
			if (hoz != -1 && hoz != obj.attributes['hoz'].value)
				l2 = l + (_lvl > 2 ? w0 : 0) + (obj.attributes['wid'].value * 1) + 1;
			hoz = obj.attributes['hoz'].value;
				
			var count2 = obj.attributes['len'].value;
			var w = obj.attributes['wid'].value;
		
			obj.onmouseover = amOver;
			obj.onmouseout = amOut;
			if (obj.attributes['len'].value >= 0)
			{
				obj.onclick = amClick;
			}

            var w2 = 100;
			var hoz2 = obj.attributes['hoz'].value;
			if (_lvl == 1)
			{
				obj.style.backgroundColor=(obj.id==_sel?(hoz2==1?_clrBkgOver:_clrVBkgOver):(hoz2==1?_clrBkg:_clrVBkg)); 
				if (obj.childNodes.length > 0)
					obj.childNodes[0].style.color=(obj.id==_sel?(hoz2==1?_clrTxtOver:_clrVTxtOver):(hoz2==1?_clrTxt:_clrVTxt)); 
				w1 = w * 1;
			}
			else
			{
			    var lft = 0;
				if (_id2.length > 0)
				{
					obj.style.top=t2 + (hoz2==1?_top:_top2-_high0);
					lft=l2 + (hoz2==1?_left:_left2);
				}
				else
				{
					obj.style.top=t2 + (_top-_high0);
					lft=l2 + (_left);
				}
				obj.style.left=lft;
			    if (lft < 500)
			        w2 = Math.max(w, w2);
			        
				obj.style.width=w;
				obj.style.zIndex=_lvl + _zIndex;	
				
				if (obj.attributes['len'].value >= 0)
				{
					obj.style.filter='Alpha(Opacity=100, FinishOpacity=70, Style=1)';	
					obj.style.height=h;
					t2 += h - 1;
				}
				else
				{
					obj.style.filter='Alpha(Opacity=0, Style=0)';	
					t2 += 2;
				}
			}
			
			if (count2 > 0)
				amInit(code2 + '_', count2, t2, l2, w2);
			
			if (_lvl == 1)
			{
				if (hoz2 == 1)
					l2 += w1 + 1; //1=spacing gab between menu items
				else
				{
					l2 = w1 + 1 + l;
					t2 += _high0 - 1;
				}
			}
		}
	}
	_lvl--;
}
function amDivOn(obj)
{
	if (obj.id.indexOf('_') > 0)
	{
		obj.style.visibility='visible';
	}
	if (obj.attributes['len'].value >= 0)
	{
		var hoz2 = obj.attributes['hoz'].value;
		obj.style.backgroundColor=(hoz2==1?_clrBkgOver:_clrVBkgOver); 
		if (obj.childNodes.length > 0)
			obj.childNodes[0].style.color=(hoz2==1?_clrTxtOver:_clrVTxtOver); 
	}
}	
function amDivOff(obj)
{
	if (obj==_curr)
	{	
		_time = 1;
		if(_close)
			clearTimeout(_close);
		_close=setTimeout('amTime()',_delay)
	}
	var hoz2 = obj.attributes['hoz'].value;
	obj.style.backgroundColor=(obj.id==_sel?(hoz2==1?_clrBkgOver:_clrVBkgOver):(hoz2==1?_clrBkg:_clrVBkg)); 
	if (obj.childNodes.length > 0)
		obj.childNodes[0].style.color=(obj.id==_sel?(hoz2==1?_clrTxtOver:_clrVTxtOver):(hoz2==1?_clrTxt:_clrVTxt)); 
}
function amParent(obj)
{
	var code = obj.id; 
	var obj2 = getElement(code);
	while (obj2 != null)
	{
		amFriend(obj2);
		amDivOn(obj2);
		code = _div + obj2.attributes['mom'].value;
		obj2 = getElement(code);
	}
}
function amFriend(obj)
{
	if (obj.attributes['mom'].value.length > 0)
	{
		var code = _div + obj.attributes['mom'].value;
		var mom = getElement(code);	
		for (i = 1; i <= mom.attributes['len'].value; i++)
		{
			var code2 = code + '_' + eval(i);
			var obj2 = getElement(code2);	
			if (obj2 != null)
			{
				obj2.style.visibility='visible';
				if (obj2.attributes['len'].value >= 0)
				{
					var hoz2 = obj.attributes['hoz'].value;
					obj2.style.backgroundColor=(obj2.id==_sel?(hoz2==1?_clrBkgOver:_clrVBkgOver):(hoz2==1?_clrBkg:_clrVBkg)); 
					if (obj.childNodes.length > 0)
						obj2.childNodes[0].style.color=(obj2.id==_sel?(hoz2==1?_clrTxtOver:_clrVTxtOver):(hoz2==1?_clrTxt:_clrVTxt)); 					
				}
			}
		}
	}
}
function amTime()
{
	if (_time)
	{
		amReset();
		_time = 0;
	}
}
function amReset()
{
	var code = "";
	for (var i = 1; i <= _count; i++)
	{
		var code2 = code + eval(i);
		var obj = getElement(_div + code2);	
		if (obj != null)
		{
			if (obj.attributes['len'].value >= 0)
			{
				var hoz2 = obj.attributes['hoz'].value;
				obj.style.backgroundColor=(obj.id==_sel?(hoz2==1?_clrBkgOver:_clrVBkgOver):(hoz2==1?_clrBkg:_clrVBkg)); 
				if (obj.childNodes.length > 0)
					obj.childNodes[0].style.color=(obj.id==_sel?(hoz2==1?_clrTxtOver:_clrVTxtOver):(hoz2==1?_clrTxt:_clrVTxt)); 					
				
			}
			if (obj.attributes['len'].value > 0)
				amReset2(code2, obj.attributes['len'].value);
		}
	}
}
function amReset2(code, count)
{
	for (var i = 1; i <= count; i++)
	{
		var code2 = code + '_' + eval(i);
		var obj = getElement(_div + code2);	
		if (obj != null)
		{
			obj.style.visibility='hidden';
			if (obj.attributes['len'].value > 0)
				amReset2(code2, obj.attributes['len'].value);
		}
	}
}
function amOver()
{	
	if(_done)
	{		
		amReset();
		amParent(this);
		_curr = this;
		_time = 0;
		var len = this.attributes['len'].value;
		if (len > 0)
		{
			for (i=1;i<=len;i++)
			{
				var code = this.id + "_" + eval(i);
				var obj = getElement(code);	
				if (obj != null)
				{
					obj.style.visibility='visible';
				}
			}
		}
	}
}
function amOut()
{
	if(_done)
	{
		amDivOff(this);
	}
	status = '';
}
function amClick()
{
	if(_done)
	{
	}
}

function amCalcTop(id, top)
{
	var obj = getElement(id);
	if (obj != null)
	    obj = obj.offsetParent;
	while (obj != null)
	{
		top += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return top;
}
function amCalcLeft(id, left)
{
	var obj = getElement(id);
	if (obj != null)
	    obj = obj.offsetParent;
	while (obj != null)
	{
		left += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return left;
}

