(function(C) {
C.ui = {
plugin: {
add: function(E, D, H) {
var G = C.ui[E].prototype;
for (var F in H) {
G.plugins[F] = G.plugins[F] || [];
G.plugins[F].push([D, H[F]])
}
},
call: function(D, F, E) {
var H = D.plugins[F];
if (!H) {
return
}
for (var G = 0; G < H.length; G++) {
if (D.options[H[G][0]]) {
H[G][1].apply(D.element, E)
}
}
}
},
cssCache: {},
css: function(D) {
if (C.ui.cssCache[D]) {
return C.ui.cssCache[D]
}
var E = C('<div class="ui-gen">').addClass(D).css({
position: "absolute",
top: "-5000px",
left: "-5000px",
display: "block"
}).appendTo("body");
C.ui.cssCache[D] = !!((!(/auto|default/).test(E.css("cursor")) || (/^[1-9]/).test(E.css("height")) || (/^[1-9]/).test(E.css("width")) || !(/none/).test(E.css("backgroundImage")) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));
try {
C("body").get(0).removeChild(E.get(0))
} catch (F) {}
return C.ui.cssCache[D]
},
disableSelection: function(D) {
C(D).attr("unselectable", "on").css("MozUserSelect", "none")
},
enableSelection: function(D) {
C(D).attr("unselectable", "off").css("MozUserSelect", "")
},
hasScroll: function(G, D) {
var F = /top/.test(D || "top") ? "scrollTop" : "scrollLeft",
E = false;
if (G[F] > 0) {
return true
}
G[F] = 1;
E = G[F] > 0 ? true : false;
G[F] = 0;
return E
}
};
var A = C.fn.remove;
C.fn.remove = function() {
C("*", this).add(this).triggerHandler("remove");
return A.apply(this, arguments)
};
function B(F, D, G) {
var E = C[F][D].getter || [];
E = (typeof E == "string" ? E.split(/,?\s+/) : E);
return (C.inArray(G, E) != -1)
}
C.widget = function(D, E) {
var F = D.split(".")[0];
D = D.split(".")[1];
C.fn[D] = function(J) {
var H = (typeof J == "string"),
I = Array.prototype.slice.call(arguments, 1);
if (H && B(F, D, J)) {
var G = C.data(this[0], D);
return (G ? G[J].apply(G, I) : undefined)
}
return this.each(function() {
var K = C.data(this, D);
if (H && K && C.isFunction(K[J])) {
K[J].apply(K, I)
} else {
if (!H) {
C.data(this, D, new C[F][D](this, J))
}
}
})
};
C[F][D] = function(H, I) {
var G = this;
this.widgetName = D;
this.widgetBaseClass = F + "-" + D;
this.options = C.extend({}, C.widget.defaults, C[F][D].defaults, I);
this.element = C(H).bind("setData." + D, function(L, J, K) {
return G.setData(J, K)
}).bind("getData." + D, function(K, J) {
return G.getData(J)
}).bind("remove", function() {
return G.destroy()
});
this.init()
};
C[F][D].prototype = C.extend({}, C.widget.prototype, E)
};
C.widget.prototype = {
init: function() {},
destroy: function() {
this.element.removeData(this.widgetName)
},
getData: function(D) {
return this.options[D]
},
setData: function(D, E) {
this.options[D] = E;
if (D == "disabled") {
this.element[E ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled")
}
},
enable: function() {
this.setData("disabled", false)
},
disable: function() {
this.setData("disabled", true)
}
};
C.widget.defaults = {
disabled: false
};
C.ui.mouse = {
mouseInit: function() {
var D = this;
this.element.bind("mousedown." + this.widgetName, function(E) {
return D.mouseDown(E)
});
if (C.browser.msie) {
this._mouseUnselectable = this.element.attr("unselectable");
this.element.attr("unselectable", "on")
}
this.started = false
},
mouseDestroy: function() {
this.element.unbind("." + this.widgetName);
(C.browser.msie && this.element.attr("unselectable", this._mouseUnselectable))
},
mouseDown: function(F) {
(this._mouseStarted && this.mouseUp(F));
this._mouseDownEvent = F;
var D = this,
G = (F.which == 1),
E = (typeof this.options.cancel == "string" ? C(F.target).parents().add(F.target).filter(this.options.cancel).length : false);
if (!G || E || !this.mouseCapture(F)) {
return true
}
this._mouseDelayMet = !this.options.delay;
if (!this._mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
D._mouseDelayMet = true
}, this.options.delay)
}
if (this.mouseDistanceMet(F) && this.mouseDelayMet(F)) {
this._mouseStarted = (this.mouseStart(F) !== false);
if (!this._mouseStarted) {
F.preventDefault();
return true
}
}
this._mouseMoveDelegate = function(H) {
return D.mouseMove(H)
};
this._mouseUpDelegate = function(H) {
return D.mouseUp(H)
};
C(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate);
return false
},
mouseMove: function(D) {
if (C.browser.msie && !D.button) {
return this.mouseUp(D)
}
if (this._mouseStarted) {
this.mouseDrag(D);
return false
}
if (this.mouseDistanceMet(D) && this.mouseDelayMet(D)) {
this._mouseStarted = (this.mouseStart(this._mouseDownEvent, D) !== false);
(this._mouseStarted ? this.mouseDrag(D) : this.mouseUp(D))
}
return !this._mouseStarted
},
mouseUp: function(D) {
C(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
if (this._mouseStarted) {
this._mouseStarted = false;
this.mouseStop(D)
}
return false
},
mouseDistanceMet: function(D) {
return (Math.max(Math.abs(this._mouseDownEvent.pageX - D.pageX), Math.abs(this._mouseDownEvent.pageY - D.pageY)) >= this.options.distance)
},
mouseDelayMet: function(D) {
return this._mouseDelayMet
},
mouseStart: function(D) {},
mouseDrag: function(D) {},
mouseStop: function(D) {},
mouseCapture: function(D) {
return true
}
};
C.ui.mouse.defaults = {
cancel: null,
distance: 1,
delay: 0
}
})(jQuery);
(function(A) {
A.widget("ui.tabs", {
init: function() {
this.options.event += ".tabs";
this.tabify(true)
},
setData: function(B, C) {
if ((/^selected/).test(B)) {
this.select(C)
} else {
this.options[b] = C;
this.tabify()
}
},
length: function() {
return this.$tabs.length
},
tabId: function(B) {
return B.title && B.title.replace(/\s/g, "_").replace(/[^A-Za-z0-9\-_:\.]/g, "") || this.options.idPrefix + A.data(B)
},
ui: function(C, B) {
return {
options: this.options,
tab: C,
panel: B,
index: this.$tabs.index(C)
}
},
tabify: function(P) {
this.$lis = A("li:has(a[href])", this.element);
this.$tabs = this.$lis.map(function() {
return A("a", this)[0]
});
this.$panels = A([]);
var O = this,
E = this.options;
this.$tabs.each(function(R, Q) {
if (Q.hash && Q.hash.replace("#", "")) {
O.$panels = O.$panels.add(Q.hash)
} else {
if (A(Q).attr("href") != "#") {
A.data(Q, "href.tabs", Q.href);
A.data(Q, "load.tabs", Q.href);
var T = O.tabId(Q);
Q.href = "#" + T;
var S = A("#" + T);
if (!S.length) {
S = A(E.panelTemplate).attr("id", T).addClass(E.panelClass).insertAfter(O.$panels[R - 1] || O.element);
S.data("destroy.tabs", true)
}
O.$panels = O.$panels.add(S)
} else {
E.disabled.push(R + 1)
}
}
});
if (P) {
this.element.addClass(E.navClass);
this.$panels.each(function() {
var Q = A(this);
Q.addClass(E.panelClass)
});
if (E.selected === undefined) {
if (location.hash) {
this.$tabs.each(function(T, Q) {
if (Q.hash == location.hash) {
E.selected = T;
if (A.browser.msie || A.browser.opera) {
var S = A(location.hash),
R = S.attr("id");
S.attr("id", "");
setTimeout(function() {
S.attr("id", R)
}, 500)
}
scrollTo(0, 0);
return false
}
})
} else {
if (E.cookie) {
var I = parseInt(A.cookie("ui-tabs" + A.data(O.element)), 10);
if (I && O.$tabs[i]) {
E.selected = I
}
} else {
if (O.$lis.filter("." + E.selectedClass).length) {
E.selected = O.$lis.index(O.$lis.filter("." + E.selectedClass)[0])
}
}
}
}
E.selected = E.selected === null || E.selected !== undefined ? E.selected : 0;
E.disabled = A.unique(E.disabled.concat(A.map(this.$lis.filter("." + E.disabledClass), function(R, Q) {
return O.$lis.index(R)
}))).sort();
if (A.inArray(E.selected, E.disabled) != -1) {
E.disabled.splice(A.inArray(E.selected, E.disabled), 1)
}
this.$panels.addClass(E.hideClass);
this.$lis.removeClass(E.selectedClass);
if (E.selected !== null) {
this.$panels.eq(E.selected).show().removeClass(E.hideClass);
this.$lis.eq(E.selected).addClass(E.selectedClass);
var B = function() {
A(O.element).triggerHandler("tabsshow", [O.fakeEvent("tabsshow"), O.ui(O.$tabs[E.selected], O.$panels[E.selected])], E.show)
};
if (A.data(this.$tabs[E.selected], "load.tabs")) {
this.load(E.selected, B)
} else {
B()
}
}
A(window).bind("unload", function() {
O.$tabs.unbind(".tabs");
O.$lis = O.$tabs = O.$panels = null
})
}
for (var H = 0, N; N = this.$lis[H]; H++) {
A(N)[A.inArray(H, E.disabled) != -1 && !A(N).hasClass(E.selectedClass) ? "addClass" : "removeClass"](E.disabledClass)
}
if (E.cache === false) {
this.$tabs.removeData("cache.tabs")
}
var J, D, K = {
"min-width": 0,
duration: 1
},
F = "normal";
if (E.fx && E.fx.constructor == Array) {
J = E.fx[0] || K, D = E.fx[1] || K
} else {
J = D = E.fx || K
}
var C = {
display: "",
overflow: "",
height: ""
};
if (!A.browser.msie) {
C.opacity = ""
}
function M(R, Q, S) {
Q.animate(J, J.duration || F, function() {
Q.addClass(E.hideClass).css(C);
if (A.browser.msie && J.opacity) {
Q[0].style.filter = ""
}
if (S) {
L(R, S, Q)
}
})
}
function L(R, S, Q) {
if (D === K) {
S.css("display", "block")
}
S.animate(D, D.duration || F, function() {
S.removeClass(E.hideClass).css(C);
if (A.browser.msie && D.opacity) {
S[0].style.filter = ""
}
A(O.element).triggerHandler("tabsshow", [O.fakeEvent("tabsshow"), O.ui(R, S[0])], E.show)
})
}
function G(R, T, Q, S) {
T.addClass(E.selectedClass).siblings().removeClass(E.selectedClass);
M(R, Q, S)
}
this.$tabs.unbind(".tabs").bind(E.event, function() {
var T = A(this).parents("li:eq(0)"),
Q = O.$panels.filter(":visible"),
S = A(this.hash);
if ((T.hasClass(E.selectedClass) && !E.unselect) || T.hasClass(E.disabledClass) || A(this).hasClass(E.loadingClass) || A(O.element).triggerHandler("tabsselect", [O.fakeEvent("tabsselect"), O.ui(this, S[0])], E.select) === false) {
this.blur();
return false
}
O.options.selected = O.$tabs.index(this);
if (E.unselect) {
if (T.hasClass(E.selectedClass)) {
O.options.selected = null;
T.removeClass(E.selectedClass);
O.$panels.stop();
M(this, Q);
this.blur();
return false
} else {
if (!Q.length) {
O.$panels.stop();
var R = this;
O.load(O.$tabs.index(this), function() {
T.addClass(E.selectedClass).addClass(E.unselectClass);
L(R, S)
});
this.blur();
return false
}
}
}
if (E.cookie) {
A.cookie("ui-tabs" + A.data(O.element), O.options.selected, E.cookie)
}
O.$panels.stop();
if (S.length) {
var R = this;
O.load(O.$tabs.index(this), Q.length ? function() {
G(R, T, Q, S)
} : function() {
T.addClass(E.selectedClass);
L(R, S)
})
} else {
throw "jQuery UI Tabs: Mismatching fragment identifier."
}
if (A.browser.msie) {
this.blur()
}
return false
});
if (!(/^click/).test(E.event)) {
this.$tabs.bind("click.tabs", function() {
return false
})
}
},
add: function(E, D, C) {
if (C == undefined) {
C = this.$tabs.length
}
var G = this.options;
var I = A(G.tabTemplate.replace(/#\{href\}/g, E).replace(/#\{label\}/g, D));
I.data("destroy.tabs", true);
var H = E.indexOf("#") == 0 ? E.replace("#", "") : this.tabId(A("a:first-child", I)[0]);
var F = A("#" + H);
if (!F.length) {
F = A(G.panelTemplate).attr("id", H).addClass(G.hideClass).data("destroy.tabs", true)
}
F.addClass(G.panelClass);
if (C >= this.$lis.length) {
I.appendTo(this.element);
F.appendTo(this.element[0].parentNode)
} else {
I.insertBefore(this.$lis[C]);
F.insertBefore(this.$panels[C])
}
G.disabled = A.map(G.disabled, function(K, J) {
return K >= C ? ++K : K
});
this.tabify();
if (this.$tabs.length == 1) {
I.addClass(G.selectedClass);
F.removeClass(G.hideClass);
var B = A.data(this.$tabs[0], "load.tabs");
if (B) {
this.load(C, B)
}
}
this.element.triggerHandler("tabsadd", [this.fakeEvent("tabsadd"), this.ui(this.$tabs[C], this.$panels[C])], G.add)
},
remove: function(B) {
var D = this.options,
E = this.$lis.eq(B).remove(),
C = this.$panels.eq(B).remove();
if (E.hasClass(D.selectedClass) && this.$tabs.length > 1) {
this.select(B + (B + 1 < this.$tabs.length ? 1 : -1))
}
D.disabled = A.map(A.grep(D.disabled, function(G, F) {
return G != B
}), function(G, F) {
return G >= B ? --G : G
});
this.tabify();
this.element.triggerHandler("tabsremove", [this.fakeEvent("tabsremove"), this.ui(E.find("a")[0], C[0])], D.remove)
},
enable: function(B) {
var C = this.options;
if (A.inArray(B, C.disabled) == -1) {
return
}
var D = this.$lis.eq(B).removeClass(C.disabledClass);
if (A.browser.safari) {
D.css("display", "inline-block");
setTimeout(function() {
D.css("display", "block")
}, 0)
}
C.disabled = A.grep(C.disabled, function(F, E) {
return F != B
});
this.element.triggerHandler("tabsenable", [this.fakeEvent("tabsenable"), this.ui(this.$tabs[b], this.$panels[b])], C.enable)
},
disable: function(C) {
var B = this,
D = this.options;
if (C != D.selected) {
this.$lis.eq(C).addClass(D.disabledClass);
D.disabled.push(C);
D.disabled.sort();
this.element.triggerHandler("tabsdisable", [this.fakeEvent("tabsdisable"), this.ui(this.$tabs[C], this.$panels[C])], D.disable)
}
},
select: function(B) {
if (typeof B == "string") {
B = this.$tabs.index(this.$tabs.filter("[href$=" + B + "]")[0])
}
this.$tabs.eq(B).trigger(this.options.event)
},
load: function(G, K) {
var L = this,
D = this.options,
E = this.$tabs.eq(G),
J = E[0],
H = K == undefined || K === false,
B = E.data("load.tabs");
K = K || function() {};
if (!B || !H && A.data(J, "cache.tabs")) {
K();
return
}
var M = function(N) {
var O = A(N),
P = O.find("*:last");
return P.length && P.is(":not(img)") && P || O
};
var C = function() {
L.$tabs.filter("." + D.loadingClass).removeClass(D.loadingClass).each(function() {
if (D.spinner) {
M(this).parent().html(M(this).data("label.tabs"))
}
});
L.xhr = null
};
if (D.spinner) {
var I = M(J).html();
M(J).wrapInner("<em></em>").find("em").data("label.tabs", I).html(D.spinner)
}
var F = A.extend({}, D.ajaxOptions, {
url: B,
success: function(O, N) {
A(J.hash).html(O);
C();
if (D.cache) {
A.data(J, "cache.tabs", true)
}
A(L.element).triggerHandler("tabsload", [L.fakeEvent("tabsload"), L.ui(L.$tabs[G], L.$panels[G])], D.load);
D.ajaxOptions.success && D.ajaxOptions.success(O, N);
K()
}
});
if (this.xhr) {
this.xhr.abort();
C()
}
E.addClass(D.loadingClass);
setTimeout(function() {
L.xhr = A.ajax(F)
}, 0)
},
url: function(C, B) {
this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs", B)
},
destroy: function() {
var B = this.options;
this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");
this.$tabs.each(function() {
var C = A.data(this, "href.tabs");
if (C) {
this.href = C
}
var D = A(this).unbind(".tabs");
A.each(["href", "load", "cache"], function(F, E) {
D.removeData(E + ".tabs")
})
});
this.$lis.add(this.$panels).each(function() {
if (A.data(this, "destroy.tabs")) {
A(this).remove()
} else {
A(this).removeClass([B.selectedClass, B.unselectClass, B.disabledClass, B.panelClass, B.hideClass].join(" "))
}
})
},
fakeEvent: function(B) {
return A.event.fix({
type: B,
target: this.element[0]
})
}
});
A.ui.tabs.defaults = {
unselect: false,
event: "click",
disabled: [],
cookie: null,
spinner: "Loading…",
cache: false,
idPrefix: "ui-tabs-",
ajaxOptions: {},
fx: null,
tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
panelTemplate: "<div></div>",
navClass: "ui-tabs-nav",
selectedClass: "ui-tabs-selected",
unselectClass: "ui-tabs-unselect",
disabledClass: "ui-tabs-disabled",
panelClass: "ui-tabs-panel",
hideClass: "ui-tabs-hide",
loadingClass: "ui-tabs-loading"
};
A.ui.tabs.getter = "length";
A.extend(A.ui.tabs.prototype, {
rotation: null,
rotate: function(C, F) {
F = F || false;
var B = this,
E = this.options.selected;
function G() {
B.rotation = setInterval(function() {
E = ++E < B.$tabs.length ? E : 0;
B.select(E)
}, C)
}
function D(H) {
if (!H || H.clientX) {
clearInterval(B.rotation)
}
}
if (C) {
G();
if (!F) {
this.$tabs.bind(this.options.event, D)
} else {
this.$tabs.bind(this.options.event, function() {
D();
E = B.options.selected;
G()
})
}
} else {
D();
this.$tabs.unbind(this.options.event, D)
}
}
})
})(jQuery);