if (typeof util === "undefined") {
    var util = {};
}

if (!util.style) {
    util.style = {
        toggle: function($element, styleClass) {
            if ($element && !!styleClass) {
                if ($element.hasClass(styleClass)) {
                    $element.removeClass(styleClass);
                } else {
                    $element.addClass(styleClass);
                }
            }
            return $element;
        },

        showElement: function(elementOrId) {
            var $element = this.getElement(elementOrId);
            if ($element.hasClass("hide")) {
                $element.removeClass("hide");
            } else {
                if ($element.css("display") === "none") {
                    $element.show();
                }
            }
            return $element;
        },

        hideElement: function(elementOrId) {
            var $element = this.getElement(elementOrId);
            if ($element.hasClass("hide")) {
                if ($element.css("display") !== "none") {
                    $element.hide();
                }
            } else {
                $element.addClass("hide");
            }
            return $element;
        },

        showBusyAnimation: function() {
            $(".iceOutConStatActv").removeClass("hide");
        },

        hideBusyAnimation: function() {
            // hides all busy animations
            $(document).find(".iceOutConStatActv").addClass("hide");
        },

        getElement: function (elementOrId) {
            var $element = elementOrId;
            if (typeof elementOrId === 'string' || elementOrId instanceof String) {
                $element = $("[id$=" + elementOrId + "]").first();
            }
            return $element || function(){};
        }
    };
}
