//uptime8
// outline = #000066
//line colour = #FF9175
//on rall over = #d6d6d6
// ************************************
// *  Browser Testing
// ************************************
var NS4 = (document.layers) ? 1 : 0
var IE4 = (document.all&&(!document.getElementById)) ? 1 : 0
var IE5 = (document.getElementById && document.all) ? 1 : 0
// If we are IE4 then we are going to add some functionality to make it act
// more like IE5... this should help simplify code, although it may complicate browser
// detection for other scripts.
if (IE4){
	document.getElementById = IE4getElementById
}
var NS6 = (document.getElementById && (!document.all)) ? 1 : 0
	
// Global Variables

var dm_Tab = 0	
var dm_Normal = 1
var dm_Double = 2
var dm_Image = 3
var dm_Text = 4
var dm_preloadList = new Array()
var dm_currentMenu = false
var dm_showRequestId, dm_showRequestName, dm_showRequestParent
var dm_globalHideRequests = new Array()
var dm_currentEvent = 0
var dm_loadComplete = false
var dm_prematureRequest = false
var dm_activeMenus = new Array()
var dm_geckoMenuFix = new Array()
var leftPos = 0
var topPos = 0
var lastElementName
var sImagePath // Path that preloadImage, and other functions will use to find the image.  Changes on the fly.
var menuTimer = 500 //number of msec delay before showing/killing menus.
if(!dm_absolutePath){
	var dm_absolutePath = ""
}

// Preload Menu "Arrows"
sImagePath = dm_absolutePath + "images/"
var dm_menuArrow = preloadImage ("menuArrow.gif")
var dm_menuArrow_ro = preloadImage ("menuArrow_ro.gif")

var dm_menuArrowLarge = preloadImage ("menuArrowLarge.gif")
var dm_menuArrowLarge_ro = preloadImage ("menuArrowLarge_ro.gif")

// ************************************
// * Misc. functions
// ************************************

//Ths is only here for compatibility.  this function does nothing
function preloadSideMenuImages(){
	var nothing
	// Do nothing
}

//Ths is only here for compatibility.  this function does nothing
function writesideMenus(){
	var nothing
	// Do nothing
}

//Set image element to preloaded image
function setImage (menuId, imageId){
	var tmpImageName = 'img' + menuId + imageId
		
	//  NN4
	if (NS4){
		document.layers[menuId].document[tmpImageName].src = eval(menuId + imageId + '.src')
	}		
		
	// IE5+, and browsers based on the Gecko core (like NS6, and Mozilla).
	if (IE4 || IE5 || NS6){
		document.getElementById(tmpImageName).src = eval(menuId + imageId + '.src')
	}
}

// Return a preloaded image	
function preloadImage(tsImageName){
	tempImage = new Image()
	tempImage.src = sImagePath + tsImageName
	return tempImage
}
// This function is used to give IE4 a "getElementById()" method.
function IE4getElementById(tsElementId){
	return eval("document.all." + tsElementId)
}

// Check if we have native javascript support for push() and pop() methods in arrays, 
// if not, make them.  This will probably be the case for IE4 and IE5.
if (!dm_globalHideRequests.push){
	Array.prototype.push = function(v){
		this[this.length] = v
	} 	
}
	
if (!dm_globalHideRequests.pop){
	Array.prototype.pop = function() {
		var r = this[this.length - 1]
		this.length--
		return r
	}
}
	
if (!dm_globalHideRequests.shift){
	Array.prototype.shift = function() {
		var i = 0
		var l = this.length - 1
		if (i==l){
			var r = this[l]
			this.length--
			return r
		}else{
			var r = this[i]
			for (c=i; c<l; c++){
				this[c]=this[c+1]
			}
			this.length--
			return r
		}
	}
}

// And create some more array methods
// This one will let you pop an item out of the middle of the array
Array.prototype.extract = function(i) {
	var l = this.length - 1
	if (i==l){
		var r = this[l]
		this.length--
		return r
	}else{
		var r = this[i]
		for (c=i; c<l; c++){
			this[c]=this[c+1]
		}
		this.length--
		return r
	}
}
	
// This one will find an item in the array, and return it's position, +1
// If nothing is found, 0 is returnd
Array.prototype.find = function(search,increment,startpos) {
	if(!increment){
		increment=1
	}
	if(!startpos){
		startpos=0
	}
	for (var i=startpos; i<this.length; i+=increment){
		if (this[i] == search){
			return i+1
		}
	}
	return 0
}

// This one will find an item in the array, and return it's position, +1
// If nothing is found, 0 is returnd
Array.prototype.findMin = function() {
	var curMin
	var curPos = 0
	if(this.length){
		curMin = this[0]
		curPos = 1
		for(var i=0;i<this.length;i++){
			if(curMin<this[i]){
				curMin = this[i]
				curPos = (i+1)
			}
		}
	}
	return curPos
}

// This one will push a "," delimited string onto an array
Array.prototype.pushList = function(v) {
	v+=',' // add a comma to the end
	var z = 0
	var i =0
	do	{
		i = v.indexOf(',',z)
		this.push(v.slice(z,i))
		z = i+1
	} while (z < v.length)
}


// Load all menus that need to be created
function writeMenus(){
	// nothing
}


// *****************************
// * Menu generation code
// *****************************

function initMenus(){

	do{
		dm_makeMenu(dm_preloadList.shift())	
	}while(dm_preloadList.length)
	
	dm_loadComplete = true
	
	if(dm_prematureRequest){
		setTimeout('dm_showMenu("'+dm_prematureRequest+'",false)',10)
	}

 	if(typeof dn_firstLoop != "undefined"){
  		dn_scrollnews(0);
 	};
}

