var isMenDown = false, levRefs = [], doneDisMenus = 0, theTTCTimeout;
function displayBasedMenu(oImg,oImg2) {
var cacheImg1 = new Image(), cacheImg2 = new Image();
cacheImg1.src = oImg; cacheImg2.src = oImg2;
this.img = oImg;
this.img2 = oImg2;
this.sub = [];
this.getMenuCode = function () { return getMenuCode( this ); }
}
function displayBasedSub(oText,oScript) { this.text = oText; this.sub = []; this.script = oScript; }
function getMenuCode( oMenuOb ) {
if( !document.childNodes ) { return ''; }
doneDisMenus++;
var oOutline = '<table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:#bfbfbf;font-size:9pt;color:#000;font-family:Tahoma,Arial,sans-serif;cursor:default;"><tr><td style="width:0.5em;"> </td>';
for( var x = 0, oOutline2 = ''; x < oMenuOb.sub.length; x++ ) {
oOutline += '<td style="width:'+oMenuOb.sub[x].text.length+'em;" nowrap><span style="border:1px solid #bfbfbf;width:100%;'+(window.opera?'':'display:block;')+'" onmouseover="doHighLight(this,\'disMen'+
doneDisMenus+'_'+x+'\',1);" onmouseout="doLowLight(this,1);" onclick="popLow(this,\'disMen'+doneDisMenus+'_'+x+
'\');">'+oMenuOb.sub[x].text+'</span></td>';
oOutline2 += getSubMenuCode( oMenuOb.sub[x], 'disMen'+doneDisMenus+'_'+x, 2, oMenuOb.img, oMenuOb.img2 );
}
return oOutline + '<td onclick="linkClick();"> </td></tr></table>' + oOutline2;
}
function getSubMenuCode( oSubMenuOb, oUnique, oLev, oImg, oImg2 ) {
if( !oSubMenuOb.sub.length ) { return ''; }
var isIEMac = window.ActiveXObject && navigator.platform.indexOf( 'Mac' ) + 1 && !navigator.__ice_version && !window.opera;
var oOutline = (isIEMac?'':('<span style="position:absolute;display:none;" id="'+oUnique+'">'))+
'<table border="0" cellpadding="3" cellspacing="0" style="background-color:#bfbfbf;border-bottom:1px solid #000;border-top:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #000;font-size:9pt;color:#000;font-family:Tahoma,Arial,sans-serif;cursor:default;'+(isIEMac?('position:absolute;display:none;" id="'+oUnique+'"'):'"')+'>'+
'<tr><td style="border-bottom:1px solid #888;border-top:1px solid #fff;border-left:1px solid #fff;border-right:1px solid #888;" nowrap>'+oSubMenuOb.text+':</td></tr>';
for( var x = 0, oOutline2 = ''; x < oSubMenuOb.sub.length; x++ ) {
var theExtraBord = ( ( x == oSubMenuOb.sub.length - 1 ) ? 'border-bottom:1px solid #888;' : '' ) + ( x ? '' : 'border-top:1px solid #fff;' );
if( oSubMenuOb.sub[x].script ) {
oOutline += '<tr><td style="'+theExtraBord+'border-right:1px solid #888;border-left:1px solid #fff;width:100%;" onmouseover="doHighLight(this,\''+oUnique+'_'+x+'\','+oLev+');" onclick="linkClick();eval(unescape(\''+escape(oSubMenuOb.sub[x].script)+'\'));" nowrap width="100%">'+oSubMenuOb.sub[x].text+'</td></tr>';
} else {
oOutline += '<tr><td style="'+theExtraBord+'border-right:1px solid #888;border-left:1px solid #fff;background-color:#bfbfbf;background-image:url('+oImg+');background-position:center right;background-repeat:no-repeat;" onmouseover="doHighLight(this,\''+oUnique+'_'+x+'\','+oLev+',\''+escape(oImg)+'\',\''+escape(oImg2)+'\');" nowrap width="100%">'+(isIEMac?'<span></span>':'')+oSubMenuOb.sub[x].text+' </td></tr>';
oOutline2 += getSubMenuCode( oSubMenuOb.sub[x], oUnique+'_'+x, oLev + 1, oImg, oImg2 );
}
}
return oOutline + '</table>'+(isIEMac?'':'</span>')+oOutline2;
}
function doHighLight(oOb,oOb2,oLevel,oImg,oImg2) {
if( isMenDown ) {
window.clearTimeout( theTTCTimeout );
theTTCTimeout = window.setTimeout('linkClick();',5000);
closeToLevel(oLevel);
popLow2(oOb,document.getElementById(oOb2),oLevel,oImg,oImg2);
} else if( oLevel == 1 ) {
oOb.style.borderLeft = '1px solid #fff';
oOb.style.borderTop = '1px solid #fff';
oOb.style.borderRight = '1px solid #888';
oOb.style.borderBottom = '1px solid #888';
}
}
function doLowLight(oOb,oMenNum) { if( !isMenDown ) { oOb.style.border = '1px solid #bfbfbf'; } }
function linkClick() { window.clearTimeout( theTTCTimeout ); closeToLevel(1); isMenDown = false; }
function popLow(oOb,oOb2) {
closeToLevel(1);
if( !isMenDown ) { theTTCTimeout = window.setTimeout('linkClick();',5000); isMenDown = true; popLow2(oOb,document.getElementById(oOb2),1); } else { window.clearTimeout( theTTCTimeout ); isMenDown = false; doHighLight(oOb,oOb2,1); }
}
function popLow2(oOb,oOb2,oLevel,oImg,oImg2) {
levRefs[oLevel] = [oOb,oOb2,oImg];
if(oOb2) { oOb2.style.display = 'block'; oOb2.style.zIndex='2'; rePos(oOb2,oOb,oLevel); if( window.opera ) { oOb2.style.display = 'none'; oOb2.style.display = 'block'; } }
if( oLevel - 1 ) {
if( oImg2 ) { oOb.style.backgroundImage = 'url('+unescape(oImg2)+')'; }
oOb.style.backgroundColor = '#00007f';
oOb.style.color = '#fff';
if( window.opera ) { oOb.style.display = 'none'; oOb.style.display = 'table-cell'; }
} else {
oOb.style.borderLeft = '1px solid #888';
oOb.style.borderTop = '1px solid #888';
oOb.style.borderRight = '1px solid #fff';
oOb.style.borderBottom = '1px solid #fff';
}
}
function closeToLevel(oLevel) {
for( var x = levRefs.length - 1; x > oLevel - 1; x-- ) {
if( levRefs[x]) {
if(levRefs[x][1]) { levRefs[x][1].style.display = 'none'; }
if( x - 1 ) {
if( levRefs[x][2] ) { levRefs[x][0].style.backgroundImage = 'url('+unescape(levRefs[x][2])+')'; }
levRefs[x][0].style.backgroundColor = '#bfbfbf';
levRefs[x][0].style.color = '#000';
} else {
levRefs[x][0].style.border = '1px solid #bfbfbf';
}
levRefs[x] = null;
}
}
}
function rePos(oObToPos,oObToRef,oLev) {
var isIEMac = window.ActiveXObject && navigator.platform.indexOf( 'Mac' ) + 1 && !navigator.__ice_version && !window.opera;
var theObToResize = isIEMac ? oObToPos : oObToPos.childNodes[0]; if( isIEMac && oObToRef.childNodes[0].tagName ) { oObToRef = oObToRef.childNodes[0]; }
if( theObToResize.offsetWidth < oObToRef.offsetWidth + ( ( oLev - 1 ) ? 0 : 50 ) ) { theObToResize.setAttribute( 'width', ( oObToRef.offsetWidth + ( ( oLev - 1 ) ? 0 : 50 ) ) + 'px' ); }
for( var posX = 0, posY = 0; oObToRef.style.position != 'absolute' && oObToRef.style.position != 'relative' && oObToRef.style.position != 'fixed' && oObToRef; oObToRef = oObToRef.offsetParent ) {
posX += oObToRef.offsetLeft; posY += oObToRef.offsetTop; }
if( oLev - 1 ) { posX += ( parseInt( oObToRef.style.left ) + ( isIEMac ? oObToRef : oObToRef.childNodes[0] ).offsetWidth ) - 3;
posY += parseInt( oObToRef.style.top ); posX -= isIEMac ? 2 : 0; } else { posY += isIEMac ? 12 : 17; posX -= isIEMac ? 5 : 0; }
oObToPos.style.left = posX + 'px'; oObToPos.style.top = posY + 'px';
}