﻿/*
* jQuery UI 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui || (function (c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.2", plugin: { add: function (k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]) } }, call: function (j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k) } } } }, contains: function (k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j) }, hasScroll: function (m, k) { if (c(m).css("overflow") == "hidden") { return false } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l }, isOverAxis: function (k, j, l) { return (k > j) && (k < (j + l)) }, isOver: function (o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function (k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))) }; c.fn.removeAttr = function (j) { return (a.test(j) ? this.each(function () { this.removeAttributeNS(h, j.replace(a, "")) }) : e.call(this, j)) } } c.fn.extend({ remove: function () { c("*", this).add(this).each(function () { c(this).triggerHandler("remove") }); return i.apply(this, arguments) }, enableSelection: function () { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function () { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function () { return false }) }, scrollParent: function () { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = this.parents().filter(function () { return (/(relative|absolute|fixed)/).test(c.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } else { j = this.parents().filter(function () { return (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } return (/fixed/).test(this.css("position")) || !j.length ? c(document) : j } }); c.extend(c.expr[":"], { data: function (l, k, j) { return !!c.data(l, j[3]) }, focusable: function (k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length }, tabbable: function (k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable") } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p) } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")) } return (c.inArray(o, j) != -1) } c.widget = function (k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function (p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined) } return this.each(function () { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)) }) }; c[l] = c[l] || {}; c[l][k] = function (o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function (q, p, r) { if (q.target == o) { return m._setData(p, r) } }).bind("getData." + k, function (q, p) { if (q.target == o) { return m._getData(p) } }).bind("remove", function () { return m.destroy() }) }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option" }; c.widget.prototype = { _init: function () { }, destroy: function () { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled") }, option: function (l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l) } k = {}; k[l] = m } c.each(k, function (n, o) { j._setData(n, o) }) }, _getData: function (j) { return this.options[j] }, _setData: function (j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k) } }, enable: function () { this._setData("disabled", false) }, disable: function () { this._setData("disabled", true) }, _trigger: function (l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o] } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()) } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function () { var j = this; this.element.bind("mousedown." + this.widgetName, function (k) { return j._mouseDown(k) }).bind("click." + this.widgetName, function (k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false } }); 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 (l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function () { k.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true } } this._mouseMoveDelegate = function (n) { return k._mouseMove(n) }; this._mouseUpDelegate = function (n) { return k._mouseUp(n) }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true }, _mouseMove: function (j) { if (c.browser.msie && !j.button) { return this._mouseUp(j) } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault() } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)) } return !this._mouseStarted }, _mouseUp: function (j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j) } return false }, _mouseDistanceMet: function (j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance) }, _mouseDelayMet: function (j) { return this.mouseDelayMet }, _mouseStart: function (j) { }, _mouseDrag: function (j) { }, _mouseStop: function (j) { }, _mouseCapture: function (j) { return true } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); ; /*
 * jQuery UI Effects 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects || (function (d) { d.effects = { version: "1.7.2", save: function (g, h) { for (var f = 0; f < h.length; f++) { if (h[f] !== null) { g.data("ec.storage." + h[f], g[0].style[h[f]]) } } }, restore: function (g, h) { for (var f = 0; f < h.length; f++) { if (h[f] !== null) { g.css(h[f], g.data("ec.storage." + h[f])) } } }, setMode: function (f, g) { if (g == "toggle") { g = f.is(":hidden") ? "show" : "hide" } return g }, getBaseline: function (g, h) { var i, f; switch (g[0]) { case "top": i = 0; break; case "middle": i = 0.5; break; case "bottom": i = 1; break; default: i = g[0] / h.height } switch (g[1]) { case "left": f = 0; break; case "center": f = 0.5; break; case "right": f = 1; break; default: f = g[1] / h.width } return { x: f, y: i} }, createWrapper: function (f) { if (f.parent().is(".ui-effects-wrapper")) { return f.parent() } var g = { width: f.outerWidth(true), height: f.outerHeight(true), "float": f.css("float") }; f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>'); var j = f.parent(); if (f.css("position") == "static") { j.css({ position: "relative" }); f.css({ position: "relative" }) } else { var i = f.css("top"); if (isNaN(parseInt(i, 10))) { i = "auto" } var h = f.css("left"); if (isNaN(parseInt(h, 10))) { h = "auto" } j.css({ position: f.css("position"), top: i, left: h, zIndex: f.css("z-index") }).show(); f.css({ position: "relative", top: 0, left: 0 }) } j.css(g); return j }, removeWrapper: function (f) { if (f.parent().is(".ui-effects-wrapper")) { return f.parent().replaceWith(f) } return f }, setTransition: function (g, i, f, h) { h = h || {}; d.each(i, function (k, j) { unit = g.cssUnit(j); if (unit[0] > 0) { h[j] = unit[0] * f + unit[1] } }); return h }, animateClass: function (h, i, k, j) { var f = (typeof k == "function" ? k : (j ? j : null)); var g = (typeof k == "string" ? k : null); return this.each(function () { var q = {}; var o = d(this); var p = o.attr("style") || ""; if (typeof p == "object") { p = p.cssText } if (h.toggle) { o.hasClass(h.toggle) ? h.remove = h.toggle : h.add = h.toggle } var l = d.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle)); if (h.add) { o.addClass(h.add) } if (h.remove) { o.removeClass(h.remove) } var m = d.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle)); if (h.add) { o.removeClass(h.add) } if (h.remove) { o.addClass(h.remove) } for (var r in m) { if (typeof m[r] != "function" && m[r] && r.indexOf("Moz") == -1 && r.indexOf("length") == -1 && m[r] != l[r] && (r.match(/color/i) || (!r.match(/color/i) && !isNaN(parseInt(m[r], 10)))) && (l.position != "static" || (l.position == "static" && !r.match(/left|top|bottom|right/)))) { q[r] = m[r] } } o.animate(q, i, g, function () { if (typeof d(this).attr("style") == "object") { d(this).attr("style")["cssText"] = ""; d(this).attr("style")["cssText"] = p } else { d(this).attr("style", p) } if (h.add) { d(this).addClass(h.add) } if (h.remove) { d(this).removeClass(h.remove) } if (f) { f.apply(this, arguments) } }) }) } }; function c(g, f) { var i = g[1] && g[1].constructor == Object ? g[1] : {}; if (f) { i.mode = f } var h = g[1] && g[1].constructor != Object ? g[1] : (i.duration ? i.duration : g[2]); h = d.fx.off ? 0 : typeof h === "number" ? h : d.fx.speeds[h] || d.fx.speeds._default; var j = i.callback || (d.isFunction(g[1]) && g[1]) || (d.isFunction(g[2]) && g[2]) || (d.isFunction(g[3]) && g[3]); return [g[0], i, h, j] } d.fn.extend({ _show: d.fn.show, _hide: d.fn.hide, __toggle: d.fn.toggle, _addClass: d.fn.addClass, _removeClass: d.fn.removeClass, _toggleClass: d.fn.toggleClass, effect: function (g, f, h, i) { return d.effects[g] ? d.effects[g].call(this, { method: g, options: f || {}, duration: h, callback: i }) : null }, show: function () { if (!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) { return this._show.apply(this, arguments) } else { return this.effect.apply(this, c(arguments, "show")) } }, hide: function () { if (!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) { return this._hide.apply(this, arguments) } else { return this.effect.apply(this, c(arguments, "hide")) } }, toggle: function () { if (!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (d.isFunction(arguments[0]) || typeof arguments[0] == "boolean")) { return this.__toggle.apply(this, arguments) } else { return this.effect.apply(this, c(arguments, "toggle")) } }, addClass: function (g, f, i, h) { return f ? d.effects.animateClass.apply(this, [{ add: g }, f, i, h]) : this._addClass(g) }, removeClass: function (g, f, i, h) { return f ? d.effects.animateClass.apply(this, [{ remove: g }, f, i, h]) : this._removeClass(g) }, toggleClass: function (g, f, i, h) { return ((typeof f !== "boolean") && f) ? d.effects.animateClass.apply(this, [{ toggle: g }, f, i, h]) : this._toggleClass(g, f) }, morph: function (f, h, g, j, i) { return d.effects.animateClass.apply(this, [{ add: h, remove: f }, g, j, i]) }, switchClass: function () { return this.morph.apply(this, arguments) }, cssUnit: function (f) { var g = this.css(f), h = []; d.each(["em", "px", "%", "pt"], function (j, k) { if (g.indexOf(k) > 0) { h = [parseFloat(g), k] } }); return h } }); d.each(["backgroundColor", "borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor", "color", "outlineColor"], function (g, f) { d.fx.step[f] = function (h) { if (h.state == 0) { h.start = e(h.elem, f); h.end = b(h.end) } h.elem.style[f] = "rgb(" + [Math.max(Math.min(parseInt((h.pos * (h.end[0] - h.start[0])) + h.start[0], 10), 255), 0), Math.max(Math.min(parseInt((h.pos * (h.end[1] - h.start[1])) + h.start[1], 10), 255), 0), Math.max(Math.min(parseInt((h.pos * (h.end[2] - h.start[2])) + h.start[2], 10), 255), 0)].join(",") + ")" } }); function b(g) { var f; if (g && g.constructor == Array && g.length == 3) { return g } if (f = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)) { return [parseInt(f[1], 10), parseInt(f[2], 10), parseInt(f[3], 10)] } if (f = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)) { return [parseFloat(f[1]) * 2.55, parseFloat(f[2]) * 2.55, parseFloat(f[3]) * 2.55] } if (f = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)) { return [parseInt(f[1], 16), parseInt(f[2], 16), parseInt(f[3], 16)] } if (f = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)) { return [parseInt(f[1] + f[1], 16), parseInt(f[2] + f[2], 16), parseInt(f[3] + f[3], 16)] } if (f = /rgba\(0, 0, 0, 0\)/.exec(g)) { return a.transparent } return a[d.trim(g).toLowerCase()] } function e(h, f) { var g; do { g = d.curCSS(h, f); if (g != "" && g != "transparent" || d.nodeName(h, "body")) { break } f = "backgroundColor" } while (h = h.parentNode); return b(g) } var a = { aqua: [0, 255, 255], azure: [240, 255, 255], beige: [245, 245, 220], black: [0, 0, 0], blue: [0, 0, 255], brown: [165, 42, 42], cyan: [0, 255, 255], darkblue: [0, 0, 139], darkcyan: [0, 139, 139], darkgrey: [169, 169, 169], darkgreen: [0, 100, 0], darkkhaki: [189, 183, 107], darkmagenta: [139, 0, 139], darkolivegreen: [85, 107, 47], darkorange: [255, 140, 0], darkorchid: [153, 50, 204], darkred: [139, 0, 0], darksalmon: [233, 150, 122], darkviolet: [148, 0, 211], fuchsia: [255, 0, 255], gold: [255, 215, 0], green: [0, 128, 0], indigo: [75, 0, 130], khaki: [240, 230, 140], lightblue: [173, 216, 230], lightcyan: [224, 255, 255], lightgreen: [144, 238, 144], lightgrey: [211, 211, 211], lightpink: [255, 182, 193], lightyellow: [255, 255, 224], lime: [0, 255, 0], magenta: [255, 0, 255], maroon: [128, 0, 0], navy: [0, 0, 128], olive: [128, 128, 0], orange: [255, 165, 0], pink: [255, 192, 203], purple: [128, 0, 128], violet: [128, 0, 128], red: [255, 0, 0], silver: [192, 192, 192], white: [255, 255, 255], yellow: [255, 255, 0], transparent: [255, 255, 255] }; d.easing.jswing = d.easing.swing; d.extend(d.easing, { def: "easeOutQuad", swing: function (g, h, f, j, i) { return d.easing[d.easing.def](g, h, f, j, i) }, easeInQuad: function (g, h, f, j, i) { return j * (h /= i) * h + f }, easeOutQuad: function (g, h, f, j, i) { return -j * (h /= i) * (h - 2) + f }, easeInOutQuad: function (g, h, f, j, i) { if ((h /= i / 2) < 1) { return j / 2 * h * h + f } return -j / 2 * ((--h) * (h - 2) - 1) + f }, easeInCubic: function (g, h, f, j, i) { return j * (h /= i) * h * h + f }, easeOutCubic: function (g, h, f, j, i) { return j * ((h = h / i - 1) * h * h + 1) + f }, easeInOutCubic: function (g, h, f, j, i) { if ((h /= i / 2) < 1) { return j / 2 * h * h * h + f } return j / 2 * ((h -= 2) * h * h + 2) + f }, easeInQuart: function (g, h, f, j, i) { return j * (h /= i) * h * h * h + f }, easeOutQuart: function (g, h, f, j, i) { return -j * ((h = h / i - 1) * h * h * h - 1) + f }, easeInOutQuart: function (g, h, f, j, i) { if ((h /= i / 2) < 1) { return j / 2 * h * h * h * h + f } return -j / 2 * ((h -= 2) * h * h * h - 2) + f }, easeInQuint: function (g, h, f, j, i) { return j * (h /= i) * h * h * h * h + f }, easeOutQuint: function (g, h, f, j, i) { return j * ((h = h / i - 1) * h * h * h * h + 1) + f }, easeInOutQuint: function (g, h, f, j, i) { if ((h /= i / 2) < 1) { return j / 2 * h * h * h * h * h + f } return j / 2 * ((h -= 2) * h * h * h * h + 2) + f }, easeInSine: function (g, h, f, j, i) { return -j * Math.cos(h / i * (Math.PI / 2)) + j + f }, easeOutSine: function (g, h, f, j, i) { return j * Math.sin(h / i * (Math.PI / 2)) + f }, easeInOutSine: function (g, h, f, j, i) { return -j / 2 * (Math.cos(Math.PI * h / i) - 1) + f }, easeInExpo: function (g, h, f, j, i) { return (h == 0) ? f : j * Math.pow(2, 10 * (h / i - 1)) + f }, easeOutExpo: function (g, h, f, j, i) { return (h == i) ? f + j : j * (-Math.pow(2, -10 * h / i) + 1) + f }, easeInOutExpo: function (g, h, f, j, i) { if (h == 0) { return f } if (h == i) { return f + j } if ((h /= i / 2) < 1) { return j / 2 * Math.pow(2, 10 * (h - 1)) + f } return j / 2 * (-Math.pow(2, -10 * --h) + 2) + f }, easeInCirc: function (g, h, f, j, i) { return -j * (Math.sqrt(1 - (h /= i) * h) - 1) + f }, easeOutCirc: function (g, h, f, j, i) { return j * Math.sqrt(1 - (h = h / i - 1) * h) + f }, easeInOutCirc: function (g, h, f, j, i) { if ((h /= i / 2) < 1) { return -j / 2 * (Math.sqrt(1 - h * h) - 1) + f } return j / 2 * (Math.sqrt(1 - (h -= 2) * h) + 1) + f }, easeInElastic: function (g, i, f, m, l) { var j = 1.70158; var k = 0; var h = m; if (i == 0) { return f } if ((i /= l) == 1) { return f + m } if (!k) { k = l * 0.3 } if (h < Math.abs(m)) { h = m; var j = k / 4 } else { var j = k / (2 * Math.PI) * Math.asin(m / h) } return -(h * Math.pow(2, 10 * (i -= 1)) * Math.sin((i * l - j) * (2 * Math.PI) / k)) + f }, easeOutElastic: function (g, i, f, m, l) { var j = 1.70158; var k = 0; var h = m; if (i == 0) { return f } if ((i /= l) == 1) { return f + m } if (!k) { k = l * 0.3 } if (h < Math.abs(m)) { h = m; var j = k / 4 } else { var j = k / (2 * Math.PI) * Math.asin(m / h) } return h * Math.pow(2, -10 * i) * Math.sin((i * l - j) * (2 * Math.PI) / k) + m + f }, easeInOutElastic: function (g, i, f, m, l) { var j = 1.70158; var k = 0; var h = m; if (i == 0) { return f } if ((i /= l / 2) == 2) { return f + m } if (!k) { k = l * (0.3 * 1.5) } if (h < Math.abs(m)) { h = m; var j = k / 4 } else { var j = k / (2 * Math.PI) * Math.asin(m / h) } if (i < 1) { return -0.5 * (h * Math.pow(2, 10 * (i -= 1)) * Math.sin((i * l - j) * (2 * Math.PI) / k)) + f } return h * Math.pow(2, -10 * (i -= 1)) * Math.sin((i * l - j) * (2 * Math.PI) / k) * 0.5 + m + f }, easeInBack: function (g, h, f, k, j, i) { if (i == undefined) { i = 1.70158 } return k * (h /= j) * h * ((i + 1) * h - i) + f }, easeOutBack: function (g, h, f, k, j, i) { if (i == undefined) { i = 1.70158 } return k * ((h = h / j - 1) * h * ((i + 1) * h + i) + 1) + f }, easeInOutBack: function (g, h, f, k, j, i) { if (i == undefined) { i = 1.70158 } if ((h /= j / 2) < 1) { return k / 2 * (h * h * (((i *= (1.525)) + 1) * h - i)) + f } return k / 2 * ((h -= 2) * h * (((i *= (1.525)) + 1) * h + i) + 2) + f }, easeInBounce: function (g, h, f, j, i) { return j - d.easing.easeOutBounce(g, i - h, 0, j, i) + f }, easeOutBounce: function (g, h, f, j, i) { if ((h /= i) < (1 / 2.75)) { return j * (7.5625 * h * h) + f } else { if (h < (2 / 2.75)) { return j * (7.5625 * (h -= (1.5 / 2.75)) * h + 0.75) + f } else { if (h < (2.5 / 2.75)) { return j * (7.5625 * (h -= (2.25 / 2.75)) * h + 0.9375) + f } else { return j * (7.5625 * (h -= (2.625 / 2.75)) * h + 0.984375) + f } } } }, easeInOutBounce: function (g, h, f, j, i) { if (h < i / 2) { return d.easing.easeInBounce(g, h * 2, 0, j, i) * 0.5 + f } return d.easing.easeOutBounce(g, h * 2 - i, 0, j, i) * 0.5 + j * 0.5 + f } }) })(jQuery); ; /*
 * jQuery UI Effects Highlight 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Highlight
 *
 * Depends:
 *	effects.core.js
 */
