text: var validatorMap = {
      required: [LANG_formplus.validate.required,
      function(a, b, c) {
          return "select-one" == c || "select" == c ? (c = a.selectedIndex, b = a.options[c].value, 0 <= c && "" != b && "_NULL_" != b) : null !== b && 0 !== b.length
      }],
      minLength: [function(a, b, c) {
          return "null" != typeOf(c) ? LANG_formplus.validate.minLength.substitute({
              minLength: c,
              length: b.length
          }) : ""
      },
      function(a, b, c, d, e) {
          return "null" != typeOf(e) ? b.length >= (e || 0) : !0
      }],
      maxLength: [function(a, b, c) {
          return "null" != typeOf(c) ? LANG_formplus.validate.maxLength.substitute({
              maxLength: c,
              length: b.length
          }) : ""
      },
      function(a, b, c, d, e) {
          return "null" != typeOf(e) ? b.length <= (e || 1E4) : !0
      }],
      number: [LANG_formplus.validate.number,
      function(a, b) {
          return ! isNaN(b) && !/^\s+$/.test(b)
      }],
      msn: [LANG_formplus.validate.msn,
      function(a, b) {
          return null === b || "" == b || /\S+@\S+/.test(b)
      }],
      skype: [LANG_formplus.validate.skype,
      function(a, b) {
          return ! /\W/.test(b) || /^[a-zA-Z0-9]+$/.test(b)
      }],
      digits: [LANG_formplus.validate.digits,
      function(a, b) {
          return ! /[^\d]/.test(b)
      }],
      unsignedint: [LANG_formplus.validate.unsignedint,
      function(a, b) {
          return ! /[^\d]/.test(b) && 0 < b
      }],
      unsigned: [LANG_formplus.validate.unsigned,
      function(a, b) {
          return ! isNaN(b) && !/^\s+$/.test(b) && 0 <= b
      }],
      positive: [LANG_formplus.validate.positive,
      function(a, b) {
          return ! isNaN(b) && !/^\s+$/.test(b) && 0 < b
      }],
      alpha: [LANG_formplus.validate.alpha,
      function(a, b) {
          return null === b || "" == b || /^[a-zA-Z]+$/.test(b)
      }],
      alphaint: [LANG_formplus.validate.alphaint,
      function(a, b) {
          return ! /\W/.test(b) || /^[a-zA-Z0-9]+$/.test(b)
      }],
      alphanum: [LANG_formplus.validate.alphanum,
      function(a, b) {
          return ! /\W/.test(b) || /^[\u4e00-\u9fa5a-zA-Z0-9]+$/.test(b)
      }],
      unzhstr: [LANG_formplus.validate.unzhstr,
      function(a, b) {
          return ! /\W/.test(b) || !/^[\u4e00-\u9fa5]+$/.test(b)
      }],
      date: [LANG_formplus.validate.date,
      function(a, b) {
          return null === b || "" == b || /^(19|20)[0-9]{2}-([1-9]|0[1-9]|1[012])-([1-9]|0[1-9]|[12][0-9]|3[01])$/.test(b)
      }],
      email: [LANG_formplus.validate.email,
      function(a, b) {
          return null === b || "" == b || /^[a-z\d][a-z\d_.]*@[\w-]+(?:\.[a-z]{2,})+$/i.test(b)
      }],
      emaillist: [LANG_formplus.validate.email,
      function(a, b) {
          return null === b || "" == b || /^(?:[a-z\d][a-z\d_.]*@[\w-]+(?:\.[a-z]{2,})+[,;\s]?)+$/i.test(b)
      }],
      mobile: [LANG_formplus.validate.mobile,
      function(a, b) {
          return null === b || "" == b || /^0?1[34578]\d{9}$/.test(b)
      }],
      tel: [LANG_formplus.validate.tel,
      function(a, b) {
          return null === b || "" == b || /^(0\d{2,3}-?)?[23456789]\d{5,7}(-\d{1,5})?$/.test(b)
      }],
      phone: [LANG_formplus.validate.phone,
      function(a, b) {
          return null === b || "" == b || /^0?1[34578]\d{9}$|^(0\d{2,3}-?)?[23456789]\d{5,7}(-\d{1,5})?$/.test(b)
      }],
      zip: [LANG_formplus.validate.zip,
      function(a, b) {
          return null === b || "" == b || /^\d{6}$/.test(b)
      }],
      url: [LANG_formplus.validate.url,
      function(a, b) {
          var c = RegExp("^((https|http|ftp|rtsp|mms)?://)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})(:[0-9]{1,4})?((/?)|(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$", "i");
          return null === b || "" == b || c.test(b)
      }],
      area: [LANG_formplus.validate.area,
      function(a) {
          return a.getElements("select").every(function(a) {
              var c = a.get("value");
              return ! a.isDisplayed() ? !0 : "" != c && "_NULL_" != c
          })
      }],
      equal: [LANG_formplus.validate.equal,
      function(a, b, c, d, e) {
          a = d.getElement('[name="' + e + '"]');
          return ! a || b === a.value
      }],
      onerequired: [LANG_formplus.validate.onerequired,
      function(a, b, c, d) {
          a = a.name;
          return d.getElements("input" + (a ? '[name="' + a + '"]': "")).some(function(a) {
              return ["checkbox", "radio"].contains(a.type) ? a.checked: !!a.value
          })
      }]
  },
  validate = function(a, b, c) {
      a = a || 0 === a ? document.id(a) : null;
      b = b || "";
      if (!a) return ! 0;
      var d = []; (a.match("form") || "all" == b ? a.getElements("[vtype], [pattern]") : Array.from(a)).each(function(b) {
          if (!b.isVisible()) return ! 0;
          var f = b.get("vtype").split("&&"),
          g = b.get("pattern"),
          h = RegExp(g),
          i = b.get("data-caution") || "",
          j = "custom_" + b.get("uid");
          g && (validatorMap[j] || (validatorMap[j] = [b.get("data-attention") || "",
          function(a, b) {
              return null === b || "" === b || h.test(b)
          }]), f = f.clean().include(j));
          b.get("required") && (f = ["required"].combine(f), b.erase("required"));
          if (!f.length) return ! 0;
          f.every(function(d, f) {
              var g = "",
              h = d.split(":"),
              d = h[0];
              if (h.length > 1) var j = h[1];
              h = validatorMap[d];
              if (!h) return true;
              h = typeOf(h) === "array" ? h: ["", h];
              if (i) {
                  g = i.split("&&");
                  g = g[f] || ""
              }
              var o = b.getNext(".caution"),
              g = g || (typeOf(h[0]) === "function" ? h[0](b, b.get("value"), j) : h[0]),
              h = h[1] ||
              function() {
                  return true
              },
              q = ["input", "select", "textarea"].contains(b.get("tag"));
              if (h(b, b.get("value"), b.type, a.match("[vtype]") || a.match("[pattern]") ? c || a.getParent("form") || a.getParent() : a, j)) {
                  o && b.retrieve("tips_instance", {
                      hide: function() {}
                  }).hide(true);
                  q && b.removeClass("caution-input");
                  return true
              }
              o && o.destroy();
              g && formTips.error(g, b).store(); 
              if (b.bindEvent !== false) {
                  var r = q ? "onblur": "onmouseout";
                  b[r] = function(b) {
                      b = b || window.event;
                      if (!/mouseout$/i.test(b.type) || !this.contains($(b.target || b.srcElement))) {
                          validate(this, "", a.match("[vtype]") || a.match("[pattern]") ? a.getParent("form") || a.getParent() : a);
                          o && this.retrieve("tips_instance", {
                              hide: function() {}
                          }).hide(true);
                          q && this.removeClass("caution-input")
                      }
                      this[r] = null
                  }
              }
              q && b.addClass("caution-input");
              return false
          }) || d.push(b)
      });
      return d.length ? (d.shift().focus(), !1) : !0
  },
  formTips = (new Class({
      Implements: Options,
      options: {
          form: "inline",
          type: "error",
          "class": "notice-inline",
          msg: "",
          target: document.body,
          destroy: !1,
          position: ["ct", "cb"],
          offset: [0, -9],
          intoView: !0,
          autohide: 3
      },
      initialize: function(a) {
          this.setOptions(a);
          this.hidden = !0;
          return this
      },
      toElement: function() {
          if (!this.element) {
              var a = this.options;
              this.uid = a.target.get("uid");
              this.uid++;
              var b = "inline" == a.form ? "span": "div",
              c = "_build_tips_" + (a.form ? a.form: "") + "_" + a.type + "_" + this.uid;
              this.element = a.single && document.id(c) ? document.id(c) : new Element(b, {
                  id: c,
                  "class": "caution " + a.type + " " + a["class"],
                  style: "display:none;",
                  html: '<q class="icon">' + ("success" === a.type ? "&#x25;": "&#x21;") + '</q><span class="caution-content"></span>'
              });
              this.element.inject(a.target, a.where)
          }
          return this.element
      },
      store: function(a) { ($(a) || this.options.target).store("tips_instance", this);
          return this
      },
      eliminate: function(a) { ($(a) || this.options.target).eliminate("tips_instance");
          return this
      },
      position: function(a) {
          this.element || document.id(this);
          return this.element.position({
              target: a.target,
              from: "array" == tyeOf(a.position) ? a.position[0] : "cb",
              to: "array" == tyeOf(a.position) ? a.position[0] : a.position,
              offset: a.offset
          })
      },
      show: function(a, b) {
          "object" == typeOf(a) && (b = a, a = b.msg);
          if (!this.hidden) return this;
          b = Object.merge(this.options, b || {});
          this.element || document.id(this);
          b.form && "inline" != b.form && this.element.position(b);
          if (b.intoView) try { (new Fx.Scroll(document, {
                  link: "cancel",
                  duration: 300
              })).toElementEdge(this.element)
          } catch(c) {}
          a && (this.element.getElement(".caution-content").innerHTML = a);
          this.element.show();
          this.hidden = !1; ! isNaN(b.autohide) && 0 < b.autohide && (clearTimeout(this.timer), this.timer = this.hide.delay(1E3 * b.autohide, this));
          return this.options.store ? this.store(this.options.store) : this
      },
      hide: function(a) {
          a = a || this.options.destroy;
          if (this.hidden) return this;
          this.element || document.id(this); ! 1 !== a ? (this.element.destroy(), this.element = null) : this.element.hide();
          this.hidden = !0;
          return this.eliminate(this.options.store)
      }
  })).extend({
      tip: function(a, b) {
          return (new formTips({
              type: "notice",
              target: a || document.body,
              where: "after",
              autohide: 0
          })).show(b)
      },
      error: function(a, b, c) {
          return (new formTips({
              type: "error",
              target: b || document.body,
              where: "after",
              autohide: 0
          })).show(a, c)
      },
      success: function(a, b, c) {
          return (new formTips({
              type: "success",
              target: b || document.body,
              where: "after",
              autohide: 0
          })).show(a, c)
      },
      warn: function(a, b, c) {
          return (new formTips({
              type: "warn",
              target: b || document.body,
              where: "top",
              autohide: 0,
              "class": "caution-inline",
              single: !0,
              store: !0
          })).show(a, c)
      }
  }),
  passwordStrength = function(a, b, c) {
      var d = /[A-Z]/g,
      e = RegExp("(.{" + parseInt(a.length / 2) + ",})\u0001", "g"),
      f = -1,
      f = "poor",
      f = !a || 6 > a.length ? -1 : parseInt(a.length / 6) - 1;
      a.match(e) && f--; (a.match(/[a-z]/g) || a.match(d)) && f++;
      a.match(/\d/g) && f++;
      a.match(/[\W_]/g) && f++;
      6 < a.length && 2 > f && f++;
      switch (f) {
      case - 1 : case 0:
      case 1:
          f = "poor";
          break;
      case 2:
          f = "weak";
          break;
      case 3:
          f = "good";
          break;
      default:
          f = "strong"
      }
      b.className = (c ? c + " ": "") + "password-" + f
  }.extend({
      init: function(a, b) {
          Array.from(a).each(function(a) {
              if (a && (b = b ? a.getParent().getElement(b) : a.getNext())) {
                  var d = b.setStyle("visibility", "visible").className;
                  a.addEvent("inputchange",
                  function() {
                      var a = this.value;
                      passwordStrength.prev !== a && passwordStrength(a, b, d);
                      passwordStrength.prev = a
                  })
              }
          })
      }
  });
  function changeVerify(a, b) {
      Array.from(a).each(function(a) {
          var d, e;
          "IMG" === a.tagName ? (e = a, d = a.getAttribute("src").split("?")[0]) : "A" === a.tagName && (e = a.getPrevious("img"), d = a.getAttribute("href"));
          b ? a.addEvent("click", changeCode.bind(a, e, d)) : changeCode(e, d)
      })
  }
  function changeCode(a, b) {
      b = b || a.src.split("?")[0];
      a.src = b + "?" + +new Date;
      return ! 1
  }
  function checkAll(a, b) {
      b.set("checked", a.checked)
  }
  var Placeholder = {
      support: function() {
          return "placeholder" in document.createElement("input")
      } (),
      className: "placeholder",
      init: function() {
          Placeholder.support || Placeholder.create($$("input, textarea"))
      },
      build: function(a, b) {
          var c = a.getParent();
          "static" == c.getStyle("position") && c.setStyle("position", "relative");
          return a.getPrevious("." + this.className) || (new Element("span." + this.className, {
              html: b,
              style: "visibility:hidden;"
          })).inject(a, "before").position({
              target: a,
              from: "lc",
              to: "lc",
              offset: {
                  x: 4
              },
              offsetParent: !0
          }).addEvent("click",
          function() {
              this.setStyle("visibility", "hidden");
              a.focus()
          })
      },
      create: function(a) {
          Array.from(a).each(function(a) {
              if (!Placeholder.support && a.get && a.get("placeholder")) {
                  var c = a.get("placeholder"),
                  d = Placeholder.build(a, c);
                  "" === a.value && d.setStyle("visibility", "visible");
                  a.addEvents({
                      focusin: function() {
                          d.setStyle("visibility", "hidden")
                      },
                      focusout: function() {
                          "" === this.value && d.setStyle("visibility", "visible")
                      }
                  })
              }
          })
      }
  };
  window.addEvent("domready",
  function() {
      document.forms.length && (passwordStrength.init($$("form .auto-password-check-handle")), changeVerify($$("form .auto-change-verify-handle"), !0), $$("form .action-remember-account").each(function(a) {
          a.addEvent("change",
          function() {
              this.checked ? Memory.set("sign.remember", "1", 365) : Memory.set("sign.remember", "0", 365)
          }).fireEvent("change")
      }), $$("form .action-auto-signin").addEvent("change",
      function() {
          this.checked ? Memory.set("sign.auto", "1", 14) : Memory.clean("sign.auto")
      }));
      Placeholder.init()
  }); (function() {
      this.Sync = new Class({
          Extends: Request.HTML,
          options: {
              disabled: "disabled",
              evalScripts: !0,
              hideDelay: 3,
              showMessage: !0,
              position: "before",
              tipCls: "-tip",
              ajaxTip: "ajax-tip"
          },
          initialize: function(a, b) { (this.sponsor = a) && (b = this._getOptions(a, b));
              this.parent(b)
          },
          _getOptions: function(a, b) {
              var b = b || {},
              c;
              try {
                  c = JSON.decode(a.get("data-ajax-config")) || {}
              } catch(d) {
                  c = {}
              }
              var e;
              "submit" === a.type && (e = this.dataForm = a.getParent("form"));
              e = e ? {
                  data: e.toQueryString() + "&response_json=true",
                  url: e.action,
                  method: e.method || "post"
              }: {
                  url: a.get("href"),
                  data: "response_json=true",
                  method: "get"
              };
              return c = Object.merge(e, b, a.retrieve("_ajax_config", {}), c)
          },
          _defaultState: function() {
              this.sponsor && this.sponsor.removeClass(this.options.disabled)
          },
          onFailure: function() {
              this._defaultState();
              this.parent()
          },
          _getCache: function(a) {
              return a.retrieve("ajax_cache", !1)
          },
          _clearCache: function(a) {
              a.eliminate("ajax_cache")
          },
          _setCache: function(a, b) {
              a.store("ajax_cache", b)
          },
          _progressCache: function(a) {
              a = this._getCache(a);
              if (!this.options.syncCache || !a) return ! 1;
              a.success(a.response.data);
              return ! 0
          },
          success: function(a, b) {
              this.response.data = a;
              return /text\/jcmd/.test(this.getHeader("Content-type")) ? this._jsonSuccess(a) : ["update", "append", "filter"].some(function(a) {
                  return this.options[a]
              },
              this) ? this.parent(a, b) : this.onSuccess(this.processScripts(a), b)
          },
          _jsonSuccess: function(a) {
              try {
                  a = this.response.json = JSON.decode(a, this.options.secure)
              } catch(b) {}
              this.onSuccess(a)
          },
          onSuccess: function(a) {
              this._defaultState();
              this.options.syncCache && this.sponsor && this._setCache(this.sponsor, this);
              this.response.json && this._progress(a);
              this.parent(arguments)
          },
          _progress: function(a) {
              function b() {
                  c && ("back" == c ? history.back() : "reload" == c ? location.reload() : location.href = c)
              }
              if (a) {
                  if (this.options.progress) return this.options.progress.call(this, a);
                  var c = a.redirect,
                  d; (!this.options.showMessage || ["error", "success"].every(function(c) {
                      d = a[c];
                      if (!d) return ! 0;
                      this.options.inject ? c === this.options.tipHidden ? this._clearTip(c, d) : this._injectTip(c, d) : Message(d, c, this.options.hideDelay, b);
                      return ! 1
                  },
                  this)) && b()
              }
          },
          _clearTip: function() {
              this.inject && this.tipElem && this.tipElem.destroy()
          },
          _injectTip: function(a, b) {
              var c = this.options,
              d = this.inject = document.id(c.inject),
              e = c.position,
              f = c.ajaxTip,
              a = a + c.tipCls;
              if (d) {
                  c = d.getParent();
                  this.tipElem = c.getElement("." + f);
                  if (c && this.tipElem) return this.tipElem.set("html", b); (new Element("div." + a + "." + f, {
                      html: b
                  })).inject(d, e)
              }
          },
          _request: function(a) {
              a.addClass(this.options.disabled)
          },
          _isCheck: function(a) {
              a = a || {};
              a = this.dataForm || a.data || this.options.data;
              return "element" === typeOf(a) && !validate(a) ? !1 : !0
          },
          send: function(a) {
              var b = this.sponsor;
              if (b) {
                  if (b.hasClass(this.options.disabled) || !this._isCheck(a) || this._progressCache(b)) return;
                  this._request(b)
              }
              this.parent(a)
          }
      });
      this.async = function(a, b, c) {
          if (a.hasClass("disabled")) return ! 1;
          if ("object" === typeOf(b)) c = b;
          else if ("element" === typeOf(b)) {
              if (!validate(b)) return a.removeClass("disabled"),
              !1;
              if (c && !1 === c.async) return
          } else if (b = a.retrieve("ajax_cache", !1)) return b.send(); (new Sync(a, c)).send()
      };
      this.Event_Group = {
          _request: {
              fn: async
          }
      };
      $(document.html).addEvent("click",
      function(a) {
          var b = $(a.target),
          c = b.nearest("type", "submit") || b.nearest("rel");
          if (c && !(9 === c.nodeType || c.disabled)) {
              var d = c.getParent("form");
              if (! (d && "false" === d.get("async"))) {
                  if ("submit" === c.type && d && d.get("target")) return async(c, d, {
                      async: !1
                  });
                  if ("submit" === c.type && "_request" !== c.get("rel")) return async(c, d);
                  var b = c.get("rel"),
                  e = Event_Group[b];
                  if (e) {
                      var f = e.fn,
                      e = e.loader;
                      a.preventDefault();
                      if ($(c).get && $(c).get(b)) return c;
                      e ? $LAB.script(e).wait(function() {
                          f && f(c, d)
                      }) : f && f(c, d)
                  }
              }
          }
      })
  })();
  var Popup = new Class({
      Implements: [Events, Options],
      options: {
          title: LANG_shopwidgets.tip,
          show: !0,
          minHeight: 220,
          minWidth: 250,
          effect: {
              style: "opacity",
              duration: 400,
              from: 0,
              to: 1,
              maskto: 0.7
          },
          position: {
              target: document.body,
              from: {
                  x: "center",
                  y: "center"
              },
              to: {
                  x: "center",
                  y: "center"
              },
              offset: {
                  x: 0,
                  y: 0
              }
          },
          frameTpl: '<iframe allowtransparency="allowtransparency" align="middle" frameborder="0" height="100%" width="100%" scrolling="auto" src="about:blank">\u8bf7\u4f7f\u7528\u652f\u6301iframe\u6846\u67b6\u7684\u6d4f\u89c8\u5668\u3002</iframe>',
          ajaxTpl: '<div class="loading">loading...</div>',
          asyncOptions: {
              method: "get",
              cache: !0
          },
          component: {
              container: "popup-container",
              body: "popup-body",
              header: "popup-header",
              close: "popup-btn-close",
              content: "popup-content",
              mask: "mask"
          }
      },
      initialize: function(a, b) {
          if (a) {
              this.target = a;
              this.doc = document.id(document.body);
              this.setOptions(b);
              var b = this.options,
              c = b.asyncOptions || {},
              d = this.container = this.build(b.template, a),
              e = new Element("div");
              this.body = d.getElement("." + b.component.body) || e;
              this.header = d.getElement("." + b.component.header) || e;
              this.title = this.header.getElement("h2") || e;
              this.close = d.getElements("." + b.component.close);
              this.content = d.getElement("." + b.component.content) || e;
              this.zIndex = maxZindex("div");
              b.width && !isNaN(b.width) && (b.width = 1 >= b.width && 0 < b.width ? b.width * window.getSize().x: b.width.toInt());
              b.height && !isNaN(b.height) && (b.height = 1 >= b.height && 0 < b.height ? b.height * window.getSize().y: b.height.toInt());
              this.size = {
                  x: b.width || "",
                  y: b.height || ""
              };
              b.title || this.header.getElement("h2") && this.header.getElement("h2").destroy();
              d.retrieve("instance") || this.body.setStyles({
                  width: this.size.x,
                  height: this.size.y
              });
              this.fireEvent("load", this);
              "string" === typeOf(a) && ("ajax" === b.async ? this.requestCache(Object.merge({
                  url: a + "",
                  update: this.content
              },
              c)) : (d = c.data ? a + (1 < a.indexOf("?") ? "&": "?") + c.data: a + "", this.content.getElement("iframe").set("src", d).addEvent("load", (c.onSuccess ||
              function() {}).bind(this))));
              $$("div[rel=mask]." + b.component.mask)[0] && (b.modal = !1);
              b.modal && (c = b.effect ? {
                  style: b.effect.style,
                  duration: b.effect.duration,
                  from: b.effect.from,
                  to: b.modal.opacity || b.effect.maskto
              }: !1, this.mask = new Mask({
                  target: b.modal.target || b.modal,
                  "class": b.modal["class"] || b.component.mask,
                  zIndex: this.zIndex++,
                  effect: c
              }));
              this.hidden = !0;
              this.attach()
          }
      },
      attach: function() {
          this.options.show && this.show();
          this.container.retrieve("instance") || this.container.store("instance", this).addEvent("click:relay(." + this.options.component.close + ")",
          function() {
              this.hide()
          }.bind(this));
          return this
      },
      build: function(a, b) {
          var c = this.options,
          d = c.id ? document.id(c.id) : document.getElement("[data-single=true]." + c.component.container),
          e;
          "element" === typeOf(b) ? e = b.tagName.test(/^(?:IMG|OBJECT|SCRIPT)$/) ? b: b.innerHTML: "string" === typeOf(b) && (e = "ajax" === c.async ? c.ajaxTpl: c.frameTpl);
          if (c.single && d) return "element" === typeOf(b) && (d.retrieve("instance").content.innerHTML = e),
          d;
          a = '<div class="{container}" {id} data-single="' + !!c.single + '" hideFocus="true" tabindex="1">' + this.getTemplate(a) + "</div>";
          Object.merge(c.component, {
              title: c.title,
              id: c.id ? 'id="' + c.id + '"': "",
              main: e
          });
          return (new Element("div", {
              html: a.substitute(c.component)
          })).getFirst().inject(this.doc)
      },
      getTemplate: function(a, b) {
          var c = this.options;
          if ((a = a || c.template) && "string" === typeOf(a)) {
              if (!document.id(a)) return a;
              a = document.id(a)
          }
          if ("element" === typeOf(a) && /^(?:script|textarea|template)$/i.test(a.tagName)) return document.id(a).get("value") || document.id(a).get("html");
          var b = b || c.type,
          d = '<div class="{body}">;<div class="{header}">;<h2>{title}</h2>;<span><button type="button" class="{close}" title="\u5173\u95ed"><i>\u00d7</i></button></span>;</div>;<div class="{content}">{main}</div>;</div>'.split(";");
          if ("nohead" === b) d[1] = d[2] = d[3] = d[4] = "";
          else if ("notitle" === b) d[2] = "";
          else if ("noclose" === b || c.autoHide) d[3] = "";
          return d.join("\n")
      },
      show: function() {
          if (!this.hidden) return this;
          this.container.setStyle("display", "block");
          this.position();
          Browser.ie6 && this.options.useIframeShim && (new Element("iframe", {
              frameborder: 0,
              src: "about:blank",
              style: "position:absolute;z-index:-1;border:0 none;filter:alpha(opacity=0);top:" + ( - this.container.getPatch().y || 0) + "px;left:" + ( - this.container.getPatch().x || 0) + "px;width:" + (this.container.getSize().x || 0) + "px;height:" + (this.container.getSize().y || 0) + "px;"
          })).inject(this.container);
          var a = this.options.effect;
          if (a) {
              if (!0 === a || "opacity" === a.style) this.container.setStyle("opacity", a.from || 0).setStyle("visibility", "visible"); (new Fx.Tween(this.container, {
                  duration: a.duration || 400,
                  onComplete: function() {
                      this.container.focus()
                  }.bind(this)
              })).start(a.style || "opacity", a.from || 0, a.to || 1)
          } else this.container.focus();
          this.hidden = !1;
          this.fireEvent("show", this);
          this.mask && this.mask.show();
          this.options.autoHide && (this.container.timer = this.hide.delay(1E3 * this.options.autoHide.toInt(), this));
          return this
      },
      hide: function() {
          if (this.hidden) return this;
          var a = this.container.retrieve("resize_position");
          a && window.removeEvent("resize", a);
          this.fireEvent("close", this);
          this.options.pins && this.container.pin(!1, !1, !1);
          a = this.options.effect;
          this.options.single ? a ? this.stopTimer().container.setStyles({
              display: "none",
              opacity: 0,
              visibility: "hidden"
          }) : this.container.setStyle("display", "none") : (a ? this.container.timer = (new Fx.Tween(this.container, {
              duration: a.duration || 400,
              link: "ignore",
              onComplete: function() {
                  this.container.destroy()
              }.bind(this)
          })).start(a.style || "opacity", a.to || 1, a.from || 0) : this.container.destroy(), document.id(this.container).eliminate("instance"));
          this.hidden = !0;
          this.container.store("instance", this);
          return this.hideMask()
      },
      stopTimer: function() {
          this.container.timer && (clearTimeout(this.container.timer), this.container.timer = null);
          return this
      },
      hideMask: function() {
          this.options.modal && $$("[data-single]").retrieve("instance").every(function(a) {
              return ! a || !a.close.length || a.hidden
          }) && this.mask.hide();
          return this
      },
      hideAll: function() {
          this.hide();
          var a = $$("[data-single]").retrieve("instance");
          a.length && a.each(function(a) {
              a && a.hide()
          })
      },
      position: function() {
          var a = this.options,
          b; ! this.size.x && (Browser.ie && 8 > Browser.version && this.container.getSize().x >= this.doc.getSize().x) && document.id(this.body).setStyle("width", a.minWidth.toInt() - this.container.getPatch().x); ! this.size.y && (Browser.ie && 8 > Browser.version && this.container.getSize().y >= this.doc.getSize().y) && document.id(this.body).setStyle("height", Math.min(a.minHeight.toInt(), this.doc.getSize().y) - this.container.getPatch().y);
          this.size.y ? b = this.container: this.container.getSize().y >= this.doc.getSize().y && (b = this.doc);
          "element" === typeOf(b) && this.setHeight(b);
          this.container.position(a.position);
          a.pins && this.container.pin();
          return this
      },
      setHeight: function(a) {
          a = a || this.container;
          this.content.setStyle("height", (!this.size.y && Browser.ie && 8 > Browser.version ? this.body.getStyle("height").toInt() : a.getSize().y - this.container.getPatch().y) - document.id(this.body).getPatch().y - document.id(this.header).getOuterSize().y - this.content.getPatch().y)
      },
      setTitle: function(a) {
          this.title.set("html", a)
      },
      requestCache: function(a) {
          var b;
          if (!a) return null;
          if (a.target && a.cache && (b = a.target.retrieve("request:cache"))) return b.success(b.response.text);
          b = (new Request.HTML(a)).send();
          a.target && a.target.store("request:cache", b);
          return this
      },
      toElement: function() {
          return this.container
      }
  });
  Element.implement({
      fixed: function(a) {
          var a = [a].flatten() || ["top", "left"],
          b = a.contains("left"),
          c = a.contains("top");
          if (Browser.ie6) {
              var d = window.getScroll(),
              e = this.getPosition().x - d.x,
              f = this.getPosition().y - d.y,
              a = function() {
                  b && this.getStyle("left").toInt() >= document.body.clientWidth || c && this.getStyle("top").toInt() >= document.body.clientHeight || (d = window.getScroll(), this.set("morph", {
                      duration: 200,
                      transition: Fx.Transitions.Quart.easeOut
                  }).morph({
                      left: b ? e + d.x: null,
                      top: c ? f + d.y: null
                  }))
              }.bind(this);
              window.addEvent("scroll", a)
          }
      },
      pin: function(a, b, c, d) {
          "object" === typeOf(a) && (d = a.pos, c = a.restore, b = a.forceScroll, a = a.enable);
          var d = d ? [d].flatten() : ["top", "left", "bottom", "right"],
          e = d.contains("left");
          if (!1 !== a) {
              if (!this.retrieve("pin:_pinned")) {
                  a = window.getScroll();
                  this.store("pin:_original", this.getStyles("position", d));
                  d = this.getPosition(!Browser.ie6 ? document.body: this.getOffsetParent());
                  d = {
                      left: e ? d.x - a.x: "",
                      top: d.y - a.y
                  };
                  if (Browser.ie6) {
                      b && this.setPosition({
                          x: this.getOffsets().x + a.x,
                          y: this.getOffsets().y + a.y
                      });
                      "static" == this.getStyle("position") && this.setStyle("position", "absolute");
                      var f = this.getPosition().x - a.x,
                      g = this.getPosition().y - a.y,
                      b = function() {
                          if (this.retrieve("pin:_pinned") && !(e && this.getStyle("left").toInt() >= document.body.clientWidth || this.getStyle("top").toInt() >= document.body.clientHeight)) {
                              var a = window.getScroll();
                              this.setStyles({
                                  left: e ? f + a.x: "",
                                  top: g + a.y
                              })
                          }
                      }.bind(this);
                      this.store("pin:_scrollFixer", b);
                      window.addEvent("scroll", b)
                  } else this.setStyle("position", "fixed").setStyles(d);
                  this.store("pin:_pinned", !0)
              }
          } else {
              if (!this.retrieve("pin:_pinned")) return this;
              c && this.setStyles(this.retrieve("pin:_original", {}));
              this.eliminate("pin:_original");
              this.store("pin:_pinned", !1);
              Browser.ie6 && (window.removeEvent("scroll", this.retrieve("pin:_scrollFixer")), this.eliminate("pin:_scrollFixer"))
          }
          return this
      },
      togglePin: function() {
          return this.pin(!this.retrieve("pin:_pinned"))
      }
  });
  
  
  var Mask = new Class({
      Implements: [Options, Events],
      options: {
          "class": "mask",
          effect: {
              style: "opacity",
              duration: 300,
              from: 0,
              to: 0.7
          }
      },
      initialize: function(a) {
          this.target = a && document.id(a.target) || document.id(document.body);
          this.setOptions(a);
          this.element = $$("div[rel=mask]." + this.options["class"])[0] || (new Element("div[rel=mask]." + this.options["class"])).inject(this.options.injectTo || (this.target == window ? document.body: this.target));
          this.options.html && this.element.set("html", this.options.html.stripScripts());
          this.hidden = !0
      },
      setSize: function() {
          this.target && document.id(this.element).isVisible() && this.element.setStyles({
              height: this.options.height || Math.max(this.target.getScrollSize().y, this.target.getSize().y, this.target.clientHeight || 0)
          })
      },
      position: function() {
          this.element.position({
              target: this.target,
              resize: this.options.resize
          })
      },
      show: function() {
          if (this.hidden) {
              this.target == window && document.html.setStyles({
                  height: "100%",
                  overflow: ""
              });
              window.addEvent("resize", this.setSize.bind(this));
              this.setSize();
              this.element.setStyle("display", "block");
  
              this.options.html && this.element.setStyle("line-height", this.element.getSize().y);
              this.options.position && this.position();
              this.options.pins && this.element.pin();
              var a = this.options.effect;
              if (a) {
                  if (!0 === a || "opacity" == a.style) this.element.setStyle("opacity", a.from || 0).setStyle("visibility", "visible"); (new Fx.Tween(this.element, {
                      duration: a.duration || 400
                  })).start(a.style || "opacity", a.from || 0, a.to)
              } else 0 === this.element.get("opacity") && this.element.set("opacity", "").setStyle("visibility", "");
              this.hidden = !1;
              return this
          }
      },
      hide: function() {
          if (!this.hidden) {
              window.removeEvent("resize", this.setSize.bind(this));
              var a = this.element.retrieve("resize_position");
              a && window.removeEvent("resize", a); (a = this.options.effect) ? (new Fx.Tween(this.element, {
                  duration: a.duration || 400,
                  onComplete: function() {
                      this.element.destroy()
                  }.bind(this)
              })).start(a.style || "opacity", a.to, a.from || 0) : this.element.destroy();
              this.target == window && document.html.setStyles({
                  height: "",
                  overflow: ""
              });
              this.hidden = !0;
              return this
          }
      },
      toggle: function() {
          return this[this.hidden ? "show": "hide"]()
      },
      toElement: function() {
          return this.element
      }
  });
  Element.Properties.mask = {
      set: function(a) {
          var b = this.retrieve("mask");
          b && ((b = document.id(b.element)) && b.destroy(), this.eliminate("mask"));
          return this.store("mask:options", a)
      },
      get: function() {
          var a = this.retrieve("mask");
          a || (a = new Mask(Object.merge(this.retrieve("mask:options") || {},
          {
              target: this
          })), this.store("mask", a));
          return a
      }
  };
  Element.implement({
      mask: function(a) {
          a && this.set("mask", a);
          this.get("mask").show();
          return this
      },
      unmask: function() {
          this.get("mask").hide();
          return this
      }
  });
  
  var Dialog = (new Class({
      Extends: Popup,
      initialize: function(a, b) {
          b = Object.merge({
              width: 330,
              useIframeShim: !0,
              template: document.id("popup_template"),
              position: {
                  intoView: !0
              }
          },
          b || {});
          this.parent(a, b)
      }
  })).extend({
      instance: function(a, b) {
          return new Dialog(a, Object.merge({
              show: !1
          },
          b || {}))
      },
      alert: function() {
          var a = Array.from(arguments).link({
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {};
          Dialog.instance(new Element("div", {
              html: '<div class="pop-attention-main"><div class="figure"><dfn class="alert">!</dfn><span class="mark">' + a.msg + '</span></div><div class="bottom"><button type="button" class="btn btn-caution action-confirm"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + "</span></span></button> </div></div>"
          }), Object.merge({
              width: 350,
              title: "\u53cb\u60c5\u63d0\u793a",
              modal: window,
              pins: !0,
              single: !1,
              effect: !1,
              position: {
                  intoView: !0
              },
              component: {
                  container: "alert-container",
                  header: "alert-header",
                  close: "alert-btn-close",
                  body: "alert-body",
                  content: "alert-content"
              },
              onLoad: function() {
                  this.content.getElements(".action-confirm").addEvent("click",
                  function() {
                      this.hide();
                      a.callback && a.callback.call(this)
                  }.bind(this))
              }
          },
          b)).show()
      },
      alert_valen: function() {
          var a = Array.from(arguments).link({
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {};
          Dialog.instance(new Element("div", {
              html: '<div class="pop-attention-main"><div class="figure"><dfn class="alert">!</dfn><span class="mark">' + a.msg + '</span></div><div class="bottom"><button type="button" class="btn btn-caution action-confirm"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + "</span></span></button> </div></div>"
          }), Object.merge({
              width: 540,
              title: "\u53cb\u60c5\u63d0\u793a",
              modal: window,
              pins: !0,
              single: !1,
              effect: !1,
              position: {
                  intoView: !0
              },
              component: {
                  container: "alert-container",
                  header: "alert-header",
                  close: "alert-btn-close",
                  body: "alert-body",
                  content: "alert-content"
              },
              onLoad: function() {
                  this.content.getElements(".action-confirm").addEvent("click",
                  function() {
                      this.hide();
                      a.callback && a.callback.call(this)
                  }.bind(this))
              }
          },
          b)).show()
      },
      confirm: function() {
          var a = Array.from(arguments).link({
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {};
          Dialog.instance(new Element("div", {
              html: '<div class="pop-attention-main"><div class="figure"><dfn class="confirm">!</dfn><span class="mark">' + a.msg + '</span></div><div class="bottom"><button type="button" class="btn btn-caution action-confirm" data-return="1"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + '</span></span></button><button type="button" class="btn btn-simple action-cancel" data-return="0"><span><span>' + (b.cancelText || LANG_shopwidgets.cancel) + "</span></span></button></div></div>"
          }), Object.merge({
              width: 350,
              title: "\u53cb\u60c5\u63d0\u793a",
              modal: window,
              pins: !0,
              single: !1,
              effect: !1,
              position: {
                  intoView: !0
              },
              component: {
                  container: "alert-container",
                  header: "alert-header",
                  close: "alert-btn-close",
                  body: "alert-body",
                  content: "alert-content"
              },
              onLoad: function() {
                  var b = this,
                  d;
                  this.content.getElements("[data-return]").addEvent("click",
                  function() {
                      d = !!this.get("data-return").toInt();
                      b.hide();
                      a.callback && a.callback.call(this, d)
                  })
              }
          },
          b)).show()
      },
          confirm_leavel_message: function() {
          var a = Array.from(arguments).link({
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {};
          Dialog.instance(new Element("div", {
              html: '<div class="pop-attention-main"><div class="figure"><dfn class="confirm">!</dfn><span class="mark">' + a.msg + '</span></div><div class="bottom"><button type="button" class="btn btn-caution action-confirm" data-return="1"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + '</span></span></button><button type="button" class="btn btn-simple action-cancel" data-return="0"><span><span>' + (b.cancelText || LANG_shopwidgets.cancel) + "</span></span></button></div></div>"
          }), Object.merge({
              width: 350,
              title: "\u53cb\u60c5\u63d0\u793a",
              modal: window,
              pins: !0,
              single: !1,
              effect: !1,
              position: {
                  intoView: !0
              },
              component: {
                  container: "alert-container",
                  header: "alert-header",
                  close: "alert-btn-close",
                  body: "alert-body",
                  content: "alert-content"
              },
              onLoad: function() {
                  var b = this,
                  d;
                  this.content.getElements("[data-return]").addEvent("click",
                  function() {
                      d = !!this.get("data-return").toInt();
                      if(!d){ //如果点取消
                          b.hide(); 
                      }
                      if(a.callback){
                          a.callback && a.callback.call(this, d)
                          b.hide();
                      }
                  })
              }
          },
          b)).show()
      },
      confirm_valen: function() {
          var a = Array.from(arguments).link({
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {};
          Dialog.instance(new Element("div", {
              html: '<div class="pop-attention-main"><div class="figure"><dfn class="confirm">!</dfn><span class="mark">' + a.msg + '</span></div><div class="bottom"><button type="button" class="btn btn-simple action-confirm" data-return="1"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + '</span></span></button><button type="button" class="btn btn-simple action-cancel" data-return="0"><span><span>' + (b.cancelText || LANG_shopwidgets.cancel) + "</span></span></button><span class='btn btn-simple action-clear' data-return='0'>清除</span></div></div>"
          }), Object.merge({
              width: 350,
              title: "\u53cb\u60c5\u63d0\u793a",
              modal: window,
              pins: !0,
              single: !1,
              effect: !1,
              position: {
                  intoView: !0
              },
              component: {
                  container: "alert-container",
                  header: "alert-header",
                  close: "alert-btn-close",
                  body: "alert-body",
                  content: "alert-content"
              },
              onLoad: function() {
                  var b = this,
                  d;
                  this.content.getElements("[data-return]").addEvent("click",
                  function() {
                      d = !!this.get("data-return").toInt();
                      if(!d){ //如果点取消
                          b.hide(); 
                      }
                      if(a.callback){
                          if(a.callback.call(this, d)){
                              b.hide(); 
                          }
                      }
                  })
              }
          },
          b)).show()
      },
      tips: function() {
          var a = Array.from(arguments).link({
              element: Type.isElement,
              msg: Type.isString,
              callback: Type.isFunction,
              options: Type.isObject
          }),
          b = a.options || {},
          c = document.id(a.element);
          Dialog.instance(new Element("div", {
              html: '<span class="icon">&#x24;</span><span class="icoimg"></span><p>' + a.msg + '</p><div class="bottom"><button type="button" class="btn btn-caution btn-small action-confirm" data-return="1"><span><span>' + (b.confirmText || LANG_shopwidgets.confirm) + '</span></span></button><button type="button" class="btn btn-simple btn-small action-cancel" data-return="0"><span><span>' + (b.cancelText || LANG_shopwidgets.cancel) + "</span></span></button></div>"
          }), Object.merge({
              width: "",
              modal: !1,
              template: '<div class="{body}"><div class="{content}">{main}</div></div>',
              single: !0,
              effect: !1,
              position: {
                  target: c,
                  from: {
                      x: "c",
                      y: "b"
                  },
                  to: {
                      x: "c",
                      y: "t"
                  },
                  offset: {
                      x: 0,
                      y: -12
                  },
                  intoView: !0,
                  resize: !0
              },
              component: {
                  container: "dialog-tips-container",
                  body: "dialog-tips-body",
                  content: "dialog-tips-content"
              },
              onLoad: function() {
                  var b = this,
                  c;
                  this.content.getElements("[data-return]").removeEvents("click").addEvent("click",
                  function() {
                      c = !!this.get("data-return").toInt();
                      a.callback && a.callback.call(this, c);
                      b.hide()
                  });
                  this.arrow = Arrow(this.container, {
                      to: this.options.position.from
                  });
                  this.options.position.offset = this.arrow.setTargetOffset(this.options.position);
                  this.options.eventTarget && this.container.addEvent("outerclick",
                  function(a) {
                      a.target != this.options.eventTarget && this.hide()
                  }.bind(this))
              },
              onShow: function() {
                  this.arrow.show()
              },
              onClose: function() {
                  this.container.removeEvents("outerclick")
              }
          },
          b)).show()
      },
      iframe: function(a, b) {
          return Dialog.instance(a, Object.merge({
              async: "iframe"
          },
          b || {})).show()
      },
      ajax: function(a, b) {
          return Dialog.instance(a, Object.merge({
              async: "ajax"
          },
          b || {})).show()
      },
      image: function(a, b) {
          return Dialog.instance(new Element("div", {
              html: '<img src="' + a + '" />'
          }), Object.merge({
              template: '<div class="{body}"><span><button type="button" class="{close}" title="\u5173\u95ed"><i>\u00d7</i></button></span><div class="{content}">{main}</div></div>',
              width: "",
              height: "",
              modal: !0,
              single: !0,
              component: {
                  container: "image-container",
                  close: "image-btn-close",
                  content: "image-content"
              }
          },
          b || {})).show()
      },
      image_loading: function(a, b){
          return Dialog.instance(new Element("div", {
              html: '<img src="' + a + '" />'
          }), Object.merge({
              template: '<div class="{body}"><span><button type="button" style="opacity:0; filter:Alpha(opacity=0)" class="{close}" title="\u5173\u95ed"><i>\u00d7</i></button></span><div class="{content}">{main}</div></div>',
              width: "",
              height: "",
              modal: !0,
              single: !0,
              component: {
                  container: "image-container",
                  close: "image-btn-close-loading",
                  content: "image-content"
              }
          },
          b || {})).show()
      }
  }),
  popTip = new Class({
      Extends: Popup,
      initialize: function(a, b) {
          if (a) {
              var b = b || {},
              c = new Element("div[html=" + a + "]"),
              d = b.relative || document.body,
              e = /^(?:body|html)$/i.test(d.tagName.toLowerCase()),
              f = e ? "center": 0,
              g = e ? 0 : "top",
              h = !!e,
              e = e ? 0 : "bottom";
              this.options = Object.merge(this.options, {
                  type: b.type || "nofoot",
                  template: b.template || document.id("xtip_template"),
                  modal: !1,
                  pins: h,
                  single: !1,
                  effect: !0,
                  position: {
                      target: d,
                      from: {
                          x: 0,
                          y: e
                      },
                      to: {
                          x: f,
                          y: g
                      },
                      offset: {
                          x: b.offset && b.offset.x ? b.offset.x: 0,
                          y: b.offset && b.offset.y ? b.offset.y: 0
                      },
                      intoView: void 0 !== b.intoView ? b.intoView: !0
                  },
                  component: {
                      container: "xtip-container",
                      body: "xtip-body",
                      header: "xtip-header",
                      close: "xtip-btn-close",
                      content: "xtip-content"
                  }
              });
              this.parent(c, b)
          }
      }
  }),
  Tips = new Class({
      Implements: Options,
      options: {
          type: "autohide",
          offset: {
              x: 0,
              y: -9
          },
          hideDelay: 2E3,
          position: "topCenter",
          inject: document.body,
          where: "bottom",
          "class": "xtips-container",
          arrow: !0,
          text: null
      },
      initialize: function() {
          var a = Array.from(arguments).link({
              element: Type.isElement,
              msg: Type.isString,
              options: Type.isObject
          }),
          b = this.elements = document.id(a.element) || $$("[data-tips]");
          if (!b || "elements" === typeOf(b) && !b.length) return null;
          this.setOptions(a.options);
          this.options.inject = this.options.inject || document.body;
          this.build(a.msg)
      },
      build: function(a) {
          var b = "inline" == this.options.type ? "span": "div",
          c = "<" + b + ' class="xtips-content"></' + b + ">";
          this.container = document.id("xtips_container") || (new Element(b + "#xtips_container." + this.options["class"], {
              html: c
          })).inject("inline" == this.options.type && typeOf("element" == this.elements) ? this.elements: document.id(this.options.inject), this.options.where).store("tips", this);
          this.content = this.container.getElement(".xtips-content");
          this.msg = a || "";
          return this
      },
      attach: function(a) {
          "mouse" == a ? Array.from(this.elements).each(function(a) {
              a.addEvents({
                  mouseenter: this.show.bind(this, [a, this.msg, !1]),
                  mouseleave: this.hide.bind(this)
              })
          }) : "click" == a && Array.from(this.elements).each(function(a) {
              a.addEvent("click",
              function() {
                  this.hidden ? this.show(a, this.msg) : this.hide()
              })
          });
          return this
      },
      show: function(a, b, c) {
          c = c || this.options.type; ! b && "element" === typeOf(this.elements) && (b = this.elements);
          a = a || this.msg || b.get("data-tips") || b.retrieve("tips:text");
          if (!b || !a || !this.container) return this;
          "tooltip" !== this.options.type && (a = '<q class="icon">&#x24;</q>' + a);
          this.content.set("html", a);
          var a = this.options.position.toLowerCase(),
          d = b.getPosition(),
          e = this.container.getSize(),
          f = b.getSize(),
          g = b.get("data-tips-config"),
          g = JSON.decode(g) || {},
          h = {};
          "inline" !== this.options.type && ( - 1 != ["rightcenter", "rc", "cr"].indexOf(a) ? h = {
              left: d.x + f.x,
              top: Math.max(d.y + (e.y - f.y) / 2, 0)
          }: -1 != ["topcenter", "tc", "ct"].indexOf(a) ? h = {
              left: Math.max(d.x - (e.x - f.x) / 2 + this.options.offset.x || 0, 0),
              top: Math.max(d.y - e.y + this.options.offset.y || 0, 0)
          }: -1 != ["bottomleft", "bl", "lb"].indexOf(a) && (h = {
              left: Math.max(d.x || 0, 0),
              top: Math.max(d.y + f.y + this.options.offset.y || 0, 0)
          }));
          h = Object.merge({
              display: "",
              opacity: 1,
              visibility: "visible",
              width: g.width ? g.width: e.x > window.getSize().x ? window.getSize().x: ""
          },
          h);
          this.container.setStyles(h);
          this.options.arrow && (a = {
              topCenter: {
                  x: "b",
                  y: "c"
              },
              rightCenter: {
                  x: "l",
                  y: "c"
              },
              bottomCenter: {
                  x: "t",
                  y: "c"
              },
              leftCenter: {
                  x: "r",
                  y: "c"
              }
          },
          Arrow(this.container, {
              to: a[this.options.position]
          }).show());
          this.hidden = !1;
          "autohide" == c && (this.stopTimer(b), b.timer = this.hide.delay(this.options.hideDelay, this));
          return this
      },
      stopTimer: function(a) {
          a.timer && (clearTimeout(a.timer), a.timer = null);
          return this
      },
      hide: function() {
          this.container.setStyle("opacity", 0).setStyle("visibility", "hidden");
          this.hidden = !0;
          return this
      }
  });
  Element.implement({
      tips: function(a, b) { (new Tips(this)).show(a, this, b);
          return this
      }
  });
  var Warn = function(a, b, c) {
      if (a = document.id(a)) this.msg = b || "",
      c = c || "warn-message",
      this.container = document.id("warn_message") ? document.id("warn_message").set("html", this.msg) : (new Element("span#warn_message." + c, {
          html: this.msg
      })).inject(a, "after")
  };
  Warn.prototype.show = function(a) {
      this.container.set("html", a || this.msg || "").show("block")
  };
  Warn.prototype.hide = function() {
      this.container.hide()
  };
  var ToolTip = (new Class({
      Implements: [Events, Options],
      Binds: ["hide"],
      timer: null,
      options: {
          autohide: !0,
          offset: 12,
          hideDelay: 1E3,
          "class": "tooltip",
          arrow: "arrow",
          position: {
              from: "cb",
              to: "ct",
              offset: {
                  x: 0,
                  y: -2
              }
          },
          text: null
      },
      initialize: function(a, b) {
          this.element = a;
          this.setOptions(b);
          this.toolTip = (new Element("div." + this.options["class"] + "-container", {
              html: '<div class="' + this.options["class"] + '-content">' + this.options.text + "</div>"
          })).hide().inject(document.body);
          this.content = this.toolTip.getElement("." + this.options["class"] + "-content");
          this.options.arrow && (this.arrow = Arrow(this.toolTip, {
              "class": this.options.arrow,
              to: this.options.position.from
          }), this.options.position.offset = this.arrow.setTargetOffset(this.options.position)); [this.element, this.toolTip].each(function(a) {
              a.addEvents({
                  mouseenter: function() {
                      this.options.autohide && window.clearTimeout(this.timer)
                  }.bind(this),
                  mouseleave: function() {
                      if (this.options.autohide) this.timer = this.hide.delay(this.options.hideDelay, this)
                  }.bind(this)
              })
          },
          this)
      },
      hide: function() {
          var a;
          this.toolTip.hide();
          "element" == typeOf(a = this.toolTip.getElement("div.close")) && a.destroy();
          this.fireEvent("hide");
          this.element.erase("data-tooltip-displayed");
          return this
      },
      position: function() {
          this.toolTip.position(Object.merge(this.options.position, {
              target: this.element
          }));
          return this
      },
      set: function(a) {
          "element" == typeOf(a) ? this.content.empty().grab(a) : this.content.set("html", a);
          this.options.autohide || (new Element('div.close[title="\u5173\u95ed"]')).inject(this.toolTip, "top").addEvent("click", this.hide.bind(this))
      },
      show: function() {
          this.element.get("data-tooltip-displayed") || (this.element.set("data-tooltip-displayed", !0), this.toolTip.show(), this.position(), this.arrow && this.arrow.show(), this.fireEvent("show"));
          return this
      }
  })).extend({
      instance: function(a, b, c) {
          var d, e, f = ["string", "element"].contains(typeOf(b)),
          g = f ? b: c || null,
          b = f ? c || {}: b;
          "object" == typeOf(d = document.retrieve("ToolTip.current")) && d.hide();
          null == (e = a.retrieve("ToolTip.instance")) ? e = new ToolTip(a, b) : e.setOptions(b);
          a.store("ToolTip.instance", e);
          document.store("ToolTip.current", e);
          g && e.set(g);
          return e
      }
  }),
  Arrow = function(a, b) {
      b = Object.merge({
          target: document.body,
          "class": "arrow",
          to: "bc",
          offset: {
              x: 0,
              y: 0
          }
      },
      b || {});
      "element" == typeOf(a) && (b.target = a);
      var c = "string" == typeof b["class"] ? b["class"] : "arrow",
      d = {
          b: c + "-bottom",
          t: c + "-top",
          l: c + "-left",
          r: c + "-right"
      };
      b.position = Arrow.getCoordinate(b.to);
      c = (new Element("div." + c + "." + d[b.position.x], {
          html: '<i class="below">\u25c6</i><i class="above">\u25c6</i>'
      })).inject(b.target).store("Arrow:position", b);
      c.show = function() {
          this.setStyle("display", "").position(b);
          return this
      };
      c.position = function(a, b) {
          var c, d;
          if (["string", "element"].contains(typeOf(a))) {
              c = document.id(a);
              d = b
          } else {
              d = a;
              c = document.id(d.target)
          }
          if (c) {
              d = Object.merge({
                  to: "bc",
                  offset: {
                      x: 0,
                      y: 0
                  }
              },
              d || this.retrieve("Arrow:position", {}));
              var i = {
                  c: {
                      x: 0.5
                  },
                  m: {
                      y: 0.5
                  },
                  r: {
                      x: 1
                  },
                  b: {
                      y: 1
                  }
              },
              j = c.getSize();
              c = c.getPatch("border");
              var m = this.getSize(),
              l = d.position || Arrow.getCoordinate(d.to);
              return this.setStyles({
                  left: i[l.y].x ? (j.x - m.x - c.x) * i[l.y].x + d.offset.x: "",
                  top: i[l.y].y ? (j.y - m.y - c.y) * i[l.y].y + d.offset.y: ""
              })
          }
      };
      c.setTargetOffset = function(a, b) {
          if (typeof a == "object" && a.to && a.offset) {
              b = a.offset;
              a = a.to
          } else b = b || {
              x: 0,
              y: 0
          };
          var a = Arrow.getCoordinate(a),
          c = {
              t: ["y", -1, "bottom"],
              b: ["y", 1, "top"],
              l: ["x", -1, "right"],
              r: ["x", 1, "left"]
          };
          b[c[a.x][0]] = b[c[a.x][0]] + c[a.x][1] * this.getElement(".below").getStyle("border-" + c[a.x][2] + "-width").toInt();
          return b
      };
      return c
  }.extend({
      getCoordinate: function(a) {
          if ("object" == typeof a && (a.x || 0 === a.x) && (a.y || 0 === a.y)) {
              if ( - 1 < "ltbr".indexOf(a.x) && -1 < "ltbrcm".indexOf(a.y)) return a;
              if ( - 1 < "cm".indexOf(a.x)) return {
                  x: a.y,
                  y: a.x
              };
              a = a.x.toString() + a.y.toString()
          }
          var a = a.toLowerCase(),
          b = a.match(/^c(enter)?|^m(iddle)?/g),
          c = a.match(/c(enter)?$|m(iddle)?$/g);
          if (b || c) a = a.split(b ? b[0] : c[0])[b ? 1 : 0],
          a += a.test(/^l(eft)?|^r(ight)?/g) ? "m": "c";
          return {
              x: a.test(/^l(eft)?|^0/) ? "l": a.test(/^r(ight)?|^1(00%)?/) ? "r": a.test(/^t(op)?/) ? "t": "b",
              y: a.test(/l(eft)?$/) ? "l": a.test(/r(ight)?$/) ? "r": a.test(/t(op)?$|0$/) ? "t": a.test(/b(ottom)?$|1(00%)?$/) ? "b": a.test(/m(iddle)?$/) ? "m": "c"
          }
      }
  });
  function Message(a, b, c, d, e) {
      if (!a) return null;
      isNaN(b) ? "function" === typeOf(c) ? (d = c, c = 3) : (b = b || "show", c = !isNaN(c) ? c: 3) : (c = b, b = "show");
      var f = {
          container: "message-" + b,
          body: "message-body",
          content: "message-content",
          icon: {
              show: "",
              success: "&#x25;",
              error: "&#x21;"
          } [b]
      },
      g = document.id("pop_message_" + b);
      if (g && (g = g.retrieve("instance"))) g.content.innerHTML = a,
      g.show();
      new Popup(new Element("div[html=" + a + "]"), {
          id: "pop_message_" + b,
          type: "nohead",
          template: e || document.id("message_template"),
          modal: !1,
          pins: !0,
          single: !0,
          effect: !0,
          autoHide: c,
          component: f,
          onShow: function() {
              this.stopTimer()
          },
          onClose: "function" === typeOf(d) ? d.bind(this) : null
      });
      return "error" == b ? !1 : !0
  }
  Message.show = function(a, b, c) {
      Message(a || LANG_jstools.messageShow, "show", b, c)
  };
  Message.hide = function(a) {
      a = a || "show";
      document.id("pop_message_" + a) && document.id("pop_message_" + a).retrieve("instance").hide()
  };
  Message.error = function(a, b, c) {
      return Message(a || LANG_jstools.messageError, "error", b, c)
  };
  Message.success = function(a, b, c) {
      return Message(a || LANG_jstools.messageSuccess, "success", b, c)
  };
  function maxZindex(a, b) {
  	/*
      var a = $$(a || "div"),
      c = 0;
      if (a.length) {
          var d = a.filter(function(a) {
              if (! (1 != a.nodeType || ["script", "link", "base", "style"].contains(a.tagName.toLowerCase()))) return ["absolute", "relative", "fixed"].contains(a.getStyle("position"))
          });
          if (d.length) for (var e = 0,
          f = d.length; e < f; e++) var g = d[e].getStyle("z-index"),
          c = Math.max(c, isNaN(g) ? 0 : g)
      }
      b && (c += parseInt(b));
      return Math.min(c, 2147483647)
  	*/
  };
  var AutoPlay = new Class({
      options: {
          autoplay: !0,
          interval: 3E3,
          pauseOnHover: !0
      },
      _autoInit: function(a) {
          this.options.autoplay && (this.autofn = a ||
          function() {},
          this.autoEvent().startAutoplay())
      },
      autoEvent: function() {
          this.options.pauseOnHover && this.container && this.container.addEvents({
              mouseenter: this.stopAutoplay.bind(this),
              mouseleave: function() {
                  this.startAutoplay()
              }.bind(this)
          });
          return this
      },
      startAutoplay: function() {
          this.paused = !1;
          this.autoTimer = function() {
              this.paused || this.autofn()
          }.periodical(this.options.interval, this)
      },
      stopAutoplay: function() {
          this.autoTimer && (clearInterval(this.autoTimer), this.autoTimer = void 0);
          this.paused = !0
      }
  }),
  LazyLoad = new Class({
      Implements: [Options, Events],
      options: {
          img: "data-src",
          textarea: "action-lazyload",
          lazyDataType: "textarea",
          execScript: !0,
          islazyload: !0,
          lazyEventType: "beforeSwitch",
          onAfter: function() {}
      },
      loadCustomLazyData: function(a, b) {
          var c, d, e = this.options.textarea,
          f = this.options.img;
          this.options.islazyload && Array.from(a).each(function(a) {
              switch (b) {
              case "img":
                  d = "IMG" === a.nodeName ? [a] : a.getElements("img");
                  d.each(function(a) {
                      this.loadImgSrc(a, f)
                  },
                  this);
                  break;
              default:
                  (c = a.getElement("textarea")) && c.hasClass(e) && this.loadAreaData(c)
              }
          },
          this)
      },
      loadImgSrc: function(a, b, c) {
          var b = b || this.options.img,
          d = a.getProperty(b);
          a.removeProperty(b);
          d && a.src != d && imageReady(d,
          function() {
              a.src = d;
              c && c()
          },
          function() {
              this.fireEvent("after", a)
          }.bind(this))
      },
      loadAreaData: function(a, b) {
          var c = (new Element("div")).inject(a, "before");
          this.stripScripts(a.value, c);
          a.destroy();
          b && b()
      },
      isAllDone: function() {
          var a = this.options.lazyDataType,
          b = this.options[a],
          c,
          d,
          e = "img" === a;
          if (a && this.container) {
              a = this.container.getElements(a);
              c = 0;
              for (d = a.length; c < d; c++) if (e ? a[c].get(b) : a[c].hasClass(b)) return ! 1
          }
          return ! 0
      },
      stripScripts: function(a, b) {
          var c = "",
          d = a.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,
          function(a, b) {
              c += b + "\n";
              return ""
          });
          b.set("html", this.options.execScript ? d: a);
          this.options.execScript && Browser.exec(c)
      },
      _lazyloadInit: function(a) {
          this.addEvent(this.options.lazyEventType,
          function() {
              this.loadCustomLazyData("function" == typeOf(a) ? a(arguments) : a, this.options.lazyDataType);
              this.isAllDone() && this.removeEvent(this.options.lazyEventType, arguments.callee)
          }.bind(this))
      }
  }),
  DataLazyLoad = new Class({
      Extends: LazyLoad,
      options: {
          containers: document,
          threshold: null,
          syncEl: null,
          config: {
              mod: "manual",
              diff: "default",
              placeholder: ""
          }
      },
      initialize: function(a, b) {
          this.setOptions(a);
          b = b || this.options.containers;
          this.containers = Array.from(b);
          this.containers.length && (window.Shop && (this.options.config.placeholder = Shop.url.placeholder), this.lazyinit())
      },
      lazyinit: function() {
          this.threshold = this.getThreshold();
          this.filterItems().getItemsLength();
          this.initLoadEvent()
      },
      filterItems: function() {
          var a = [],
          b = [];
          this.containers.each(function(c) {
              a = a.combine(c.getElements("img").filter(this.filterImg, this));
              b = b.combine(c.getElements("textarea").filter(this.filterArea, this))
          },
          this);
          this.images = a;
          this.areas = b;
          return this
      },
      filterImg: function(a) {
          var b = this.options.img,
          c = a.getAttribute(b),
          d = this.threshold,
          e = this.options.config.placeholder;
          if ("manual" === this.options.config.mod) {
              if (c) return e && (a.src = e),
              !0
          } else if ($(a).getOffsets().y > d && !c) return a.set(b, a.src),
          e ? a.src = e: a.removeAttribute("src"),
          !0
      },
      filterArea: function(a) {
          return a.hasClass(this.options.textarea)
      },
      initLoadEvent: function() {
          function a() {
              d.threshold = d.getThreshold();
              b()
          }
          function b() {
              c || (c = function() {
                  d.loadItems.call(d);
                  d.getItemsLength() || e.removeEvents({
                      scroll: b,
                      resize: a
                  });
                  c = null
              }.delay(100))
          }
          var c, d = this,
          e = window;
          e.addEvent("domready", this.loadItems.bind(this));
          this.getItemsLength() && e.addEvents({
              scroll: b,
              resize: a
          })
      },
      loadItems: function() {
          var a = this.options.syncEl;
          if (a) return this.loadsync(this[a], a);
          this.initItems(this.images.concat(this.areas));
          this.fireEvent("callback")
      },
      initItems: function(a) {
          var b = this.threshold + window.getScroll().y,
          c = {
              images: [],
              areas: []
          },
          d = {
              areas: "loadAreaData",
              images: "loadImgSrc"
          };
          a.each(function(a) {
              var f = "TEXTAREA" == a.tagName ? "areas": "images",
              a = $(a);
              f && "none" == a.getStyle("display") && a.getParent();
              if (a.getOffsets().y <= b) this[d[f]](a);
              else c[f].push(a)
          },
          this);
          this.images = c.images;
          this.areas = c.areas
      },
      loadsync: function(a, b) {
          if (a.length) {
              var c = this.threshold + window.getScroll().y,
              d = "areas" == b,
              a = a.filter(function(a) {
                  d && (a = "none" == a.getStyle("display") ? a.parentNode: a);
                  return a.getOffsets().y <= c
              });
              if (a.length) {
                  var e = a.shift(),
                  f = this.loadsync.bind(this, [this[b].erase(e), b]);
                  if (d) return this.loadAreaData(e, f);
                  this.loadImgSrc(e, !1, f)
              }
          }
      },
      getThreshold: function() {
          if (this.options.threshold) return this.options.threshold;
          var a = this.options.config.diff,
          b = window.getSize().y;
          return "default" === a ? 1 * b: b + a
      },
      getItemsLength: function() {
          return this.images.length + this.areas.length
      }
  }),
  Tabs = new Class({
      Implements: [AutoPlay, LazyLoad],
      options: {
          eventType: "mouse",
          hasTriggers: !0,
          triggersBox: ".switchable-triggerBox",
          triggers: ".switchable-trigger",
          content: ".switchable-content",
          panels: ".switchable-panel",
          activeIndex: 0,
          activeClass: "active",
          steps: 1,
          delay: 100,
          haslrbtn: !1,
          prev: ".prev",
          next: ".next",
          autoplay: !1,
          disableCls: null
      },
      initialize: function(a, b) {
          if (this.container = $(a)) this.setOptions(b),
          this.activeIndex = this.options.activeIndex,
          this.init()
      },
      init: function() {
          this.fireEvent("load");
          this.getMarkup();
          this.triggersEvent().extendPlugins();
          this.options.hasTriggers && this.triggers[this.activeIndex] && this.triggers[this.activeIndex].addClass(this.options.activeClass);
          this.options.showClass && this.panels[this.activeIndex] && this.panels[this.activeIndex].addClass(this.options.showClass);
          this.options.islazyload && this.fireEvent("beforeSwitch", {
              toIndex: this.activeIndex
          });
          this.fireEvent("init")
      },
      extendPlugins: function() {
          var a = this.options;
          a.autoplay && this._autoInit(this.autofn.bind(this));
          a.islazyload && this._lazyloadInit(this.getLazyPanel.bind(this));
          Tabs.plugins.each(function(a) {
              a.init && a.init.call(this)
          },
          this)
      },
      autofn: function() {
          this.switchTo(this.activeIndex < this.length - 1 ? this.activeIndex + 1 : 0, "FORWARD")
      },
      getMarkup: function() {
          var a = this.container,
          b = this.options,
          c;
          b.hasTriggers && (c = $(b.triggersBox) || a.getElement(b.triggersBox));
          this.triggers = c ? c.getChildren() : a.getElements(b.triggers);
          panels = this.panels = a.getElements(b.panels);
          this.content = $(b.content) || a.getElement(b.content) ? a.getElement(b.content) : panels[0] ? panels[0].getParent() : [];
          this.content = Array.from(this.content); ! panels.length && this.content.length && (this.panels = this.content[0].getChildren());
          if (!this.panels.length) return this;
          this.activeIndex = this.activeIndex.limit(0, this.panels.length - 1);
          this.length = this.panels.length / b.steps
      },
      triggersEvent: function() {
          var a = this.options,
          b = this.triggers;
          a.hasTriggers && b.each(function(b, d) {
              b.addEvent("click",
              function(a) {
                  this.options.stopEvent && a.stop();
                  this.triggerIsValid(d) && this.cancelTimer().switchTo(d)
              }.bind(this));
              "mouse" === a.eventType && b.addEvents({
                  mouseenter: function() {
                      this.triggerIsValid(d) && (this.switchTimer = this.switchTo.delay(a.delay, this, d))
                  }.bind(this),
                  mouseleave: this.cancelTimer.bind(this)
              })
          },
          this);
          a.haslrbtn && this.lrbtn();
          return this
      },
      lrbtn: function() {
          var a = this; ["prev", "next"].each(function(b) {
              this[b + "btn"] = this.container.getElements(this.options[b]).addEvent("click",
              function() {
                  if (!this.hasClass(a.options.disableCls)) a[b]()
              })
          },
          this);
          this.disabledBtn()
      },
      disabledBtn: function() {
          var a = this.options.disableCls;
          a && this.addEvent("switch",
          function(b) {
              b = b.currentIndex;
              b = 0 === b ? this.prevbtn: b === Math.ceil(this.length) - 1 ? this.nextbtn: void 0;
              this.nextbtn.removeClass(a);
              this.prevbtn.removeClass(a);
              b && b.addClass(a)
          }.bind(this))
      },
      triggerIsValid: function(a) {
          return this.activeIndex !== a
      },
      cancelTimer: function() {
          this.switchTimer && (clearTimeout(this.switchTimer), this.switchTimer = void 0);
          return this
      },
      switchTo: function(a, b) {
          var c = this.options,
          d = this.triggers,
          e = this.panels,
          f = this.activeIndex,
          g = c.steps,
          h = f * g,
          i = a * g;
          if (!this.triggerIsValid(a)) return this;
          this.fireEvent("beforeSwitch", {
              toIndex: a
          });
          c.hasTriggers && this.switchTrigger( - 1 < f ? d[f] : null, d[a]);
          void 0 === b && (b = a > f ? "FORWARD": "BACKWARD");
          this.switchView(e.slice(h, h + g), e.slice(i, i + g), a, b);
          this.activeIndex = a;
          return this.fireEvent("switch", {
              currentIndex: a
          })
      },
      switchTrigger: function(a, b) {
          var c = this.options.activeClass;
          a && a.removeClass(c);
          b && b.addClass(c)
      },
      switchView: function(a, b) {
          var c = this.options.showClass;
          c && (a[0].removeClass(c), b[0].addClass(c));
          a[0].setStyle("display", "none");
          b[0].setStyle("display", "")
      },
      prev: function() {
          var a = this.activeIndex;
          this.switchTo(0 < a ? a - 1 : this.length - 1, "BACKWARD")
      },
      next: function() {
          var a = this.activeIndex;
          this.switchTo(a < this.length - 1 ? a + 1 : 0, "FORWARD")
      },
      getLazyPanel: function(a) {
          var b = this.options.steps,
          a = a[0].toIndex * b;
          return this.panels.slice(a, a + b)
      }
  });
  Tabs.plugins = [];
  Tabs.Effects = {
      none: function(a, b) {
          a[0].setStyle("display", "none");
          b[0].setStyle("display", "block")
      },
      fade: function(a, b) {
          if (1 !== a.length) throw Error("fade effect only supports steps == 1.");
          var c = a[0],
          d = b[0];
          this.anim && this.anim.cancel();
          this.anim = (new Fx.Tween(c, {
              duration: this.options.duration,
              onStart: function() {
                  d.setStyle("opacity", 1)
              },
              onCancel: function() {
                  this.element.setOpacity(0);
                  this.fireEvent("complete")
              },
              onComplete: function() {
                  d.setStyle("zIndex", 2);
                  c.setStyle("zIndex", 1);
                  this.anim = void 0
              }.bind(this)
          })).start("opacity", 1, 0)
      },
      scroll: function(a, b, c, d) {
          function e(a) {
              for (var b = n ? h - 1 : 0, c = (b + 1) * m, b = b * m; b < c; b++) {
                  var d = (n ? -1 : 1) * j * h;
                  l[b].setStyle("position", a ? "relative": "").setStyle(k, a ? d: "")
              }
              return a ? n ? j: -j * h: i.setStyle(k, n ? -j * (h - 1) : "")
          }
          var f = this,
          b = this.options,
          a = this.activeIndex,
          g = "scrollx" === b.effect,
          h = this.length,
          i = this.content[0],
          j = this.viewSize[g ? 0 : 1],
          m = b.steps,
          l = this.panels,
          k = g ? "left": "top",
          b = -j * c,
          p,
          n = "FORWARD" !== d,
          k = "absolute" == i.getStyle("position") ? k: "margin-" + k; (p = n && 0 === a && c === h - 1 || !n && a === h - 1 && 0 === c) && (b = e.call(this, !0));
          fromp = i.getStyle(k).toInt();
          fromp = isNaN(fromp) ? 0 : fromp;
          this.anim && this.anim.cancel();
          this.anim = (new Fx.Tween(i, {
              duration: this.options.duration,
              transition: this.options.transition,
              onComplete: function() {
                  p && e.call(f);
                  this.anim = void 0
              }.bind(this)
          })).start(k, fromp, b)
      }
  };
  Effects = Tabs.Effects;
  Effects.scrollx = Effects.scrolly = Effects.scroll;
  var Switchable = new Class({
      Extends: Tabs,
      options: {
          autoplay: !0,
          position: "absolute",
          isFloat: !0,
          effect: "none",
          circular: !1,
          duration: 500,
          transition: Fx.Transitions.linear,
          direction: "FORWARD",
          viewSize: []
      },
      extendPlugins: function() {
          this.parent();
          this.effInit()
      },
      effInit: function() {
          var a = this.options,
          b = a.effect,
          c = this.panels,
          d = this.content[0],
          e = a.steps,
          f = this.activeIndex,
          g = c.length,
          h = c[0].measure(function() {
              return {
                  x: this.getSize().x ? this.getSize().x + this.getPatch("margin").x: this.getStyle("width").toInt() + this.getPatch().x,
                  y: this.getSize().y ? this.getSize().y + this.getPatch("margin").y: this.getStyle("height").toInt() + this.getPatch().y
              }
          });
          this.viewSize = [a.viewSize[0] || h.x * e, a.viewSize[1] || h.y * e];
          if ("none" !== b) switch (b) {
          case "scrollx":
          case "scrolly":
              "absolute" == a.position ? (d.setStyle("position", "absolute"), d.getParent().setStyles({
                  position: "relative"
              })) : "relative" == a.position && d.setStyle("position", "relative");
              "scrollx" === b && (a.isFloat && c.setStyle("float", "left"), d.setStyle("width", this.viewSize[0] * (g / e)));
              break;
          case "fade":
              var i = f * e,
              j = i + e - 1,
              m;
              c.each(function(b, c) {
                  m = c >= i && c <= j;
                  b.setStyles({
                      opacity: m ? 1 : 0,
                      position: a.position || "",
                      zIndex: m ? 2 : 1
                  })
              })
          }
      },
      switchView: function(a, b, c, d) {
          var e = this.options,
          f = e.effect,
          g = e.circular,
          f = "function" == typeOf(f) ? f: Effects[f];
          g && (d = e.direction);
          f && f.call(this, a, b, c, d)
      }
  }),
  Accordion = new Class({
      Extends: Tabs,
      options: {
          eventType: "click",
          multiple: !1
      },
      triggerIsValid: function(a) {
          return this.activeIndex !== a || this.options.multiple
      },
      switchView: function(a, b, c) {
          var d = this.options,
          b = b[0];
          d.multiple ? (this.triggers[c].toggleClass(d.activeClass), b.setStyle("display", "none" == b.getStyle("display") ? "block": "none")) : (a[0].setStyle("display", "none"), b.setStyle("display", "block"))
      }
  }),
  Slide = new Class({
      Extends: Switchable,
      options: {
          viewStep: 4
      },
      effect: function(a, b, c, d) {
          function e(a) {
              for (var b = k ? g - 1 : 0, c = (b + 1) * j, b = b * j; b < c; b++) {
                  var d = (k ? -1 : 1) * i * g;
                  m[b].setStyle("position", a ? "relative": "").setStyle(l, a ? d: "")
              }
              return a ? k ? i: -i * g: h.setStyle(l, k ? -i * (g - 1) : "")
          }
          var a = this.options,
          b = this.activeIndex,
          f = "scrollx" === a.effect,
          g = this.length,
          h = this.content[0],
          i = this.viewSize[f ? 0 : 1],
          j = a.steps,
          m = this.panels,
          l = f ? "left": "top",
          f = -i * c,
          k = "FORWARD" !== d;
          if (k && 0 === b && c === g - 1 || !k && b === g - 1 && 0 === c) f = e.call(this, !0);
          fromp = h.getStyle(l).toInt();
          fromp = isNaN(fromp) ? 0 : fromp;
          if (this.anim) return this;
          var p = [],
          n = a.viewStep,
          o = n - j;
          this.anim = (new Fx.Tween(h, {
              duration: this.options.duration,
              transition: this.options.transition,
              onStart: function() {
                  this.to[0].value = k ? i: -i;
                  if (!k) {
                      for (var a = c,
                      b, d = n - 1; 0 <= d; d--) a++,
                      a > g && (b || (b = n - d), p.push(d), m[d].setStyle(l, b * i));
                      c || (m[o].setStyle(l, i), m[0].setStyle(l, i))
                  }
              },
              onComplete: function() {
                  h.setStyle(l, 0);
                  m.each(function(a, b) {
                      var d = !c ? 0 : -i * c,
                      e = c + n - g;
                      k && b < e && (d = -i * (c - g)); ! k && p.contains(b) && (d = i * (o - p[0]));
                      a.setStyle("position", "relative").setStyle(l, d)
                  });
                  this.anim = void 0
              }.bind(this)
          })).start(l, fromp, f)
      },
      switchView: function(a, b, c, d) {
          var e = this.options;
          e.circular && (d = e.direction);
          this.effect(a, b, c, d)
      }
  });
  Switchable.autoRender = function(a, b) {
      var c = $(b || document.body).getElements(a || ".auto-bind-widget"),
      d;
      Array.from($$("img[data-src]"), $$("textarea.action-lazyload")).length && (d = $(document.body).get("data-lazyload-config") || "", new DataLazyLoad(JSON.decode(d)));
      c.length && c.each(function(a) {
          var b = a.get("data-widget-type");
          if (b && "Tabs Switchable Slide DropMenu Accordion DataLazyLoad".indexOf(b) > -1) try {
              d = a.get("data-widget-config") || "";
              if (b === "DataLazyLoad") return new window[b](JSON.decode(d), a);
              new window[b](a, JSON.decode(d))
          } catch(c) {}
      })
  };
  window.addEvent("domready", Switchable.autoRender.bind(Switchable));