; (function($) {
    var _remove = $.fn.remove; $.fn.remove = function() { $("*", this).add(this).triggerHandler("remove"); return _remove.apply(this, arguments); }; function isVisible(element) {
        function checkStyles(element) { var style = element.style; return (style.display != 'none' && style.visibility != 'hidden'); }
        var visible = checkStyles(element); (visible && $.each($.dir(element, 'parentNode'), function() { return (visible = checkStyles(this)); })); return visible;
    }
    $.extend($.expr[':'], { data: function(a, i, m) { return $.data(a, m[3]); }, tabbable: function(a, i, m) { var nodeName = a.nodeName.toLowerCase(); return (a.tabIndex >= 0 && (('a' == nodeName && a.href) || (/input|select|textarea|button/.test(nodeName) && 'hidden' != a.type && !a.disabled)) && isVisible(a)); } }); $.keyCode = { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38 }; function getter(namespace, plugin, method, args) {
        function getMethods(type) { var methods = $[namespace][plugin][type] || []; return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); }
        var methods = getMethods('getter'); if (args.length == 1 && typeof args[0] == 'string') { methods = methods.concat(getMethods('getterSetter')); }
        return ($.inArray(method, methods) != -1);
    }
    $.widget = function(name, prototype) {
        var namespace = name.split(".")[0]; name = name.split(".")[1]; $.fn[name] = function(options) {
            var isMethodCall = (typeof options == 'string'), args = Array.prototype.slice.call(arguments, 1); if (isMethodCall && options.substring(0, 1) == '_') { return this; }
            if (isMethodCall && getter(namespace, name, options, args)) { var instance = $.data(this[0], name); return (instance ? instance[options].apply(instance, args) : undefined); }
            return this.each(function() { var instance = $.data(this, name); (!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))); (instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args)); });
        }; $[namespace][name] = function(element, options) { var self = this; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace + '-' + name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get(element)[name], options); this.element = $(element).bind('setData.' + name, function(e, key, value) { return self._setData(key, value); }).bind('getData.' + name, function(e, key) { return self._getData(key); }).bind('remove', function() { return self.destroy(); }); this._init(); }; $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); $[namespace][name].getterSetter = 'option';
    };
})(jQuery);