! function($, e) {
	function t(e, t) {
		this.element = $(e), this.options = $.extend({}, r, t), this._defaults = r, this._name = n, this.init()
	}
	var n = "CheckboxUI",
		i = (e.VBArray && !e.XMLHttpRequest, e.document, ["destroy", "refresh"]),
		r = {};
	t.prototype.init = function() {
		var e = this;
		e.element.hide(), e.element.attr("autocomplete", "off"), e.ui = $("<i />").attr("data-name", e.element.attr("name") || "").attr("data", e.element.attr("data") || "").addClass("checkboxui").css({
			"margin-top": e.element.css("margin-top"),
			"margin-bottom": e.element.css("margin-bottom"),
			"margin-left": e.element.css("margin-left"),
			"margin-right": e.element.css("margin-right")
		}).insertAfter(e.element), e.refresh(), e.element.bind("change", function() {
			e.refresh()
		}), e.element.parent("label").bind("click." + e._name, function(t) {
			return !$(t.target).is(":checkbox") && e.ui.triggerHandler("click"), t.stopPropagation(), t.preventDefault(), !1
		}), e.ui.bind("click." + e._name, function(t) {
			return e.element.is(":disabled") ? !1 : (e.element.is(":checked") ? e.element.prop("checked", !1) : e.element.prop("checked", !0), e.element.triggerHandler("change"), t.stopPropagation(), !1)
		})
	}, t.prototype.refresh = function() {
		var e = "";
		return this.element.is(":checked") && (e += "-checked"), this.element.is(":disabled") && (e += "-disabled"), this.ui.removeClass().addClass("checkboxui"), e && this.ui.addClass("checkboxui" + e), this
	}, $.fn[n] = function(e) {
		var r, a, s, o;
		if ("string" == typeof e) {
			if (r = arguments, a = e, s = function() {
				for (var e = 0; e < i.length; e++)
					if (i[e] === a) return !0;
				return !1
			}, Array.prototype.shift.call(r), "check" == a) return !!this.data("plugin_" + n);
			if (s()) return this.each(function() {
				var e = $(this).data("plugin_" + n);
				e && e[a] && e[a].apply(e, r)
			});
			if (o = this.first().data("plugin_" + n), o && o[a]) return o[a].apply(o, r);
			throw new TypeError(n + ' has no method "' + a + '"')
		}
		return this.each(function() {
			var i = $(this).data("plugin_" + n);
			i || $(this).data("plugin_" + n, new t(this, e))
		})
	}
}(jQuery, window);