(function (a) { a.effects.highlight = function (b) { return this.queue(function () { var e = a(this), d = ["backgroundImage", "backgroundColor", "opacity"]; var h = a.effects.setMode(e, b.options.mode || "show"); var c = b.options.color || "#ffff99"; var g = e.css("backgroundColor"); a.effects.save(e, d); e.show(); e.css({ backgroundImage: "none", backgroundColor: c }); var f = { backgroundColor: g }; if (h == "hide") { f.opacity = 0 } e.animate(f, { queue: false, duration: b.duration, easing: b.options.easing, complete: function () { if (h == "hide") { e.hide() } a.effects.restore(e, d); if (h == "show" && a.browser.msie) { this.style.removeAttribute("filter") } if (b.callback) { b.callback.apply(this, arguments) } e.dequeue() } }) }) } })(jQuery); ; /*
 * jQuery UI Effects Pulsate 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Pulsate
 *
 * Depends:
 *	effects.core.js
 */
(function (a) { a.effects.pulsate = function (b) { return this.queue(function () { var d = a(this); var g = a.effects.setMode(d, b.options.mode || "show"); var f = b.options.times || 5; var e = b.duration ? b.duration / 2 : a.fx.speeds._default / 2; if (g == "hide") { f-- } if (d.is(":hidden")) { d.css("opacity", 0); d.show(); d.animate({ opacity: 1 }, e, b.options.easing); f = f - 2 } for (var c = 0; c < f; c++) { d.animate({ opacity: 0 }, e, b.options.easing).animate({ opacity: 1 }, e, b.options.easing) } if (g == "hide") { d.animate({ opacity: 0 }, e, b.options.easing, function () { d.hide(); if (b.callback) { b.callback.apply(this, arguments) } }) } else { d.animate({ opacity: 0 }, e, b.options.easing).animate({ opacity: 1 }, e, b.options.easing, function () { if (b.callback) { b.callback.apply(this, arguments) } }) } d.queue("fx", function () { d.dequeue() }); d.dequeue() }) } })(jQuery); ; /*
 * jQuery UI Effects Slide 1.7.2
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	effects.core.js
 */
