function $() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
        var element = arguments[i];
        if (typeof element == 'string') {
            element = document.getElementById(element);
        }
        if (arguments.length == 1) {
            return element;
        }
        elements.push(element);
    }
    return elements;
}

var TRMenu = {

    showDropMenu:function(oSel, oTime) {
        if (this.addedMenu) {
            if (typeof(oTime) != 'number') {
                oTime = 10;
            }

            if (this.lastDropMenu != "") {
                if (this.lastDropMenu != oSel) {
                    this.do_hideDropMenu();
                }
                else {
                    clearTimeout(this.dropMenuTimer);
                }
            }
            var _self = this;
            setTimeout(function() { _self.do_showDropMenu(); }, oTime);
            this.lastDropMenu = oSel;

        }
    },

    do_showDropMenu:function() {
        $(this.lastDropMenu).style.display = "block";
    },

    hideDropMenu:function(oSel, oTime) {
        if (this.addedMenu) {
            if (typeof(oTime) != 'number') {
                oTime = 1000;
            }
            var _self = this;
            this.lastDropMenu = oSel;
            this.dropMenuTimer = setTimeout(function() { _self.do_hideDropMenu(); } , oTime);
        }
    },

    do_hideDropMenu:function() {
        if (this.addedMenu) {
            clearTimeout(this.dropMenuTimer);
            if ($(this.lastDropMenu)) {
                $(this.lastDropMenu).style.display = "none";
            }
            this.lastDropMenu = "";
        }
    },

    menu_swap:function(objMenu, strImg) {
        if (this.addedMenu) {
            objMenu.src = "images/" + strImg;
        }
    },

    addedMenu:false,
    dropMenuTimer:null,
    lastDropMenu:""

};
