/////////////////////////////////////////////////////////////////////////
// WRITTEN BY Shane Rushik 02/26/2003
/////////////////////////////////////////////////////////////////////////
//	Set up submenu links.
//	You can call the arrays anything you want... 
//	Just reference their name from the hyperlinks at the end of this code
//////////////////////////////////////////////////////////////////////////////////////////////////
// Misc Variables
	var timer;       			// holds the current timer value
	Menu_Over = null 			// Menu currently highlighted 
	OffsetMenuTop = 18 			// Offset Menu Top by the height of the cell so it's top is at the cell bottom
	OffsetMenuLeft = 0 			// Offset Menu Left
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
// This is the bit that does it all.
function ShowMenu(elem,HTML){

	if(Menu_Over!=null){if(!document.layers){Menu_Over.className='NavBarOFF'}}
	Menu_Over = elem
	if(!document.layers){elem.className='NavBarOVER'}

	var HTMLCode = ''
	HTMLelem = eval(HTML)
	if(HTMLelem.length>0){
		HTMLCode += '<table class="DropDownOutBox" cellpadding="1" cellspacing="0" border="0"><tr><td>'
		HTMLCode += '<table class="DropDownSubBox" cellpadding="2" cellspacing="0" border="0">'
				for(i=0;i<HTMLelem.length;i++){
						//if(i!=0){HTMLCode += '</td>'}
						clearTimeout(timer)
						HTMLCode += '<tr><td class="DropDownText" onmouseover="this.className=\'DropDownTextOVER\';' +
						    'clearTimeout(timer); " onclick="' + HTMLelem[i][2]+ '.location.href=\'' +
						    HTMLelem[i][1] + '\'" onmouseout=\"this.className=\'DropDownText\'; timer=setTimeout(\'HideDiv()\',500); ">'
						HTMLCode += '<nobr>'+ HTMLelem[i][0] +'</nobr><br></td></tr>'
				}
		HTMLCode += '</table></td></tr></table>'

	}
		if(document.layers){
			document.DropDownList.left = findPosX(elem) + OffsetMenuLeft 
			document.DropDownList.top = findPosY(elem)  + OffsetMenuTop
			document.DropDownList.document.write(HTMLCode); document.layers['DropDownList'].document.close();
		}
		if(document.all){
			DropDownList.style.left = findPosX(elem) + OffsetMenuLeft 
			DropDownList.style.top = findPosY(elem) + OffsetMenuTop
			DropDownList.innerHTML = HTMLCode
		}
		if(!document.all && document.getElementById){
			document.getElementById('DropDownList').style.left = findPosX(elem) + OffsetMenuLeft 
			document.getElementById('DropDownList').style.top = findPosY(elem) + OffsetMenuTop 
			document.getElementById('DropDownList').innerHTML = HTMLCode
		}
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// find the Left position
function findPosX(obj){
	var curleft=0;
		if(document.getElementById||document.all){while(obj.offsetParent){curleft+=obj.offsetLeft;obj=obj.offsetParent;}}
		else if(document.layers){curleft+=obj.x;}
	return curleft;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// find the top position
function findPosY(obj){
	var curtop=0;
		if(document.getElementById||document.all){
			while(obj.offsetParent){
				curtop+=obj.offsetTop;
				obj=obj.offsetParent;
				//alert(curtop);
			}
		}
		else if(document.layers){curtop+=obj.y;}
	return curtop;
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// set the mouse click mouseup event
if(document.layers)document.captureEvents(Event.MOUSEMOVE);document.onmouseup=HideDiv;

//////////////////////////////////////////////////////////////////////////////////////////////////
// hide the menu
function HideDiv(){
	if(Menu_Over!=null){
		if(!document.layers){Menu_Over.className='NavBarOFF'}
	}
	if(document.layers){document.DropDownList.top = -999}
	if(document.all){DropDownList.style.top = -999}
	if(!document.all && document.getElementById){document.getElementById('DropDownList').style.top = -999}
}
//-----------------------------------------------------------------------
//----- ADDED FOR SHC WEBSITE - LISTS MENU ITEMS IN FIXED AREA.
function ListMenuItems(HTML){
	var HTMLCode = ''
	HTMLelem = eval(HTML)
	if(HTMLelem.length>0){
		HTMLCode += '<table width="137" cellpadding="0" cellspacing="0" border="0">'
				for(i=0;i<HTMLelem.length;i++){
						//if(i!=0){HTMLCode += '</td>'}
						clearTimeout(timer)
					  HTMLCode += '<tr>'
					  HTMLCode += '  <td width="8" height="14" align="right"><img name="bullet_SUB'+i+'" border="0" src="/interface05/images/spacer.gif" width="6" height="8"></td>'
					  HTMLCode += '  <td width="1" height="14" bgcolor="#999999"><img border="0" src="/interface05/images/spacer.gif" width="1" height="8"></td>'
					  HTMLCode += '  <td width="4" height="14" ><img border="0" src="/interface05/images/spacer.gif" width="4" height="8"></td>'
					  HTMLCode += '  <td  height="14" class="MenuBoxText" onclick="' + HTMLelem[i][2]+ '.location.href=\'' + HTMLelem[i][1] + '\'" onmouseover="ArrowChange(\'bullet_SUB'+i+'\',\'bullet\',\'ON\');this.className=\'MenuBoxTextOVER\';" onmouseout="ArrowChange(\'bullet_SUB'+i+'\',\'bullet\',\'OFF\');this.className=\'MenuBoxText\';">'
					  HTMLCode += '  <nobr> '+ HTMLelem[i][0] +'</nobr><br></td>'
					  HTMLCode += '</tr>'
						
						
					//HTMLCode += '<tr><td class="MenuBoxText" onmouseover="this.className=\'MenuBoxTextOVER\';" onclick="self.location.href=\'' +
					//	    HTMLelem[i][1] + '\'" onmouseout=\"this.className=\'MenuBoxText\';">'
					//	HTMLCode += '<nobr>'+ HTMLelem[i][0] +'</nobr><br></td></tr>'
				}
		HTMLCode += '</table>'
		HTMLCode += '<table border="0" cellpadding="0" cellspacing="0" width="100%">'
		HTMLCode += '  <tr>'
		HTMLCode += '   <td width="9"><img border="0" src="/interface05/images/spacer.gif" width="9" height="4"></td>'
		HTMLCode += '   <td><img border="0" src="/interface05/images/content/graymenucorner.gif" width="8" height="4"></td>'
		HTMLCode += '   </tr>'
		HTMLCode += '</table>'		

	}
	document.write(HTMLCode)
}

function ArrowChange(destpic, picsrc, onoff) { 

	// show ON IMAGE
	if(onoff == "ON") { 	
		source = eval(picsrc+ "_ON.src"); 
		document[destpic].src = source; 
	} 
	// show OFF IMAGE
	if(onoff == "OFF"){ 
		source = eval(picsrc+ "_OFF.src"); 
		document[destpic].src = source; 
	} 
}
//--- IMAGE DECLARATIONS ------------------------------------------	
	bullet_ON = new Image();
	bullet_ON.src = "/interface05/images/content/bullet_arrow.gif";
	bullet_OFF = new Image();
	bullet_OFF.src = "/images/spacer.gif";	
//----------------------------------------------------------------