/**include
//_javascript/js-wrapper.js;
//_javascript/debug.js;
*/

/**
 * Menu control
 */
var menuControl = newObject({
    id    : null,
    timer : null,
    curEl : -1,
    menuLnk : null,
    subMenu : null,

    init : function (id, isGTypeOpen, isServOpen, isApplOpen) {
        this.id = "#" + id;
        if (!isGTypeOpen) {
            this.$w0.createStyle(this.id + " .catalogue" + " .lev2", "display: none;");
        }
        if (!isServOpen) {
            this.$w0.createStyle(this.id + " .services" + " .lev2", "display: none;");
        }
        if (!isApplOpen) {
            this.$w0.createStyle(this.id + " .application" + " .lev2", "display: none;");
        }
    },
    onready : function (a, b) {
        this.subMenu = {};
        this.menuLnk = this.$$(this.id + " a#mnLnk*");
        for(var i = 0; i < this.menuLnk.length; i++) {
            this.menuLnk[i].addListener(this, "onclick").i = i;
            this.subMenu[i] = this.menuLnk[i].getNextSibling();
        }
    },
    onclick : function(evtWr, dt)
    {
        evtWr.elmWr.elm.blur();

        if (this.subMenu[dt.i]) {
            evtWr.eventDrop();
            evtWr.stopBubbling();
            this.subMenu[dt.i].invDisplay();
        }
    }
});
