
	/* MENUS.JS */
	
	var eOpenMenu = null;

	function OpenMenu(eSrc,eMenu){
		if(eOpenMenu){CloseMenu(eOpenMenu)};CloseMenu(eMenu);eMenu.style.display="inline";eMenu.style.visibility="visible";
		var loc=getAbsPos(eSrc);var offset=getAbsPos(eMenu.offsetParent);
		if((loc.top+eSrc.offsetHeight+eMenu.offsetHeight)>(document.body.scrollTop+document.body.clientHeight)){loc.top-=eMenu.offsetHeight;}else{loc.top+=eSrc.offsetHeight;} 
		if((loc.left+eMenu.offsetWidth)>(document.body.scrollLeft+document.body.clientWidth)){loc.left=document.body.scrollLeft+document.body.clientWidth-eMenu.offsetWidth;}
		eMenu.style.display="none";eMenu.style.visibility="hidden";
		eMenu.style.left=loc.left-offset.left;eMenu.style.top=loc.top-offset.top;
		fadeElementIn(eMenu,0.5);
		eOpenMenu = eMenu;
	}

	function CloseMenu(eMenu){
		eMenu.style.visibility="hidden";eMenu.style.display="none";eMenu.style.left=-10000;eMenu.style.top=-10000;
		eOpenMenu = null;
	}

	function getDropDownID(eSrc){if(eSrc){return eSrc.id+"b0"}}
	
	document.onmouseover = function() {return doMouseOver();}

	function doMouseOver(e){
	    if (!e) {e = window.event}
	    if (!e) {return}
	    var eSrc = e.srcElement;
		if(!eSrc){return}
		if ("MenuLink"==eSrc.className){
			var eMenu=getElement(getDropDownID(eSrc));
			if(!eMenu && eOpenMenu && !eOpenMenu.contains(eSrc)){CloseMenu(eOpenMenu);}
			if(eMenu){OpenMenu(eSrc,eMenu);}
		}else if(eOpenMenu && !eOpenMenu.contains(eSrc)){CloseMenu(eOpenMenu);}
		var title = getTitle(eSrc);
		if (title && title.length > 0){eSrc.title=title;window.status=title;return true;}
	}

	function getTitle(oel){
		if(!oel){return}
		if(!oel.getAttribute("vID") && (!oel.tagName || oel.tagName.toLowerCase()!="tbody")){return} 	
		if(oel.title && oel.title.length>0){return oel.title}
		return getTitle(oel.parentNode);
	}

	document.onfocusin = function() {document.onmouseover();}
	
	document.onmouseout = function() {return doMouseOut();}

    function doMouseOut(e) {
	    if (!e) {e = window.event}
	    if (!e) {return}
		var eSrc = e.srcElement;if(!eSrc){return}
		var verbID=eSrc.getAttribute("vID");if(verbID && verbID.length > 0){window.status="";}
	}	

