
/* Disable autocomplete */
var flag = 1;
function disAutoComplete(obj) {
    if (flag) {
        obj.setAttribute("autocomplete", "off");
        flag = 0;
    }
    //window.location = "#";
    obj.focus();
}

// $(function () {
//     var dates = $('#fromdate, #enddate').datepicker({
//         defaultDate: "+1w",
//         changeMonth: false,
//         numberOfMonths: 2,
//         dateFormat: 'yy-mm-dd',
//         onSelect: function (selectedDate) {
//             var option = this.id == "fromdate" ? "minDate" : "maxDate";
//             var instance = $(this).data("datepicker");
//             var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
//             dates.not(this).datepicker("option", option, date);
//         }
//     });
// });
/*
* jQuery Form Plugin; v20130616
* http://jquery.malsup.com/form/
* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL
* https://github.com/malsup/form#copyright-and-license
 */
; (function (e) { "use strict"; function t(t) { var r = t.data; t.isDefaultPrevented() || (t.preventDefault(), e(this).ajaxSubmit(r)) } function r(t) { var r = t.target, a = e(r); if (!a.is("[type=submit],[type=image]")) { var n = a.closest("[type=submit]"); if (0 === n.length) return; r = n[0] } var i = this; if (i.clk = r, "image" == r.type) if (void 0 !== t.offsetX) i.clk_x = t.offsetX, i.clk_y = t.offsetY; else if ("function" == typeof e.fn.offset) { var o = a.offset(); i.clk_x = t.pageX - o.left, i.clk_y = t.pageY - o.top } else i.clk_x = t.pageX - r.offsetLeft, i.clk_y = t.pageY - r.offsetTop; setTimeout(function () { i.clk = i.clk_x = i.clk_y = null }, 100) } function a() { if (e.fn.ajaxSubmit.debug) { var t = "[jquery.form] " + Array.prototype.join.call(arguments, ""); window.console && window.console.log ? window.console.log(t) : window.opera && window.opera.postError && window.opera.postError(t) } } var n = {}; n.fileapi = void 0 !== e("<input type='file'/>").get(0).files, n.formdata = void 0 !== window.FormData; var i = !!e.fn.prop; e.fn.attr2 = function () { if (!i) return this.attr.apply(this, arguments); var e = this.prop.apply(this, arguments); return e && e.jquery || "string" == typeof e ? e : this.attr.apply(this, arguments) }, e.fn.ajaxSubmit = function (t) { function r(r) { var a, n, i = e.param(r, t.traditional).split("&"), o = i.length, s = []; for (a = 0; o > a; a++)i[a] = i[a].replace(/\+/g, " "), n = i[a].split("="), s.push([decodeURIComponent(n[0]), decodeURIComponent(n[1])]); return s } function o(a) { for (var n = new FormData, i = 0; a.length > i; i++)n.append(a[i].name, a[i].value); if (t.extraData) { var o = r(t.extraData); for (i = 0; o.length > i; i++)o[i] && n.append(o[i][0], o[i][1]) } t.data = null; var s = e.extend(!0, {}, e.ajaxSettings, t, { contentType: !1, processData: !1, cache: !1, type: u || "POST" }); t.uploadProgress && (s.xhr = function () { var r = e.ajaxSettings.xhr(); return r.upload && r.upload.addEventListener("progress", function (e) { var r = 0, a = e.loaded || e.position, n = e.total; e.lengthComputable && (r = Math.ceil(100 * (a / n))), t.uploadProgress(e, a, n, r) }, !1), r }), s.data = null; var l = s.beforeSend; return s.beforeSend = function (e, t) { t.data = n, l && l.call(this, e, t) }, e.ajax(s) } function s(r) { function n(e) { var t = null; try { e.contentWindow && (t = e.contentWindow.document) } catch (r) { a("cannot get iframe.contentWindow document: " + r) } if (t) return t; try { t = e.contentDocument ? e.contentDocument : e.document } catch (r) { a("cannot get iframe.contentDocument: " + r), t = e.document } return t } function o() { function t() { try { var e = n(g).readyState; a("state = " + e), e && "uninitialized" == e.toLowerCase() && setTimeout(t, 50) } catch (r) { a("Server abort: ", r, " (", r.name, ")"), s(D), j && clearTimeout(j), j = void 0 } } var r = f.attr2("target"), i = f.attr2("action"); w.setAttribute("target", d), u || w.setAttribute("method", "POST"), i != m.url && w.setAttribute("action", m.url), m.skipEncodingOverride || u && !/post/i.test(u) || f.attr({ encoding: "multipart/form-data", enctype: "multipart/form-data" }), m.timeout && (j = setTimeout(function () { T = !0, s(k) }, m.timeout)); var o = []; try { if (m.extraData) for (var l in m.extraData) m.extraData.hasOwnProperty(l) && (e.isPlainObject(m.extraData[l]) && m.extraData[l].hasOwnProperty("name") && m.extraData[l].hasOwnProperty("value") ? o.push(e('<input type="hidden" name="' + m.extraData[l].name + '">').val(m.extraData[l].value).appendTo(w)[0]) : o.push(e('<input type="hidden" name="' + l + '">').val(m.extraData[l]).appendTo(w)[0])); m.iframeTarget || (v.appendTo("body"), g.attachEvent ? g.attachEvent("onload", s) : g.addEventListener("load", s, !1)), setTimeout(t, 15); try { w.submit() } catch (c) { var p = document.createElement("form").submit; p.apply(w) } } finally { w.setAttribute("action", i), r ? w.setAttribute("target", r) : f.removeAttr("target"), e(o).remove() } } function s(t) { if (!x.aborted && !F) { if (M = n(g), M || (a("cannot access response document"), t = D), t === k && x) return x.abort("timeout"), S.reject(x, "timeout"), void 0; if (t == D && x) return x.abort("server abort"), S.reject(x, "error", "server abort"), void 0; if (M && M.location.href != m.iframeSrc || T) { g.detachEvent ? g.detachEvent("onload", s) : g.removeEventListener("load", s, !1); var r, i = "success"; try { if (T) throw "timeout"; var o = "xml" == m.dataType || M.XMLDocument || e.isXMLDoc(M); if (a("isXml=" + o), !o && window.opera && (null === M.body || !M.body.innerHTML) && --O) return a("requeing onLoad callback, DOM not available"), setTimeout(s, 250), void 0; var u = M.body ? M.body : M.documentElement; x.responseText = u ? u.innerHTML : null, x.responseXML = M.XMLDocument ? M.XMLDocument : M, o && (m.dataType = "xml"), x.getResponseHeader = function (e) { var t = { "content-type": m.dataType }; return t[e] }, u && (x.status = Number(u.getAttribute("status")) || x.status, x.statusText = u.getAttribute("statusText") || x.statusText); var l = (m.dataType || "").toLowerCase(), c = /(json|script|text)/.test(l); if (c || m.textarea) { var f = M.getElementsByTagName("textarea")[0]; if (f) x.responseText = f.value, x.status = Number(f.getAttribute("status")) || x.status, x.statusText = f.getAttribute("statusText") || x.statusText; else if (c) { var d = M.getElementsByTagName("pre")[0], h = M.getElementsByTagName("body")[0]; d ? x.responseText = d.textContent ? d.textContent : d.innerText : h && (x.responseText = h.textContent ? h.textContent : h.innerText) } } else "xml" == l && !x.responseXML && x.responseText && (x.responseXML = X(x.responseText)); try { L = _(x, l, m) } catch (b) { i = "parsererror", x.error = r = b || i } } catch (b) { a("error caught: ", b), i = "error", x.error = r = b || i } x.aborted && (a("upload aborted"), i = null), x.status && (i = x.status >= 200 && 300 > x.status || 304 === x.status ? "success" : "error"), "success" === i ? (m.success && m.success.call(m.context, L, "success", x), S.resolve(x.responseText, "success", x), p && e.event.trigger("ajaxSuccess", [x, m])) : i && (void 0 === r && (r = x.statusText), m.error && m.error.call(m.context, x, i, r), S.reject(x, "error", r), p && e.event.trigger("ajaxError", [x, m, r])), p && e.event.trigger("ajaxComplete", [x, m]), p && !--e.active && e.event.trigger("ajaxStop"), m.complete && m.complete.call(m.context, x, i), F = !0, m.timeout && clearTimeout(j), setTimeout(function () { m.iframeTarget || v.remove(), x.responseXML = null }, 100) } } } var l, c, m, p, d, v, g, x, b, y, T, j, w = f[0], S = e.Deferred(); if (r) for (c = 0; h.length > c; c++)l = e(h[c]), i ? l.prop("disabled", !1) : l.removeAttr("disabled"); if (m = e.extend(!0, {}, e.ajaxSettings, t), m.context = m.context || m, d = "jqFormIO" + (new Date).getTime(), m.iframeTarget ? (v = e(m.iframeTarget), y = v.attr2("name"), y ? d = y : v.attr2("name", d)) : (v = e('<iframe name="' + d + '" src="' + m.iframeSrc + '" />'), v.css({ position: "absolute", top: "-1000px", left: "-1000px" })), g = v[0], x = { aborted: 0, responseText: null, responseXML: null, status: 0, statusText: "n/a", getAllResponseHeaders: function () { }, getResponseHeader: function () { }, setRequestHeader: function () { }, abort: function (t) { var r = "timeout" === t ? "timeout" : "aborted"; a("aborting upload... " + r), this.aborted = 1; try { g.contentWindow.document.execCommand && g.contentWindow.document.execCommand("Stop") } catch (n) { } v.attr("src", m.iframeSrc), x.error = r, m.error && m.error.call(m.context, x, r, t), p && e.event.trigger("ajaxError", [x, m, r]), m.complete && m.complete.call(m.context, x, r) } }, p = m.global, p && 0 === e.active++ && e.event.trigger("ajaxStart"), p && e.event.trigger("ajaxSend", [x, m]), m.beforeSend && m.beforeSend.call(m.context, x, m) === !1) return m.global && e.active--, S.reject(), S; if (x.aborted) return S.reject(), S; b = w.clk, b && (y = b.name, y && !b.disabled && (m.extraData = m.extraData || {}, m.extraData[y] = b.value, "image" == b.type && (m.extraData[y + ".x"] = w.clk_x, m.extraData[y + ".y"] = w.clk_y))); var k = 1, D = 2, A = e("meta[name=csrf-token]").attr("content"), E = e("meta[name=csrf-param]").attr("content"); E && A && (m.extraData = m.extraData || {}, m.extraData[E] = A), m.forceSync ? o() : setTimeout(o, 10); var L, M, F, O = 50, X = e.parseXML || function (e, t) { return window.ActiveXObject ? (t = new ActiveXObject("Microsoft.XMLDOM"), t.async = "false", t.loadXML(e)) : t = (new DOMParser).parseFromString(e, "text/xml"), t && t.documentElement && "parsererror" != t.documentElement.nodeName ? t : null }, C = e.parseJSON || function (e) { return window.eval("(" + e + ")") }, _ = function (t, r, a) { var n = t.getResponseHeader("content-type") || "", i = "xml" === r || !r && n.indexOf("xml") >= 0, o = i ? t.responseXML : t.responseText; return i && "parsererror" === o.documentElement.nodeName && e.error && e.error("parsererror"), a && a.dataFilter && (o = a.dataFilter(o, r)), "string" == typeof o && ("json" === r || !r && n.indexOf("json") >= 0 ? o = C(o) : ("script" === r || !r && n.indexOf("javascript") >= 0) && e.globalEval(o)), o }; return S } if (!this.length) return a("ajaxSubmit: skipping submit process - no element selected"), this; var u, l, c, f = this; "function" == typeof t && (t = { success: t }), u = t.type || this.attr2("method"), l = t.url || this.attr2("action"), c = "string" == typeof l ? e.trim(l) : "", c = c || window.location.href || "", c && (c = (c.match(/^([^#]+)/) || [])[1]), t = e.extend(!0, { url: c, success: e.ajaxSettings.success, type: u || "GET", iframeSrc: /^https/i.test(window.location.href || "") ? "javascript:false" : "about:blank" }, t); var m = {}; if (this.trigger("form-pre-serialize", [this, t, m]), m.veto) return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"), this; if (t.beforeSerialize && t.beforeSerialize(this, t) === !1) return a("ajaxSubmit: submit aborted via beforeSerialize callback"), this; var p = t.traditional; void 0 === p && (p = e.ajaxSettings.traditional); var d, h = [], v = this.formToArray(t.semantic, h); if (t.data && (t.extraData = t.data, d = e.param(t.data, p)), t.beforeSubmit && t.beforeSubmit(v, this, t) === !1) return a("ajaxSubmit: submit aborted via beforeSubmit callback"), this; if (this.trigger("form-submit-validate", [v, this, t, m]), m.veto) return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"), this; var g = e.param(v, p); d && (g = g ? g + "&" + d : d), "GET" == t.type.toUpperCase() ? (t.url += (t.url.indexOf("?") >= 0 ? "&" : "?") + g, t.data = null) : t.data = g; var x = []; if (t.resetForm && x.push(function () { f.resetForm() }), t.clearForm && x.push(function () { f.clearForm(t.includeHidden) }), !t.dataType && t.target) { var b = t.success || function () { }; x.push(function (r) { var a = t.replaceTarget ? "replaceWith" : "html"; e(t.target)[a](r).each(b, arguments) }) } else t.success && x.push(t.success); if (t.success = function (e, r, a) { for (var n = t.context || this, i = 0, o = x.length; o > i; i++)x[i].apply(n, [e, r, a || f, f]) }, t.error) { var y = t.error; t.error = function (e, r, a) { var n = t.context || this; y.apply(n, [e, r, a, f]) } } if (t.complete) { var T = t.complete; t.complete = function (e, r) { var a = t.context || this; T.apply(a, [e, r, f]) } } var j = e('input[type=file]:enabled[value!=""]', this), w = j.length > 0, S = "multipart/form-data", k = f.attr("enctype") == S || f.attr("encoding") == S, D = n.fileapi && n.formdata; a("fileAPI :" + D); var A, E = (w || k) && !D; t.iframe !== !1 && (t.iframe || E) ? t.closeKeepAlive ? e.get(t.closeKeepAlive, function () { A = s(v) }) : A = s(v) : A = (w || k) && D ? o(v) : e.ajax(t), f.removeData("jqxhr").data("jqxhr", A); for (var L = 0; h.length > L; L++)h[L] = null; return this.trigger("form-submit-notify", [this, t]), this }, e.fn.ajaxForm = function (n) { if (n = n || {}, n.delegation = n.delegation && e.isFunction(e.fn.on), !n.delegation && 0 === this.length) { var i = { s: this.selector, c: this.context }; return !e.isReady && i.s ? (a("DOM not ready, queuing ajaxForm"), e(function () { e(i.s, i.c).ajaxForm(n) }), this) : (a("terminating; zero elements found by selector" + (e.isReady ? "" : " (DOM not ready)")), this) } return n.delegation ? (e(document).off("submit.form-plugin", this.selector, t).off("click.form-plugin", this.selector, r).on("submit.form-plugin", this.selector, n, t).on("click.form-plugin", this.selector, n, r), this) : this.ajaxFormUnbind().on("submit.form-plugin", n, t).on("click.form-plugin", n, r) }, e.fn.ajaxFormUnbind = function () { return this.off("submit.form-plugin click.form-plugin") }, e.fn.formToArray = function (t, r) { var a = []; if (0 === this.length) return a; var i = this[0], o = t ? i.getElementsByTagName("*") : i.elements; if (!o) return a; var s, u, l, c, f, m, p; for (s = 0, m = o.length; m > s; s++)if (f = o[s], l = f.name, l && !f.disabled) if (t && i.clk && "image" == f.type) i.clk == f && (a.push({ name: l, value: e(f).val(), type: f.type }), a.push({ name: l + ".x", value: i.clk_x }, { name: l + ".y", value: i.clk_y })); else if (c = e.fieldValue(f, !0), c && c.constructor == Array) for (r && r.push(f), u = 0, p = c.length; p > u; u++)a.push({ name: l, value: c[u] }); else if (n.fileapi && "file" == f.type) { r && r.push(f); var d = f.files; if (d.length) for (u = 0; d.length > u; u++)a.push({ name: l, value: d[u], type: f.type }); else a.push({ name: l, value: "", type: f.type }) } else null !== c && c !== void 0 && (r && r.push(f), a.push({ name: l, value: c, type: f.type, required: f.required })); if (!t && i.clk) { var h = e(i.clk), v = h[0]; l = v.name, l && !v.disabled && "image" == v.type && (a.push({ name: l, value: h.val() }), a.push({ name: l + ".x", value: i.clk_x }, { name: l + ".y", value: i.clk_y })) } return a }, e.fn.formSerialize = function (t) { return e.param(this.formToArray(t)) }, e.fn.fieldSerialize = function (t) { var r = []; return this.each(function () { var a = this.name; if (a) { var n = e.fieldValue(this, t); if (n && n.constructor == Array) for (var i = 0, o = n.length; o > i; i++)r.push({ name: a, value: n[i] }); else null !== n && n !== void 0 && r.push({ name: this.name, value: n }) } }), e.param(r) }, e.fn.fieldValue = function (t) { for (var r = [], a = 0, n = this.length; n > a; a++) { var i = this[a], o = e.fieldValue(i, t); null === o || void 0 === o || o.constructor == Array && !o.length || (o.constructor == Array ? e.merge(r, o) : r.push(o)) } return r }, e.fieldValue = function (t, r) { var a = t.name, n = t.type, i = t.tagName.toLowerCase(); if (void 0 === r && (r = !0), r && (!a || t.disabled || "reset" == n || "button" == n || ("checkbox" == n || "radio" == n) && !t.checked || ("submit" == n || "image" == n) && t.form && t.form.clk != t || "select" == i && -1 == t.selectedIndex)) return null; if ("select" == i) { var o = t.selectedIndex; if (0 > o) return null; for (var s = [], u = t.options, l = "select-one" == n, c = l ? o + 1 : u.length, f = l ? o : 0; c > f; f++) { var m = u[f]; if (m.selected) { var p = m.value; if (p || (p = m.attributes && m.attributes.value && !m.attributes.value.specified ? m.text : m.value), l) return p; s.push(p) } } return s } return e(t).val() }, e.fn.clearForm = function (t) { return this.each(function () { e("input,select,textarea", this).clearFields(t) }) }, e.fn.clearFields = e.fn.clearInputs = function (t) { var r = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; return this.each(function () { var a = this.type, n = this.tagName.toLowerCase(); r.test(a) || "textarea" == n ? this.value = "" : "checkbox" == a || "radio" == a ? this.checked = !1 : "select" == n ? this.selectedIndex = -1 : "file" == a ? /MSIE/.test(navigator.userAgent) ? e(this).replaceWith(e(this).clone(!0)) : e(this).val("") : t && (t === !0 && /hidden/.test(a) || "string" == typeof t && e(this).is(t)) && (this.value = "") }) }, e.fn.resetForm = function () { return this.each(function () { ("function" == typeof this.reset || "object" == typeof this.reset && !this.reset.nodeType) && this.reset() }) }, e.fn.enable = function (e) { return void 0 === e && (e = !0), this.each(function () { this.disabled = !e }) }, e.fn.selected = function (t) { return void 0 === t && (t = !0), this.each(function () { var r = this.type; if ("checkbox" == r || "radio" == r) this.checked = t; else if ("option" == this.tagName.toLowerCase()) { var a = e(this).parent("select"); t && a[0] && "select-one" == a[0].type && a.find("option").selected(!1), this.selected = t } }) }, e.fn.ajaxSubmit.debug = !1 })(jQuery);


/* Cookie Plugin 
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function (d, e, b) { if (arguments.length > 1 && (e === null || typeof e !== "object")) { b = jQuery.extend({}, b); if (e === null) { b.expires = -1 } if (typeof b.expires === "number") { var g = b.expires, c = b.expires = new Date(); c.setDate(c.getDate() + g) } return (document.cookie = [encodeURIComponent(d), "=", b.raw ? String(e) : encodeURIComponent(String(e)), b.expires ? "; expires=" + b.expires.toUTCString() : "", b.path ? "; path=" + b.path : "", b.domain ? "; domain=" + b.domain : "", b.secure ? "; secure" : ""].join("")) } b = e || {}; var a, f = b.raw ? function (h) { return h } : decodeURIComponent; return (a = new RegExp("(?:^|; )" + encodeURIComponent(d) + "=([^;]*)").exec(document.cookie)) ? f(a[1]) : null };

/* Table Sorter */
(function ($) {
    $.extend({
        tablesorter: new
            function () {
                var parsers = [], widgets = []; this.defaults = { cssHeader: "header", cssAsc: "headerSortUp", cssDesc: "headerSortDown", cssChildRow: "expand-child", sortInitialOrder: "asc", sortMultiSortKey: "shiftKey", sortForce: null, sortAppend: null, sortLocaleCompare: true, textExtraction: "simple", parsers: {}, widgets: [], widgetZebra: { css: ["even", "odd"] }, headers: {}, widthFixed: false, cancelSelection: true, sortList: [], headerList: [], dateFormat: "us", decimal: '/\.|\,/g', onRenderHeader: null, selectorHeaders: 'thead th', debug: false }; function benchmark(s, d) { log(s + "," + (new Date().getTime() - d.getTime()) + "ms"); } this.benchmark = benchmark; function log(s) { if (typeof console != "undefined" && typeof console.debug != "undefined") { console.log(s); } else { alert(s); } } function buildParserCache(table, $headers) { if (table.config.debug) { var parsersDebug = ""; } if (table.tBodies.length == 0) return; var rows = table.tBodies[0].rows; if (rows[0]) { var list = [], cells = rows[0].cells, l = cells.length; for (var i = 0; i < l; i++) { var p = false; if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) { p = getParserById($($headers[i]).metadata().sorter); } else if ((table.config.headers[i] && table.config.headers[i].sorter)) { p = getParserById(table.config.headers[i].sorter); } if (!p) { p = detectParserForColumn(table, rows, -1, i); } if (table.config.debug) { parsersDebug += "column:" + i + " parser:" + p.id + "\n"; } list.push(p); } } if (table.config.debug) { log(parsersDebug); } return list; }; function detectParserForColumn(table, rows, rowIndex, cellIndex) { var l = parsers.length, node = false, nodeValue = false, keepLooking = true; while (nodeValue == '' && keepLooking) { rowIndex++; if (rows[rowIndex]) { node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex); nodeValue = trimAndGetNodeText(table.config, node); if (table.config.debug) { log('Checking if value was empty on row:' + rowIndex); } } else { keepLooking = false; } } for (var i = 1; i < l; i++) { if (parsers[i].is(nodeValue, table, node)) { return parsers[i]; } } return parsers[0]; } function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) { return rows[rowIndex].cells[cellIndex]; } function trimAndGetNodeText(config, node) { return $.trim(getElementText(config, node)); } function getParserById(name) { var l = parsers.length; for (var i = 0; i < l; i++) { if (parsers[i].id.toLowerCase() == name.toLowerCase()) { return parsers[i]; } } return false; } function buildCache(table) { if (table.config.debug) { var cacheTime = new Date(); } var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0, totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0, parsers = table.config.parsers, cache = { row: [], normalized: [] }; for (var i = 0; i < totalRows; ++i) { var c = $(table.tBodies[0].rows[i]), cols = []; if (c.hasClass(table.config.cssChildRow)) { cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c); continue; } cache.row.push(c); for (var j = 0; j < totalCells; ++j) { cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j])); } cols.push(cache.normalized.length); cache.normalized.push(cols); cols = null; }; if (table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); } return cache; }; function getElementText(config, node) { var text = ""; if (!node) return ""; if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false; if (config.textExtraction == "simple") { if (config.supportsTextContent) { text = node.textContent; } else { if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) { text = node.childNodes[0].innerHTML; } else { text = node.innerHTML; } } } else { if (typeof (config.textExtraction) == "function") { text = config.textExtraction(node); } else { text = $(node).text(); } } return text; } function appendToTable(table, cache) { if (table.config.debug) { var appendTime = new Date() } var c = cache, r = c.row, n = c.normalized, totalRows = n.length, checkCell = (n[0].length - 1), tableBody = $(table.tBodies[0]), rows = []; for (var i = 0; i < totalRows; i++) { var pos = n[i][checkCell]; rows.push(r[pos]); if (!table.config.appender) { var l = r[pos].length; for (var j = 0; j < l; j++) { tableBody[0].appendChild(r[pos][j]); } } } if (table.config.appender) { table.config.appender(table, rows); } rows = null; if (table.config.debug) { benchmark("Rebuilt table:", appendTime); } applyWidget(table); setTimeout(function () { $(table).trigger("sortEnd"); }, 0); }; function buildHeaders(table) { if (table.config.debug) { var time = new Date(); } var meta = ($.metadata) ? true : false; var header_index = computeTableHeaderCellIndexes(table); $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) { this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex]; this.order = formatSortingOrder(table.config.sortInitialOrder); this.count = this.order; if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true; if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index); if (!this.sortDisabled) { var $th = $(this).addClass(table.config.cssHeader); if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th); } table.config.headerList[index] = this; }); if (table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); } return $tableHeaders; }; function computeTableHeaderCellIndexes(t) {
                    var matrix = []; var lookup = {}; var thead = t.getElementsByTagName('THEAD')[0]; var trs = thead.getElementsByTagName('TR'); for (var i = 0; i < trs.length; i++) {
                        var cells = trs[i].cells; for (var j = 0; j < cells.length; j++) {
                            var c = cells[j]; var rowIndex = c.parentNode.rowIndex; var cellId = rowIndex + "-" + c.cellIndex; var rowSpan = c.rowSpan || 1; var colSpan = c.colSpan || 1
                            var firstAvailCol; if (typeof (matrix[rowIndex]) == "undefined") { matrix[rowIndex] = []; } for (var k = 0; k < matrix[rowIndex].length + 1; k++) { if (typeof (matrix[rowIndex][k]) == "undefined") { firstAvailCol = k; break; } } lookup[cellId] = firstAvailCol; for (var k = rowIndex; k < rowIndex + rowSpan; k++) { if (typeof (matrix[k]) == "undefined") { matrix[k] = []; } var matrixrow = matrix[k]; for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) { matrixrow[l] = "x"; } }
                        }
                    } return lookup;
                } function checkCellColSpan(table, rows, row) { var arr = [], r = table.tHead.rows, c = r[row].cells; for (var i = 0; i < c.length; i++) { var cell = c[i]; if (cell.colSpan > 1) { arr = arr.concat(checkCellColSpan(table, headerArr, row++)); } else { if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) { arr.push(cell); } } } return arr; }; function checkHeaderMetadata(cell) { if (($.metadata) && ($(cell).metadata().sorter === false)) { return true; }; return false; } function checkHeaderOptions(table, i) { if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; }; return false; } function checkHeaderOptionsSortingLocked(table, i) { if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder; return false; } function applyWidget(table) { var c = table.config.widgets; var l = c.length; for (var i = 0; i < l; i++) { getWidgetById(c[i]).format(table); } } function getWidgetById(name) { var l = widgets.length; for (var i = 0; i < l; i++) { if (widgets[i].id.toLowerCase() == name.toLowerCase()) { return widgets[i]; } } }; function formatSortingOrder(v) { if (typeof (v) != "Number") { return (v.toLowerCase() == "desc") ? 1 : 0; } else { return (v == 1) ? 1 : 0; } } function isValueInArray(v, a) { var l = a.length; for (var i = 0; i < l; i++) { if (a[i][0] == v) { return true; } } return false; } function setHeadersCss(table, $headers, list, css) { $headers.removeClass(css[0]).removeClass(css[1]); var h = []; $headers.each(function (offset) { if (!this.sortDisabled) { h[this.column] = $(this); } }); var l = list.length; for (var i = 0; i < l; i++) { h[list[i][0]].addClass(css[list[i][1]]); } } function fixColumnWidth(table, $headers) { var c = table.config; if (c.widthFixed) { var colgroup = $('<colgroup>'); $("tr:first td", table.tBodies[0]).each(function () { colgroup.append($('<col>').css('width', $(this).width())); }); $(table).prepend(colgroup); }; } function updateHeaderSortCount(table, sortList) { var c = table.config, l = sortList.length; for (var i = 0; i < l; i++) { var s = sortList[i], o = c.headerList[s[0]]; o.count = s[1]; o.count++; } } function multisort(table, sortList, cache) { if (table.config.debug) { var sortTime = new Date(); } var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length; for (var i = 0; i < l; i++) { var c = sortList[i][0]; var order = sortList[i][1]; var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c)); var e = "e" + i; dynamicExp += "var " + e + " = " + s; dynamicExp += "if(" + e + ") { return " + e + "; } "; dynamicExp += "else { "; } var orgOrderCol = cache.normalized[0].length - 1; dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];"; for (var i = 0; i < l; i++) { dynamicExp += "}; "; } dynamicExp += "return 0; "; dynamicExp += "}; "; if (table.config.debug) { benchmark("Evaling expression:" + dynamicExp, new Date()); } eval(dynamicExp); cache.normalized.sort(sortWrapper); if (table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime); } return cache; }; function makeSortFunction(type, direction, index) { var a = "a[" + index + "]", b = "b[" + index + "]"; if (type == 'text' && direction == 'asc') { return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));"; } else if (type == 'text' && direction == 'desc') { return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));"; } else if (type == 'numeric' && direction == 'asc') { return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));"; } else if (type == 'numeric' && direction == 'desc') { return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));"; } }; function makeSortText(i) { return "((a[" + i + "] < b[" + i + "]) ? -1 : ((a[" + i + "] > b[" + i + "]) ? 1 : 0));"; }; function makeSortTextDesc(i) { return "((b[" + i + "] < a[" + i + "]) ? -1 : ((b[" + i + "] > a[" + i + "]) ? 1 : 0));"; }; function makeSortNumeric(i) { return "a[" + i + "]-b[" + i + "];"; }; function makeSortNumericDesc(i) { return "b[" + i + "]-a[" + i + "];"; }; function sortText(a, b) { if (table.config.sortLocaleCompare) return a.localeCompare(b); return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }; function sortTextDesc(a, b) { if (table.config.sortLocaleCompare) return b.localeCompare(a); return ((b < a) ? -1 : ((b > a) ? 1 : 0)); }; function sortNumeric(a, b) { return a - b; }; function sortNumericDesc(a, b) { return b - a; }; function getCachedSortType(parsers, i) { return parsers[i].type; }; this.construct = function (settings) { return this.each(function () { if (!this.tHead || !this.tBodies) return; var $this, $document, $headers, cache, config, shiftDown = 0, sortOrder; this.config = {}; config = $.extend(this.config, $.tablesorter.defaults, settings); $this = $(this); $.data(this, "tablesorter", config); $headers = buildHeaders(this); this.config.parsers = buildParserCache(this, $headers); cache = buildCache(this); var sortCSS = [config.cssDesc, config.cssAsc]; fixColumnWidth(this); $headers.click(function (e) { var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0; if (!this.sortDisabled && totalRows > 0) { $this.trigger("sortStart"); var $cell = $(this); var i = this.column; this.order = this.count++ % 2; if (this.lockedOrder) this.order = this.lockedOrder; if (!e[config.sortMultiSortKey]) { config.sortList = []; if (config.sortForce != null) { var a = config.sortForce; for (var j = 0; j < a.length; j++) { if (a[j][0] != i) { config.sortList.push(a[j]); } } } config.sortList.push([i, this.order]); } else { if (isValueInArray(i, config.sortList)) { for (var j = 0; j < config.sortList.length; j++) { var s = config.sortList[j], o = config.headerList[s[0]]; if (s[0] == i) { o.count = s[1]; o.count++; s[1] = o.count % 2; } } } else { config.sortList.push([i, this.order]); } }; setTimeout(function () { setHeadersCss($this[0], $headers, config.sortList, sortCSS); appendToTable($this[0], multisort($this[0], config.sortList, cache)); }, 1); return false; } }).mousedown(function () { if (config.cancelSelection) { this.onselectstart = function () { return false }; return false; } }); $this.on("update", function () { var me = this; setTimeout(function () { me.config.parsers = buildParserCache(me, $headers); cache = buildCache(me); }, 1); }).on("updateCell", function (e, cell) { var config = this.config; var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex]; cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(getElementText(config, cell), cell); }).on("sorton", function (e, list) { $(this).trigger("sortStart"); config.sortList = list; var sortList = config.sortList; updateHeaderSortCount(this, sortList); setHeadersCss(this, $headers, sortList, sortCSS); appendToTable(this, multisort(this, sortList, cache)); }).on("appendCache", function () { appendToTable(this, cache); }).on("applyWidgetId", function (e, id) { getWidgetById(id).format(this); }).on("applyWidgets", function () { applyWidget(this); }); if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) { config.sortList = $(this).metadata().sortlist; } if (config.sortList.length > 0) { $this.trigger("sorton", [config.sortList]); } applyWidget(this); }); }; this.addParser = function (parser) { var l = parsers.length, a = true; for (var i = 0; i < l; i++) { if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) { a = false; } } if (a) { parsers.push(parser); }; }; this.addWidget = function (widget) { widgets.push(widget); }; this.formatFloat = function (s) { var i = parseFloat(s); return (isNaN(i)) ? 0 : i; }; this.formatInt = function (s) { var i = parseInt(s); return (isNaN(i)) ? 0 : i; }; this.isDigit = function (s, config) { return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, ''))); }; this.clearTableBody = function (table) { if ($.browser.msie) { function empty() { while (this.firstChild) this.removeChild(this.firstChild); } empty.apply(table.tBodies[0]); } else { table.tBodies[0].innerHTML = ""; } };
            }
    }); $.fn.extend({ tablesorter: $.tablesorter.construct }); var ts = $.tablesorter; ts.addParser({ id: "text", is: function (s) { return true; }, format: function (s) { return $.trim(s.toLocaleLowerCase()); }, type: "text" }); ts.addParser({ id: "digit", is: function (s, table) { var c = table.config; return $.tablesorter.isDigit(s, c); }, format: function (s) { return $.tablesorter.formatFloat(s); }, type: "numeric" }); ts.addParser({ id: "currency", is: function (s) { return /^[£$€?.]/.test(s); }, format: function (s) { return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), "")); }, type: "numeric" }); ts.addParser({ id: "ipAddress", is: function (s) { return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s); }, format: function (s) { var a = s.split("."), r = "", l = a.length; for (var i = 0; i < l; i++) { var item = a[i]; if (item.length == 2) { r += "0" + item; } else { r += item; } } return $.tablesorter.formatFloat(r); }, type: "numeric" }); ts.addParser({ id: "url", is: function (s) { return /^(https?|ftp|file):\/\/$/.test(s); }, format: function (s) { return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), '')); }, type: "text" }); ts.addParser({ id: "isoDate", is: function (s) { return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s); }, format: function (s) { return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0"); }, type: "numeric" }); ts.addParser({ id: "percent", is: function (s) { return /\%$/.test($.trim(s)); }, format: function (s) { return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), "")); }, type: "numeric" }); ts.addParser({ id: "usLongDate", is: function (s) { return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/)); }, format: function (s) { return $.tablesorter.formatFloat(new Date(s).getTime()); }, type: "numeric" }); ts.addParser({ id: "shortDate", is: function (s) { return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s); }, format: function (s, table) { var c = table.config; s = s.replace(/\-/g, "/"); if (c.dateFormat == "us") { s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2"); } else if (c.dateFormat == "uk") { s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1"); } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") { s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3"); } return $.tablesorter.formatFloat(new Date(s).getTime()); }, type: "numeric" }); ts.addParser({ id: "time", is: function (s) { return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s); }, format: function (s) { return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime()); }, type: "numeric" }); ts.addParser({ id: "metadata", is: function (s) { return false; }, format: function (s, table, cell) { var c = table.config, p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName; return $(cell).metadata()[p]; }, type: "numeric" }); ts.addWidget({ id: "zebra", format: function (table) { if (table.config.debug) { var time = new Date(); } var $tr, row = -1, odd; $("tr:visible", table.tBodies[0]).each(function (i) { $tr = $(this); if (!$tr.hasClass(table.config.cssChildRow)) row++; odd = (row % 2 == 0); $tr.removeClass(table.config.widgetZebra.css[odd ? 0 : 1]).addClass(table.config.widgetZebra.css[odd ? 1 : 0]) }); if (table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); } } });
})(jQuery);

