﻿var bolFocus = false;

var t;

var tme = 0;

var objNow = null;

var strIDNow = "", strParIDNow = "";

function changeMenu(obj, over, sub, event, cls, idl) {

    if (over) {

		focusItem(obj, cls);

        subMenu(sub, event, over, obj.id);



        tme = 0;

        t = clearInterval(t);

        t = setInterval("hideSubMn()", 500);

    } else

		focusItemOut(obj, cls, idl);

}



function changeSubMenu(obj, over, cls) {

	focusItem(obj, cls);

    if (over) {

        tme = 0;

        t = clearInterval(t);

        t = setInterval("hideSubMn()", 500);

    } 

}



function subMenu(sub, event, bolShow, strParID) {

    if (event != null && sub != null && sub != '') {

        var obj;

        var x = event.clientX - 10;

        var y = event.clientY - 3;

        var yScroll = 0;



        if (sub != 'none')

            bolShow = true;

        else

            bolShow = false;



        if (bolShow) {

            obj = document.getElementById(sub);

            if (typeof window.pageYOffset != 'undefined')

                yScroll = window.pageYOffset;

            else {

                if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')

                    yScroll = document.documentElement.scrollTop;

                else {

                    if (typeof document.body != 'undefined')

                        yScroll = document.body.scrollTop;

                }

            }



            //if (!bolFocus) {

                y = y + yScroll;

				if(y < 150)

					y = 150;

                obj.style.left = "220px";

                obj.style.top = (y - 20) + "px";

                strParIDNow = strParID;

            //}

        }



        if (strIDNow != "" && strIDNow != "none") {

            document.getElementById(strIDNow).style.visibility = "hidden";

        }



        if (obj != null) {

            if (y > 10 && x > 10)

                obj.style.visibility = "visible";

        }

        

        objNow = obj;

        strIDNow = sub;

        

        if ((strParID == strParIDNow || strParIDNow == "") && bolShow) {

            bolFocus = true;

        } else {

            bolFocus = false;

        }

    }

}



function hideSubMn() {

    tme = tme + 1;

    if (tme >= 3) {

        tme = 0;

        bolFocus = false;

        t = clearInterval(t);

        try {

            document.getElementById(strIDNow).style.visibility = "hidden";

        } catch (err) {

        }

    }

}

function focusItem(o, cls) {

	o.className = cls;

}

function focusItemOut(o, cls, idl) {

	if(document.getElementById(idl).className == 'linkmenuover')

		o.className = cls + 'over';

	else

		o.className = cls;

}