////////////////////

	var BBNSkipFocus=false;
	function BBNtblExp(oel){
		var tbl=BBNtbl(oel); 
		if((tbl)&&(tbl.rows.length>1)&&(tbl.rows[1].cells[0].firstChild)){
			var TR=tbl.rows[1];			
			if (TR.className=='bbnChild'){
				TR.className='bbnChildEx';TR=tbl.rows[0];
				if (TR.cells[0].className){TR.cells[0].className=TR.cells[0].className.replace("Plus","Minus")}
			}else{
				TR.className='bbnChild';TR=tbl.rows[0];
				if (TR.cells[0].className){TR.cells[0].className=TR.cells[0].className.replace("Minus","Plus")}
			}
		}
	}
	function BBNIsItem(oel){if((oel)&&(oel.className)&&(oel.className=='bbnItem')){return true}return false;}
	function BBNMouseDown(){
		var TD=window.event.srcElement;
		if ((TD)&&(window.event.x<(getAbsPos(TD).left+15))){
			var oel=TD.firstChild;
			if(BBNIsItem(oel)){
				var root=BBNRoot(TD);
				BBNSkipFocus=true;				
				if((root)&&(root.currentNode)&&(oel!=root.currentNode)){					
					if ((oel) && (oel.parentNode) && (oel.parentNode.parentNode) && (oel.parentNode.parentNode.nextSibling)){
						var TR=oel.parentNode.parentNode.nextSibling;
						if((TR)&&(TR.contains(root.currentNode))){BBNSkipFocus=false}
					}
				}
				BBNtblExp(oel);
			}
		}
	}
	function BBNDblClick(root){
		if ((root)&&(root.currentNode)&&(window.event.srcElement)){
			if ((window.event.srcElement==root.currentNode)||(root.currentNode.contains(window.event.srcElement))){
				BBNtblExp(root.currentNode);
			}
		}
	}

	function BBNRoot(oel){tmp=oel;while((tmp)&&(!tmp.root)){tmp=tmp.parentNode}if((tmp)&&(tmp.root)){return tmp}}
	function BBNtblIsExp(tbl){if((tbl)&&(tbl.rows.length>1)&&(tbl.rows[1].cells[0].firstChild)&&(tbl.rows[1].className=='bbnChildEx')){return true};return false}
	function BBNtbl(oel){var tmp=oel;while((tmp)&&(tmp.tagName)&&(tmp.tagName.toLowerCase()!='table')&&(!tmp.root)){tmp=tmp.parentNode}if(tmp && tmp.tagName && tmp.tagName.toLowerCase()=='table' && !tmp.root){return tmp}}
	function BBNelem(tbl){if((tbl)&&(tbl.rows.length>0)&&(tbl.rows[0].cells[0].firstChild)){return tbl.rows[0].cells[0].firstChild}}
	function BBNtblLast(tbl){if(BBNtblIsExp(tbl)){return BBNtblLast(tbl.rows[1].cells[0].lastChild)}else{return tbl}}
	function BBNtblFirst(tbl){if(BBNtblIsExp(tbl)){return tbl.rows[1].cells[0].firstChild}}

	function BBNPrev(oel){
		var tbl=BBNtbl(oel);
		if (tbl){
			if(tbl.previousSibling){tbl=BBNtblLast(BBNtbl(tbl.previousSibling))}
			else{tbl=BBNtbl(tbl.parentNode)}
			return BBNelem(tbl);
		}
	}
	function BBNNext(oel,includechildren){
		var tbl=BBNtbl(oel);
		if (tbl){						
			var nxt;
			if (includechildren){nxt=BBNelem(BBNtblFirst(tbl))}
			if (nxt){return nxt}
			nxt=BBNelem(BBNtbl(tbl.nextSibling));
			if (nxt){return nxt}
			var root=BBNRoot(tbl);
			return BBNNext(tbl.parentNode,false)			
		}
	}
	function BBNKeyDown(){
		var oel=window.event.srcElement;		
		while((oel) && !BBNIsItem(oel)){oel=oel.parentNode}
		if (BBNIsItem(oel)){
			var tbl;
			switch (window.event.keyCode){
				case 37://arrowleft										
					tbl=BBNtbl(oel); 
					if(BBNtblIsExp(tbl)){BBNtblExp(tbl);window.event.returnValue=false;}
					else{if(BBNfocus(BBNelem(BBNtbl(tbl.parentNode)))){window.event.returnValue=false}}				
					break;
				case 39://arrowRight
					tbl=BBNtbl(oel);
					if (!BBNtblIsExp(tbl)){BBNtblExp(tbl);window.event.returnValue=false;}else 
					{if (BBNfocus(BBNNext(tbl,true))){window.event.returnValue=false;}}
					break;
				case 38://arrowUp
					if (BBNfocus(BBNPrev(oel))){window.event.returnValue=false;}
					break;
				case 40://arrowDown
					oel=BBNNext(oel,true);					
					if(BBNfocus(oel)){window.event.returnValue=false}
					break;
				case 13://enter
					BBNtblExp(oel);window.event.returnValue=false;
					break;
			}
		}
	}
	function BBNBlur(root){
		if(!root.currentNode){try{root.currentNode=BBNelem(BBNtblFirst(root.firstChild.rows[0].cells[0].firstChild))}catch(e){}}
		if(root.currentNode){root.currentNode.tabIndex=-1;root.currentNode.tabStop=false;root.currentNode.style.backgroundColor='';root.currentNode.style.color='';}
	}
	function BBNOnFocus(root,div){
		if (!root){return}
		if(!div){div=window.event.srcElement};
		while((div) && !BBNIsItem(div)){div=div.parentNode}
		if (!div){return}
		if (BBNIsItem(div)){
			BBNBlur(root);
			root.currentNode=div;
			div.style.backgroundColor='highlight';
			div.style.color='highlighttext';				
			div.tabIndex=0;div.tabStop=true;
		}
		//TODO can't back-tab off focusable child element
		if(root.currentNode){BBNfocus(root.currentNode);}
		BBNSkipFocus=false;
	}
	function BBNItemToFocus(elem){var chd=elem.firstChild;if(chd&&typeof(chd.tagName)!=UNDEF&&chd.tagName!=null&&chd.tagName.toLowerCase()!='img'){return chd;}return elem}
	function BBNfocus(elem){
		if ((elem)&&(!BBNSkipFocus)){
			try{
				elem=BBNItemToFocus(elem);
				BBNSkipFocus=true;
				if(document.activeElement!=elem){elem.focus();}				
				return true
			}
			catch(e){BBNSkipFocus=false;return BBNfocus(BBNPrev(elem))}
		}
		return false
	}
/*
	function BBNAddSiblingFromHTML(sibling,itemHTML,before){
		if ((!sibling)||(!itemHTML)){return}
		var TR=BBNDivTR(sibling);
		if (!TR){return}
		if ((before)&&(TR.previousSibling){
			TR=TR.previousSibling
		}else{
		}
		if ((div)&&(!BBNSkipFocus)){
			try{
				if (!div.firstChild){div=div.firstChild}
				if (document.activeElement!=div){div.focus();}
				return true
			}catch(e){
				return BBNfocus(BBNPrev(div))
			}
		}
		return false
	}
*/
	
////////////////////////////

function reColor(oel,newColor){if(typeof(newColor)==UNDEF||newColor==null){oel.runtimeStyle.color='';}else{oel.runtimeStyle.color=newColor;}}