/* 
* Custom Select Box/upload/radio/checkbox
*/
(function ($) { $.jStyling = function (a) { $.jStyling.main.init(a) }; $.jStyling.createSelect = function (a, b) { $.jStyling.main.createSelect(a, b) }; $.jStyling.updateSelect = function (a) { $.jStyling.main.updateSelect(a) }; $.jStyling.destroySelect = function (a) { $.jStyling.main.destroySelect(a) }; $.jStyling.createCheckbox = function (a, b) { $.jStyling.main.createCheckbox(a, b) }; $.jStyling.updateCheckbox = function (a) { $.jStyling.main.updateCheckbox(a) }; $.jStyling.destroyCheckbox = function (a) { $.jStyling.main.destroyCheckbox(a) }; $.jStyling.createRadio = function (a, b) { $.jStyling.main.createRadio(a, b) }; $.jStyling.updateRadio = function (a) { $.jStyling.main.updateRadio(a) }; $.jStyling.destroyRadio = function (a) { $.jStyling.main.destroyRadio(a) }; $.jStyling.createFileInput = function (a, b) { $.jStyling.main.createFileInput(a, b) }; $.jStyling.destroyFileInput = function (a) { $.jStyling.main.destroyFileInput(a) }; $.fn.jStyling = function (a) { return $.jStyling(a) }; $.jStyling.settings = { selectClass: { 'w': 'jstyling-select', 's': 'jstyling-select-s', 'l': 'jstyling-select-l', 't': 'jstyling-select-t' }, checkboxClass: 'jstyling-checkbox', radioClass: 'jstyling-radio', fileClass: { 'w': 'jstyling-file', 'f': 'jstyling-file-f', 'b': 'jstyling-file-b' }, fileButtonText: 'Browse' }; $.jStyling.customOptions = {}; $.jStyling.main = { init: function (a) { $.extend($.jStyling.settings, a || {}) }, checkType: function (a, b) { var c = $(a).is(b) ? true : false; return c }, createSelect: function (m, n) { $.jStyling.customOptions = (n) ? n : {}; return m.each(function () { if (!$.jStyling.main.checkType(this, 'select')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.selectClass.w)) { return false } var d = this; var f = $('<div>').addClass($.jStyling.settings.selectClass.w); if ($(d).attr('disabled')) { f.addClass('disabled') } if ($.jStyling.customOptions.extraClass) { $(f).addClass($.jStyling.customOptions.extraClass) } var g = $('<div>').addClass($.jStyling.settings.selectClass.s); var h = $('<div>').addClass($.jStyling.settings.selectClass.t); var j = $(d).find('option'); var k = '<div class="' + $.jStyling.settings.selectClass.l + '">'; for (var i = 0; i < j.length; i++) { var l = ($(j[i]).attr('disabled')) ? 'item-' + $(j[i]).val() + ' disabled' : 'item-' + $(j[i]).val(); k = k + '<div class="' + l + '">' + $(j[i]).html() + '</div>' } k = k + '</div>'; h.html($(d).find('option:selected').html()); f.append(k).append(g); g.append(h); $(d).before(f).hide(); $(f).append(d); $(f).find('.' + $.jStyling.settings.selectClass.l + ' div').on('click', function () { if (!$(this).is('.disabled')) { var a = $(this).attr('class').replace('item-', '').replace(' disabled', ''); var b = $(d).find('option[value="' + a + '"]'); $(d).get(0).selectedIndex = parseInt($(b).index()); $(d).trigger('change'); h.html($(b).html()) } }); f.on('click', function () { if (!$(this).find('select').attr('disabled')) { var c = $(this).is(' .active'); if (false == c) { $('.' + $.jStyling.settings.selectClass.l + ':visible').parent().removeClass('active') } $(this).toggleClass('active'); if (false == c) { $(document).off('click.closeSelect').on('click.closeSelect', function (e) { var a = e.target; var b = $('.' + $.jStyling.settings.selectClass.l + ':visible').parent().find('*').andSelf(); if ($.inArray(a, b) < 0) { $('.' + $.jStyling.settings.selectClass.w).removeClass('active'); $(document).off('click.closeSelect') } }) } } }) }) }, updateSelect: function (k) { return k.each(function () { if (!$.jStyling.main.checkType(this, 'select')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.selectClass.w)) { var c = this; if ($(c).attr('disabled')) { $(c).parent().addClass('disabled') } else { $(c).parent().removeClass('disabled') } var d = $(c).parent().find('.' + $.jStyling.settings.selectClass.s); var e = $(d).find('.' + $.jStyling.settings.selectClass.t); var f = $(c).parent().find('.' + $.jStyling.settings.selectClass.l); var g = $(c).find('option'); var h = ''; for (var i = 0; i < g.length; i++) { var j = ($(g[i]).attr('disabled')) ? 'item-' + $(g[i]).val() + ' disabled' : 'item-' + $(g[i]).val(); h = h + '<div class="' + j + '">' + $(g[i]).html() + '</div>' } $(f).html(h); $(f).find(' div').off('click').on('click', function () { if (!$(this).is('.disabled')) { var a = $(this).attr('class').replace('item-', '').replace(' disabled', ''); var b = $(c).find('option[value="' + a + '"]'); $(c).get(0).selectedIndex = parseInt($(b).index()); $(c).trigger('change'); $(e).html(b.html()) } }); $(e).html($(c).find('option:selected').html()) } }) }, destroySelect: function (c) { return c.each(function () { if (!$.jStyling.main.checkType(this, 'select')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.selectClass.w)) { var a = this; var b = $(a).parent(); $(document).off('click.closeSelect'); $(b).before($(a)); $(b).remove(); $(a).show() } }) }, createCheckbox: function (f, g) { $.jStyling.customOptions = (g) ? g : {}; return f.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=checkbox]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.checkboxClass)) { return false } var a = this; var b = ($(a).is(':checked')) ? ' active' : ''; var c = ($(a).attr('disabled')) ? ' disabled' : ''; var d = $('<div>').addClass($.jStyling.settings.checkboxClass + b + c); if ($.jStyling.customOptions.extraClass) { $(d).addClass($.jStyling.customOptions.extraClass) } $(a).before(d); $(d).append(a); $(a).on('click.checkboxClick', function (e) { $(a).parent().toggleClass('active') }); $(d).on('click', function (e) { if ($(this).is('.disabled') == false && !$(e.target).is('input[type=checkbox]')) { $(a).trigger('click') } }) }) }, updateCheckbox: function (d) { return d.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=checkbox]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.checkboxClass)) { var a = this; var b = ($(a).is(' :checked')) ? ' active' : ''; var c = ($(a).attr('disabled')) ? ' disabled' : ''; $(a).parent().removeClass('active disabled').addClass(b + c) } }) }, destroyCheckbox: function (c) { return c.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=checkbox]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.checkboxClass)) { var a = this; var b = $(a).parent(); $(a).off('click.checkboxClick'); $(b).before($(a)); $(b).remove() } }) }, createRadio: function (f, g) { $.jStyling.customOptions = (g) ? g : {}; return f.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=radio]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.radioClass)) { return false } var a = this; var b = ($(a).is(':checked')) ? ' active' : ''; var c = ($(a).attr('disabled')) ? ' disabled' : ''; var d = $('<div>').addClass($.jStyling.settings.radioClass + b + c); if ($.jStyling.customOptions.extraClass) { $(d).addClass($.jStyling.customOptions.extraClass) } $(a).before(d); $(d).append(a); $(a).on('click.radioClick', function (e) { $('input[type=radio][name=' + $(a).attr('name') + ']').parent().removeClass('active'); $(a).parent().addClass('active') }); $(d).on('click', function (e) { if ($(this).is('.disabled') == false && !$(e.target).is('input[type=radio]')) { $(a).trigger('click') } }) }) }, updateRadio: function (d) { return d.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=radio]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.radioClass)) { var a = this; var b = ($(a).is(':checked')) ? ' active' : ''; var c = ($(a).attr('disabled')) ? ' disabled' : ''; $(a).parent().removeClass('active disabled').addClass(b + c) } }) }, destroyRadio: function (c) { return c.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=radio]')) { return false } if ($(this).parent().is('.' + $.jStyling.settings.radioClass)) { var a = this; var b = $(a).parent(); $(a).off('click.radioClick'); $(b).before($(a)); $(b).remove() } }) }, createFileInput: function (e, f) { $.jStyling.customOptions = (f) ? f : {}; return e.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=file]')) { return false } if (!$(this).parent().parent().is('.' + $.jStyling.settings.fileClass.w)) { var a = this; var b = $('<div>').addClass($.jStyling.settings.fileClass.w); var c = $('<div>').addClass($.jStyling.settings.fileClass.f); var d = $('<div>').addClass($.jStyling.settings.fileClass.b); if ($.jStyling.customOptions.extraClass) { $(b).addClass($.jStyling.customOptions.extraClass) } if ($.jStyling.customOptions.fileButtonText) { $(d).html($.jStyling.customOptions.fileButtonText) } else { $(d).html($.jStyling.settings.fileButtonText) } if ($(a).val() != '') { $(c).html($(a).val()) } $(b).append(c).append(d); $(a).before(b); $(d).append($(a)); var h = $(d).outerHeight(); $(a).css({ 'height': h + 'px', 'font-size': h + 'px' }).on('change', function () { $(this).parent().prev().html($(a).val()) }) } }) }, destroyFileInput: function (c) { return c.each(function () { if (!$.jStyling.main.checkType(this, 'input[type=file]')) { return false } if ($(this).parent().parent().is('.' + $.jStyling.settings.fileClass.w)) { var a = this; var b = $(a).parent().parent(); $(b).before($(a)); $(b).remove(); $(a).removeAttr('style') } }) } } })(jQuery);