(function (a) { a.effects.slide = function (b) { return this.queue(function () { var e = a(this), d = ["position", "top", "left"]; var i = a.effects.setMode(e, b.options.mode || "show"); var h = b.options.direction || "left"; a.effects.save(e, d); e.show(); a.effects.createWrapper(e).css({ overflow: "hidden" }); var f = (h == "up" || h == "down") ? "top" : "left"; var c = (h == "up" || h == "left") ? "pos" : "neg"; var j = b.options.distance || (f == "top" ? e.outerHeight({ margin: true }) : e.outerWidth({ margin: true })); if (i == "show") { e.css(f, c == "pos" ? -j : j) } var g = {}; g[f] = (i == "show" ? (c == "pos" ? "+=" : "-=") : (c == "pos" ? "-=" : "+=")) + j; e.animate(g, { queue: false, duration: b.duration, easing: b.options.easing, complete: function () { if (i == "hide") { e.hide() } a.effects.restore(e, d); a.effects.removeWrapper(e); if (b.callback) { b.callback.apply(this, arguments) } e.dequeue() } }) }) } })(jQuery); ;

/*
Watermark v3.1.3 (March 22, 2011) plugin for jQuery
http://jquery-watermark.googlecode.com/
Copyright (c) 2009-2011 Todd Northrop
http://www.speednet.biz/
Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function (a, h, y) { var w = "function", v = "password", j = "maxLength", n = "type", b = "", c = true, u = "placeholder", i = false, t = "watermark", g = t, f = "watermarkClass", q = "watermarkFocus", l = "watermarkSubmit", o = "watermarkMaxLength", e = "watermarkPassword", d = "watermarkText", k = /\r/g, s = "input:data(" + g + "),textarea:data(" + g + ")", m = "input:text,input:password,input[type=search],input:not([type]),textarea", p = ["Page_ClientValidate"], r = i, x = u in document.createElement("input"); a.watermark = a.watermark || { version: "3.1.3", runOnce: c, options: { className: t, useNative: c, hideBeforeUnload: c }, hide: function (b) { a(b).filter(s).each(function () { a.watermark._hide(a(this)) }) }, _hide: function (a, r) { var p = a[0], q = (p.value || b).replace(k, b), l = a.data(d) || b, m = a.data(o) || 0, i = a.data(f); if (l.length && q == l) { p.value = b; if (a.data(e)) if ((a.attr(n) || b) === "text") { var g = a.data(e) || [], c = a.parent() || []; if (g.length && c.length) { c[0].removeChild(a[0]); c[0].appendChild(g[0]); a = g } } if (m) { a.attr(j, m); a.removeData(o) } if (r) { a.attr("autocomplete", "off"); h.setTimeout(function () { a.select() }, 1) } } i && a.removeClass(i) }, show: function (b) { a(b).filter(s).each(function () { a.watermark._show(a(this)) }) }, _show: function (g) { var p = g[0], u = (p.value || b).replace(k, b), h = g.data(d) || b, s = g.attr(n) || b, t = g.data(f); if ((u.length == 0 || u == h) && !g.data(q)) { r = c; if (g.data(e)) if (s === v) { var m = g.data(e) || [], l = g.parent() || []; if (m.length && l.length) { l[0].removeChild(g[0]); l[0].appendChild(m[0]); g = m; g.attr(j, h.length); p = g[0] } } if (s === "text" || s === "search") { var i = g.attr(j) || 0; if (i > 0 && h.length > i) { g.data(o, i); g.attr(j, h.length) } } t && g.addClass(t); p.value = h } else a.watermark._hide(g) }, hideAll: function () { if (r) { a.watermark.hide(m); r = i } }, showAll: function () { a.watermark.show(m) } }; a.fn.watermark = a.fn.watermark || function (p, o) { var t = "string"; if (!this.length) return this; var s = i, r = typeof p === t; if (r) p = p.replace(k, b); if (typeof o === "object") { s = typeof o.className === t; o = a.extend({}, a.watermark.options, o) } else if (typeof o === t) { s = c; o = a.extend({}, a.watermark.options, { className: o }) } else o = a.watermark.options; if (typeof o.useNative !== w) o.useNative = o.useNative ? function () { return c } : function () { return i }; return this.each(function () { var B = "dragleave", A = "dragenter", z = this, i = a(z); if (!i.is(m)) return; if (i.data(g)) { if (r || s) { a.watermark._hide(i); r && i.data(d, p); s && i.data(f, o.className) } } else { if (x && o.useNative.call(z, i) && (i.attr("tagName") || b) !== "TEXTAREA") { r && i.attr(u, p); return } i.data(d, r ? p : b); i.data(f, o.className); i.data(g, 1); if ((i.attr(n) || b) === v) { var C = i.wrap("<span>").parent(), t = a(C.html().replace(/type=["']?password["']?/i, 'type="text"')); t.data(d, i.data(d)); t.data(f, i.data(f)); t.data(g, 1); t.attr(j, p.length); t.focus(function () { a.watermark._hide(t, c) }).bind(A, function () { a.watermark._hide(t) }).bind("dragend", function () { h.setTimeout(function () { t.blur() }, 1) }); i.blur(function () { a.watermark._show(i) }).bind(B, function () { a.watermark._show(i) }); t.data(e, i); i.data(e, t) } else i.focus(function () { i.data(q, 1); a.watermark._hide(i, c) }).blur(function () { i.data(q, 0); a.watermark._show(i) }).bind(A, function () { a.watermark._hide(i) }).bind(B, function () { a.watermark._show(i) }).bind("dragend", function () { h.setTimeout(function () { a.watermark._show(i) }, 1) }).bind("drop", function (e) { var c = i[0], a = e.originalEvent.dataTransfer.getData("Text"); if ((c.value || b).replace(k, b).replace(a, b) === i.data(d)) c.value = a; i.focus() }); if (z.form) { var w = z.form, y = a(w); if (!y.data(l)) { y.submit(a.watermark.hideAll); if (w.submit) { y.data(l, w.submit); w.submit = function (c, b) { return function () { var d = b.data(l); a.watermark.hideAll(); if (d.apply) d.apply(c, Array.prototype.slice.call(arguments)); else d() } } (w, y) } else { y.data(l, 1); w.submit = function (b) { return function () { a.watermark.hideAll(); delete b.submit; b.submit() } } (w) } } } } a.watermark._show(i) }) }; if (a.watermark.runOnce) { a.watermark.runOnce = i; a.extend(a.expr[":"], { data: function (c, d, b) { return !!a.data(c, b[3]) } }); (function (c) { a.fn.val = function () { var e = this; if (!e.length) return arguments.length ? e : y; if (!arguments.length) if (e.data(g)) { var f = (e[0].value || b).replace(k, b); return f === (e.data(d) || b) ? b : f } else return c.apply(e, arguments); else { c.apply(e, arguments); a.watermark.show(e); return e } } })(a.fn.val); p.length && a(function () { for (var b, c, d = p.length - 1; d >= 0; d--) { b = p[d]; c = h[b]; if (typeof c === w) h[b] = function (b) { return function () { a.watermark.hideAll(); return b.apply(null, Array.prototype.slice.call(arguments)) } } (c) } }); a(h).bind("beforeunload", function () { a.watermark.options.hideBeforeUnload && a.watermark.hideAll() }) } })(jQuery, window);

/*
Masked Input plugin for jQuery
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function (a) { var c = (a.browser.msie ? "paste" : "input") + ".mask"; var b = (window.orientation != undefined); a.mask = { definitions: { "9": "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]"} }; a.fn.extend({ caret: function (e, f) { if (this.length == 0) { return } if (typeof e == "number") { f = (typeof f == "number") ? f : e; return this.each(function () { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(e, f) } else { if (this.createTextRange) { var g = this.createTextRange(); g.collapse(true); g.moveEnd("character", f); g.moveStart("character", e); g.select() } } }) } else { if (this[0].setSelectionRange) { e = this[0].selectionStart; f = this[0].selectionEnd } else { if (document.selection && document.selection.createRange) { var d = document.selection.createRange(); e = 0 - d.duplicate().moveStart("character", -100000); f = e + d.text.length } } return { begin: e, end: f} } }, unmask: function () { return this.trigger("unmask") }, mask: function (j, d) { if (!j && this.length > 0) { var f = a(this[0]); var g = f.data("tests"); return a.map(f.data("buffer"), function (l, m) { return g[m] ? l : null }).join("") } d = a.extend({ placeholder: "_", completed: null }, d); var k = a.mask.definitions; var g = []; var e = j.length; var i = null; var h = j.length; a.each(j.split(""), function (m, l) { if (l == "?") { h--; e = m } else { if (k[l]) { g.push(new RegExp(k[l])); if (i == null) { i = g.length - 1 } } else { g.push(null) } } }); return this.each(function () { var r = a(this); var m = a.map(j.split(""), function (x, y) { if (x != "?") { return k[x] ? d.placeholder : x } }); var n = false; var q = r.val(); r.data("buffer", m).data("tests", g); function v(x) { while (++x <= h && !g[x]) { } return x } function t(x) { while (!g[x] && --x >= 0) { } for (var y = x; y < h; y++) { if (g[y]) { m[y] = d.placeholder; var z = v(y); if (z < h && g[y].test(m[z])) { m[y] = m[z] } else { break } } } s(); r.caret(Math.max(i, x)) } function u(y) { for (var A = y, z = d.placeholder; A < h; A++) { if (g[A]) { var B = v(A); var x = m[A]; m[A] = z; if (B < h && g[B].test(x)) { z = x } else { break } } } } function l(y) { var x = a(this).caret(); var z = y.keyCode; n = (z < 16 || (z > 16 && z < 32) || (z > 32 && z < 41)); if ((x.begin - x.end) != 0 && (!n || z == 8 || z == 46)) { w(x.begin, x.end) } if (z == 8 || z == 46 || (b && z == 127)) { t(x.begin + (z == 46 ? 0 : -1)); return false } else { if (z == 27) { r.val(q); r.caret(0, p()); return false } } } function o(B) { if (n) { n = false; return (B.keyCode == 8) ? false : null } B = B || window.event; var C = B.charCode || B.keyCode || B.which; var z = a(this).caret(); if (B.ctrlKey || B.altKey || B.metaKey) { return true } else { if ((C >= 32 && C <= 125) || C > 186) { var x = v(z.begin - 1); if (x < h) { var A = String.fromCharCode(C); if (g[x].test(A)) { u(x); m[x] = A; s(); var y = v(x); a(this).caret(y); if (d.completed && y == h) { d.completed.call(r) } } } } } return false } function w(x, y) { for (var z = x; z < y && z < h; z++) { if (g[z]) { m[z] = d.placeholder } } } function s() { return r.val(m.join("")).val() } function p(y) { var z = r.val(); var C = -1; for (var B = 0, x = 0; B < h; B++) { if (g[B]) { m[B] = d.placeholder; while (x++ < z.length) { var A = z.charAt(x - 1); if (g[B].test(A)) { m[B] = A; C = B; break } } if (x > z.length) { break } } else { if (m[B] == z[x] && B != e) { x++; C = B } } } if (!y && C + 1 < e) { r.val(""); w(0, h) } else { if (y || C + 1 >= e) { s(); if (!y) { r.val(r.val().substring(0, C + 1)) } } } return (e ? B : i) } if (!r.attr("readonly")) { r.one("unmask", function () { r.unbind(".mask").removeData("buffer").removeData("tests") }).bind("focus.mask", function () { q = r.val(); var x = p(); s(); setTimeout(function () { if (x == j.length) { r.caret(0, x) } else { r.caret(x) } }, 0) }).bind("blur.mask", function () { p(); if (r.val() != q) { r.change() } }).bind("keydown.mask", l).bind("keypress.mask", o).bind(c, function () { setTimeout(function () { r.caret(p(true)) }, 0) }) } p() }) } }) })(jQuery);

/*	ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
(function (c) { function r(b, d) { d = d === "x" ? m.width() : m.height(); return typeof b === "string" ? Math.round(b.match(/%/) ? d / 100 * parseInt(b, 10) : parseInt(b, 10)) : b } function M(b) { b = c.isFunction(b) ? b.call(i) : b; return a.photo || b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i) } function Y() { for (var b in a) if (c.isFunction(a[b]) && b.substring(0, 2) !== "on") a[b] = a[b].call(i); a.rel = a.rel || i.rel; a.href = a.href || i.href; a.title = a.title || i.title } function Z(b) { i = b; a = c(i).data(q); Y(); if (a.rel && a.rel !== "nofollow") { g = c(".cboxElement").filter(function () { return (c(this).data(q).rel || this.rel) === a.rel }); j = g.index(i); if (j < 0) { g = g.add(i); j = g.length - 1 } } else { g = c(i); j = 0 } if (!B) { C = B = n; N = i; N.blur(); c(document).bind("keydown.cbox_close", function (d) { if (d.keyCode === 27) { d.preventDefault(); e.close() } }).bind("keydown.cbox_arrows", function (d) { if (g.length > 1) if (d.keyCode === 37) { d.preventDefault(); D.click() } else if (d.keyCode === 39) { d.preventDefault(); E.click() } }); a.overlayClose && s.css({ cursor: "pointer" }).one("click", e.close); c.event.trigger(aa); a.onOpen && a.onOpen.call(i); s.css({ opacity: a.opacity }).show(); a.w = r(a.initialWidth, "x"); a.h = r(a.initialHeight, "y"); e.position(0); O && m.bind("resize.cboxie6 scroll.cboxie6", function () { s.css({ width: m.width(), height: m.height(), top: m.scrollTop(), left: m.scrollLeft() }) }).trigger("scroll.cboxie6") } P.add(D).add(E).add(t).add(Q).hide(); R.html(a.close).show(); e.slideshow(); e.load() } var q = "colorbox", F = "hover", n = true, e, x = c.browser.msie && !c.support.opacity, O = x && c.browser.version < 7, aa = "cbox_open", H = "cbox_load", S = "cbox_complete", T = "resize.cbox_resize", s, k, u, p, U, V, W, X, g, m, l, I, J, K, Q, P, t, E, D, R, y, z, v, w, i, N, j, a, B, C, $ = { transition: "elastic", speed: 350, width: false, height: false, innerWidth: false, innerHeight: false, initialWidth: "400", initialHeight: "400", maxWidth: false, maxHeight: false, scalePhotos: n, scrolling: n, inline: false, html: false, iframe: false, photo: false, href: false, title: false, rel: false, opacity: 0.9, preloading: n, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: false, overlayClose: n, slideshow: false, slideshowAuto: n, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: false, onLoad: false, onComplete: false, onCleanup: false, onClosed: false }; e = c.fn.colorbox = function (b, d) { var h = this; if (!h.length) if (h.selector === "") { h = c("<a/>"); b.open = n } else return this; h.each(function () { var f = c.extend({}, c(this).data(q) ? c(this).data(q) : $, b); c(this).data(q, f).addClass("cboxElement"); if (d) c(this).data(q).onComplete = d }); b && b.open && Z(h); return this }; e.init = function () { function b(d) { return c('<div id="cbox' + d + '"/>') } m = c(window); k = c('<div id="colorbox"/>'); s = b("Overlay").hide(); u = b("Wrapper"); p = b("Content").append(l = b("LoadedContent").css({ width: 0, height: 0 }), J = b("LoadingOverlay"), K = b("LoadingGraphic"), Q = b("Title"), P = b("Current"), t = b("Slideshow"), E = b("Next"), D = b("Previous"), R = b("Close")); u.append(c("<div/>").append(b("TopLeft"), U = b("TopCenter"), b("TopRight")), c("<div/>").append(V = b("MiddleLeft"), p, W = b("MiddleRight")), c("<div/>").append(b("BottomLeft"), X = b("BottomCenter"), b("BottomRight"))).children().children().css({ "float": "left" }); I = c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>"); c("form").prepend(s, k.append(u, I)); if (x) { k.addClass("cboxIE"); O && s.css("position", "absolute") } p.children().bind("mouseover mouseout", function () { c(this).toggleClass(F) }).addClass(F); y = U.height() + X.height() + p.outerHeight(n) - p.height(); z = V.width() + W.width() + p.outerWidth(n) - p.width(); v = l.outerHeight(n); w = l.outerWidth(n); k.css({ "padding-bottom": y, "padding-right": z }).hide(); E.click(e.next); D.click(e.prev); R.click(e.close); p.children().removeClass(F); c(".cboxElement").live("click", function (d) { if (d.button !== 0 && typeof d.button !== "undefined") return n; else { Z(this); return false } }) }; e.position = function (b, d) { function h(A) { U[0].style.width = X[0].style.width = p[0].style.width = A.style.width; K[0].style.height = J[0].style.height = p[0].style.height = V[0].style.height = W[0].style.height = A.style.height } var f = m.height(); f = Math.max(f - a.h - v - y, 0) / 2 + m.scrollTop(); var o = Math.max(document.documentElement.clientWidth - a.w - w - z, 0) / 2 + m.scrollLeft(); b = k.width() === a.w + w && k.height() === a.h + v ? 0 : b; u[0].style.width = u[0].style.height = "9999px"; k.dequeue().animate({ width: a.w + w, height: a.h + v, top: f, left: o }, { duration: b, complete: function () { h(this); C = false; u[0].style.width = a.w + w + z + "px"; u[0].style.height = a.h + v + y + "px"; d && d() }, step: function () { h(this) } }) }; e.resize = function (b) { function d() { a.w = a.w || l.width(); a.w = a.mw && a.mw < a.w ? a.mw : a.w; return a.w } function h() { a.h = a.h || l.height(); a.h = a.mh && a.mh < a.h ? a.mh : a.h; return a.h } function f(G) { e.position(G, function () { if (B) { if (x) { A && l.fadeIn(100); k[0].style.removeAttribute("filter") } if (a.iframe) l.append("<iframe id='cboxIframe'" + (a.scrolling ? " " : "scrolling='no'") + " name='iframe_" + (new Date).getTime() + "' frameborder=0 src='" + a.href + "' " + (x ? "allowtransparency='true'" : "") + " />"); l.show(); Q.show().html(a.title); if (g.length > 1) { P.html(a.current.replace(/\{current\}/, j + 1).replace(/\{total\}/, g.length)).show(); E.html(a.next).show(); D.html(a.previous).show(); a.slideshow && t.show() } J.hide(); K.hide(); c.event.trigger(S); a.onComplete && a.onComplete.call(i); a.transition === "fade" && k.fadeTo(L, 1, function () { x && k[0].style.removeAttribute("filter") }); m.bind(T, function () { e.position(0) }) } }) } if (B) { var o, A, L = a.transition === "none" ? 0 : a.speed; m.unbind(T); if (b) { l.remove(); l = c('<div id="cboxLoadedContent"/>').html(b); l.hide().appendTo(I).css({ width: d(), overflow: a.scrolling ? "auto" : "hidden" }).css({ height: h() }).prependTo(p); c("#cboxPhoto").css({ cssFloat: "none" }); O && c("select:not(#colorbox select)").filter(function () { return this.style.visibility !== "hidden" }).css({ visibility: "hidden" }).one("cbox_cleanup", function () { this.style.visibility = "inherit" }); a.transition === "fade" && k.fadeTo(L, 0, function () { f(0) }) || f(L); if (a.preloading && g.length > 1) { b = j > 0 ? g[j - 1] : g[g.length - 1]; o = j < g.length - 1 ? g[j + 1] : g[0]; o = c(o).data(q).href || o.href; b = c(b).data(q).href || b.href; M(o) && c("<img />").attr("src", o); M(b) && c("<img />").attr("src", b) } } else setTimeout(function () { var G = l.wrapInner("<div style='overflow:auto'></div>").children(); a.h = G.height(); l.css({ height: a.h }); G.replaceWith(G.children()); e.position(L) }, 1) } }; e.load = function () { var b, d, h, f = e.resize; C = n; i = g[j]; a = c(i).data(q); Y(); c.event.trigger(H); a.onLoad && a.onLoad.call(i); a.h = a.height ? r(a.height, "y") - v - y : a.innerHeight ? r(a.innerHeight, "y") : false; a.w = a.width ? r(a.width, "x") - w - z : a.innerWidth ? r(a.innerWidth, "x") : false; a.mw = a.w; a.mh = a.h; if (a.maxWidth) { a.mw = r(a.maxWidth, "x") - w - z; a.mw = a.w && a.w < a.mw ? a.w : a.mw } if (a.maxHeight) { a.mh = r(a.maxHeight, "y") - v - y; a.mh = a.h && a.h < a.mh ? a.h : a.mh } b = a.href; J.show(); K.show(); if (a.inline) { c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H + " cbox_cleanup", function () { c(this).replaceWith(l.children()) }); f(c(b)) } else if (a.iframe) f(" "); else if (a.html) f(a.html); else if (M(b)) { d = new Image; d.onload = function () { var o; d.onload = null; d.id = "cboxPhoto"; c(d).css({ margin: "auto", border: "none", display: "block", cssFloat: "left" }); if (a.scalePhotos) { h = function () { d.height -= d.height * o; d.width -= d.width * o }; if (a.mw && d.width > a.mw) { o = (d.width - a.mw) / d.width; h() } if (a.mh && d.height > a.mh) { o = (d.height - a.mh) / d.height; h() } } if (a.h) d.style.marginTop = Math.max(a.h - d.height, 0) / 2 + "px"; f(d); g.length > 1 && c(d).css({ cursor: "pointer" }).click(e.next); if (x) d.style.msInterpolationMode = "bicubic" }; d.src = b } else c("<div />").appendTo(I).load(b, function (o, A) { A === "success" ? f(this) : f(c("<p>Request unsuccessful.</p>")) }) }; e.next = function () { if (!C) { j = j < g.length - 1 ? j + 1 : 0; e.load() } }; e.prev = function () { if (!C) { j = j > 0 ? j - 1 : g.length - 1; e.load() } }; e.slideshow = function () { function b() { t.text(a.slideshowStop).bind(S, function () { h = setTimeout(e.next, a.slideshowSpeed) }).bind(H, function () { clearTimeout(h) }).one("click", function () { d(); c(this).removeClass(F) }); k.removeClass(f + "off").addClass(f + "on") } var d, h, f = "cboxSlideshow_"; t.bind("cbox_closed", function () { t.unbind(); clearTimeout(h); k.removeClass(f + "off " + f + "on") }); d = function () { clearTimeout(h); t.text(a.slideshowStart).unbind(S + " " + H).one("click", function () { b(); h = setTimeout(e.next, a.slideshowSpeed); c(this).removeClass(F) }); k.removeClass(f + "on").addClass(f + "off") }; if (a.slideshow && g.length > 1) a.slideshowAuto ? b() : d() }; e.close = function () { c.event.trigger("cbox_cleanup"); a.onCleanup && a.onCleanup.call(i); B = false; c(document).unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T + " resize.cboxie6 scroll.cboxie6"); s.css({ cursor: "auto" }).fadeOut("fast"); k.stop(n, false).fadeOut("fast", function () { c("#colorbox iframe").attr("src", "about:blank"); l.remove(); k.css({ opacity: 1 }); try { N.focus() } catch (b) { } c.event.trigger("cbox_closed"); a.onClosed && a.onClosed.call(i) }) }; e.element = function () { return c(i) }; e.settings = $; c(e.init) })(jQuery);
$.fn.colorbox.settings.opacity = 0.6;
$.fn.colorbox.settings.transition = "none";

/*!
 * jQuery Tools v1.2.5 - The missing UI library for the Web
 * 
 * scrollable/scrollable.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return m.add(n)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.children(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(1,a)},prev:function(a){return f.move(-1,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children("."+e.clonedClass+":last").before(b),h.children("."+e.clonedClass+":first").replaceWith(b.clone().addClass(e.clonedClass))):h.append(b),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}}),f.seekTo(0,0,function(){})}var m=c(b,e.prev).click(function(){f.prev()}),n=c(b,e.next).click(function(){f.next()});!e.circular&&f.getSize()>1&&(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(m.toggleClass(e.disabledClass,b<=0),n.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||m.addClass(e.disabledClass)),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var o={};h[0].ontouchstart=function(a){var b=a.touches[0];o.x=b.clientX,o.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=o.x-b.clientX,d=o.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).bind("keydown.scrollable",function(b){if(e.keyboard&&!b.altKey&&!b.ctrlKey&&!a(b.target).is(":input")){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);

// GBC core
/*
jQuery plugin:	cssWatermark(className)
Purpose:		Creates a watermark effect using only css classes.
Copyright:		© 2011 by CafePress.
License:		Not authorized for redistribution or third-party use.
Author:			Elijah Taylor (etaylor(-at-)cafepress(-dot-)com)
*/
jQuery.fn.cssWatermark = function (className) {

	return this.each(function () {
		var $obj = $(this);
		$obj.bind('focus', function () {
			$(this).removeClass(className);
		});
		$obj.bind('blur', function () {
			if ($(this).val() == '') {
				$(this).addClass(className);
			}
			else {
				$(this).removeClass(className);
			}
		});
		// Always clear it while they're typing
		$obj.bind('keydown', function () {
			$(this).removeClass(className);
		});
		// Initial check
		if ($obj.val() == '') {
			$obj.addClass(className);
		}
		else {
			$obj.removeClass(className);
		}
	});
};
/*
jQuery plugin:	sniffCardType(settings)
Purpose:		Detects credit card type and changes an element's CSS class name based on the result.
Parameters:		spanId, visaClass, mcClass, amexClass, discoverClass, defaultClass
Returns:        jQuery
Copyright:		© 2011 by CafePress.
License:		Not authorized for redistribution or third-party use.
Author:			Elijah Taylor (etaylor(-at-)cafepress(-dot-)com)
*/
jQuery.fn.sniffCardType = function (settings) {

	settings = jQuery.extend({
		spanId: 'ccType',
		visaClass: 'card_visa',
		mcClass: 'card_mc',
		amexClass: 'card_amex',
		discoverClass: 'card_disc',
		allClass: 'card_all',
		noneClass: 'card_invalid',
		inputId: ''
	}, settings);

	this.each(function () {
		$(this).bind('keyup blur', (function () {
			var finish = function (span, className) {
				span.attr('class', className);
				$('#' + settings.inputId).val(className);
			}
			var span = jQuery('#' + settings.spanId);
			var val = $(this).val();
			if (val.length < 2) {
				finish(span, settings.allClass);
				return;
			}
			var firstTwo = val.substr(0, 2);
			if (firstTwo.substr(0, 1) == 4) {
				finish(span, settings.visaClass);
			}
			else if (firstTwo >= 51 && firstTwo <= 55) {
				finish(span, settings.mcClass);
			}
			else if (firstTwo == 34 || firstTwo == 37) {
				finish(span, settings.amexClass);
			}
			else {
				if (
					val.substring(0, 4) == 6011
					 || (val.substring(0, 6) >= 622126 && val.substring(0, 6) <= 622925)
					 || (val.substring(3, 0) >= 644 && val.substring(0, 3) <= 649)
					 || firstTwo == 65) {
					finish(span, settings.discoverClass);
				}
				else {
					finish(span, settings.noneClass);
				}
			}
		}));
	});
	return this;
};