// Build the start of the menu
function dm_makeMenu(menuName, showMenuNow, menuParent){
	
	if (NS4) {
		var menuObjectArray = eval('dm_menu_' + menuName)
		var menuId = menuName
		var menuHeight = 0
		document.layers[menuId] = new Layer(menuObjectArray[0][2], window)
		var newMenuObject = document.layers[menuId]
		if(menuParent){
			if(menuParent.dm_image){
			topPos = menuParent.dm_image.y
			topPos += menuParent.pageY
			leftPos = menuParent.dm_image.x
			leftPos += menuParent.pageX		
			}	
		}else{
			getAnchorPos(menuObjectArray[0][3])
		}
		if (menuObjectArray[0][6]){
			topPos = getAnchorTop(menuObjectArray[0][6])
		}
		newMenuObject.dm_parent = menuParent
		newMenuObject.dm_hideRequests = new Array()
		if(menuParent){
			newMenuObject.dm_master = menuParent.dm_masterParent
			menuParent.dm_activeChild = newMenuObject
		}
		newMenuObject.visibility = 'hide'
		newMenuObject.top = topPos + menuObjectArray[0][4]
		newMenuObject.left = leftPos + menuObjectArray[0][5]
		//newMenuObject.bgColor = 'red'
		for(var i=1;menuObjectArray.length>i;i++){
			if(menuObjectArray[i][0]==dm_Tab){
				menuHeight+=menuObjectArray[i][4]
			}
			if(menuObjectArray[i][0]==dm_Normal){
				menuHeight+=17
				if(i==1){
					menuHeight++
				}
			}
			if(menuObjectArray[i][0]==dm_Double){
				menuHeight+=31
				if(i==1){
					menuHeight++
				}
			}
			if(menuObjectArray[i][0]==dm_Image){
				menuHeight+=menuObjectArray[i][4]
				if(i==1){
					menuHeight++
				}
				if(i==menuObjectArray.length-1){
					menuHeight++
				}
			}
			if(menuObjectArray[i][0]==dm_Text){
				menuHeight+=250
			}
		}
		newMenuObject.document.open()
		newMenuObject.document.write('<img src="'+dm_absolutePath+'shim.gif" width='+menuObjectArray[0][2]+' height='+menuHeight+'>')
		newMenuObject.document.close()
		var menuItemPosition = 0
		var menuObjectDiv, itemHtml, itemId, imageId
		var menuObjectImage, htmlString, tempVar, tempVar2, tempVar3
		for(i=1;menuObjectArray.length>i;i++){
			itemId = menuId + '_' + i
			imageId = 'img_' + itemId
			document.layers[itemId] = new Layer(400, newMenuObject)
			menuObjectDiv = document.layers[itemId]
			if((menuObjectArray[i][1].substr(0,7).toLowerCase()!="http://")&&(menuObjectArray[i][1].substr(0,8).toLowerCase()!="https:///")&&(menuObjectArray[i][1].substr(0,6).toLowerCase()!="ftp:///")){
				menuObjectArray[i][1] = dm_absolutePath + menuObjectArray[i][1]
			}
			menuObjectDiv.dm_href = menuObjectArray[i][1]
			menuObjectDiv.dm_masterParent = newMenuObject
			menuObjectDiv.dm_itemType = menuObjectArray[i][0]
			menuObjectDiv.visibility = 'inherit'
			menuObjectDiv.zIndex = 3
			//menuObjectDiv.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);
			if (menuObjectArray[i][1]){
				menuObjectDiv.captureEvents(Event.MOUSEUP);
				menuObjectDiv.onmouseup = dm_gotoHref		
			}
			menuObjectDiv.left = 0
			menuObjectDiv.top = menuItemPosition
						
			if(menuObjectArray[i][0]==dm_Tab){
					menuObjectDiv.onmouseover = dm_tabOver
					menuObjectDiv.onmouseout = dm_tabOut
					menuObjectDiv.dm_child = menuObjectArray[i][5];
					menuObjectDiv.document.open()
					menuObjectDiv.document.write(dm_makeImageTag(imageId, menuObjectArray[i][2], menuObjectArray[i][3], menuObjectArray[i][4]));
					menuObjectDiv.document.close()
					menuItemPosition+=menuObjectArray[i][4]
					menuObjectDiv.dm_image = menuObjectDiv.document.images[imageId]
					newMenuObject.dm_defaultTab = menuObjectDiv
			}
					
			if(menuObjectArray[i][0]==dm_Normal){
					menuObjectDiv.dm_child = menuObjectArray[i][3]
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff';
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff';
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10;
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>';
					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					tempVar = (menuObjectArray[i][3])?1:2
					tempVar2 = (menuObjectArray[i][3])?menuObjectArray[0][2]-16:menuObjectArray[0][2]-2
					tempVar3 = menuObjectArray[i][1]
					if(!menuObjectArray[i][1]){
						tempVar3 = '#'
					}
										
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width='+tempVar2+' colspan="'+tempVar+'"><a href="'+tempVar3+'" style="padding: 0px 5px 0px '+menuObjectArray[i][5] + 'px; font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; text-decoration:none;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</a></td>'

					if(menuObjectArray[i][3]){
						htmlString+='<td><a href="'+tempVar3+'">' + dm_makeImageTag(imageId, "../%21/images/menuArrow.gif", 14, 16) + '</a></td>'
						menuObjectDiv.dm_imageId = imageId
					}
					
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					menuItemPosition+=16
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
					}else{
						htmlString+=dm_makeSeparatorTag()
					}
					menuItemPosition++
					htmlString+='</table>'
				
					menuObjectDiv.document.open()
					menuObjectDiv.document.write(htmlString)
					menuObjectDiv.document.close()
					menuObjectDiv.dm_image = menuObjectDiv.document.images[imageId]

			}
			
			if(menuObjectArray[i][0]==dm_Double){
					menuObjectDiv.dm_child = menuObjectArray[i][3]
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff';
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff';
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10;
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>';
					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					tempVar = (menuObjectArray[i][3])?1:2
					tempVar2 = (menuObjectArray[i][3])?menuObjectArray[0][2]-16:menuObjectArray[0][2]-2
					tempVar3 = menuObjectArray[i][1]
					if(!menuObjectArray[i][1]){
						tempVar3 = '#'
					}
										
					htmlString+='<tr>'+dm_makeSideBorderTag(30)
					htmlString+='<td width='+tempVar2+' colspan="'+tempVar+'"><a href="'+tempVar3+'" style="padding: 0px 5px 0px '+menuObjectArray[i][5] + 'px; font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; text-decoration:none;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</a></td>'

					if(menuObjectArray[i][3]){
						htmlString+='<td><a href="'+tempVar3+'">' + dm_makeImageTag(imageId, "images/menuArrowLarge.gif", 14, 30) + '</a></td>'
						menuObjectDiv.dm_imageId = imageId
					}
					
					htmlString+=dm_makeSideBorderTag(30)+ '</tr>'
					
					menuItemPosition+=30
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
					}else{
						htmlString+=dm_makeSeparatorTag()
					}
					menuItemPosition++
					htmlString+='</table>'
				
					menuObjectDiv.document.open()
					menuObjectDiv.document.write(htmlString)
					menuObjectDiv.document.close()
					menuObjectDiv.dm_image = menuObjectDiv.document.images[imageId]

			}
			
			if(menuObjectArray[i][0]==dm_Image){
					menuObjectDiv.onmouseover = dm_blockOver
					menuObjectDiv.onmouseout = dm_blockOut
					menuObjectDiv.bgColor = '#ffffff';
					menuObjectDiv.dm_bgColor = '#ffffff';
					
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>';
					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					tempVar3 = menuObjectArray[i][1]
					if(!menuObjectArray[i][1]){
						tempVar3 = '#'
					}
															
					htmlString+='<tr>'+dm_makeSideBorderTag(menuObjectArray[i][4])
					htmlString+='<td colspan=2 width=100%><a href="'+tempVar3+'">' + dm_makeImageTag('', menuObjectArray[i][2], menuObjectArray[i][3], menuObjectArray[i][4]) + '</a></td>'
					htmlString+=dm_makeSideBorderTag(menuObjectArray[i][4])+ '</tr>'
					
					menuItemPosition+=menuObjectArray[i][4]
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					htmlString+='</table>'
				
					menuObjectDiv.document.open()
					menuObjectDiv.document.write(htmlString)
					menuObjectDiv.document.close()
			}
			
			if(menuObjectArray[i][0]==dm_Text){
					menuObjectDiv.onmouseover = dm_blockOver;
					menuObjectDiv.onmouseout = dm_blockOut;
					menuObjectDiv.bgColor = '#ffffff';
					
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>';
					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					tempVar2 = menuObjectArray[0][2]-2
					
					tempVar3 = menuObjectArray[i][1]
					if(!menuObjectArray[i][1]){
						tempVar3 = '#'
					}
														
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width='+tempVar2+' colspan=2><a href="'+tempVar3+'" style="padding: 0px 5px 0px 5px; font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; text-decoration:none;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</a></td>'			
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					menuItemPosition+=16
					
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width='+tempVar2+' colspan=2><a href="'+tempVar3+'" style="padding: 0px 5px 0px 5px; font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; text-decoration:none;">'
					htmlString+=menuObjectArray[i][3]
					htmlString+='</a></td>'			
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					menuItemPosition+=16
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					htmlString+='</table>'
				
					menuObjectDiv.document.open()
					menuObjectDiv.document.write(htmlString)
					menuObjectDiv.document.close()
			}
			
		}
		newMenuObject.visibility = showMenuNow?'show':'hide'
	}
	
	
	if (IE4||IE5) {
		var menuObjectArray = eval('dm_menu_' + menuName)
		var menuId = menuName
		document.body.insertAdjacentHTML('BeforeEnd','<div id=' + menuId + ' style="position: absolute; visibility: hidden;"></div>')
		var newMenuObject = document.getElementById(menuId)
		getAnchorPos(menuObjectArray[0][3])
		if (menuObjectArray[0][6]){
			topPos = getAnchorTop(menuObjectArray[0][6])
		}
		newMenuObject.dm_parent = menuParent
		newMenuObject.dm_hideRequests = new Array()
		if(menuParent){
			newMenuObject.dm_master = menuParent.dm_masterParent
			menuParent.dm_activeChild = newMenuObject
		}
		newMenuObject.style.cursor = "hand"
		newMenuObject.style.visibility = showMenuNow?'visible':'hidden'
		newMenuObject.style.left = leftPos + menuObjectArray[0][5] + 'px'
		newMenuObject.style.top = topPos + menuObjectArray[0][4] + 'px'
		newMenuObject.style.width = menuObjectArray[0][2]
		
		var menuItemPosition = 0
		var menuObjectDiv, itemHtml, itemId, imageId
		var menuObjectImage, htmlString, tempVar
		for(var i=1;menuObjectArray.length>i;i++){
			itemId = menuId + '_' + i
			imageId = 'img_' + itemId
			newMenuObject.insertAdjacentHTML('BeforeEnd','<div id=' + itemId + ' style="position: absolute;"></div>')
			menuObjectDiv = document.getElementById(itemId)
			if((menuObjectArray[i][1].substr(0,7).toLowerCase()!="http://")&&(menuObjectArray[i][1].substr(0,8).toLowerCase()!="https:///")&&(menuObjectArray[i][1].substr(0,6).toLowerCase()!="ftp:///")){
				menuObjectDiv.dm_href = dm_absolutePath + menuObjectArray[i][1]
			}else{
				menuObjectDiv.dm_href = menuObjectArray[i][1]
			}
			menuObjectDiv.dm_masterParent = newMenuObject
			menuObjectDiv.dm_itemType = menuObjectArray[i][0]
			//menuObjectDiv.id = itemId
			if (menuObjectArray[i][1]){
				menuObjectDiv.onclick = dm_gotoHref	
			}
			//menuObjectDiv.style.position = 'absolute'
			menuObjectDiv.style.left = '0px'
			menuObjectDiv.style.top = menuItemPosition + 'px'
			menuObjectDiv.style.width = menuObjectArray[0][2]
						
			if(menuObjectArray[i][0]==dm_Tab){
					with(menuObjectDiv){
						onmouseover = dm_tabOver
						onmouseout = dm_tabOut
					}
					menuObjectDiv.dm_child = menuObjectArray[i][5]
					menuObjectDiv.insertAdjacentHTML('BeforeEnd',dm_makeImageTag(imageId, menuObjectArray[i][2], menuObjectArray[i][3], menuObjectArray[i][4]))
					menuItemPosition+=menuObjectArray[i][4]
					newMenuObject.dm_defaultTab = menuObjectDiv
			}
			
			if(menuObjectArray[i][0]==dm_Normal){
					menuObjectDiv.dm_child = menuObjectArray[i][3]		
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10
					
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>'

					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					tempVar = (menuObjectArray[i][3])?1:2
										
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width=100% colspan="'+tempVar+'" style="font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; padding-left: '+menuObjectArray[i][5] + 'px; padding-right 5px;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</td>'

					if(menuObjectArray[i][3]){
						htmlString+='<td>' + dm_makeImageTag(imageId, "images/menuArrow.gif", 14, 16) + '</td>'
						menuObjectDiv.dm_imageId = imageId
					}
					
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					menuItemPosition+=16
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
					}else{
						htmlString+=dm_makeSeparatorTag()
					}
					menuItemPosition++
					htmlString+='</table>'
				
					menuObjectDiv.insertAdjacentHTML('BeforeEnd',htmlString)
					
					menuObjectDiv.dm_image = document.getElementById(imageId)
			
			}
			
			if(menuObjectArray[i][0]==dm_Double){
					menuObjectDiv.dm_child = menuObjectArray[i][3]		
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10
					
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>'

					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					tempVar = (menuObjectArray[i][3])?1:2
										
					htmlString+='<tr>'+dm_makeSideBorderTag(30)
					htmlString+='<td width=100% colspan="'+tempVar+'" style="font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; padding-left: '+menuObjectArray[i][5] + 'px; padding-right 5px;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</td>'

					if(menuObjectArray[i][3]){
						htmlString+='<td>' + dm_makeImageTag(imageId, "images/menuArrowLarge.gif", 14, 30) + '</td>'
						menuObjectDiv.dm_imageId = imageId
					}
					
					htmlString+=dm_makeSideBorderTag(30)+ '</tr>'
					
					menuItemPosition+=30
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
					}else{
						htmlString+=dm_makeSeparatorTag()
					}
					menuItemPosition++
					htmlString+='</table>'
				
					menuObjectDiv.insertAdjacentHTML('BeforeEnd',htmlString)
					
					menuObjectDiv.dm_image = document.getElementById(imageId)
			
			}
			
			if(menuObjectArray[i][0]==dm_Image){	
					menuObjectDiv.onmouseover = dm_blockOver
					menuObjectDiv.onmouseout = dm_blockOut
					menuObjectDiv.style.backgroundColor = '#ffffff'
										
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>'

					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					htmlString+='<tr>'+dm_makeSideBorderTag(menuObjectArray[i][4])
					
					htmlString+='<td width=100% colspan=2>' + dm_makeImageTag('', menuObjectArray[i][2], menuObjectArray[i][3], menuObjectArray[i][4]) + '</td>'

					htmlString+=dm_makeSideBorderTag(menuObjectArray[i][4])+ '</tr>'
					
					menuItemPosition+=menuObjectArray[i][4]
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}

					htmlString+='</table>'
				
					menuObjectDiv.insertAdjacentHTML('BeforeEnd',htmlString)
			
			}
			
			if(menuObjectArray[i][0]==dm_Text){		
					menuObjectDiv.onmouseover = dm_blockOver
					menuObjectDiv.onmouseout = dm_blockOut
					menuObjectDiv.style.backgroundColor = '#ffffff'
					menuObjectDiv.dm_bgColor = '#ffffff'
						
					htmlString = '<table cellpadding=0 cellspacing=0 border=0 width='+menuObjectArray[0][2]+'>'

					if(i==1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width=100% colspan=2 style="font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; padding-left: 5px; padding-right 5px;">'
					htmlString+='<nobr>' + menuObjectArray[i][2] + '</nobr>'
					htmlString+='</td>'
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					menuItemPosition+=16
					
					htmlString+='<tr>'+dm_makeSideBorderTag(16)
					htmlString+='<td width=100% colspan=2 style="font-family: tahoma,verdana,arial,helvetica; font-size: 11px; font-weight: bold; color: #000033; padding-left: 5px; padding-right 5px;">'
					htmlString+=menuObjectArray[i][3]
					htmlString+='</td>'
					htmlString+=dm_makeSideBorderTag(16)+ '</tr>'
					
					if(i==menuObjectArray.length-1){
						htmlString+=dm_makeBorderTag()
						menuItemPosition++
					}
					htmlString+='</table>'
				
					menuObjectDiv.insertAdjacentHTML('BeforeEnd',htmlString)
			}
		}
	}
	
	// Menu for IE5+, and browsers based on the Gecko core (like NS6, and Mozilla).
	if (NS6){

		var menuObjectArray = eval('dm_menu_' + menuName)
		var menuId = menuName
		var newMenuObject = document.createElement("div")
		//alert(menuObjectArray[0][3])
		getAnchorPos(menuObjectArray[0][3])
		if (menuObjectArray[0][6]){
			topPos = getAnchorTop(menuObjectArray[0][6])
		}
		//alert('gotposition')
		newMenuObject.id = menuId
		newMenuObject.dm_parent = menuParent
		newMenuObject.dm_hideRequests = new Array()
		if(menuParent){
			newMenuObject.dm_master = menuParent.dm_masterParent
			menuParent.dm_activeChild = newMenuObject
		}
		newMenuObject.dm_left = leftPos + menuObjectArray[0][5] + 'px'
		newMenuObject.dm_top = topPos + menuObjectArray[0][4] + 'px'
		newMenuObject.style.position = 'absolute'
		if (IE5){
			newMenuObject.style.visibility = showMenuNow?'visible':'hidden'
		}
		if (NS6){
			newMenuObject.style.visibility = 'hidden'
		}
		newMenuObject.style.cursor = NS6 ? "pointer" : "hand"
		newMenuObject.style.left = leftPos + menuObjectArray[0][5] + 'px'
		newMenuObject.style.top = topPos + menuObjectArray[0][4] + 'px'
		newMenuObject.style.width = menuObjectArray[0][2]
		newMenuObject.dm_items = new Array()
		document.body.appendChild(newMenuObject)
		
		var menuItemPosition = 0
		var menuObjectDiv, itemHtml, itemId, imageId, dm_tempVar1
		var menuObjectTable, menuObjectRow, menuObjectCell, menuObjectTBody, menuObjectImage
		for(var i=1;menuObjectArray.length>i;i++){
			itemId = menuId + '_' + i
			imageId = 'img_' + itemId
			menuObjectDiv = document.createElement("div")
			if((menuObjectArray[i][1].substr(0,7).toLowerCase()!="http://")&&(menuObjectArray[i][1].substr(0,8).toLowerCase()!="https:///")&&(menuObjectArray[i][1].substr(0,6).toLowerCase()!="ftp:///")){
				menuObjectDiv.dm_href = dm_absolutePath + menuObjectArray[i][1]
			}else{
				menuObjectDiv.dm_href = menuObjectArray[i][1]
			}
			menuObjectDiv.id = itemId
			if (menuObjectArray[i][1]){
				menuObjectDiv.onclick = dm_gotoHref	
			}
			menuObjectDiv.dm_masterParent = newMenuObject
			menuObjectDiv.dm_itemType = menuObjectArray[i][0]
			menuObjectDiv.style.position = 'absolute'
			menuObjectDiv.style.left = '0px'
			menuObjectDiv.style.top = menuItemPosition + 'px'
			menuObjectDiv.style.width = menuObjectArray[0][2]
			menuObjectDiv.style.visibility = 'inherit'
			newMenuObject.dm_items.push(menuObjectDiv)
						
			if(menuObjectArray[i][0]==dm_Tab){
					menuObjectDiv.onmouseover = dm_tabOver
					menuObjectDiv.onmouseout = dm_tabOut
					menuObjectDiv.dm_child = menuObjectArray[i][5]
					menuObjectDiv.appendChild(dm_makeImage(imageId, menuObjectArray[i][2], menuObjectArray[i][3], menuObjectArray[i][4]))
					menuItemPosition+=menuObjectArray[i][4]
					newMenuObject.dm_defaultTab = menuObjectDiv
			}
			
			if(menuObjectArray[i][0]==dm_Normal){
					menuObjectDiv.dm_child = menuObjectArray[i][3]				
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
										
					menuObjectTable = document.createElement("table")
					menuObjectDiv.appendChild(menuObjectTable)
					menuObjectTable.cellSpacing = 0
					menuObjectTable.cellPadding = 0
					if(NS6){
						menuObjectTable.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					}
					menuObjectTable.border = 0
					menuObjectTable.width = menuObjectArray[0][2]
					
					menuObjectDiv.dm_bgObject = menuObjectTable
										
					menuObjectTBody = document.createElement("tbody") 
					menuObjectTable.appendChild(menuObjectTBody)
					
					if(i==1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					tempVar2 = (menuObjectArray[i][3])?menuObjectArray[0][2]-16:menuObjectArray[0][2]-2
					
					menuObjectRow = document.createElement("tr")
					menuObjectTBody.appendChild(menuObjectRow)
					
					menuObjectRow.appendChild(dm_makeSideBorder(16))
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10
					menuObjectCell = document.createElement("td")
					menuObjectCell.style.textAlign = 'left'
					menuObjectCell.style.fontFamily = 'tahoma,verdana,arial,helvetica'
					menuObjectCell.style.fontSize = '10px'
					menuObjectCell.style.fontWeight = 'bold'
					menuObjectCell.style.color = '#000066'
					menuObjectCell.style.paddingLeft = menuObjectArray[i][5] + 'px'
					menuObjectCell.style.paddingRight = '5px'
					menuObjectCell.width = tempVar2
					menuObjectCell.colSpan = (menuObjectArray[i][3])?1:2
					menuObjectCell.innerHTML = '<nobr>' + menuObjectArray[i][2] + '</nobr>'
					menuObjectRow.appendChild(menuObjectCell)
					
					if(menuObjectArray[i][3]){
						menuObjectCell = document.createElement("td")
						menuObjectCell.style.textAlign = 'right'
						menuObjectImage = dm_makeImage(imageId, 'images/menuArrow.gif', 14, 16)
						menuObjectCell.appendChild(menuObjectImage)
						menuObjectRow.appendChild(menuObjectCell)
						menuObjectDiv.dm_image = menuObjectImage
					}
					
					menuObjectRow.appendChild(dm_makeSideBorder(16))
					
					if(i==menuObjectArray.length-1){
						menuObjectTBody.appendChild(dm_makeBorder())
					}else{
						menuObjectTBody.appendChild(dm_makeSeparator())
					}
					menuItemPosition++
										
					menuItemPosition+=16
			}
			
			if(menuObjectArray[i][0]==dm_Double){
					menuObjectDiv.dm_child = menuObjectArray[i][3]				
					menuObjectDiv.onmouseover = dm_normalOver
					menuObjectDiv.onmouseout = dm_normalOut
					menuObjectDiv.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					menuObjectDiv.dm_bgColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
										
					menuObjectTable = document.createElement("table")
					menuObjectTable.cellSpacing = 0
					menuObjectTable.cellPadding = 0
					if(NS6){
						menuObjectTable.style.backgroundColor = (menuObjectArray[i][4])?menuObjectArray[i][4]:'#ffffff'
					}
					menuObjectTable.border = 0
					menuObjectTable.width = menuObjectArray[0][2]
					
					menuObjectDiv.dm_bgObject = menuObjectTable
										
					menuObjectTBody = document.createElement("tbody") 
					menuObjectTable.appendChild(menuObjectTBody)
					
					if(i==1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					menuObjectRow = document.createElement("tr")
					menuObjectTBody.appendChild(menuObjectRow)
					
					menuObjectRow.appendChild(dm_makeSideBorder(30))
					menuObjectArray[i][5] = menuObjectArray[i][5]?menuObjectArray[i][5]:10
					menuObjectCell = document.createElement("td")
					menuObjectCell.style.textAlign = 'left'
					menuObjectCell.style.fontFamily = 'tahoma,verdana,arial,helvetica'
					menuObjectCell.style.fontSize = '10px'
					menuObjectCell.style.fontWeight = 'bold'
					menuObjectCell.style.color = '#000066'
					menuObjectCell.style.paddingLeft = menuObjectArray[i][5] + 'px'
					menuObjectCell.style.paddingRight = '5px'
					menuObjectCell.colSpan = (menuObjectArray[i][3])?1:2
					menuObjectCell.innerHTML = '<nobr>' + menuObjectArray[i][2] + '</nobr>'
					menuObjectRow.appendChild(menuObjectCell)
					
					if(menuObjectArray[i][3]){
						menuObjectCell = document.createElement("td")
						menuObjectCell.style.textAlign = 'right'
						menuObjectImage = dm_makeImage(imageId,'images/menuArrowLarge.gif', 14, 30)
						menuObjectCell.appendChild(menuObjectImage)
						menuObjectRow.appendChild(menuObjectCell)
						menuObjectDiv.dm_image = menuObjectImage
					}
					
					menuObjectRow.appendChild(dm_makeSideBorder(30))
					
					if(i==menuObjectArray.length-1){
						menuObjectTBody.appendChild(dm_makeBorder())
					}else{
						menuObjectTBody.appendChild(dm_makeSeparator())
					}
					menuItemPosition++
					
					menuObjectDiv.appendChild(menuObjectTable)
					
					menuItemPosition+=30
					
			}
	
			if(menuObjectArray[i][0]==dm_Image){				
					menuObjectDiv.onmouseover = dm_blockOver
					menuObjectDiv.onmouseout = dm_blockOut
					menuObjectDiv.style.backgroundColor = '#ffffff'
										
					menuObjectTable = document.createElement("table")
					menuObjectTable.cellSpacing = 0
					menuObjectTable.cellPadding = 0
					if(NS6){
						menuObjectTable.style.backgroundColor = '#ffffff'
					}
					menuObjectTable.border = 0
					menuObjectTable.width = menuObjectArray[0][2]
					
					menuObjectDiv.dm_bgObject = menuObjectTable
										
					menuObjectTBody = document.createElement("tbody") 
					menuObjectTable.appendChild(menuObjectTBody)
					
					if(i==1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					menuObjectRow = document.createElement("tr")
					menuObjectTBody.appendChild(menuObjectRow)
					
					menuObjectRow.appendChild(dm_makeSideBorder(menuObjectArray[i][4]))
										
					menuObjectCell = document.createElement("td")
					menuObjectCell.style.textAlign = 'center'
					menuObjectImage = document.createElement("img")
					menuObjectImage.src = menuObjectArray[i][2]
					menuObjectImage.width = menuObjectArray[i][3]
					menuObjectImage.height = menuObjectArray[i][4]
					menuObjectCell.appendChild(menuObjectImage)
					menuObjectRow.appendChild(menuObjectCell)
					menuObjectDiv.dm_image = menuObjectImage
					
					menuObjectRow.appendChild(dm_makeSideBorder(menuObjectArray[i][4]))
					
					menuItemPosition+=menuObjectArray[i][4]
					
					if(i==menuObjectArray.length-1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					menuObjectDiv.appendChild(menuObjectTable)
				
			}
			
			if(menuObjectArray[i][0]==dm_Text){			
					menuObjectDiv.onmouseover = dm_blockOver
					menuObjectDiv.onmouseout = dm_blockOut
					menuObjectDiv.style.backgroundColor = '#ffffff'
										
					menuObjectTable = document.createElement("table")
					menuObjectTable.cellSpacing = 0
					menuObjectTable.cellPadding = 0
					if(NS6){
						menuObjectTable.style.backgroundColor = '#ffffff'
					}
					menuObjectTable.border = 0
					menuObjectTable.width = menuObjectArray[0][2]
					
					menuObjectDiv.dm_bgObject = menuObjectTable
										
					menuObjectTBody = document.createElement("tbody") 
					menuObjectTable.appendChild(menuObjectTBody)
					
					if(i==1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					menuObjectRow = document.createElement("tr")
					menuObjectTBody.appendChild(menuObjectRow)
					menuObjectRow.appendChild(dm_makeSideBorder(16))
					menuObjectCell = document.createElement("td")
					menuObjectCell.style.textAlign = 'left'
					menuObjectCell.style.fontFamily = 'tahoma,verdana,arial,helvetica'
					menuObjectCell.style.fontSize = '11px'
					menuObjectCell.style.fontWeight = 'bold'
					menuObjectCell.style.color = '#000066'
					menuObjectCell.style.paddingLeft = '5px'
					menuObjectCell.style.paddingRight = '5px'
					menuObjectCell.colSpan = 2
					menuObjectCell.innerHTML = '<nobr>' + menuObjectArray[i][2] + '</nobr>'
					menuObjectRow.appendChild(menuObjectCell)
					
					menuObjectRow.appendChild(dm_makeSideBorder(16))
					
					menuObjectRow = document.createElement("tr")
					menuObjectTBody.appendChild(menuObjectRow)
					
					menuObjectRow.appendChild(dm_makeSideBorder(1))
					menuObjectCell = document.createElement("td")
					menuObjectCell.style.textAlign = 'left'
					menuObjectCell.style.fontFamily = 'tahoma,verdana,arial,helvetica'
					menuObjectCell.style.fontSize = '10px'
					menuObjectCell.style.fontWeight = 'bold'
					menuObjectCell.style.color = '#000066'
					menuObjectCell.style.paddingLeft = '5px'
					menuObjectCell.style.paddingRight = '5px'
					menuObjectCell.colSpan = 2
					menuObjectCell.innerHTML = menuObjectArray[i][3]
					menuObjectRow.appendChild(menuObjectCell)
					
					menuObjectRow.appendChild(dm_makeSideBorder(1))
					
					if(i==menuObjectArray.length-1){
						menuObjectTBody.appendChild(dm_makeBorder())
						menuItemPosition++
					}
					
					menuObjectDiv.appendChild(menuObjectTable)
					
					menuItemPosition+=16
					
			}
			
			newMenuObject.appendChild(menuObjectDiv)
		}
		if(NS6){
			if(showMenuNow){
				newMenuObject.style.left = leftPos + menuObjectArray[0][5] + 'px'
			}else{
				newMenuObject.style.left = -500
			}
			newMenuObject.style.visibility = 'visible'
		}
	}
}

// This function works around a problem with Mozilla 0.8 (and possibly other Gecko based browsers)
// It simply changes the background color of a menu item, causing it to reflow, thus making it display
// properly.  The user may see this happen.
function dm_fixGeckoMenuSnap(menuObject){
	var menuItemObject
	for(var i=0;i<menuObject.dm_items.length;i++){
		menuItemObject = menuObject.dm_items[i]
		if(menuItemObject.dm_bgObject){
			var currentBgColor = menuItemObject.dm_bgObject.style.backgroundColor
			menuItemObject.dm_bgObject.style.backgroundColor = '#fffffe'
			menuItemObject.dm_bgObject.style.backgroundColor = currentBgColor
		}
	}
}

function dm_makeSeparator(){
	var newRow = document.createElement("tr")
	
	var newCell = document.createElement("td")
	with (newCell){
		bgColor = '#000066'
		height = 1
		width = 1
	}
	newCell.appendChild(dm_makeImage('', dm_absolutePath + 'shim.gif', 1, 1))
	newRow.appendChild(newCell)
	
	var newCell = document.createElement("td")
	with (newCell){
		bgColor = '#000066'
		height = 1
		width = '100%'
		colSpan = 2
	}
	newCell.appendChild(dm_makeImage('', dm_absolutePath + 'shim.gif', 1, 1))
	newRow.appendChild(newCell)
	
	var newCell = document.createElement("td")
	with (newCell){
		bgColor = '#e5e5e5'
		height = 1
		width = 1
	}
	newCell.appendChild(dm_makeImage('', dm_absolutePath + 'shim.gif', 1, 1))
	newRow.appendChild(newCell)
	
	return newRow
}

function dm_makeSeparatorTag(){
	return '<tr><td bgcolor=#FF9175><img src="'+dm_absolutePath+'shim.gif" height=1 width=1></td><td colspan="2" bgcolor=#FF9175><img src="'+dm_absolutePath+'shim.gif" height=1 width=1></td><td bgcolor=#FF9175><img src="'+dm_absolutePath+'shim.gif" height=q width=1></td></tr>'
}

function dm_makeSideBorder(borderHieght){
var newCell = document.createElement("td")
	with (newCell){
		bgColor = '#000066'
		height = 1
		width = 1
	}
	newCell.appendChild(dm_makeImage('', dm_absolutePath + 'shim.gif', 1, borderHieght))
	return newCell
}

function dm_makeSideBorderTag(borderHieght){
	return '<td bgcolor=#000066><img src="'+dm_absolutePath+'shim.gif" height='+borderHieght+' width=1></td>'
}

function dm_makeBorder(){
	var newRow = document.createElement("tr")
	
	var newCell = document.createElement("td")
	with (newCell){
		bgColor = '#000066'
		height = 1
		colSpan = 4
	}
	newCell.appendChild(dm_makeImage('', dm_absolutePath + 'shim.gif', 1, 1))
	newRow.appendChild(newCell)
	
	return newRow
}

function dm_makeBorderTag(borderWidth){
	if(!borderWidth){boderWidth = 1}
	return '<td colspan=4 bgcolor=#000066><img src="'+dm_absolutePath+'shim.gif" height=1 width='+borderWidth+'></td>'
}

function dm_makeImage(imageId, imageSrc, width, height){
	var newImageObject = document.createElement("img")
	newImageObject.src = dm_absolutePath + imageSrc
	newImageObject.width = width
	newImageObject.height = height
	if(imageId){
		newImageObject.id = imageId
	}
	return newImageObject
}

function dm_makeImageTag(imageId, imageSrc, width, height){
	return '<img id='+imageId+' name='+imageId+' src="'+dm_absolutePath+imageSrc+'" width='+width+' height='+height+' border=0>'
}

// ********************************
// * Event handelers
// ********************************

function dm_tabOver(){
	dm_currentMenu = this.dm_masterParent
	if(this.dm_child){
		dm_showMenu(this.dm_child, this)
	}
	if(this.dm_activeChild){
		dm_suppressHideForTree(this.dm_activeChild)
	}else{
		dm_suppressHideForTree(this.dm_masterParent)
	}
}

function dm_tabOut(){
	if(this.dm_activeChild){
		dm_requestHideForTree(this.dm_activeChild)
	}else{
		dm_requestHideForTree(this.dm_masterParent)
	}
}

function dm_normalOver(){
	dm_currentMenu = this.dm_masterParent
	dm_effectOn(this)
	if(this.dm_masterParent.dm_parent){
		dm_effectOn(this.dm_masterParent.dm_parent)
	}
	if(this.dm_child){
		dm_requestShow(this.dm_child, this)
	}
	if(this.dm_activeChild){
		dm_suppressHideForTree(this.dm_activeChild)
	}else{
		dm_suppressHideForTree(this.dm_masterParent)
	}
}

function dm_normalOut(){
	dm_effectOff(this)
	if(this.dm_child){
		dm_showRequestId = false
	}
	if(this.dm_activeChild){
		dm_requestHideForTree(this.dm_activeChild)
	}else{
		dm_requestHideForTree(this.dm_masterParent)
	}
}

function dm_blockOver(){
	dm_currentMenu = this.dm_masterParent
	if(this.dm_masterParent.dm_parent){
		dm_effectOn(this.dm_masterParent.dm_parent)
	}
	dm_suppressHideForTree(this.dm_masterParent)
}

function dm_blockOut(){
	dm_requestHideForTree(this.dm_masterParent)
	this.dm_hadMouseOn = false
}

// ********************************
// * Handler tools
// ********************************

// Another bit of bug-fix for the Gecko core.
// Since Gecko will allow an "onmouseon" on an element, but then miss the "onmouseoff", we need
// to check to see if any items were left "on" by mistake.
// This only seems to happen the first time an element gets an event.
// It also only seems to happen on elements nested in absolutely positioned DIVs.
function dm_checkEffect(menuName){
	var menuObject = document.getElementById(menuName)
	if(menuObject.dm_effectOn&&(menuObject.dm_masterParent.dm_lastEffect!=menuObject)){
		dm_effectOff(menuObject)
		if(menuObject.dm_child){
			if(dm_showRequestId==menuObject.dm_child){
				dm_showRequestId = false
			}
		}
		if(menuObject.dm_activeChild){
			dm_requestHide(menuObject.dm_activeChild)
		}
	}
}

function dm_effectOn(menuObject){
	if(NS6){
		if(menuObject.dm_masterParent.dm_lastEffect){
			if(menuObject.dm_masterParent.dm_lastEffect.dm_effectOn&&(menuObject.dm_masterParent.dm_lastEffect!=menuObject)){
				setTimeout('dm_checkEffect("'+menuObject.dm_masterParent.dm_lastEffect.id+'")', 100)
			}
		}	
		menuObject.dm_masterParent.dm_lastEffect = menuObject
	}
	if(!menuObject.dm_effectOn){
		if(menuObject.dm_image){
			if(menuObject.dm_itemType==dm_Normal){
				menuObject.dm_image.src = dm_menuArrow_ro.src
				if(NS6){
					menuObject.dm_image.width = 14
					menuObject.dm_image.height = 16
				}
			}
			if(menuObject.dm_itemType==dm_Double){
				menuObject.dm_image.src = dm_menuArrowLarge_ro.src
			}
		}
		if(menuObject.dm_itemType==dm_Normal||menuObject.dm_itemType==dm_Double){
			if(NS6){
				menuObject.dm_bgObject.style.backgroundColor = '#e5e5e5'
			}
			if(IE4 || IE5 || NS6){
				menuObject.style.backgroundColor = '#e5e5e5'
			}
			if(NS4){
				menuObject.bgColor = '#e5e5e5'
			}
		}
		menuObject.dm_effectOn=true
	}
}

function dm_effectOff(menuObject){
	if(menuObject.dm_effectOn){
		if(menuObject.dm_image){
			if(menuObject.dm_itemType==dm_Normal){
				menuObject.dm_image.src = dm_menuArrow.src
				if(NS6){
					menuObject.dm_image.width = 14
					menuObject.dm_image.height = 16
				}
			}
			if(menuObject.dm_itemType==dm_Double){
				menuObject.dm_image.src = dm_menuArrowLarge.src
			}
		}
		if(menuObject.dm_itemType==dm_Normal||menuObject.dm_itemType==dm_Double){
			if(NS6){
				menuObject.dm_bgObject.style.backgroundColor = menuObject.dm_bgColor
			}
			if(IE4 || IE5 || NS6){
				menuObject.style.backgroundColor = menuObject.dm_bgColor
			}
			if(NS4){
				menuObject.bgColor = menuObject.dm_bgColor
			}
		}
		menuObject.dm_effectOn=false
	}
}

function dm_suppressHideForTree(menuObject){
	if(menuObject.dm_hideRequests.length){
		if(NS6){
			var i = menuObject.dm_hideRequests.findMin()
			if(i){
				menuObject.dm_hideRequests.extract(i-1)	
			}
		}else{
			menuObject.dm_hideRequests.shift()
		}
	}
	if(menuObject.dm_master){
		dm_suppressHideForTree(menuObject.dm_master)
	}
}

function dm_forceHideForTree(menuObject){
	dm_hideMenu(menuObject)
	if(menuObject.dm_master){
		dm_forceHideForTree(menuObject.dm_master)
	}
}

function dm_requestHideForTree(menuObject){
	dm_requestHide(menuObject)
	if(menuObject.dm_master){
		dm_requestHideForTree(menuObject.dm_master)
	}
}

function dm_gotoHref(){
	if(NS4){
		setTimeout('window.location.href = "'+this.dm_href+'";', 10)
	}else{
		window.location.href = this.dm_href
	}
}

// ********************************
// * Show menus
// ********************************

function dm_getEventId(){
	dm_currentEvent++
	return dm_currentEvent
}


function dm_requestHideById(menuName){
	if(dm_loadComplete){
		if(NS4){
			var menuObject = document.layers[menuName]
		}else{
			var menuObject = document.getElementById(menuName)
		}
		dm_requestHide(menuObject)
	}
}

function dm_requestHide(menuObject){
	if(menuObject.dm_isActive){
		var requestEventId = dm_getEventId()
		if(!NS6){
			dm_globalHideRequests.push(menuObject)	
		}
		menuObject.dm_hideRequests.push(requestEventId)
		if(NS6){
			setTimeout('dm_processHideRequest('+requestEventId+', "'+menuObject.id+'")', menuTimer)
		}else{
			setTimeout('dm_processHideRequest('+requestEventId+')', menuTimer)
		}
	}
}

function dm_requestShow(menuName, menuParent){
	var requestEventId = dm_getEventId()
	dm_showRequestId = requestEventId
	dm_showRequestName = menuName
	dm_showRequestParent = menuParent
	setTimeout('dm_processShowRequest('+requestEventId+')', menuTimer)
}

function dm_processShowRequest(requestEventId){
	if(requestEventId==dm_showRequestId){
		dm_showMenu(dm_showRequestName, dm_showRequestParent)
	}
}

function dm_processHideRequest(requestEventId, menuName){
	if(NS6){
		var menuObject = document.getElementById(menuName)
		if(menuObject.dm_hideRequests.length){
			i = menuObject.dm_hideRequests.find(requestEventId)
			if(i){
				menuObject.dm_hideRequests.extract(i-1)
				dm_hideMenu(menuObject)
			}
		}
	}else{
		var menuObject = dm_globalHideRequests.shift()	
		if(menuObject.dm_hideRequests[0]==requestEventId){
			menuObject.dm_hideRequests.shift()
			dm_hideMenu(menuObject)
		}
	}
}

function dm_hideMenu(menuObject){
	if(IE4 || IE5){
		menuObject.style.visibility = 'hidden'
	}
	if(NS6){
		menuObject.style.left = -500
		if(menuObject.dm_lastEffect){
			dm_effectOff(menuObject.dm_lastEffect)
			if(menuObject.dm_lastEffect.dm_child){
				if(dm_showRequestId==menuObject.dm_lastEffect.dm_child){
					dm_showRequestId = false
				}
			}
		}
	}
	if(NS4){
		menuObject.visibility = 'hide'
	}
	if(menuObject.dm_activeChild){
		dm_hideMenu(menuObject.dm_activeChild)
		menuObject.dm_activeChild = false
	}
	if(menuObject.dm_parent){
		menuObject.dm_parent.dm_activeChild = false
		dm_effectOff(menuObject.dm_parent)
	}
	var i=dm_activeMenus.find(menuObject)
	if(i){dm_activeMenus.extract(i-1)}
	menuObject.dm_hideRequests.length = 0
	menuObject.dm_isActive = false
}

function dm_showMenu(menuName, menuParent){
	if(dm_loadComplete){
		if(NS4){
			var menuObject = document.layers[menuName]
		}else{
			var menuObject = document.getElementById(menuName)
		}
		if (menuObject){
			dm_showExistingMenu(menuObject, menuParent)
		}else{
			dm_makeMenu(menuName, true, menuParent)
			if(NS4){
				var menuObject = document.layers[menuName]
			}else{
				var menuObject = document.getElementById(menuName)
			}
			if(NS6){
				dm_fixGeckoMenuSnap(menuObject)
			}
			dm_showExistingMenu(menuObject, menuParent)
		}
	}else{
		dm_prematureRequest = menuName
	}
}

function dm_showExistingMenu(menuObject, menuParent){
	if(NS4){
		menuObject.visibility = 'show'
	}
	if(IE4 || IE5){
		menuObject.style.visibility = 'visible'
	}
	if(NS6){
		menuObject.style.left = menuObject.dm_left
	}
	if(menuParent){
		menuParent.dm_activeChild = menuObject
		menuParent.dm_masterParent.dm_activeChild = menuObject
	}else{
		if(dm_activeMenus.length){
			do{
				dm_hideMenu(dm_activeMenus.pop())
			}while(dm_activeMenus.length)
		}
		if(menuObject.dm_defaultTab){
			if(menuObject.dm_defaultTab.dm_child){
				dm_showMenu(menuObject.dm_defaultTab.dm_child, menuObject.dm_defaultTab)
				dm_currentMenu = menuObject
			}
		}
	}
	if(NS4){
		menuObject.visibility = 'show'
	}
	if(IE4 || IE5){
		menuObject.style.visibility = 'visible'
	}
	if(NS6){
		menuObject.style.left = menuObject.dm_left
	}
	menuObject.dm_isActive = true
	dm_activeMenus.push(menuObject)
}

// ********************************
// * Find Anchor/Element position
// ********************************
	
// Get the top position of an element
function getAnchorTop(elemName){

	if (NS4) {
		// If using NN4, we can just return the position of the tag.
		// But we'll also dig for the element, incase it's nested in a layer
		if (document.images[elemName]){
			return document.images[elemName].y
		}else{
			return getNestedAnchorTop(elemName, document)
		}
	}
	if (IE4 || IE5 || NS6){
		// with IE5+, and NN5/6 we need to dig for the position
		// Adding the position of each element as we dig 
		var elem = document.getElementById(elemName)
		var position = 0
		do {
		    position += elem.offsetTop
			elem = elem.offsetParent
		} while (elem)
		return position
	}		
}

// We will only look 1 layer deep (shouldn't be hard to mod if we need more).
function getNestedAnchorTop(elemName, rootDocument){
	var tmpY = 0
	var tmpY2 = 0
	for(i=0; i < rootDocument.layers.length; i++){
		if (rootDocument.layers[i].document.images[elemName]){
			tmpY = rootDocument.layers[i].document.images[elemName].y
			tmpY += rootDocument.layers[i].pageY
		}else{
			tmpY2 = getNestedAnchorTop2(elemName, rootDocument.layers[i])
			tmpY += tmpY2
		}
	}	
	return tmpY
}

function getNestedAnchorTop2(elemName, rootDocument){
	var tmpY = 0
	for(i=0; i < rootDocument.layers.length; i++){
		if (rootDocument.layers[i].document.images[elemName]){
			tmpY = rootDocument.layers[i].document.images[elemName].y
			tmpY += rootDocument.layers[i].pageY
		}
	}
	return tmpY
}

// Get the position of an element
function getAnchorPos(elemName){
	lastElementName = elemName
	topPos = 0
	leftPos = 0
	if (NS4) {
		if (document.images[elemName]){
			topPos = document.images[elemName].y
			leftPos = document.images[elemName].x
		}else{
			getNestedAnchorPos(elemName, document)
		}
	}
	if (IE4 || IE5 || NS6){
		var elem = document.getElementById(elemName)
		do {
		    topPos += elem.offsetTop
		    leftPos += elem.offsetLeft
			elem = elem.offsetParent
		} while (elem)
	}	
}

// We will only look 1 layer deep (shouldn't be hard to mod if we need more).
function getNestedAnchorPos(elemName, rootDocument){
	var tmpY = 0
	var tmpX = 0
	var posArray
	for(i=0; i < rootDocument.layers.length; i++){
		if (rootDocument.layers[i].document.images[elemName]){
			tmpY = rootDocument.layers[i].document.images[elemName].y
			tmpY += rootDocument.layers[i].pageY
			tmpX = rootDocument.layers[i].document.images[elemName].x
			tmpX += rootDocument.layers[i].pageX
		} else {
			posArray = getNestedAnchorPos2(elemName, rootDocument.layers[i])
			if (posArray[0] || posArray[1]){
				tmpY = posArray[0]
				tmpX = posArray[1]
			}
		}
	}
	topPos = tmpY
	leftPos = tmpX
}

function getNestedAnchorPos2(elemName, rootDocument){
	var tmpY = 0
	var tmpX = 0
	for(i=0; i < rootDocument.layers.length; i++){
		if (rootDocument.layers[i].document.images[elemName]){
			tmpY = rootDocument.layers[i].document.images[elemName].y
			tmpY += rootDocument.layers[i].pageY
			tmpX = rootDocument.layers[i].document.images[elemName].x
			tmpX += rootDocument.layers[i].pageX
		}
	}
	return [tmpY, tmpX]
}

// EOF