/* Responsive Tables */
(function (e) { e.fn.responsiveTable = function (t) { return e(this).responsiveTableInit(t) }; e.fn.responsiveTableInit = function (t) { var n = e.extend({ preserveClasses: true, dynamic: true, displayResponsiveCallback: function () { return e(document).width() < 960 }, showSwitch: true, switchTitle: "Switch to default table view.", headerSelector: "thead td, thead th", bodyRowSelector: "tbody tr", responsiveRowElement: "<dl></dl>", responsiveColumnTitleElement: "<dt></dt>", responsiveColumnValueElement: "<dd></dd>" }, t); return this.each(function () { var t = e(this); t._responsiveTableCheckElement(false); if (t.data("webks-responsive-table-processed")) { t.responsiveTableUpdate(); return true } var r = e("<div></div>"); r.addClass("webks-responsive-table"); if (n.preserveClasses) { r.addClass(t.attr("class")) } var i = new Array; t.find(n.headerSelector).each(function (t, n) { var r = e(this).html(); i[t] = r }); t.find(n.bodyRowSelector).each(function (t, s) { var o = e(n.responsiveRowElement); o.addClass("row row-" + t); if (n.preserveClasses) { o.addClass(e(this).attr("class")) } e(this).children("td").each(function (t, r) { var s = e(n.responsiveColumnTitleElement); if (n.preserveClasses) { s.addClass(e(this).attr("class")) } s.addClass("title col-" + t); s.html(i[t]); var u = e(n.responsiveColumnValueElement); if (n.preserveClasses) { u.addClass(e(this).attr("class")) } u.addClass("value col-" + t); u.html(e(this).html()); o.append(s).append(u) }); r.append(o) }); t.after(r); if (n.dynamic) { if (n.showSwitch) { var s = e("<a>"); s.addClass("switchBtn"); s.attr("href", "#"); e("div.webks-responsive-table a.switchBtn").on("click", function (e) { t.responsiveTableShowTable(); e.preventDefault(); return false }); r.prepend(s) } t.data("webks-responsive-table", r); t.data("webks-responsive-table-processed", true); r.data("table", t); r.data("settings", n); t.data("webks-responsive-table-processed", true); t.hide(); t.responsiveTableUpdate() } else { t.remove() } }) }; e.fn.responsiveTableUpdate = function () { return this.each(function () { var t = e(this); t._responsiveTableCheckElement(true); var n = t.data("webks-responsive-table"); if (n != undefined) { var r = n.data("settings"); if (r != undefined) { if (r.dynamic) { if (!r.displayResponsiveCallback()) { t.responsiveTableShowTable() } else { t.responsiveTableShowResponsive() } } } } }) }; e.fn.responsiveTableShowTable = function () { return this.each(function () { var t = e(this); t._responsiveTableCheckElement(true); var n = t.data("webks-responsive-table"); if (n.length > 0) { t.show(); n.hide() } }) }; e.fn.responsiveTableShowResponsive = function () { return this.each(function () { var t = e(this); t._responsiveTableCheckElement(); var n = t.data("webks-responsive-table"); if (n.length > 0) { t.hide(); n.show() } }) }; e.fn._responsiveTableCheckElement = function (t) { if (t === undefined) { t = true } var n = e(this); if (!n.is("table")) { throw "The selected DOM element may only be a table!" } if (t && (n.data("webks-responsive-table-processed") === undefined || !n.data("webks-responsive-table-processed"))) { throw "The selected DOM element has to be initialized by webks-responsive-table first." } return n } })(jQuery)