/*
jQuery plugin:	rolloverImage(url)
Purpose:		Automatically sets up image rollover
Parameters:		url
Returns:        jQuery
Copyright:		© 2011 by CafePress.
License:		Not authorized for redistribution or third-party use.
Author:			Elijah Taylor (etaylor(-at-)cafepress(-dot-)com)
*/
jQuery.fn.rolloverImage = function (url, delay) {
	if (!delay) delay = 500;
	return this.each(function () {
		$(this).data('originalImage', $(this).attr('src'));
		$(this).bind('mouseover', function () {
			var target = $(this);
			if (target.data('timeoutId') > 0) window.clearTimeout(target.data('timeoutId'));
			target.attr('src', url);
		});
		$(this).bind('mouseout', function () {
			$(this).data('timeoutId', window.setTimeout("$('#" + this.id + "').attr('src', '" + $(this).data('originalImage') + "');", delay));
		});
	});
};

function enable_smooth_scroll() {
	function filterPath(string) {
		return string
                .replace(/^\//, '')
                .replace(/(index|default).[a-zA-Z]{3,4}$/, '')
                .replace(/\/$/, '');
	}

	var locationPath = filterPath(location.pathname);

	var scrollElement = 'html, body';
	$('html, body').each(function () {
		var initScrollTop = $(this).attr('scrollTop');
		$(this).attr('scrollTop', initScrollTop + 1);
		if ($(this).attr('scrollTop') == initScrollTop + 1) {
			scrollElement = this.nodeName.toLowerCase();
			$(this).attr('scrollTop', initScrollTop);
			return false;
		}
	});

	$('a[href*=#]').each(function () {
		var thisPath = filterPath(this.pathname) || locationPath;
		if (locationPath == thisPath
                && (location.hostname == this.hostname || !this.hostname)
                && this.hash.replace(/#/, '')
            ) {
			if ($(this.hash).length) {
				$(this).click(function (event) {
					var targetOffset = $(this.hash).offset().top;
					var target = this.hash;
					event.preventDefault();
					$(scrollElement).animate(
                            { scrollTop: targetOffset },
                            500,
                            function () {
                            	location.hash = target;
                            });
				});
			}
		}
	});
};

String.prototype.format = function () {
	var replaceArg = function (value, index, arg) {
		var re = new RegExp('\\{' + (index) + '\\}', 'gm');
		return value.replace(re, arg);
	};

	var result = this;
	for (var i = 0; i < arguments.length; i++) {
		result = replaceArg(result, i, arguments[i]);
	}

	return result;
};

/*
jQuery plugin:	dockBounce
Purpose:		Bounces an element like it's in the dock
Parameters:		selector
Returns:        jQuery
Copyright:		© 2011 by CafePress.
License:		Not authorized for redistribution or third-party use.
Author:			Elijah Taylor (etaylor(-at-)cafepress(-dot-)com)
Requires:		jQueryUI for easing 
*/
jQuery.fn.dockBounce = function (height) {
	if (!height) height = 100;
	var speedUp = height * 3;
	var speedDown = 700;
	return this.each(function () {
		$(this).animate({ top: '-=' + height }, speedUp, 'easeOutQuad', function () {
			$(this).animate({ top: '+=' + height }, speedDown, 'easeOutBounce', function () { });
		});
	});
};

// GBC root object
var gbc = {
	// Empty object
	// Define modules below
};

// Utility module
gbc.util = {
	formatMoney: function (val) {
		var rounded = Number(val).toFixed(2);
		if (rounded.length == 7) {
			rounded = rounded.substr(0, 1) + ',' + rounded.substr(1);
		}
		else if (rounded.length == 8) {
			rounded = rounded.substr(0, 2) + ',' + rounded.substr(2);
		}
		return '$' + rounded;
	},
	showZoom: function (sku) {
		window.open('http://s7d6.scene7.com/s7/zoom/flasht_zoom.jsp?company=CanvasOnDemand&sku=' + sku + '&config=CanvasOnDemand/ZoomA', 'popup_window', 'width=600px,height=400px,left=50,top=50,scrollbars=no');
	},
	registerEmailContact: function (email) {
		$.ajax({
			type: "POST",
			url: "/services/util-helper.asmx/RegisterEmailContact",
			data: "{'email': '" + email + "'}",
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function (result) {
				// Service call success, check result
				result = result.d;
				if (result.Success) {
					// Success, show popup
					$.fn.colorbox({ width: "430px", height: "350px", scrolling: false, iframe: true, href: '/about-us/newsletter/thanks.aspx?email=' + email + '&id=' + result.ContactID });
				}
				else {
					// Failure
					alert(result.ErrorMessage);
					return;
				}
			},
			error: function (xreq, msg) {
				alert('Web service call failed: ' + msg);
				return;
			}
		});
	},
	initNewsletterForm: function () {
		$('.newsletter img').click(function () {
			gbc.util.registerEmailContact($('.newsletter input').val());
		});
		$('.newsletter input').keypress(function (e) {
			if (e.which == 13) {
				e.preventDefault();
				gbc.util.registerEmailContact($(this).val());
				return false;
			}
		});
	}
};

// Main menu controller
gbc.mainMenu = {

	originalMenuItem: '',
	menuTimerId: 0,

	hideMenu: function (id) {
		clearTimeout(gbc.mainMenu.menuTimerId);
		$('#' + id).removeClass('s').find('.ddl').fadeOut();
		gbc.mainMenu.originalMenuItem.addClass('s');
	},

	init: function () {
		gbc.mainMenu.originalMenuItem = $('#nav ul > li.s').attr('rel', 'ori');
		var i = 0;
		$('#nav ul li')
					.mouseenter(function () {
						clearTimeout(gbc.mainMenu.menuTimerId);
						var $this = $(this);
						$this.siblings().removeClass('s').find('.ddl').hide();
						var menuHeight = $(this).find('.ddl ul.col1 li').length * 28;
						$this.addClass('s');
						$this.find('.ddl').css('height', menuHeight + 'px');
						$this.find('.ddl').show();
					})
					.mouseleave(function () {
						gbc.mainMenu.menuTimerId = setTimeout('gbc.mainMenu.hideMenu("' + $(this).attr('id') + '");', 500);
					})
					.attr('id', function () { return "menuli" + i++ })
					.find('.ddl')
					.css('display', 'none');
		gbc.mainMenu.originalMenuItem.mouseenter(function () {
			$(this).siblings().each(function () {
				$(this).removeClass('s').find('.ddl').hide();
			});
			$(this).find('.ddl').show();
		});
		$('#nav ul li ul li').unbind();
	}
};

// Shopping cart controller
gbc.iCart = {

	cart: '',
	cartState: 'closed',
	panel: 'none',

	showCart: function () {
		$.get('/scripts/system/icart.aspx', function (data) {
			// Success
			gbc.iCart.panel = 'cart';
			gbc.iCart.loadItems(data);
			gbc.iCart.cart.find('.tabs .tab').removeClass('s');
			gbc.iCart.cart.find('.tabs .cart').addClass('s');

		});
	},

	hideCart: function () {
		gbc.iCart.cart.parent().animate({ bottom: '-64px', opacity: 0.8 }, 200);
		gbc.iCart.cart.find('.items').fadeOut();
		gbc.iCart.cart.find('.arrow').removeClass('contract').addClass('expand');
		gbc.iCart.cart.find('.tabs .tab').removeClass('s');
		gbc.iCart.cartState = 'closed';
		gbc.iCart.panel = 'none';
	},

	toggleCart: function (evt) {
		if (gbc.iCart.cartState == 'opened') {
			// Cart is expanded
			gbc.iCart.hideCart();
		}
		else {
			// Cart is contracted
			gbc.iCart.showCart();
		}
	},

	loadItems: function (data) {
		gbc.iCart.cart.find('.items')
			.fadeOut('fast', function () {
				var $me = $(this);
				$me.html('<div class="scrollContainer">' + $(data).find('.scrollContainer').html() + '</div>');
				gbc.iCart.attachRollovers();
				$('.iCart .cartInfo .total span').text($(data).find('#hdnOrderTotal').val());
				gbc.iCart.cart.parent().animate({ bottom: 0, opacity: 0.95 }, 200);
				$me.fadeIn();
				gbc.iCart.cart.find('.arrow').removeClass('expand').addClass('contract');
				gbc.iCart.cartState = 'opened';
			});
	},

	showGallery: function () {
		$.get('/scripts/system/igallery.aspx', function (data) {
			// Success
			gbc.iCart.panel = 'gallery';
			gbc.iCart.loadItems(data);
			gbc.iCart.cart.find('.tabs .tab').removeClass('s');
			gbc.iCart.cart.find('.tabs .gallery').addClass('s');

		});
	},

	showThanksButton: function () {
		$('.productBuilder .addToCart .btn')
			.hide()
			.attr('class', 'btn added')
			.fadeIn()
			.find('a')
				.remove()
				.end()
			.append('<a href="/cart/" target="_top"> </a>');
	},

	attachRollovers: function () {
		// Remove old tips
		$('form > .iCartHoverItem').remove();
		// Set up new ones
		gbc.iCart.cart.find('.scrollable').scrollable();
		gbc.iCart.cart.find('.item .image')
			.each(function (index) {
				// For each item in the scroller
				var item = $(this);
				item.attr('rel', index);
				var tip = item.next();
				tip.attr('rel', 'iCartTip' + index)
					.appendTo('form')
					.bind('mouseover', function () {
						// Stop the hide timer
						window.clearTimeout($(this).data('timeoutId'));
					})
					.bind('mouseleave', function () {
						// Start the hide timer
						$(this).data('timeoutId',
							window.setTimeout(function (obj) {
								$(tip).fadeOut();
								$(tip).find('accent').hide();
							}, 500, tip)
						);
					})
					.find('select').bind('change', function () {
						// Quantity drop-down change event
						var data = $(this).attr('rel').split(',');
						var quan = $(this).val();
						gbc.iCart.updateQuantity(data[0], data[1], data[2], quan, $(this).next());
						item.find('.count').text(quan);
					})
					.end()
						.find('.hoverActions')
							.find('.addtocart').click(function () {
								gbc.gallery.copyItemFromGalleryToCart($(this).attr('rel'));
							})
						.end()
							.find('.addtogallery').click(function () {
								gbc.gallery.copyItemFromCartToGallery($(this).attr('rel'));
							})
						.end()
							.find('.remove').click(function () {
								var data = $(this).attr('rel');
								if (gbc.iCart.panel == 'cart') {
									gbc.iCart.removeItem(data);
								}
								else {
									gbc.gallery.removeItem(data);
								}
							})
					.end();
			})
			.hover(
				function () {
					// MouseEnter function
					$('[rel^=iCartTip]').hide();
					var tip = $('[rel=iCartTip' + $(this).attr('rel') + ']');
					window.clearTimeout(tip.data('timeoutId'))
					tip.css('left', $(this).offset().left - (tip.outerWidth() / 2) + $(this).width() / 2);
					tip.css('top', $(this).offset().top - tip.outerHeight());
					tip.show();
				},
				function () {
					// MouseLeave function
					var tip = $('[rel=iCartTip' + $(this).attr('rel') + ']');
					// Start the hide timer
					tip.data('timeoutId',
						window.setTimeout(function () {
							$(tip).fadeOut();
							$(tip).find('accent').hide();
						}, 500)
					);
				}
			)
	},

	updateQuantity: function (i, g, o, q, l) {
		$.ajax({
			type: "POST",
			url: "/services/order-helper.asmx/UpdateQuantity",
			data: "{'lineItemId': '" + i + "', 'lineItemGuid': '" + g + "', 'orderId': '" + o + "', 'newQuantity': '" + q + "'}",
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			success: function (response) {
				// Success
				l.fadeIn(100);
				$('.iCart .cartInfo .total span').fadeOut('fast', function () {
					$(this).text(gbc.util.formatMoney(response.d))
					.fadeIn();
				});
				window.setTimeout(function () { l.hide(); }, 1000);
			},
			error: function (xreq, msg) {
				alert('Web service call failed: ' + msg);
				return;
			}
		});
	},

	addItem: function (width, height, imageId, productId, mountingId, frameId, materialId, colorEffect) {
		$('.productBuilder .addToCart .btn').fadeOut('fast');
		$.post("/services/order-helper.asmx/AddItem", { width: width, height: height, imageId: imageId, productId: productId, mountingId: mountingId, frameId: frameId, materialId: materialId, colorEffectStr: colorEffect }, function () {
			gbc.iCart.showThanksButton();
			gbc.iCart.showCart();
		});
	},

	removeItem: function (data) {
		var vals = data.split(',');
		var id = vals[0];
		var guid = vals[1];
		$.post("/services/order-helper.asmx/RemoveItem", { id: id, guid: guid }, function () {
			gbc.iCart.showCart();
		});
	},

	init: function () {
		gbc.iCart.cart = $('.iCart');
		gbc.iCart.cart.find('.arrow').click(this.toggleCart);
		gbc.iCart.cart.find('.tabs .gallery').click(gbc.iCart.showGallery);
		gbc.iCart.cart.find('.tabs .cart').click(gbc.iCart.showCart);
		gbc.iCart.cart.parent().css('opacity', 0.8);
	}
};

// Define gallery controller
gbc.gallery =
{
	addItem: function (width, height, imageId, productId, mountingId, frameId, materialId, colorEffect, waitObj) {
		var waiter = $(waitObj).parent().find('.wait');
		waiter.fadeTo('fast', 0.6);
		$.post("/services/gallery-helper.asmx/AddItem", { width: width, height: height, imageId: imageId, productId: productId, mountingId: mountingId, frameId: frameId, materialId: materialId, colorEffectStr: colorEffect }, function () {
			gbc.iCart.showGallery();
			waiter.fadeOut();
		});
	},

	moveItemToGallery: function (data, gid) {

	},

	copyItemFromCartToGallery: function (data) {
		var vals = data.split(',');
		var id = vals[0];
		var guid = vals[1];
		$.post("/services/gallery-helper.asmx/CopyItemFromCartToGallery", { id: id, guid: guid }, function () {
			gbc.iCart.showGallery();
		});
	},

	copyItemFromGalleryToCart: function (data) {
		var vals = data.split(',');
		var id = vals[0];
		var guid = vals[1];
		$.post("/services/gallery-helper.asmx/CopyItemFromGalleryToCart", { id: id, guid: guid }, function () {
			gbc.iCart.showCart();
		});
	},

	removeItem: function (data) {
		var vals = data.split(',');
		var id = vals[0];
		var guid = vals[1];
		$.post("/services/gallery-helper.asmx/RemoveItem", { id: id, guid: guid }, function () {
			gbc.iCart.showGallery();
		});
	},

	rateGallery: function (id, rating) {

	}
};

// Define carousel controller
gbc.carousel =
{
	activateItem: function (item) {
		var i = $(item);
		if (i.hasClass('s')) return;
		var thisCarousel = i.parents('.carousel');
		var index = i.attr('data-item');
		var currentPanel = thisCarousel.find('.set:visible');
		if (currentPanel.length > 0) {
			// Fade current panel out
			thisCarousel.find('.set:visible').fadeOut('fast', function () {
				// Then fade this panel in
				thisCarousel.find('.set[data-item=' + index + ']').fadeIn();
			});
		}
		else {
			// Fade this panel in
			thisCarousel.find('.set[data-item=' + index + ']').fadeIn();
		}
		thisCarousel.find('.buttons li').removeClass('s');
		i.addClass('s');
	},

	init: function () {
		var c = $('.carousel');
		c.find('.scrollable').scrollable();
		c.find('.buttons li').each(function () {
			var i = $(this);
			i.click(function () {
				gbc.carousel.activateItem(this);
			});
			if (Number(i.attr('data-item')) == 1) gbc.carousel.activateItem(i);
		});
	}
};

gbc.init = function () {
	// Init main menu first for speed
	gbc.mainMenu.init();
	// Sidebar height
	if ($('#sidebar').length > 0) {
		$('#page').addClass('sideBar');
	}
	// Search box watermark
	if ($('#header .search .ctl_txt').length > 0) {
		$.watermark.options.className = 'watermarked';
		$.watermark.options.useNative = false;
		$('#header .search .ctl_txt').watermark('Subject, artist, style...');
	}
	// Init carousel
	gbc.carousel.init();
	// Init inline cart
	gbc.iCart.init();
	// Init email signup box
	gbc.util.initNewsletterForm();
};

$(function () {
	// jQuery ready event: call main initializer
	gbc.init();
});
