﻿(function(c) { var b = c.cloneObject, a = c.filterArray; c.fn.applyTabController = (function() { var g, f, i = "tab_for_", e = "active", h = "sheet", d = "tab"; i = i.toLowerCase(); f = function() { var n, m = [], l = this, k = l.find("." + h), j = l.find("." + d); n = b(g); n.activeSheetId = undefined; n.tabsPerSheet = {}; k.each(function() { m.push(this.id); if (!n.activeSheetId && c(this).hasClass(e)) { n.activeSheetId = this.id } }); if (n.activeSheetId === undefined) { n.activeSheetId = m[0] } j.each(function() { var o, p, q = this.className.split(" "); o = a(q, function(r) { return r.toLowerCase().indexOf(i) === 0 }).pop(); p = o && o.replace(new RegExp(i, "i"), ""); if (p && c.inArray(p, m) >= 0) { n.tabsPerSheet[p] = this; c(this).click(function() { n.activateTab(p) }) } }); n.activateTab(n.activeSheetId); return l }; g = { activateTab: function(j) { if (j !== this.activeSheetId) { c("#" + this.activeSheetId).removeClass(e); c(this.tabsPerSheet[this.activeSheetId]).removeClass(e) } c("#" + j).addClass(e); c(this.tabsPerSheet[j]).addClass(e); this.activeSheetId = j } }; return f } ()) } (jQuery));