var IMAGES = "/library/flyoutmenu/images/"
var MENU_WIDTH = 180
var MENU_BORDER_COLOR = '#999999'
var MENU_BACKGROUND_COLOR = '#f1f1f1'
var MENU_CURRENTPAGE_COLOR = '#ffffff'
var MENU_MOUSEOVER_COLOR = '#cccccc'
var MENU_MOUSEDOWN_COLOR = '#999999'
var MENU_SHADOW_COLOR = '#666666'
var FLYOUT_DELAY = 200
var KILL_DELAY = 300
var SCROLL_DELAY = 35
var SCROLL_PXPERSEC = 150
var MIN_FLYOUT_WIDTH = 100
var MAX_FLYOUT_WIDTH = 410
var global = window.document
global.fo_currentMenu = null
global.fo_shadows = new Array
global.fo_killTimer = null
var flyoutTimer = null
var scrollTimer = null
var flyoutCount = 0
var flyouts = new Array
var rowHeight = 0
var menuToShow = null
var scrollDelta = 0
var scrollStart = 0
var scrollTime = 0
var scrollArea = null
var contentReady = 0
var hideIFrames = true
function newid()
{
var id
do
id = 'id' + Math.random().toString().substr(2, 10)
while (global.all(id))
return id
}
function new_XML_document()
{
try
{
var doc = new ActiveXObject("MSXMl.DOMDocument")
return doc
}
catch(err)
{
return null
}
}
function event_oncontentready()
{
if (!global.firstFlyoutInstance)
{
global.firstFlyoutInstance = true
global.body.attachEvent("onmousemove", body_onmousemove)
}
if (this.id == '')
this.id = newid()
if (navigator.appVersion.indexOf("MSIE 5.0") == -1)
hideIFrames = false
var mdd = null
if (menudata)
if (menudata.substr(0, 1) == '#')
mdd = eval(menudata.substr(1)).XMLDocument.documentElement
else
{
var md = new_XML_document()
if (md)
{
md.async = false
md.load(menudata)
if (md.parseError.errorCode == 0)
mdd = md.documentElement
}
else
mdd = null
}
var items = this.all.tags("TD")
var i
var nParentItem = 0
var nParentLen = -1
var lhref = normalized_href(location.href)
for (i=0; i<items.length; i++)
{
var item = items[i]
if (item.className == "flyoutLink" || item.className == "flyoutSubLink")
{
var disabled = false
var anchors = item.all.tags("A")
if (anchors.length > 0)
{
var anchor = anchors.item(0)
var ahref = normalized_href(anchor.href)
if (ahref == lhref)
{
anchor.outerHTML = anchor.innerHTML
item.style.borderColor = MENU_BORDER_COLOR
item.style.backgroundColor = MENU_CURRENTPAGE_COLOR
item.style.cursor = 'default'
disabled = true
nParentItem = 0
nParentLen = 9999
}
else
{
var slash = ahref.lastIndexOf("/")
if (slash == ahref.length - 1)
if (lhref.substr(0, slash + 1) == ahref)
if (ahref.length > nParentLen)
{
nParentItem = i
nParentLen = ahref.length
}
}
}
item.defaultBorder = item.style.borderColor
item.defaultBackground = item.style.backgroundColor
item.attachEvent("onmouseover", item_onmouseover)
item.attachEvent("onmouseout", item_onmouseout)
if (!disabled)
{
item.attachEvent("onmousedown", item_onmousedown)
item.attachEvent("onmouseup", item_onmouseup)
}
if (item.handle && mdd)
{
var sm = mdd.selectSingleNode("//submenu[@handle='" + item.handle + "']")
if (sm)
{
var fa = document.createElement("div")
fa.width = 4
fa.height = 7
fa.style.position = "absolute"
fa.style.left = MENU_WIDTH - 15
fa.style.marginTop = 4
fa.style.fontSize = "1px"
fa.style.backgroundImage = "url(" + IMAGES + "flyout_arrow.gif)"
fa.style.width = "4px"
fa.style.height = "7px"
item.insertAdjacentElement("afterBegin", fa)
var it = sm.firstChild
var ic = 0
var j
var mi //menu item
while (it)
{
ic++
var tn = it.tagName
var att = it.attributes
if (tn == 'item')
{
var h = '<a href="' + att.getNamedItem("href").value + '">' + att.getNamedItem("label").value + '</a>'
mi = create_sublink(h)
}
else if (tn == 'heading')
mi = create_sublink(att.getNamedItem("label").value, "flyoutSubHeading")
else if (tn == 'separator')
mi = create_separator()
else
mi = create_sublink("", "flyoutSubHeading")
scrollArea.insertAdjacentElement('beforeEnd', mi)
it = it.nextSibling
}
function normalized_href(href)
{
href = href.toLowerCase();
var slash = href.lastIndexOf("/");
if (-1 != slash)
{
var filename = href.substr(slash + 1);
if ("default.htm" == filename || "default.asp" == filename)
href = href.substr(0, slash + 1);
}
return href;
}
function image_load(src)
{
var img = new Image()
img.src = src
return img
}
function item_onmouseover()
{
var e = whichItem()
if (e.contains(window.event.fromElement))
return
if (e.style.backgroundColor != MENU_CURRENTPAGE_COLOR)
{
e.style.borderColor = MENU_BORDER_COLOR
e.style.backgroundColor = MENU_MOUSEOVER_COLOR
}
if (e.submenu == null)
{
if (e.handle)
{
menuToShow = flyouts[e.flyoutid]
if (menuToShow)
menuToShow.baseTop = element_top(e) - 3
}
else
menuToShow = null
flyoutTimer = window.setTimeout(this.id + ".show_flyout()", FLYOUT_DELAY, "JScript")
}
else if (scrollArea = e.scroller) //not a "==" typo
{
if (e.offsetParent.offsetTop > scrollArea.offsetTop)
scrollDelta = +1
else
scrollDelta = -1
scrollStart = scrollArea.scrollTop
scrollTime = current_time()
scrollTimer = window.setInterval(this.id + ".scroll()", SCROLL_DELAY, "JScript")
}
var a = e.all.tags("A")
if (a.length > 0)
window.status = a[0].href
}
function current_time()
{
var temp = new Date()
return temp.valueOf()
}
function item_onmouseout()
{
var e = whichItem()
var te = window.event.toElement
if (te)
if (e.contains(te))
return
e.style.borderColor = e.defaultBorder
e.style.backgroundColor = e.defaultBackground
if (flyoutTimer)
{
window.clearTimeout(flyoutTimer)
flyoutTimer = null
}
if (gs = scrollTimer)
{
window.clearInterval(gs)
scrollTimer = null
}
window.status = ""
}
function whichItem()
{
var e = event.srcElement
while (e.tagName != "TD")
e = e.parentElement
return e
}
function item_onmousedown()
{
if ((event.button & 1) == 0)
return;
var e = whichItem()
e.style.backgroundColor = MENU_MOUSEDOWN_COLOR
e.mouseIsDown = 1
}
function item_onmouseup()
{
if ((event.button & 1) == 0)
return;
var e = whichItem()
if (e.mouseIsDown != 1)
return
e.mouseIsDown = false
e.style.backgroundColor = MENU_MOUSEOVER_COLOR
var a = e.all.tags("A")
if (a.length > 0)
top.location.href = a[0].href
}
function remove_flyout()
{
if (global.fo_currentMenu)
{
var i
for (i=0; i<global.fo_shadows.length; i++)
global.fo_shadows[i].removeNode(true);
global.fo_shadows = new Array();
global.fo_currentMenu.style.display = 'none'
show_elements("SELECT")
show_elements("OBJECT")
if (hideIFrames) show_elements("IFRAME")
}
}
function show_flyout()
{
flyoutTimer = null
if (global.readyState != 'complete')
{
flyoutTimer = window.setTimeout(this.id + ".show_flyout()", 50, "JScript")
return
}
if (global.fo_currentMenu == menuToShow)
return
remove_flyout()
global.fo_currentMenu = menuToShow
if (menuToShow)
{
var menuChildren = menuToShow.rows[0].cells[0].childNodes
var upScroller = menuChildren(0).style
var scrollArea = menuChildren(1).style
var downScroller = menuChildren(2).style
function body_onmousemove()
{
if (!global.fo_currentMenu)
return
if (global.fo_killTimer)
return
if (global.fo_currentMenu.contains(window.event.srcElement))
return
if (window.event.x < MENU_WIDTH)
return
kill_flyout()
}
function create_sublink(html, className)
{
var sublink = document.createElement("table")
sublink.cellPadding = 0
sublink.cellSpacing = 0
sublink.style.margin = "0px 2px"
sublink.widthAdjust = 0
var td = sublink.insertRow().insertCell()
if (!className) className = "flyoutSubLink"
td.className = className
td.submenu = "1"
td.innerHTML = html
return sublink
}
function hide_elements(tagName)
{
windowed_element_visibility(tagName, -1)
}
function show_elements(tagName)
{
windowed_element_visibility(tagName, +1)
}
function windowed_element_visibility(tagName, change)
{
var els = global.all.tags(tagName)
var i
for (i=0; i < els.length; i++)
{
var el = els.item(i)
if (elements_overlap(el))
{
if (el.visLevel)
el.visLevel += change
else
el.visLevel = change
if (el.visLevel == -1)
{
el.visibilitySave = el.style.visibility
el.style.visibility = "hidden"
}
else if (el.visLevel == 0)
el.style.visibility = el.visibilitySave
}
}
}
function elements_overlap(el)
{
var left = 0
var top = 0
var width = el.offsetWidth
var height = el.offsetHeight
while (el)
{
left += el.offsetLeft
top += el.offsetTop
el = el.offsetParent
}
return ((left < global.fo_muRight) && (left + width > global.fo_muLeft) && (top < global.fo_muBottom) && (top + height > global.fo_muTop))
}