/* Modal */
function Messi(data, options) { var _this = this; _this.options = jQuery.extend({}, Messi.prototype.options, options || {}); _this.messi = jQuery(_this.template); _this.setContent(data); if (_this.options.title == null) { jQuery(".messi-titlebox", _this.messi).remove() } else { jQuery(".messi-title", _this.messi).append(_this.options.title); if (_this.options.buttons.length === 0 || !_this.options.autoclose) { if (_this.options.closeButton) { var close = jQuery('<a class="messi-closebtn"><i class="icon-remove-sign"></i></a>'); close.on("click", function () { _this.hide() }); jQuery(".messi-titlebox", this.messi).prepend(close) } } if (_this.options.titleClass != null) { jQuery(".messi-titlebox", this.messi).addClass(_this.options.titleClass) } } if (_this.options.width != null) { jQuery(".messi-box", _this.messi).css("width", _this.options.width) } if (_this.options.buttons.length > 0) { for (var i = 0; i < _this.options.buttons.length; i++) { var cls = (_this.options.buttons[i]["class"]) ? _this.options.buttons[i]["class"] : ""; var btn = jQuery('<div class="btnbox"><a class="mod-button ' + cls + '"><i class="icon-ok"></i> ' + _this.options.buttons[i].label + "</a></div>").data("value", _this.options.buttons[i].val); btn.on("click", function () { var value = jQuery.data(this, "value"); var after = (_this.options.callback != null) ? function () { _this.options.callback(value) } : null; _this.hide(after) }); jQuery(".messi-actions", this.messi).append(btn) } } else { jQuery(".messi-footbox", this.messi).remove() } _this.modal = (_this.options.modal) ? jQuery('<div class="messi-modal"></div>').css({ opacity: _this.options.modalOpacity, width: jQuery(document).width(), height: jQuery(document).height(), "z-index": _this.options.zIndex + jQuery(".messi").length }).appendTo(document.body) : null; if (_this.options.show) { _this.show() } jQuery(window).on("resize", function () { _this.resize() }); if (_this.options.autoclose != null) { setTimeout(function (_this) { _this.hide() }, _this.options.autoclose, this) } return _this } Messi.prototype = { options: { autoclose: null, buttons: [], callback: null, center: true, closeButton: true, height: "auto", title: null, titleClass: null, modal: false, modalOpacity: 0.4, show: true, unload: true, viewport: { top: "0px", left: "0px" }, width: "", zIndex: 99999 }, template: '<div class="messi"><div class="messi-box"><div class="messi-wrapper"><div class="messi-titlebox"><span class="messi-title"></span></div><div class="messi-content"></div><div class="messi-footbox clearfix"><div class="messi-actions clearfix"></div></div></div></div></div>', content: "<div></div>", visible: false, setContent: function (data) { jQuery(".messi-content", this.messi).css({ height: this.options.height }).empty().append(data) }, viewport: function () { return { top: ((jQuery(window).height() - this.messi.height()) / 2) + jQuery(window).scrollTop() + "px", left: ((jQuery(window).width() - this.messi.width()) / 2) + jQuery(window).scrollLeft() + "px" } }, show: function () { if (this.visible) { return } if (this.options.modal && this.modal != null) { this.modal.show() } this.messi.appendTo(document.body); if (this.options.center) { this.options.viewport = this.viewport(jQuery(".messi-box", this.messi)) } this.messi.css({ top: this.options.viewport.top, left: this.options.viewport.left, "z-index": this.options.zIndex + jQuery(".messi").length }).show().animate({ opacity: 1 }, 300); this.visible = true }, hide: function (after) { if (!this.visible) { return } var _this = this; this.messi.animate({ opacity: 0 }, 600, function () { if (_this.options.modal && _this.modal != null) { _this.modal.remove() } _this.messi.css({ display: "none" }).remove(); _this.visible = false; if (after) { after.call() } if (_this.options.unload) { _this.uncdp_load() } }); return this }, resize: function () { if (this.options.modal) { jQuery(".messi-modal").css({ width: jQuery(document).width(), height: jQuery(document).height() }) } if (this.options.center) { this.options.viewport = this.viewport(jQuery(".messi-box", this.messi)); this.messi.css({ top: this.options.viewport.top, left: this.options.viewport.left }) } }, toggle: function () { this[this.visible ? "hide" : "show"](); return this }, unload: function () { if (this.visible) { this.hide() } jQuery(window).off("resize", function () { this.resize() }); this.messi.remove() } }; jQuery.extend(Messi, { alert: function (data, callback, options) { var buttons = [{ id: "ok", label: "OK", val: "OK" }]; options = jQuery.extend({ closeButton: false, buttons: buttons, callback: function () { } }, options || {}, { show: true, unload: true, callback: callback }); return new Messi(data, options) }, ask: function (data, callback, options) { var buttons = [{ id: "yes", label: "Yes", val: "Y", "class": "btn-success" }, { id: "no", label: "No", val: "N", "class": "btn-danger" }]; options = jQuery.extend({ closeButton: false, modal: true, buttons: buttons, callback: function () { } }, options || {}, { show: true, unload: true, callback: callback }); return new Messi(data, options) }, img: function (src, options) { var img = new Image(); jQuery(img).cdp_load(function () { var vp = { width: jQuery(window).width() - 50, height: jQuery(window).height() - 50 }; var ratio = (this.width > vp.width || this.height > vp.height) ? Math.min(vp.width / this.width, vp.height / this.height) : 1; jQuery(img).css({ width: this.width * ratio, height: this.height * ratio }); options = jQuery.extend(options || {}, { show: true, unload: true, closeButton: true, width: this.width * ratio, height: this.height * ratio, padding: 0 }); new Messi(img, options) }).error(function () { console.log("Error loading " + src) }).attr("src", src) }, load: function (url, params, options, callback) { var buttons = []; options = jQuery.extend({ closeButton: true, modal: true, buttons: buttons, title: "" }, options || {}, { show: true, unload: true, callback: callback }); var request = { type: "post", url: url, data: params, cache: false, error: function (request, status, error) { console.log(request.responseText) }, success: function (html) { new Messi(html, options) } }; jQuery.ajax(request) } });

