var menuArr=new Array()
var ie4=document.all;
var ns6=document.getElementById&&!document.all;
var transitionprefix = 'progid:DXImageTransform.Microsoft.';
var divstyle = 'visibility:hidden;width:'+mnuwidth+';background-color:'+mnubgcolor+';filter:'+transitionprefix+mnutransition+transitionprefix+mnufilter;

if (ie4)//Width Fix for IE
    {
    document.write('<style type="text/css">');
    document.write('#MenuItem a{WIDTH:100%;}');
    document.write('</style>');
    }
if (ns6)//Transparency Fix for Moz-FrFox
    {
    document.write('<style type="text/css">');
    document.write('#MenuItem{-moz-opacity: 0.75;}');
    document.write('</style>');
    }
if (ie4||ns6)
    {
    document.write('<div id="MenuItem" style="'+divstyle+'" OnMouseOver="clearhidemenu(\'false\')" OnMouseOut="HideMenus()" ></div>');
    }


function getposOffset(what, offsettype)
    {
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
        {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
        }
    return totaloffset;
    }



function iecompattest()
    {
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

function clearbrowseredge(obj, whichedge)
    {
    var edgeoffset=0;
    if (whichedge=="rightedge")
        {
        var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
        mnuItmsDiv.contentmeasure=mnuItmsDiv.offsetWidth;
        if (windowedge-mnuItmsDiv.x < mnuItmsDiv.contentmeasure)
            {
            edgeoffset=mnuItmsDiv.contentmeasure-obj.offsetWidth;
            }
        }
        else{
        var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset;
        var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
        mnuItmsDiv.contentmeasure=mnuItmsDiv.offsetHeight;
            if (windowedge-mnuItmsDiv.y < mnuItmsDiv.contentmeasure)
                { //move up?
                edgeoffset=mnuItmsDiv.contentmeasure+obj.offsetHeight;
                if ((mnuItmsDiv.y-topedge)<mnuItmsDiv.contentmeasure) //up no good either?
                    {
                    edgeoffset=mnuItmsDiv.y+obj.offsetHeight-topedge;
                    }
                }
            }
        return edgeoffset
    }

function ShowMenus(obj, e, mnuNum)
    {
    var mnuwidth = menuArr[mnuNum+'width'];
    if (window.event){event.cancelBubble=true;}else if (e.stopPropagation){e.stopPropagation();}
    mnuItmsDiv=document.getElementById? document.getElementById("MenuItem") : MenuItem;
    Hide();
    mnuItmsDiv.innerHTML="";
    clearhidemenu(mnuItmsDiv);
    if (ie4||ns6)
        {
        mnuItmsDiv.innerHTML=menuArr[mnuNum].join("");
        mnuItmsDiv.style.width=mnuwidth;
        mnuItmsDiv.style.visibility="visible";
        mnuItmsDiv.x=getposOffset(obj, "left");
        mnuItmsDiv.y=getposOffset(obj, "top");
        mnuItmsDiv.style.left=mnuItmsDiv.x-clearbrowseredge(obj, "rightedge")+"px";
        mnuItmsDiv.style.top=mnuItmsDiv.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
        }
    }

function contains_ns6(a, b)
    {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }

function Hide()
    {
    if (typeof mnuItmsDiv!="undefined");
        {
        if (ie4||ns6)
            {
            mnuItmsDiv.style.visibility="hidden";
            }
        }
}

function HideMenus()
    {
    if (ie4||ns6)
        {
        hidedelay=setTimeout("Hide()",400)
        }
}

function clearhidemenu(mnuItmsDiv)
    {
    if (typeof hidedelay!="undefined")
        {
        clearTimeout(hidedelay);
        }
    if (ie4 && mnuItmsDiv != 'false')
        {
        mnuItmsDiv.filters[0].apply();
        mnuItmsDiv.filters[0].play();
        }
    }
function navHt(item)
{
	var style = '<style type="text/css"> \n'+
	'<!-- \n'+
	' \n'+
	'#navigation_' + item + ' a{ \n'+
	'background: url(files/images/arrowht.gif) no-repeat; \n'+
	'} \n'+
	'--> \n'+
	'</style> \n'
	document.write(style);
}