/* Color Picker */
(function (e) { var t = function () { function x(e) { if (e.originalEvent.preventDefault) e.originalEvent.preventDefault(); return false } var t = 65, n = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><label for="hex">#</label><input type="text" maxlength="6" size="6" id="hex" /></div><div class="colorpicker_rgb_r colorpicker_field"><label for="rbg_r">R</label><input type="text" maxlength="3" size="3" id="rgb_r" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><label for="rbg_g">G</label><input type="text" maxlength="3" size="3" id="rgb_g" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><label for="rbg_b">B</label><input type="text" maxlength="3" size="3" id="rgb_b" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><label for="hsb_h">H</label><input type="text" maxlength="3" size="3" id="hsb_h" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><label for="hsb_s">S</label><input type="text" maxlength="3" size="3" id="hsb_s" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><label for="hsb_b">B</label><input type="text" maxlength="3" size="3" id="hsb_b" /><span></span></div><div class="colorpicker_submit"></div></div>', r = { eventName: "click", onShow: function () { }, onBeforeShow: function () { }, onHide: function () { }, onChange: function () { }, onSubmit: function () { }, color: "ff0000", livePreview: true, flat: false }, i = function (t, n) { var r = HSBToRGB(t); e(n).data("colorpicker").fields.eq(1).val(r.r).end().eq(2).val(r.g).end().eq(3).val(r.b).end() }, s = function (t, n) { e(n).data("colorpicker").fields.eq(4).val(t.h).end().eq(5).val(t.s).end().eq(6).val(t.b).end() }, o = function (t, n) { e(n).data("colorpicker").fields.eq(0).val(HSBToHex(t)).end() }, u = function (t, n) { e(n).data("colorpicker").selector.css("backgroundColor", "#" + HSBToHex({ h: t.h, s: 100, b: 100 })); e(n).data("colorpicker").selectorIndic.css({ left: parseInt(150 * t.s / 100, 10), top: parseInt(150 * (100 - t.b) / 100, 10) }) }, a = function (t, n) { e(n).data("colorpicker").hue.css("top", parseInt(150 - 150 * t.h / 360, 10)) }, f = function (t, n) { e(n).data("colorpicker").currentColor.css("backgroundColor", "#" + HSBToHex(t)) }, l = function (t, n) { e(n).data("colorpicker").newColor.css("backgroundColor", "#" + HSBToHex(t)) }, c = function (n) { var r = n.charCode || n.keyCode || -1; if (r > t && r <= 90 || r === 32) { return false } var i = e(this).parent().parent(); if (i.data("colorpicker").livePreview === true) { h.apply(this) } }, h = function (t) { var n = e(this).parent().parent(), r; if (this.parentNode.className.indexOf("_hex") > 0) { n.data("colorpicker").color = r = HexToHSB(fixHex(this.value)) } else if (this.parentNode.className.indexOf("_hsb") > 0) { n.data("colorpicker").color = r = fixHSB({ h: parseInt(n.data("colorpicker").fields.eq(4).val(), 10), s: parseInt(n.data("colorpicker").fields.eq(5).val(), 10), b: parseInt(n.data("colorpicker").fields.eq(6).val(), 10) }) } else { n.data("colorpicker").color = r = RGBToHSB(fixRGB({ r: parseInt(n.data("colorpicker").fields.eq(1).val(), 10), g: parseInt(n.data("colorpicker").fields.eq(2).val(), 10), b: parseInt(n.data("colorpicker").fields.eq(3).val(), 10) })) } if (t) { i(r, n.get(0)); o(r, n.get(0)); s(r, n.get(0)) } u(r, n.get(0)); a(r, n.get(0)); l(r, n.get(0)); n.data("colorpicker").onChange.apply(n, [r, HSBToHex(r), HSBToRGB(r), n.data("colorpicker").parent]) }, p = function (t) { var n = e(this).parent().parent(); n.data("colorpicker").fields.parent().removeClass("colorpicker_focus") }, d = function () { t = this.parentNode.className.indexOf("_hex") > 0 ? 70 : 65; e(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus"); e(this).parent().addClass("colorpicker_focus") }, v = function (t) { var n = e(this).parent().find("input").focus(); var r = { el: e(this).parent().addClass("colorpicker_slider"), max: this.parentNode.className.indexOf("_hsb_h") > 0 ? 360 : this.parentNode.className.indexOf("_hsb") > 0 ? 100 : 255, y: t.pageY, field: n, val: parseInt(n.val(), 10), preview: e(this).parent().parent().data("colorpicker").livePreview }; e(document).on("mouseup", r, g); e(document).on("mousemove", r, m); return x(t) }, m = function (e) { e.data.field.val(Math.max(0, Math.min(e.data.max, parseInt(e.data.val + e.pageY - e.data.y, 10)))); if (e.data.preview) { h.apply(e.data.field.get(0), [true]) } return false }, g = function (t) { h.apply(t.data.field.get(0), [true]); t.data.el.removeClass("colorpicker_slider").find("input").focus(); e(document).off("mouseup", g); e(document).off("mousemove", m); return false }, b = function (t) { var n = { cal: e(this).parent(), y: e(this).offset().top }; n.preview = n.cal.data("colorpicker").livePreview; e(document).on("mouseup", n, E); e(document).on("mousemove", n, w); return x(t) }, w = function (e) { h.apply(e.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360 * (150 - Math.max(0, Math.min(150, e.pageY - e.data.y))) / 150, 10)).get(0), [e.data.preview]); return false }, E = function (t) { i(t.data.cal.data("colorpicker").color, t.data.cal.get(0)); o(t.data.cal.data("colorpicker").color, t.data.cal.get(0)); e(document).off("mouseup", E); e(document).off("mousemove", w); return false }, S = function (t) { y = e(this).offset().top; preview = t.data.cal.data("colorpicker").livePreview; h.apply(t.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360 * (150 - Math.max(0, Math.min(150, t.pageY - y))) / 150, 10)).get(0), [preview]) }; downSelector = function (t) { var n = { cal: e(this).parent(), pos: e(this).offset() }; n.preview = n.cal.data("colorpicker").livePreview; e(document).on("mouseup", n, upSelector); e(document).on("mousemove", n, moveSelector); e(".colorpicker_color").one("click", n, moveSelector); t.data = n; moveSelector(t); return x(t) }, moveSelector = function (e) { h.apply(e.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100 * (150 - Math.max(0, Math.min(150, e.pageY - e.data.pos.top))) / 150, 10)).end().eq(5).val(parseInt(100 * Math.max(0, Math.min(150, e.pageX - e.data.pos.left)) / 150, 10)).get(0), [e.data.preview]); return false }, upSelector = function (t) { var n = { cal: e(this).parent(), pos: e(this).offset() }; i(t.data.cal.data("colorpicker").color, t.data.cal.get(0)); o(t.data.cal.data("colorpicker").color, t.data.cal.get(0)); e(document).off("mouseup", upSelector); e(document).off("mousemove", moveSelector); return false }, enterSubmit = function (t) { e(this).addClass("colorpicker_focus") }, leaveSubmit = function (t) { e(this).removeClass("colorpicker_focus") }, clickSubmit = function (t) { var n = e(this).parent(); var r = n.data("colorpicker").color; n.data("colorpicker").origColor = r; f(r, n.get(0)); n.data("colorpicker").onSubmit(r, HSBToHex(r), HSBToRGB(r), n.data("colorpicker").el, n.data("colorpicker").parent) }, show = function (t) { var n = e("#" + e(this).data("colorpickerId")); n.data("colorpicker").onBeforeShow.apply(this, [n.get(0)]); var r = e(this).offset(); var i = getViewport(); var s = r.top + this.offsetHeight; var o = r.left; if (s + 176 > i.t + i.h) { s -= this.offsetHeight + 176 } if (o + 356 > i.l + i.w) { o -= 356 } n.css({ left: o + "px", top: s + "px" }); if (n.data("colorpicker").onShow.apply(this, [n.get(0)]) != false) { n.show() } e(document).on("mousedown", { cal: n }, hide); return false }, hide = function (t) { if (!isChildOf(t.data.cal.get(0), t.target, t.data.cal.get(0))) { if (t.data.cal.data("colorpicker").onHide.apply(this, [t.data.cal.get(0)]) != false) { t.data.cal.hide() } e(document).off("mousedown", hide) } }, isChildOf = function (e, t, n) { if (e === t) { return true } if (e.contains) { return e.contains(t) } if (e.compareDocumentPosition) { return !!(e.compareDocumentPosition(t) & 16) } var r = t.parentNode; while (r && r !== n) { if (r === e) { return true } r = r.parentNode } return false }, getViewport = function () { var e = document.compatMode == "CSS1Compat"; return { l: window.pageXOffset || (e ? document.documentElement.scrollLeft : document.body.scrollLeft), t: window.pageYOffset || (e ? document.documentElement.scrollTop : document.body.scrollTop), w: window.innerWidth || (e ? document.documentElement.clientWidth : document.body.clientWidth), h: window.innerHeight || (e ? document.documentElement.clientHeight : document.body.clientHeight) } }, fixHSB = function (e) { return { h: Math.min(360, Math.max(0, e.h)), s: Math.min(100, Math.max(0, e.s)), b: Math.min(100, Math.max(0, e.b)) } }, fixRGB = function (e) { return { r: Math.min(255, Math.max(0, e.r)), g: Math.min(255, Math.max(0, e.g)), b: Math.min(255, Math.max(0, e.b)) } }, fixHex = function (e) { var t = 6 - e.length; if (t > 0) { var n = []; for (var r = 0; r < t; r++) { n.push("0") } n.push(e); e = n.join("") } return e }, HexToRGB = function (e) { e = parseInt(e.indexOf("#") > -1 ? e.substring(1) : e, 16); return { r: e >> 16, g: (e & 65280) >> 8, b: e & 255 } }, HexToHSB = function (e) { return RGBToHSB(HexToRGB(e)) }, RGBToHSB = function (e) { var t = { h: 0, s: 0, b: 0 }; var n = Math.min(e.r, e.g, e.b); var r = Math.max(e.r, e.g, e.b); var i = r - n; t.b = r; t.s = r != 0 ? 255 * i / r : 0; if (t.s != 0) { if (e.r === r) { t.h = (e.g - e.b) / i } else if (e.g === r) { t.h = 2 + (e.b - e.r) / i } else { t.h = 4 + (e.r - e.g) / i } } else { t.h = -1 } t.h *= 60; if (t.h < 0) { t.h += 360 } t.s *= 100 / 255; t.b *= 100 / 255; return t }, HSBToRGB = function (e) { var t = {}; var n = Math.round(e.h); var r = Math.round(e.s * 255 / 100); var i = Math.round(e.b * 255 / 100); if (r == 0) { t.r = t.g = t.b = i } else { var s = i; var o = (255 - r) * i / 255; var u = (s - o) * (n % 60) / 60; if (n === 360) { n = 0 } if (n < 60) { t.r = s; t.b = o; t.g = o + u } else if (n < 120) { t.g = s; t.b = o; t.r = s - u } else if (n < 180) { t.g = s; t.r = o; t.b = o + u } else if (n < 240) { t.b = s; t.r = o; t.g = s - u } else if (n < 300) { t.b = s; t.g = o; t.r = o + u } else if (n < 360) { t.r = s; t.g = o; t.b = s - u } else { t.r = 0; t.g = 0; t.b = 0 } } return { r: Math.round(t.r), g: Math.round(t.g), b: Math.round(t.b) } }, RGBToHex = function (t) { var n = [t.r.toString(16), t.g.toString(16), t.b.toString(16)]; e.each(n, function (e, t) { if (t.length === 1) { n[e] = "0" + t } }); return n.join("") }, RGBstringToHex = function (e) { function n(e) { return ("0" + parseInt(e, 10).toString(16)).slice(-2) } if (!e) { return "#FFFFFF" } var t = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); if (t) { return "#" + n(t[1]) + n(t[2]) + n(t[3]) } else { return e } }, HSBToHex = function (e) { return RGBToHex(HSBToRGB(e)) }, restoreOriginal = function () { var t = e(this).parent(); var n = t.data("colorpicker").origColor; t.data("colorpicker").color = n; i(n, t.get(0)); o(n, t.get(0)); s(n, t.get(0)); u(n, t.get(0)); a(n, t.get(0)); l(n, t.get(0)) }; return { init: function (t) { t = e.extend({}, r, t || {}); if (typeof t.color == "string") { if (t.color.substring(0, 4) == "rgb(") { t.color = HexToHSB(RGBstringToHex(t.color)) } else { t.color = HexToHSB(t.color) } } else if (t.color.r !== undefined && t.color.g !== undefined && t.color.b !== undefined) { t.color = RGBToHSB(t.color) } else if (t.color.h !== undefined && t.color.s !== undefined && t.color.b !== undefined) { t.color = fixHSB(t.color) } else { return this } return this.each(function () { if (!e(this).data("colorpickerId")) { var r = e.extend({}, t); r.origColor = t.color; var m, g = 0; m = e("#colorpicker_" + g).length === 0; while (!m) { g = parseInt(Math.random() * 1e4); m = e("#colorpicker_" + g).length === 0 } var y = "colorpicker_" + g; e(this).data("colorpickerId", y); r.parent = e(this); var w = e(n); w.attr("id", y).attr("data-parent", e(this).attr("id")); if (r.flat) { w.appendTo(this).show() } else { w.appendTo(document.body) } r.fields = w.find("input").on("keyup", c).on("change", h).on("blur", p).on("focus", d); w.find("span").on("mousedown", v).end().find(">div.colorpicker_current_color").on("click", restoreOriginal); r.selector = w.find("div.colorpicker_color").on("mousedown", downSelector); r.selectorIndic = r.selector.find("div div"); r.el = this; r.hue = w.find("div.colorpicker_hue div"); w.find("div.colorpicker_hue").on("mousedown", b); w.find("div.colorpicker_hue").on("mousedown", { cal: w }, S); r.newColor = w.find("div.colorpicker_new_color"); r.currentColor = w.find("div.colorpicker_current_color"); w.data("colorpicker", r); w.find("div.colorpicker_submit").on("mouseenter", enterSubmit).on("mouseleave", leaveSubmit).on("click", clickSubmit); i(r.color, w.get(0)); s(r.color, w.get(0)); o(r.color, w.get(0)); a(r.color, w.get(0)); u(r.color, w.get(0)); f(r.color, w.get(0)); l(r.color, w.get(0)); if (r.flat) { w.css({ position: "relative", display: "block" }) } else { e(this).on(r.eventName, show) } } }) }, showPicker: function () { return this.each(function () { if (e(this).data("colorpickerId")) { show.apply(this) } }) }, hidePicker: function () { return this.each(function () { if (e(this).data("colorpickerId")) { e("#" + e(this).data("colorpickerId")).hide() } }) }, setColor: function (t) { if (typeof t == "string") { if (t.substring(0, 4) == "rgb(") { t = HexToHSB(RGBstringToHex(t)) } else { t = HexToHSB(t) } } else if (t.r !== undefined && t.g !== undefined && t.b !== undefined) { t = RGBToHSB(t) } else if (t.h !== undefined && t.s !== undefined && t.b !== undefined) { t = fixHSB(t) } else { return this } return this.each(function () { if (e(this).data("colorpickerId")) { var n = e("#" + e(this).data("colorpickerId")); n.data("colorpicker").color = t; n.data("colorpicker").origColor = t; i(t, n.get(0)); s(t, n.get(0)); o(t, n.get(0)); a(t, n.get(0)); u(t, n.get(0)); f(t, n.get(0)); l(t, n.get(0)) } }) } } }(); e.fn.extend({ ColorPicker: t.init, ColorPickerHide: t.hidePicker, ColorPickerShow: t.showPicker, ColorPickerSetColor: t.setColor }) })(jQuery);

(function ($) {
    $.fn.extend({
        doCenter: function () {
            return this.each(function () {
                var top = ($(window).height() - $(this).outerHeight()) / 2;
                var left = ($(window).width() - $(this).outerWidth()) / 2;
                $(this).css({ position: 'absolute', margin: 0, top: (top > 0 ? top : 0) + 'px', left: (left > 0 ? left : 0) + 'px' });
            });
        }
    });
})(jQuery);

/**
 * jQuery Grid-A-Licious(tm) v3.01
 *
 * Terms of Use - jQuery Grid-A-Licious(tm)
 * under the MIT (http://www.opensource.org/licenses/mit-license.php) License.
 *
 * Copyright 2008-2012 Andreas Pihlström (Suprb). All rights reserved.
 * (http://suprb.com/apps/gridalicious/)
 *
 */
(function (a, b) { var c = function (a, b, c) { var d; return function () { function h() { if (!c) a.apply(f, g); d = null } var f = this, g = arguments; if (d) clearTimeout(d); else if (c) a.apply(f, g); d = setTimeout(h, b || 150) } }; jQuery.fn[b] = function (a) { return a ? this.bind("resize", c(a)) : this.trigger(b) } })(jQuery, "smartresize"); (function (a) { a.Gal = function (b, c) { this.element = a(c); this._init(b) }; a.Gal.settings = { selector: ".item", width: 225, gutter: 20, animate: false, animationOptions: { speed: 200, duration: 300, effect: "fadeInOnAppear", queue: true, complete: function () { } } }; a.Gal.prototype = { _init: function (b) { var c = this; this.name = this._setName(5); this.gridArr = []; this.gridArrAppend = []; this.gridArrPrepend = []; this.setArr = false; this.setGrid = false; this.setOptions; this.cols = 0; this.itemCount = 0; this.prependCount = 0; this.isPrepending = false; this.appendCount = 0; this.resetCount = true; this.ifCallback = true; this.box = this.element; this.options = a.extend(true, {}, a.Gal.settings, b); this.gridArr = a.makeArray(this.box.find(this.options.selector)); this.isResizing = false; this.w = 0; this.boxArr = []; this._setCols(); this._renderGrid("append"); a(this.box).addClass("gridalicious"); a(window).smartresize(function () { c.resize() }) }, _setName: function (a, b) { b = b ? b : ""; return a ? this._setName(--a, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + b) : b }, _setCols: function () { this.cols = Math.floor(this.box.width() / this.options.width); diff = (this.box.width() - this.cols * this.options.width - this.options.gutter) / this.cols; w = (this.options.width + diff) / this.box.width() * 100; this.w = w; for (var b = 0; b < this.cols; b++) { var c = a("<div></div>").addClass("galcolumn").attr("id", "item" + b + this.name).css({ width: w + "%", paddingLeft: this.options.gutter, paddingBottom: this.options.gutter, "float": "left", "-webkit-box-sizing": "border-box", "-moz-box-sizing": "border-box", "-o-box-sizing": "border-box", "box-sizing": "border-box" }); this.box.append(c) } this.box.find(a("#clear" + this.name)).remove(); var d = a("<div></div>").css({ clear: "both", height: "0", width: "0", display: "block" }).attr("id", "clear" + this.name); this.box.append(d) }, _renderGrid: function (b, c, d, e) { var f = []; var g = []; var h = []; var i = 0; var j = this.prependCount; var k = this.appendCount; var l = this.options.gutter; var m = this.cols; var n = this.name; var o = 0; var p = a(".galcolumn").width(); if (c) { g = c; if (b == "append") { k += d; i = this.appendCount } if (b == "prepend") { this.isPrepending = true; i = Math.round(d % m); if (i <= 0) i = m } if (b == "renderAfterPrepend") { k += d; i = d } } else { g = this.gridArr; k = a(this.gridArr).size() } a.each(g, function (c, d) { var e = a(d); var g = "100%"; if (e.hasClass("not-responsive")) { g = "auto" } e.css({ marginBottom: l, zoom: "1", filter: "alpha(opacity=0)", opacity: "0" }).find("img, object, embed, iframe").css({ width: g, height: "auto", display: "block", "margin-left": "auto", "margin-right": "auto" }); if (b == "prepend") { i--; a("#item" + i + n).prepend(e); f.push(e); if (i == 0) i = m } else { a("#item" + i + n).append(e); f.push(e); i++; if (i >= m) i = 0; if (k >= m) k = k - m } }); this.appendCount = k; this.itemCount = i; if (b == "append" || b == "prepend") { if (b == "prepend") { this._updateAfterPrepend(this.gridArr, g) } this._renderItem(f); this.isPrepending = false } else { this._renderItem(this.gridArr) } }, _collectItems: function () { var b = []; a(this.box).find(this.options.selector).each(function (c) { b.push(a(this)) }); return b }, _renderItem: function (b) { var c = this.options.animationOptions.speed; var d = this.options.animationOptions.effect; var e = this.options.animationOptions.duration; var f = this.options.animationOptions.queue; var g = this.options.animate; var h = this.options.animationOptions.complete; var i = 0; var j = 0; if (g === true && !this.isResizing) { if (f === true && d == "fadeInOnAppear") { if (this.isPrepending) b.reverse(); a.each(b, function (d, f) { setTimeout(function () { a(f).animate({ opacity: "1.0" }, e); j++; if (j == b.length) { h.call(undefined, b) } }, i * c); i++ }) } else if (f === false && d == "fadeInOnAppear") { if (this.isPrepending) b.reverse(); a.each(b, function (c, d) { a(d).animate({ opacity: "1.0" }, e); j++; if (j == b.length) { if (this.ifCallback) { h.call(undefined, b) } } }) } if (f === true && !d) { a.each(b, function (c, d) { a(d).css({ opacity: "1", filter: "alpha(opacity=1)" }); j++; if (j == b.length) { if (this.ifCallback) { h.call(undefined, b) } } }) } } else { a.each(b, function (b, c) { a(c).css({ opacity: "1", filter: "alpha(opacity=1)" }) }); if (this.ifCallback) { h.call(b) } } }, _updateAfterPrepend: function (b, c) { var d = this.gridArr; a.each(c, function (a, b) { d.unshift(b) }); this.gridArr = d }, resize: function () { this.box.find(a(".galcolumn")).remove(); this._setCols(); this.ifCallback = false; this.isResizing = true; this._renderGrid("append"); this.ifCallback = true; this.isResizing = false }, append: function (b) { var c = this.gridArr; var d = this.gridArrPrepend; a.each(b, function (a, b) { c.push(b); d.push(b) }); this._renderGrid("append", b, a(b).size()) }, prepend: function (b) { this.ifCallback = false; this._renderGrid("prepend", b, a(b).size()); this.ifCallback = true } }; a.fn.gridalicious = function (b, c) { if (typeof b === "string") { this.each(function () { var d = a.data(this, "gridalicious"); d[b].apply(d, [c]) }) } else { this.each(function () { a.data(this, "gridalicious", new a.Gal(b, this)) }) } return this } })(jQuery)