/* combine : /javascript/common/libraries/underscore-min.js*/
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,g=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},w.find=w.detect=function(n,t,r){var e;return E(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:g&&n.every===g?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var E=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:E(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?null:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var k=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=k(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index<t.index?-1:1}),"value")};var F=function(n,t,r,e){var u={},i=k(t||w.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return F(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return F(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i},w.bind=function(n,t){if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));var r=o.call(arguments,2);return function(){return n.apply(t,r.concat(o.call(arguments)))}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);return 0===t.length&&(t=w.functions(n)),A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var M={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};M.unescape=w.invert(M.escape);var S={escape:RegExp("["+w.keys(M.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(M.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(S[n],function(t){return M[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var T=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||T).source,(r.interpolate||T).source,(r.evaluate||T).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(B,function(n){return"\\"+q[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);/* complete : /javascript/common/libraries/underscore-min.js*/


/* combine : /javascript/desktop/common/jdw_popup.js*/
avoidLeft = 10000;
avoidRight = 1;
avoidTop = 10000;
avoidBottom = 1;

function findObj(n,d) { //v3.0
  var p,i,x;
  if (!d)
    d = document;
  if (((p=n.indexOf("?"))>0) && (parent.frames.length)) {
    d = parent.frames[n.substring(p+1)].document;
    n = n.substring(0,p);
  }
  if (n.length < 2)
    return null;
  x = d[n];
  if (!x && d.all)
    x = d.all[n];
  //for (i=0; !x && i<d.forms.length; i++)
  //x = eval("document.forms[" + i + "]." + n);
  //for (i=0; !x && d.layers && i<d.layers.length; i++)
  //x = findObj(n,d.layers[i].document);
  if (!x) {
    if ((navigator.appName == "Netscape") && (navigator.appVersion.indexOf("4.") < 0))
      x = document.getElementById(n);
  }
  return x;
}

function mapCoords(x,y,obj) {
  var xAdjust = 250;
  var yAdjust = 300;

  if (obj != null) {
    if (navigator.appName == "Netscape") {
      if (obj.clip) {
        xAdjust = obj.clip.width + 25;
        yAdjust = obj.clip.height + 25;
      }
    } else {
      xAdjust = obj.scrollWidth + 25;
      yAdjust = obj.scrollHeight + 25;
    }
  }

  if (navigator.appName == "Netscape") {
    var xMax,yMax;

    yMax = window.innerHeight - yAdjust;
    if (y > yMax)
      y = yMax;
    else
      y = y - 25;
    if (y < 1)
      y = 1;

    xMax = window.innerWidth - xAdjust;
    if (x > xMax)
      x = xMax;
    else
      x = x - 50;
    if (x < 1)
      x = 1;

    x += window.pageXOffset;
    y += window.pageYOffset;

    //to avoid opening over edit fields...
    var xMove = 0;
    if ((x <= avoidRight) && ((x+xAdjust) >= avoidLeft)) {
      xMove = (x+xAdjust) - avoidLeft;
      if (xMove > (avoidRight - x))
        xMove = x - avoidRight;
    }
    var yMove = 0;
    if ((y <= avoidBottom) && ((y+yAdjust) >= avoidTop)) {
      yMove = (y+yAdjust) - avoidTop;
      if (yMove > (avoidBottom - y))
        yMove = y - avoidBottom;
    }
    if (Math.abs(1.5*yMove) > Math.abs(xMove))
      x = x - xMove;
    else
      y = y - yMove;
  } else { //if (event)
    var xMax,yMax;
    var ind50 = (navigator.appVersion.indexOf("MSIE 5") >= 0);

    yMax = window.document.body.offsetHeight - yAdjust;
    if (! ind50)
      yMax += window.document.body.scrollTop;

    if (y > yMax)
      y = yMax;
    else
      y = y - 25;
    if (y < 1)
      y = 1;

    xMax = window.document.body.offsetWidth - xAdjust;
    if (! ind50)
      xMax += window.document.body.scrollLeft;

    if (x > xMax)
      x = xMax;
    else
      x = x - 50;
    if (x < 1)
      x = 1;

    if (ind50) {
      y += window.document.body.scrollTop;
      x += window.document.body.scrollLeft;
    }
  }
  return ((y<<16) | x);
}

/*
 * Variable arguments.
 *
 * Hide all the objects(DIVs) passed in as arguments except the last
 * one.
 */
function DoPopups() { //v3.0
  var args=DoPopups.arguments;
  var obj = null;
  if (args.length > 0)
    obj = findObj(args[args.length-1]);

  var xy = mapCoords(xLoc,yLoc,obj);

  var x = xy & 0x0000FFFF;
  var y = xy >> 16;

  var i,v,d;
  for (i=0; i<args.length; i++) {
    if (i == (args.length-1))
      v = 'show';
    else
      v = 'hide';

    if ((obj=findObj(args[i])) != null) {
      if (obj.style) {
        obj = obj.style;
        if (v == 'show') {
          v = 'visible';
          d = 'inline';
        }
        else if (v == 'hide') {
          v = 'hidden';
          d = 'none';
        }
      }
      if (navigator.appName == "Netscape") {
        obj.top = 0;
        obj.left = 0;
      } else {
        //PC 09/10/01. Change to make all hidden layers in IE move to the top left of the screen
        //And stop the scroll bars appearing.
        if (v == 'hidden') {
          obj.posTop = 0;
          obj.posLeft = 0;
        } else {
          obj.posTop = y;
          obj.posLeft = x;
        }
      }
      obj.visibility = v;
      obj.display = d;
    }
  }
}

function doAdvancedSearchPopup() {
    var width = '600';
    var height = '350';
  //if we have arguments then the advance search link has been clicked.
  //using the url passed in means we overwrite whatever is in the
  //advancedSearchUrl which may have been populated by the results of a
  //previous search.
  if(doAdvancedSearchPopup.arguments.length > 0) {
    advancedSearchPopupUrl = doAdvancedSearchPopup.arguments[0];
  }
  if(doAdvancedSearchPopup.arguments.length > 1) {
      width = doAdvancedSearchPopup.arguments[1];
  }
  if(doAdvancedSearchPopup.arguments.length > 2) {
      height = doAdvancedSearchPopup.arguments[2];
  }
  if(advancedSearchPopupUrl != null && advancedSearchPopupUrl != "") {
    var win = window.open(advancedSearchPopupUrl,'SearchWindow','dependant,resizeable,scrollbars=no,width=' + width + ',height=' + height + ',left=50,top=50');
    if (win) {
      win.focus();
    }
  }
}

var win=null; // spotts:36A1-HPR:1.6.2.2.8.3:2004/01/14:relocate from bottomNavigation_inc.jsp and faq_view.jsp
function fnNewWindow(mypage,myname,w,h,scroll){
  var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  var settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
  win = window.open(mypage,myname,settings);
}

var winPop = null; // spotts:36A1-HPR:1.6.2.2.8.3:2004/01/14:relocate from bottomNavigation_inc.jsp
function fnNewPopup(mypage,w,h){
  var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  var settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no, resizable=no, location=no, menubar=no';
  winPop = window.open(mypage,'myname',settings);
}

function MOREINFO(strUrl) {

    newWindow = window.open(strUrl, 'MoreInfoWindow',
            'dependant,resizeable,scrollbars=yes,width=600,height=600,left=50,top=50');

    if (newWindow) {
        newWindow.focus();
    }
}

function EXTRAINFO(strUrl,width,height) {

    newWindow = window.open(strUrl, 'ExtraInfoWindow',
        'dependant,scrollbars=no,width='+width+',height='+height+',left=100,top=100');

    if (newWindow) {
        newWindow.focus();
    }
}

// this one used by Hyperlinks
function OpenWindow(url,name,params) {
  var w = window.open(url, name, params);
  if (w)
    w.focus();
}/* complete : /javascript/desktop/common/jdw_popup.js*/


/* combine : /javascript/desktop/common/jdw_menuControl.js*/
var xLoc=0,yLoc=0; // mouse pointer position

function NetscapeMouseMove(e) {
  xLoc = e.pageX; // - window.pageXOffset;
  yLoc = e.pageY; // - window.pageYOffset;
  // PROD-588: Try/catch because newer browsers don't support this
  try {
	  window.routeEvent(e);
  } catch(err) {}
  }

function IEMouseClick() {
  if (navigator.appName != "Netscape") {
    xLoc = event.x; if (document.body) xLoc += document.body.scrollLeft;
    yLoc = event.y; if (document.body) yLoc += document.body.scrollTop;
  }
}

if ((navigator.appName == "Netscape") && (navigator.userAgent.indexOf("Opera 4")==-1) && (window.Event)) {
  document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove = NetscapeMouseMove;
}

function MM_findObj(n, d) { //v4.0 Macromedia x-browser getObjectByID() routine
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && document.getElementById) x=document.getElementById(n); return x;
}

// START: stevepotts competition popup...
function togVis(elementId_str) {
  var obj=MM_findObj(document.layers?elementId_str+"_NN":elementId_str+"_IE"); 
  if(!document.layers) obj=obj.style;
  var v=obj.visibility; obj.visibility=(v.length<1||v.substr(0,3)=="hid")?"visible":"hidden";
}
function positionToCursor(elementId_str) {
  var obj=MM_findObj(document.layers?elementId_str+"_NN":elementId_str+"_IE"); 
  if(!document.layers) obj=obj.style; obj.left=xLoc-200; obj.top=yLoc-220;
}
// ...END

// START: "other great sites" rollover...
function changepic(pic) {
  document.roll01.src=pic;
}
// ...END

// START: "swapimage"
function swapImage(imgToChange,newImage) {
    imgToChange.src=newImage;
}

function onLoad() {}//artefact from previous menu system, unused by stevepotts menu

function deleteWebOfferItem(menuContainer_a){
  if(menuContainer_a!=null&&typeof(menuContainer_a)=="object"){
    if(menuContainer_a.length == 0){
    return;
    }
    
 
    if(menuContainer_a.length > 0){
      var d=document;
      if(typeof(menuContainer_a[0])=="object"){
      	var mc=menuContainer_a[0];
       
        
        if(mc.menuItem_a!=null&&typeof(mc.menuItem_a)=='object'){ //has popup
			deleteItem('webOfferMenuItem');
		
        } 
  	  }//if 
    }//if > 0

  }//if
  	
}

function deleteItem(itemName){

  var x=document.getElementById(itemName);
  if(x != null){
  	 x.parentNode.removeChild(x);
  }else{
  	// look to see if we need to delete the last item.
  	var maxItems = document.getElementById("maxNamMenuItems").value;
  	// total static menu items 
  	var staticMenu = document.getElementById('navmenuglobal').getElementsByTagName("table");
  	var staticCount = staticMenu.length;
  	
  	
  	if( parseInt(staticCount) > parseInt(maxItems)){
  		document.getElementById('navmenuglobal').deleteCell(-1);
  	}
  }
   
}



/* complete : /javascript/desktop/common/jdw_menuControl.js*/


/* combine : /javascript/desktop/common/messages.js*/
function strMessageCheck() {
  var pairs = location.search.substring(1).split(",");
  var pos = 0;
  var key = "";
  var value = "";
    
  for(var counter=0; counter < pairs.length; counter++) {
      var pos = pairs[counter].indexOf("=");
      if(pos == -1) {
          continue;
      }
      key = pairs[counter].substring(0,pos); 
      if(key == "strMsg") {
          value = unescape(pairs[counter].substring(pos+1));
          alert(value);
          return;
      }    
  }
}

function checkPromotionalState() {
  if (jPopUp == "claim" ) {
      DoPopups('CLAIM-popup');
  }else if (jPopUp == "omaMessage") {
      var win = window.open(url, "UserMessage", "width=400,height=200");
  } else if (jPopUp == "omaPopup") {
      var win = window.open(url, "OutOfDate", "width=400,height=200");
  }
}

function displayInvalidSearchPopup() {
    DoPopups('INVALID_SEARCH-popup');
}

function displayAbortTitleChangePopup() {
	DoPopups('TITLE_CHANGE_BAG-popup');
}   
            
function displayAnyPopups() {
    if (jPopUp) {
        DoPopups('CLAIM-popup');
        scroll(0,0);
    }
}/* complete : /javascript/desktop/common/messages.js*/


/* combine : /javascript/common/libraries/jquery/jquery-1.11.1.wpi.min.jsDoNotParse*/
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
/* complete : /javascript/common/libraries/jquery/jquery-1.11.1.wpi.min.js*/


/* combine : /javascript/common/libraries/jquery/jquery-migrate-1.2.1.min.js*/

(function(jQuery,window,undefined){var warnedAbout={};jQuery.migrateWarnings=[];if(!jQuery.migrateMute&&window.console&&window.console.log){window.console.log("JQMIGRATE: Logging is active");}
if(jQuery.migrateTrace===undefined){jQuery.migrateTrace=true;}
jQuery.migrateReset=function(){warnedAbout={};jQuery.migrateWarnings.length=0;};function migrateWarn(msg){var console=window.console;if(!warnedAbout[msg]){warnedAbout[msg]=true;jQuery.migrateWarnings.push(msg);if(console&&console.warn&&!jQuery.migrateMute){console.warn("JQMIGRATE: "+msg);if(jQuery.migrateTrace&&console.trace){console.trace();}}}}
function migrateWarnProp(obj,prop,value,msg){if(Object.defineProperty){try{Object.defineProperty(obj,prop,{configurable:true,enumerable:true,get:function(){migrateWarn(msg);return value;},set:function(newValue){migrateWarn(msg);value=newValue;}});return;}catch(err){}}
jQuery._definePropertyBroken=true;obj[prop]=value;}
if(document.compatMode==="BackCompat"){migrateWarn("jQuery is not compatible with Quirks Mode");}
var attrFn=jQuery("<input/>",{size:1}).attr("size")&&jQuery.attrFn,oldAttr=jQuery.attr,valueAttrGet=jQuery.attrHooks.value&&jQuery.attrHooks.value.get||function(){return null;},valueAttrSet=jQuery.attrHooks.value&&jQuery.attrHooks.value.set||function(){return undefined;},rnoType=/^(?:input|button)$/i,rnoAttrNodeType=/^[238]$/,rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,ruseDefault=/^(?:checked|selected)$/i;migrateWarnProp(jQuery,"attrFn",attrFn||{},"jQuery.attrFn is deprecated");jQuery.attr=function(elem,name,value,pass){var lowerName=name.toLowerCase(),nType=elem&&elem.nodeType;if(pass){if(oldAttr.length<4){migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");}
if(elem&&!rnoAttrNodeType.test(nType)&&(attrFn?name in attrFn:jQuery.isFunction(jQuery.fn[name]))){return jQuery(elem)[name](value);}}
if(name==="type"&&value!==undefined&&rnoType.test(elem.nodeName)&&elem.parentNode){migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");}
if(!jQuery.attrHooks[lowerName]&&rboolean.test(lowerName)){jQuery.attrHooks[lowerName]={get:function(elem,name){var attrNode,property=jQuery.prop(elem,name);return property===true||typeof property!=="boolean"&&(attrNode=elem.getAttributeNode(name))&&attrNode.nodeValue!==false?name.toLowerCase():undefined;},set:function(elem,value,name){var propName;if(value===false){jQuery.removeAttr(elem,name);}else{propName=jQuery.propFix[name]||name;if(propName in elem){elem[propName]=true;}
elem.setAttribute(name,name.toLowerCase());}
return name;}};if(ruseDefault.test(lowerName)){migrateWarn("jQuery.fn.attr('"+lowerName+"') may use property instead of attribute");}}
return oldAttr.call(jQuery,elem,name,value);};jQuery.attrHooks.value={get:function(elem,name){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="button"){return valueAttrGet.apply(this,arguments);}
if(nodeName!=="input"&&nodeName!=="option"){migrateWarn("jQuery.fn.attr('value') no longer gets properties");}
return name in elem?elem.value:null;},set:function(elem,value){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="button"){return valueAttrSet.apply(this,arguments);}
if(nodeName!=="input"&&nodeName!=="option"){migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");}
elem.value=value;}};var matched,browser,oldInit=jQuery.fn.init,oldParseJSON=jQuery.parseJSON,rquickExpr=/^([^<]*)(<[\w\W]+>)([^>]*)$/;jQuery.fn.init=function(selector,context,rootjQuery){var match;if(selector&&typeof selector==="string"&&!jQuery.isPlainObject(context)&&(match=rquickExpr.exec(jQuery.trim(selector)))&&match[0]){if(selector.charAt(0)!=="<"){migrateWarn("$(html) HTML strings must start with '<' character");}
if(match[3]){migrateWarn("$(html) HTML text after last tag is ignored");}
if(match[0].charAt(0)==="#"){migrateWarn("HTML string cannot start with a '#' character");jQuery.error("JQMIGRATE: Invalid selector string (XSS)");}
if(context&&context.context){context=context.context;}
if(jQuery.parseHTML){return oldInit.call(this,jQuery.parseHTML(match[2],context,true),context,rootjQuery);}}
return oldInit.apply(this,arguments);};jQuery.fn.init.prototype=jQuery.fn;jQuery.parseJSON=function(json){if(!json&&json!==null){migrateWarn("jQuery.parseJSON requires a valid JSON string");return null;}
return oldParseJSON.apply(this,arguments);};jQuery.uaMatch=function(ua){ua=ua.toLowerCase();var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};};if(!jQuery.browser){matched=jQuery.uaMatch(navigator.userAgent);browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version;}
if(browser.chrome){browser.webkit=true;}else if(browser.webkit){browser.safari=true;}
jQuery.browser=browser;}
migrateWarnProp(jQuery,"browser",jQuery.browser,"jQuery.browser is deprecated");jQuery.sub=function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context);}
jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context);}
return jQuery.fn.init.call(this,selector,context,rootjQuerySub);};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);migrateWarn("jQuery.sub() is deprecated");return jQuerySub;};jQuery.ajaxSetup({converters:{"text json":jQuery.parseJSON}});var oldFnData=jQuery.fn.data;jQuery.fn.data=function(name){var ret,evt,elem=this[0];if(elem&&name==="events"&&arguments.length===1){ret=jQuery.data(elem,name);evt=jQuery._data(elem,name);if((ret===undefined||ret===evt)&&evt!==undefined){migrateWarn("Use of jQuery.fn.data('events') is deprecated");return evt;}}
return oldFnData.apply(this,arguments);};var rscriptType=/\/(java|ecma)script/i,oldSelf=jQuery.fn.andSelf||jQuery.fn.addBack;jQuery.fn.andSelf=function(){migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");return oldSelf.apply(this,arguments);};if(!jQuery.clean){jQuery.clean=function(elems,context,fragment,scripts){context=context||document;context=!context.nodeType&&context[0]||context;context=context.ownerDocument||context;migrateWarn("jQuery.clean() is deprecated");var i,elem,handleScript,jsTags,ret=[];jQuery.merge(ret,jQuery.buildFragment(elems,context).childNodes);if(fragment){handleScript=function(elem){if(!elem.type||rscriptType.test(elem.type)){return scripts?scripts.push(elem.parentNode?elem.parentNode.removeChild(elem):elem):fragment.appendChild(elem);}};for(i=0;(elem=ret[i])!=null;i++){if(!(jQuery.nodeName(elem,"script")&&handleScript(elem))){fragment.appendChild(elem);if(typeof elem.getElementsByTagName!=="undefined"){jsTags=jQuery.grep(jQuery.merge([],elem.getElementsByTagName("script")),handleScript);ret.splice.apply(ret,[i+1,0].concat(jsTags));i+=jsTags.length;}}}}
return ret;};}
var eventAdd=jQuery.event.add,eventRemove=jQuery.event.remove,eventTrigger=jQuery.event.trigger,oldToggle=jQuery.fn.toggle,oldLive=jQuery.fn.live,oldDie=jQuery.fn.die,ajaxEvents="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",rajaxEvent=new RegExp("\\b(?:"+ajaxEvents+")\\b"),rhoverHack=/(?:^|\s)hover(\.\S+|)\b/,hoverHack=function(events){if(typeof(events)!=="string"||jQuery.event.special.hover){return events;}
if(rhoverHack.test(events)){migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");}
return events&&events.replace(rhoverHack,"mouseenter$1 mouseleave$1");};if(jQuery.event.props&&jQuery.event.props[0]!=="attrChange"){jQuery.event.props.unshift("attrChange","attrName","relatedNode","srcElement");}
if(jQuery.event.dispatch){migrateWarnProp(jQuery.event,"handle",jQuery.event.dispatch,"jQuery.event.handle is undocumented and deprecated");}
jQuery.event.add=function(elem,types,handler,data,selector){if(elem!==document&&rajaxEvent.test(types)){migrateWarn("AJAX events should be attached to document: "+types);}
eventAdd.call(this,elem,hoverHack(types||""),handler,data,selector);};jQuery.event.remove=function(elem,types,handler,selector,mappedTypes){eventRemove.call(this,elem,hoverHack(types)||"",handler,selector,mappedTypes);};jQuery.fn.error=function(){var args=Array.prototype.slice.call(arguments,0);migrateWarn("jQuery.fn.error() is deprecated");args.splice(0,0,"error");if(arguments.length){return this.bind.apply(this,args);}
this.triggerHandler.apply(this,args);return this;};jQuery.fn.toggle=function(fn,fn2){if(!jQuery.isFunction(fn)||!jQuery.isFunction(fn2)){return oldToggle.apply(this,arguments);}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){var lastToggle=(jQuery._data(this,"lastToggle"+fn.guid)||0)%i;jQuery._data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;};toggler.guid=guid;while(i<args.length){args[i++].guid=guid;}
return this.click(toggler);};jQuery.fn.live=function(types,data,fn){migrateWarn("jQuery.fn.live() is deprecated");if(oldLive){return oldLive.apply(this,arguments);}
jQuery(this.context).on(types,this.selector,data,fn);return this;};jQuery.fn.die=function(types,fn){migrateWarn("jQuery.fn.die() is deprecated");if(oldDie){return oldDie.apply(this,arguments);}
jQuery(this.context).off(types,this.selector||"**",fn);return this;};jQuery.event.trigger=function(event,data,elem,onlyHandlers){if(!elem&&!rajaxEvent.test(event)){migrateWarn("Global events are undocumented and deprecated");}
return eventTrigger.call(this,event,data,elem||document,onlyHandlers);};jQuery.each(ajaxEvents.split("|"),function(_,name){jQuery.event.special[name]={setup:function(){var elem=this;if(elem!==document){jQuery.event.add(document,name+"."+jQuery.guid,function(){jQuery.event.trigger(name,null,elem,true);});jQuery._data(this,name,jQuery.guid++);}
return false;},teardown:function(){if(this!==document){jQuery.event.remove(document,name+"."+jQuery._data(this,name));}
return false;}};});})(jQuery,window);/* complete : /javascript/common/libraries/jquery/jquery-migrate-1.2.1.min.js*/


/* combine : /javascript/common/libraries/jquery/jquery.overlay.js*/
/*
Options
	
	overlay.create({
		bindTo  //Element you wish to bind the overlay to... 
		behindOverlay [true,false],
		showDelay [int], //	time it takes for the please wait to appear
		closeDelay [int] //	time taken to close overlay from when it is created IF NOT SET A MANUAL CLOSE IS NEEDED
	});

	/***************************** /
	
		When clicking the 'addtobag' button the following below is used to execute the overlay message, however on execution the overlay is shown with 100% transparency
		'showDelay' specifies the time delay to show the overlay, 'closeDelay' is the time it takes to remove it. 
		
		however! a overlay.closeOverlay can be executed to break the operation and close the overlay sooner, possibly before the 'showDelay' is over.
		
		overlay.create('#prodOptionsPanelContainer .boxCurveContainer:eq(0)', {height:310,  'showDelay' : 200, 'closeDelay' : 4000});
	
	/***************************** /

*/
var overlay = {
	options : {  
			opacity : 0.8,
			showDelay : 1000,
			displayProcessing : 3000,
			displayTime : 0
	}, 
	
	delayCloseOverlay : function (delay) {
		$('body').animate({'dummy':'1'}, delay, function () {
				$('body').prop('style','');
				$('.overlay').prop('closeNow', '1');
				overlay.closeOverlay({closeNow : true });
		});
	}, 
	
	closeOverlay : function () {
						
			var removeOverlay = 0;
			var closeNow = 1;
										   
			if($('.overlay').css('opacity') > 0 && $('.overlay').prop('closeNow') == 0)
				var closeNow = 0;
				
			if(closeNow == 0 && $('.overlay').prop('closeNow') == 0) {
				var removeOverlay = (this.options.displayTime + this.options.displayProcessing) - new Date().getTime();
				
				if (removeOverlay < 0)
					removeOverlay = 0;
					
				this.delayCloseOverlay(removeOverlay);
			} else {
				$('.overlay').stop().animate({opacity:0}, function () {
					$(this).remove();
				});
			}

			return removeOverlay;
	},
	
	showPleaseWait : function () {
		if($('.overlay').size() == 1) {
			$('.overlay').fadeTo(1000, this.options.opacity);
			$('.overlay div').fadeIn(1000);
			
			this.options.displayTime = new Date().getTime();
		}
	},	
	setStyles : function (ele, overlayMods) {
			
			if(ele.css('width') && ele.prop('class') =='boxCurveContainer')
				$('.overlay').css({'width': (ele.width() + 6) + 'px', 'margin-left': '-3px'});
			else if(ele.css('width'))
				$('.overlay').css({'width': ele.css('width'), 'margin-left': '0px'});
			if(overlayMods.width)
				$('.overlay').css({'width': overlayMods.width + 'px'});
			if(overlayMods.height)
				$('.overlay').css({'height': overlayMods.height + 'px'});
			if(overlayMods.behindOverlay == true)
			   	$('.overlay').css({'zIndex': '4561'});
			if(overlayMods.cssStyle)
				$('.overlay').css(overlayMods.cssStyle);
	},
	create : function (overlayMods) {
					
			if(!overlayMods)
				var overlayMods = {};
			
			if(!overlayMods.msg) {
				overlayMods.msg = "Please Wait";
			}
			
			if($('.' + overlayMods.trigger).parents('div.displayOverlay').size() == 1){
				var ele = $('.' + overlayMods.trigger).parents('div.displayOverlay');
			} else {
				var ele = $('.' + overlayMods.trigger);
			}
			
		//	$('.' + overlayMods.trigger).removeClass(overlayMods.trigger);
			
			var opacity = this.options.opacity;
			var showDelay = (overlayMods.showDelay ? overlayMods.showDelay : 0);
			
			if(ele.css('position') == 'static' || !ele.css('position'))
				//ele.css('position', 'relative')			
			if(showDelay > 0)
				opacity = 0;
			
			ele.append('<div class="overlay" closeNow="0" style="display:' + (opacity == 0 ? 'none' : 'block') + ';"><div id="mLoadingMessage" class="formOverlayBorder" style="display:' + (opacity == 0 ? 'none' : 'block') + ';"><div class="curveLT"></div><div class="curveRT"></div><div class="overlayCornerBL"></div><div class="overlayCornerBR"></div>' + overlayMods.msg + '</div></div>')
			.find('.overlay').animate({opacity:opacity},function(){$('.overlay').css('display', 'block');})
			
			if($('.formOverlayBorder').size() > 0)
				$('.formOverlayBorder').css({
					'margin-top':'-' + ($('.formOverlayBorder').height()) + 'px'
				});
			
			
			if(overlayMods.showDelay) {
				this.options.showDelay = overlayMods.showDelay;
				setTimeout("overlay.showPleaseWait()", showDelay);
			} else if(this.options.showDelay) {
				this.options.showDelay = 0;
			}
			
			this.setStyles(ele, overlayMods);
			
		   	if(overlayMods.closeDelay)
				overlay.delayCloseOverlay(overlayMods.closeDelay);
			
	}
};

/* complete : /javascript/common/libraries/jquery/jquery.overlay.js*/


/* combine : /javascript/common/libraries/jquery/jquery.easing.js*/
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 *//* complete : /javascript/common/libraries/jquery/jquery.easing.js*/


/* combine : /javascript/common/libraries/jquery/jquery.url.packed.js*/
jQuery.url=function(){var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function(){str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--){uri[options.key[i]]=m[i]||""}uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2){if($1){uri[options.q.name][$1]=$2}});return uri};var key=function(key){if(!parsed.length){setUp()}if(key=="base"){if(parsed.port!==null&&parsed.port!==""){return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"}else{return parsed.protocol+"://"+parsed.host+"/"}}return(parsed[key]==="")?null:parsed[key]};var param=function(item){if(!parsed.length){setUp()}return(parsed.queryKey[item]===null)?null:parsed.queryKey[item]};var setUp=function(){parsed=parseUri();getSegments()};var getSegments=function(){var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/")};return{setMode:function(mode){strictMode=mode=="strict"?true:false;return this},setUrl:function(newUri){options.url=newUri===undefined?window.location:newUri;setUp();return this},segment:function(pos){if(!parsed.length){setUp()}if(pos===undefined){return segments.length}return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos]},attr:key,param:param}}();/* complete : /javascript/common/libraries/jquery/jquery.url.packed.js*/


/* combine : /javascript/common/libraries/jquery/jquery-ui-1.11.2.wpi.min.jsDoNotParse*/
/*! jQuery UI - v1.12.1 - 2017-05-26
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/menu.js, widgets/mouse.js, widgets/selectmenu.js, widgets/tooltip.js, effect.js, effects/effect-drop.js, effects/effect-fade.js, effects/effect-highlight.js, effects/effect-scale.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,l=t(this),h=l.outerWidth(),c=l.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=h+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),T=e(k.my,l.outerWidth(),l.outerHeight());"right"===n.my[0]?D.left-=h:"center"===n.my[0]&&(D.left-=h/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=T[0],D.top+=T[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:h,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+T[0],u[1]+T[1]],my:n.my,at:n.at,within:b,elem:l})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-h,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:l,left:D.left,top:D.top,width:h,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],l=r&&n.collapsible,h=l?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:l?t():a,newPanel:h};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=l?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=h&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===l&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))
},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var n=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var l=n[s]("widget");t.data(l[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(l[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(o){var a=i.options.classes[o]||"";a=t.trim(a.replace(n,"")),s[o]=(a+" "+e[o]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var o=!1;t(document).on("mouseup",function(){o=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!o){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),o=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,o=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))
},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){h.of=t,a.is(":hidden")||a.position(h)}var o,a,r,l,h=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),l=t("<div>").html(a.find(".ui-tooltip-content").html()),l.removeAttr("name").find("[name]").removeAttr("name"),l.removeAttr("id").find("[id]").removeAttr("id"),l.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(h.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip;var a="ui-effects-",r="ui-effects-style",l="ui-effects-animated",h=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=h(),n=s._rgba=[];return i=i.toLowerCase(),f(l,function(t,o){var a,r=o.re.exec(i),l=r&&o.parse(r),h=o.space||"rgba";return l?(a=s[h](l),s[c[h].cache]=a[c[h].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],h=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=h.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),h.fn=t.extend(h.prototype,{parse:function(n,a,r,l){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,l],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof h?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=h(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=h(t),n=s._space(),o=c[n],a=0===this.alpha()?h("transparent"):this,r=a[o.cache]||o.to(a._rgba),l=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],h=s[o],c=u[n.type]||{};null!==h&&(null===a?l[o]=h:(c.mod&&(h-a>c.mod/2?a+=c.mod:a-h>c.mod/2&&(a-=c.mod)),l[o]=i((h-a)*e+a,n)))}),this[n](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=h(e)._rgba;return h(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),l=Math.min(s,n,o),h=r-l,c=r+l,u=.5*c;return e=l===r?0:s===r?60*(n-o)/h+360:n===r?60*(o-s)/h+120:60*(s-n)/h+240,i=0===h?0:.5>=u?h/c:h/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,l=n.to,c=n.from;h.fn[s]=function(s){if(l&&!this[a]&&(this[a]=l(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=h(c(d)),n[a]=d,n):h(d)},f(o,function(e,i){h.fn[e]||(h.fn[e]=function(n){var o,a=t.type(n),l="alpha"===e?this._hsla?"hsla":"rgba":s,h=this[l](),c=h[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),h[i.idx]=n,this[l](h)))})})}),h.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=h(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(l){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=h(e.elem,i),e.end=h(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(h),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(h.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var l=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",h=l.children?a.find("*").addBack():a;h=h.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),h=h.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),h=h.map(function(){var e=this,i=t.Deferred(),s=t.extend({},l,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,h.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),l.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(l)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(a+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(a+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(r,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(r)||"",t.removeData(r)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(a+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=a+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(l),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=u.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[c](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===c:"show"===c)?(r[c](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,c=s.mode,u=[],d=function(e){var i=t(this),s=t.effects.mode(i,c)||o;i.data(l,!0),u.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?c?this[c](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(d).each(i):this.queue(r,d).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,l=o?a.scrollLeft():0,h=n.offset(),c={top:h.top-r,left:h.left-l,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-l,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var c=t.effects;t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r?"-=":"+=",c="+="===h?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,u[l]=h+s,a&&(n.css(u),u[l]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],l=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,l,n.from.y,_),v=t.effects.setTransition(a,l,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,h,n.from.x,_),v=t.effects.setTransition(a,h,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(l=l.concat(["marginTop","marginBottom"]).concat(r),h=h.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,l,n.from.y,o),a=t.effects.setTransition(i,l,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,h,n.from.x,o),a=t.effects.setTransition(i,h,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,u=e.distance||o["top"===h?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[h],d[h]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[l][1]]=d.clip[a[l][0]],"show"===r&&(o.cssClip(d.clip),o.css(h,d[h]),d.clip=s,d[h]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var c;t.uiBackCompat!==!1&&(c=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)}))});
/* complete : /javascript/common/libraries/jquery/jquery-ui-1.11.2.wpi.min.js*/


/* combine : /javascript/common/libraries/jdw_ajax.js*/
$.fn.Sleep = function(duration, callback) {
	if(!callback)callback=function(){return false;};
	$(this).animate({dummy:1}, duration, callback);
	return this;
};
	
var modalLinkStack=[];       

var modalDefaults = {
	delay: 300,
	width : 500,
	height: 300,
	controlsHeight: 50,
	headerHeight: 50,			
	scrollTop: 60,			
	controls : '',
	closeDefault : '<div class="modalButtonClose modalButtonCloseFooter"><div class="modalButton"><div class="buttonCapLt"></div><a href="#" alt="Click to close this window" title="Click to close this window">Close this window</a><div class="buttonCapRt"></div></div></div>',
	backDefault : '<div class="modalButtonBack" id="modalButtonLeft" style="display:none;"><div class="modalButton"><div class="buttonCapLt"></div><a id="modalBackAnchor" href="#" alt="Click to Go Back" title="Click to go back">Back</a><div class="buttonCapRt"></div></div></div>',
	overlayClose : 'true', 
	backButton : 'true',
	nonModal: 'false'
};
			
var modalFunctions = {
	create : {
		container : function (data, showScrollbars, options) {			
			var new_overlay = 0;
			if($('#modal_overlay').size() == 0) {
				$('body').append('<div id="modal_overlay" style="display: none"></div>');
				$('body').append('<div id="modal_coremetrics_node" style="display: none"></div>');
				$('body').append('<div id="modal_outer" style="display: none"></div>');
				$('#modal_outer').append('<div id="modal_container" class="displayOverlay modal_container">' + data + '</div>');
				var new_overlay = 1;
			} else {
				$('#modal_outer').find('#modal_container').html(data);
			}

			$('#modal_overlay').css({'width':'100%'});
			if(jdBrowser.msie == true) {
				$('#modal_overlay').fadeTo(1, 0.8);
			}
			
			var modalParam = $('#modal_outer').find('#modalParam');
			
			if($('#modal_outer').find('#modalParam').attr('title'))
				modalDefaults.title = modalParam.attr('title');
			if($('#modal_outer').find('#modalParam').attr('overlayClose'))
				modalDefaults.overlayClose = modalParam.attr('overlayClose');
			if($('#modal_outer').find('#modalParam').attr('backButton'))
				modalDefaults.backButton = modalParam.attr('backButton');
			if($('#modal_outer').find('#modalParam').attr('nonModal'))
				modalDefaults.nonModal = modalParam.attr('nonModal');
			if($('#modal_outer').find('#modalParam').attr('width'))	
				modalDefaults.width = modalParam.attr('width');
			if($('#modal_outer').find('#modalParam').attr('height'))
				modalDefaults.height = modalParam.attr('height');
			if($('#modal_outer').find('#modalParam').attr('controlsHeight'))
				modalDefaults.controlsHeight = modalParam.attr('controlsHeight');
			if($('#modal_outer').find('#modalParam').attr('scrollTopValue')) {
				modalDefaults.scrollTop = parseInt(modalParam.attr('scrollTopValue'));
		    }
		    
		    if(options && options.height) {
		    	modalDefaults.height = options.height;
		    }if(options && options.width) {
		    	modalDefaults.width = options.width;
		    }
			
			var marginLeft;	
            if($('#modal_outer').find('#modalParam').attr('marginLeft')){
				marginLeft =  parseInt(modalParam.attr('marginLeft'));
			} else {
			 	 marginLeft = -(modalDefaults.width/2);
			}				
			
			var outerHeight = parseInt(modalDefaults.height) + parseInt(modalDefaults.controlsHeight) + parseInt(modalDefaults.headerHeight);
			$('#modal_outer').css({'height': outerHeight + 'px','margin-left' : marginLeft + 'px', 'margin-top' : '-' + (outerHeight/2) + 'px'});
			$('#modal_outer').css({'position':'absolute', 'top': ($(window).scrollTop() + modalDefaults.scrollTop)+'px', 'marginTop': '0px'})
			
			var overflow = 'hidden';
			if(showScrollbars) {
			    overflow = 'auto';
			}
			var backgroundColor = $('#modal_outer').find('#modal_container').css("backgroundColor");
			if($('#modal_outer').find('#modalParam').attr('backgroundColor')) {
				backgroundColor = modalParam.attr('backgroundColor');
		    }
			var border = $('#modal_outer').find('#modal_container').css("border")
			if($('#modal_outer').find('#modalParam').attr('border')) {
				border = modalParam.attr('border');
		    }
			var height = $(document).height();
			$('#modal_overlay').css({'position':'absolute', 'height': height});
			
			if(jdBrowser.msie){
				var modalContainerCSS = $('#modal_outer').find('#modal_container');
				var paddingtop = modalContainerCSS.css('padding-top').split("px")[0];
				var paddingbottom = modalContainerCSS.css('padding-bottom').split("px")[0];
	 		
				modalDefaults.height = parseInt(modalDefaults.height) + parseInt(paddingtop);
			}
			
			var modalContainer = $('#modal_outer').find('#modal_container');
			if ( typeof border != 'undefined' ){
				modalContainer.css({'height': (modalDefaults.height-20) + 'px', 'width': (modalDefaults.width-20) + 'px', 'overflow': overflow, 'backgroundColor': backgroundColor, 'border': border + 'px'});
			} else {
				modalContainer.css({'height': (modalDefaults.height-20) + 'px', 'width': (modalDefaults.width-20) + 'px', 'overflow': overflow, 'backgroundColor': backgroundColor});
			}
			
		}, header :	function (options) {
			
			var hideHeader = options ? options.hideHeader : false;
			if(!hideHeader) {
				if($('#modal_outer').find('#modal_header').size() == 0) {
					if ( typeof modalDefaults.title != 'undefined' ){
						$('#modal_outer').prepend('<div id="modal_header"><p class="title"></p></div>');
					} else {
						$('#modal_outer').prepend('<div id="modal_header"></div>');
					}
					
					if(options && options.closeButtonHeader) {
						$('#modal_header').append('<div class="modalButtonClose"><div class="buttonCapLt"></div><a style="cursor:pointer;">Close this window</a><div class="buttonCapRt"></div></div>');
					}
					
					if ( typeof modalDefaults.title != 'undefined' ){
						$('#modal_outer').find('#modal_header').find('.title').html(modalDefaults.title);
					}
					$('#modal_outer').find('#modal_header').css({'width': (modalDefaults.width-12) + 'px'});
				}	
			}
		}, footer : function(options) {
			
			var hideFooter = options ? options.hideFooter : false;
			if(!hideFooter) {
				modalDefaults.controls = modalFunctions.getModalControls(options);
				
				if($('#modal_outer').find('#controls').html()) {
					modalDefaults.controls = $('#modal_outer').find('#controls').html();
					$('#modal_outer').find('#controls').remove();
				}
				
				if($('#modal_outer').find('#modal_control').size() == 1)
					$('#modal_outer').find('#modal_control').remove();
				
				$('#modal_outer').append('<div id="modal_control">' + modalDefaults.controls + '</div>');
				$('#modal_outer').find('#modal_control').css({'width': (modalDefaults.width-20) + 'px'});
			}
		}, closeBtn : function (options) {
			var disableClose = options ? options.disableClose : false;
			if (modalDefaults.overlayClose == 'false' || disableClose) {
				$('.modalButtonClose').hide();
			}
			if(options && !options.closeButtonFooter) {
				$('.modalButtonCloseFooter').hide();
			}
		}, backBtn : function (disableClose, showScrollbars) {
		   	if (modalLinkStack.length > 1 && modalDefaults.backButton=='true'){		   		
		   		var options = {
		   				fromBack: true,
		   				scrollbars: showScrollbars,
		   				closeButtonFooter: !disableClose
		   		};
		   		$('#modalBackAnchor').attr("modalBack", true);
		   		$('#modalBackAnchor').click(function() {
		   			jdwModal.displayModalFromUrl(modalLinkStack[modalLinkStack.length - 2], options);
		   		});
		   		//fade in 
		   		$('.modalButtonBack').show();	  	
  	       } 
		}	
	}, executeModal : function (data, disableClose, showScrollbars, options) {
	    if (getIEVersionNumber() <= 6) {
			setSelects("hidden");
		}
				
		if($('#modal_outer').find('#modal_container').size() == 1) {
			$('#modal_overlay').animate({opacity: 0.7}, 200, function () {
				$('#modal_overlay').animate({opacity: 0.8}, 200);
			});					
			
			this.create.container(data, showScrollbars, options);
						
			modalDefaults.controls = modalFunctions.getModalControls(options);
			
			if($('#modal_outer').find('#modal_container').find('#controls').html()) {
				modalDefaults.controls = $('#modal_outer').find('#modal_container').find('#controls').html();
				$('#modal_outer #modal_container #controls').fadeIn();
			}
			
			if(!options || !options.hideFooter) {
				$('#modal_outer').find('#modal_control').html(modalDefaults.controls);
			}
			
			this.create.header(options);
			$('#modal_outer').find('#modal_control').remove();
			this.create.footer(options);
   			this.create.closeBtn(options);
			this.create.backBtn(disableClose, showScrollbars);
		} else {
			this.create.container(data, showScrollbars,options);
			this.create.header(options);
			this.create.footer(options);
			this.create.closeBtn(options);
			
			if (typeof onPCMPage != 'undefined') {
				setTimeout(function() {
					$('#modal_overlay, #modal_outer').animate({opacity: 'show'}, 10, function () {
						$('#modal_overlay').animate({opacity: 0.8}, 350, 'linear', function(){
							$('.modalLoadFocus').first().focus();
							// Amplience workaround, adding a callback function is the long term solution
							$("#fitting").cssDropdown();
							$("#optionColourSelect").cssDropdown();
							$("#optionSizeSelect").cssDropdown();
						});
					}); 
				}, 500);				
			} else {
				setTimeout(function() {
					$('#modal_overlay, #modal_outer').animate({opacity: 'show'}, 10, function () {
						$('#modal_overlay').animate({opacity: 0.8}, 350, 'linear', function(){$('.modalLoadFocus').first().focus();});
					}); 
				}, 500);				
			}	
		}

		
		$('#modal_outer #modal_container').scrollTop(0);
		
		if(options && options.onSuccess) {
			options.onSuccess();
		}

	}, getModalControls : function(options) {

			var continueUrl; 
			var continueText; 
			var nextButton;
			var backButton = modalDefaults.backDefault;;
			var continueButton;
			var closeButton = modalDefaults.closeDefault;
			
			if(options) {
				continueUrl = (options.continueUrl ? options.continueUrl : null);
				continueText = (options.continueText ? options.continueText : 'Continue');		
			
				if(options.backText) {
					backButton = '<div class="modalButtonBack" id="modalButtonLeft" style="display:none;">' +
								 '<div class="modalButton"><div class="buttonCapLt"></div><a id="modalBackAnchor" ' +
								 'href="#" alt="Click to Go Back" title="Click to go back">' + options.backText + '</a>' +
								 '<div class="buttonCapRt"></div></div></div>';
				} 
				
				if(continueUrl) {
					continueButton = '<div class="btn primaryBtn icon-tick" id="modalButtonRight"><div class="modalButton">' +
								 	 '<div class="buttonCapLt"></div><a id="modalContinueAnchor" ' + 
								 	 'onclick="'+ continueUrl + '"' + 
								 	 ' alt="Click to move forward" title="Click to move forward">' + continueText + 
								 	 '</a><div class="buttonCapRt"></div></div></div>';
				}
			
				if(options.closeText) {
					closeButton = '<div class="modalButtonClose" id="modalButtonLeft">' +
								  '<div class="modalButton"><div class="buttonCapLt"></div><a id="modalBackAnchor" ' +
								  'href="#" alt="Click to close" title="Click to close">' + options.closeText + '</a>' +
								  '<div class="buttonCapRt"></div></div></div>';
				} 
			}	
			
			var controls;
			if(backButton)
				controls = backButton;
				
			if(continueButton)
				controls+=continueButton;
			
			if(closeButton)
				controls+=closeButton;
				
			return controls;
	}
}

function getIEVersionNumber() {
	if (/MSIE\s(\d+\.\d+);/.test(navigator.userAgent)) {
   		return new Number(RegExp.$1);
	} else {
   		return 999;
	}
}

function setSelects(visibility) {
    selects = document.getElementsByTagName('select');
    for(i = 0; i < selects.length; i++) {
        selects[i].style.visibility = visibility;
    }
}

function openModalJQ(data, url, fromBack, disableClose,  showScrollbars, options) {
	reset();	
	if(url)
		updateLinkStack(url, fromBack);   
   	    
    modalFunctions.executeModal(data, disableClose, showScrollbars, options);
    
    return false;
}

var closeModalDuration = 350;
function closeModalJQ() {
	$('#modal_overlay, #modal_outer').animate({opacity:'hide'}, closeModalDuration, function () { $(this).remove(); });
	if (getIEVersionNumber() <= 6) {
		setSelects("visible");
	}	
	if(jdBrowser.msie == true) {
		$('body, html').css({'overflow':''});
		$('body, html').attr('style', '');
	}
	
	setTimeout(function () {
			if(typeof yourvar != 'undefined' && jdwModalOptions.onClose) {
				jdwModalOptions.onClose();
			}
		
			// clear stored links
			modalLinkStack = [];	
			jdwModalOptions = {};
		}, closeModalDuration + 500);
}

function enableCloseModalJQByClickingOutsideBorder(callBack) {
	/* Close overlay by clicking anywhere outside it's borders do this here so 
	when you close the overlay you go back to the home page. */		
	$('body').on('click', callBack, window.clickAnyWhereClickHandler);
}

function clickAnyWhereClickHandler(e){ 	// Add new event handler
	if($('#modal_overlay').size()!=0 && $(e.target).closest('.orderContainer').length==0){
		$('body').die('click', window.clickAnyWhereClickHandler); // Unbind default event handler defined in jdw_ajax.js
		closeModalJQ();
		//The call back function name is passed in as a string,
		//so the .on() function does not execute with 2 params, but uses 3 params.
		var clickAnyWhereCallBack = e.data;
		if (clickAnyWhereCallBack) {
			eval(clickAnyWhereCallBack + "()");
		}
	}
}

function disableCloseModalJQByClickingOutsideBorder(){
	$('body').die('click', window.clickAnyWhereClickHandler);	
}

function updateLinkStack(url,fromBack){
	// if not modal back button
    if (url && !fromBack) {
    	pushLink(url);
    } else if(fromBack) {
    	popLink();
    }
}

function pushLink(url) {		
	//push link onto stack
	if(modalLinkStack.length==0){
	  	modalLinkStack[0] = url;
	}else{
	 	modalLinkStack[modalLinkStack.length] = url;
	}
}

function popLink(){
	//pop link from stack
	modalLinkStack.splice(modalLinkStack.length - 1,1);
}

function reset(){
   	modalDefaults.backButton='true';
   	modalDefaults.overlayClose='true';
   	modalDefaults.nonModal='false';
}

$(document).on('click', '.modalButtonClose', function(event){
	event.preventDefault(); 
	closeModalJQ(); 
	
	var onCloseFunctionName = $(this).attr('onClose');
	if ( onCloseFunctionName ) {
		eval( onCloseFunctionName + '()' );
	}
});

$(window).resize(function(){
		$('#modal_outer, #prodImageZoomify').css({'position':'absolute', 'top': ($(window).scrollTop() + 60)+'px', 'marginTop': '0px'})
		
		var height = $(document).height();
		var width =  $(document).width();
		$('#modal_overlay').css({'position':'absolute', 'height': height, 'width' : width });
});

function checkForRedirect(xmlHttpRequest) {
	var redirectUrl = xmlHttpRequest.getResponseHeader('REDIRECT_URL');
	if (redirectUrl == null || redirectUrl.length == 0) {
		return true;
	} else {
		location.href = redirectUrl;
	}
}

function getUniqueClass(selected) {
   	var uniqueID = new Date().getTime() + "Class";
   	$(selected).addClass(uniqueID);
   	
   	return uniqueID;
}

function ajaxGet(selected, successCallback, url) {
   	
   	if (!url) {
		var url = $(selected).attr('href');
	}
	
	if (!successCallback.hideUpdatingOverlay) {
	    overlay.create({'msg':'Updating', 'showDelay' : 1000, 'trigger': getUniqueClass(selected)});
	}

	var xhtmlRequest = $.get(url, function (data) {
		closedelay = overlay.closeOverlay();
	    if (checkForRedirect(xhtmlRequest)) {
	       successCallback(data);	
	    }
	});	
}

var closedelay;

function performAjaxRequest( urlString, beforeSendFunction, onCompleteFunction, dataType, data,
						onSuccessFunction, onErrorFunction, sendMethod, triggerData, 
						sessionTimeoutFunction ) {
	var xhtmlRequest;
	var createUpdatingOverlay = true;
	
	// Default blank value of sendMethod to explicitly say 'GET' as a blank value seems to upset the
	// android browser.
	if(!sendMethod) {
		sendMethod = 'GET';
	}
	
	if (beforeSendFunction && beforeSendFunction.hideUpdatingOverlay) {
		createUpdatingOverlay = false;
	}
	
	var options = {
		url: urlString,
		beforeSend: function(data) {
			if (createUpdatingOverlay) {
			    overlay.create({ trigger:triggerData,
			    				 cssStyle:{height:'100%',marginLeft:'0px', marginTop:'0px',width:'100%'}, msg : 'Please Wait'});
			}
			if ( dataType ) {
				data.setRequestHeader( 'ajaxDataType', dataType );
			}
			if (beforeSendFunction) {
				var result = beforeSendFunction(data);
				if(result == false) {
					closedelay = overlay.closeOverlay();
				}
					
				return result;
			}
		},
		complete: function(data) {
			closedelay = overlay.closeOverlay();
			if (onCompleteFunction) {
				onCompleteFunction(data);
			}
		},
		dataType: dataType,
		data: data,
		contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
		success: function(data) {
			var dataType = xhtmlRequest.getResponseHeader('ajaxDataType');
			if ( 'json' === dataType ) {
				// For requests that expect a json response, session timeouts can be a problem
				//  since the redirect check below this code will return html.
				if ( data.isSessionTimeout ) {
					if ( sessionTimeoutFunction ) {
						sessionTimeoutFunction( data );
					} else {
						window.location = "/shop/session/timeout/sessionTimeout.action";
					}
					return;
				}
			}
			if (checkForRedirect(xhtmlRequest)) {
				if(onSuccessFunction) {
					onSuccessFunction(data, urlString);
				}
			}
		},
		error: function(data) {
			if(onErrorFunction) {
				onErrorFunction(data);
			} else {
				window.location = "/shop/session/timeout/sessionTimeout.action";
			}
		},
		type: sendMethod
	};
	
	xhtmlRequest = $.ajax(options);
}

		/* complete : /javascript/common/libraries/jdw_ajax.js*/


/* combine : /javascript/desktop/common/jdw_Modal.js*/
/* Facade to provide a simplified interface to display modal windows. */

var jdwModalOptions = {};

var jdwModal = function() {
	return {
	
		/*  Displays a modal window using the provided data.
		 *  ---------------------------------------------------------------
		 *	
		 *	data : 		A String of data to be displayed.
		 *			
		 *	options:	Object containing named options as appropriate.
		 *			
		 *	Available options are:
		 *	----------------------
		 *	continueUrl:	when continue button is clicked the modal will close and navigate to this URL. If not specified button will be hidden.
		 *	continueText:	the text displayed on the continue button default is 'Continue'.
		 *	closeText:		the text displayed on the close button. Default is 'Close'.
		 *  fromBack:		
		 *  hideClose:		hides the close button if true
		 *  closeButtonHeader: determines if we have a close button in the header
		 *  closeButtonFooter:		show a close button in the footer
		 * 	onSuccess: callback function
		 *  onClose:				function to call when the modal closes.
		 */	 		 
		displayModalFromData : function(data,options) {		
			var fromBack = false;
		 	var hideClose = false;
		 	if(options.fromBack) {
		 		fromBack = true;
		 		hideClose = true;
		 	}
			if(options && options.onClose) {
				jdwModalOptions.onClose = options.onClose;
			}
			openModalJQ(data,null,fromBack,hideClose,false,options); 		
		},
		
		/**  Displays a modal window retrieving the data from the given URL.
		 *  ---------------------------------------------------------------
		 *	
		 *	url : 		The url providing the data to display within the modal.  This can
		 *				also be a simple string to display in the modal.
		 *			
		 *	options:	Object containing named options as appropriate.
		 *			
		 *	Available options are:
		 *	----------------------
		 *	continueUrl:			when continue button is clicked the modal will close and navigate to this URL. If not specified button will be hidden.
		 *	continueText:			the text displayed on the continue button default is 'Continue'.
		 *	closeText:				the text displayed on the close button. Default is 'Close'.
		 *	backText:				the text displayed on the back button. Default is 'Back'.	
		 *	buttons:				an HTML snippet specifying the buttons that will appear (overrides all other options to do with buttons).		
		 *	hideBack:				force hiding of the back button.
		 *	hideClose:				force hiding of the close button.
		 * 	hideHeader:				hide the top panel where the title goes.
		 *  hideFooter:				hide the bottom panel where the buttons are.
		 *  onClose:				function to call when the modal closes.
		 *  width:					the width of the modal
		 *  height:					the height of the modal
		 *  closeButtonHeader:		show a header with a close button
		 *  closeButtonFooter:		show a close button in the footer
		 *  scrollbars:				show scrollbars on the modal
		 *  triggerData :			class name of a div for the updating overlay to cover
		 */	 
		displayModalFromUrl : function(url,options) {		
						
			var fromBack = (options ? options.fromBack : false);
			var hideClose = (options ? options.hideClose : false);
			var scrollbars = (options ? options.scrollbars : false);
					
			if(options && options.onClose) {
				jdwModalOptions.onClose = options.onClose;
			}
			
			var successCallback = function(data) {
				openModalJQ(data,url,fromBack,hideClose,scrollbars,options); 
			};
			
			var errorCallback = function(data) {
				if (data.status == 0) {
					openModalJQ('An unexpected error has occurred.  Please close this box and try again.',url,fromBack,hideClose,false,options); 
				}
			}
						
			performAjaxRequest(url,options.beforeSendFunction,null,null,null,successCallback,errorCallback,'GET',options.triggerData);	
		}
	}
}();/* complete : /javascript/desktop/common/jdw_Modal.js*/


/* combine : /javascript/desktop/common/modal.js*/
var jdw = jdw || {};

/* The following prototype functions would ideally be in a separate javascript utility file. */

/* Allows standard javascript arrays to be used as queues, by adding a peek() method to go with 
 *  the push() and pop() that they already have.
 */
Array.prototype.peek = function() {
    return ( (this.length > 0) ? this[this.length - 1] : null );
};
/* Allows us to get the boolean value of string objects if they contain "true" or "false".
 *  Case-insensitive.
 */
String.prototype.parseBoolean = function( defaultVal ) {
    var ret = defaultVal;
    if ( this.toLowerCase() === 'true' ) {
        ret = true;
    } else if ( this.toLowerCase() == 'false' ) {
        ret = false;
    }
    return ret;
};
/* Extends the normally split() functionality of strings by allowing us to specify an escape 
 *  character with which we can escape-out instances of the character used to split the string.  In
 *  this way, we can include instances of the split char within individual fields of the string
 *  without breaking parsing. eg:
 *  
 *  "item\ one item\ two".splitWithEscapeCharacters( ' ', '\' )
 *  
 *  ... would return the array ["item\ one","item\ two"].  Note that the escape characters are
 *  retained in the items in the split result. 
 */
String.prototype.splitWithEscapedCharacters = function( splitChar, escapeChar ) {
    var ret = [];
    var cchar = null;
    var currentSection = "";
    for ( var i = 0 ; i < this.length ; i++ ) {
        cchar = this.charAt( i );
        if ( cchar == splitChar ) {
            ret.push( currentSection );
            currentSection = "";
        } else {
            if ( cchar == escapeChar ) {
                currentSection = currentSection + cchar;
                cchar = this.charAt(++i);
            }
            currentSection = currentSection + cchar;
    }
    }
    ret.push( currentSection );
    return ret;
};
/* Allow us to strip out a character where it is used to escape-out other characters (including
 *  itself). eg, if we wished to express the literal string "a b!" using the '!' character as an 
 *  escape character, and where the space character was considered a special character that needs
 *  escaping, we might write: 
 *  
 *      var escapedString = "a! b!!"
 *      
 * (Note that we've expressly made the '!' character a special character also by using it as an 
 *  escape character, thereby necessitating that it, too, be escaped.)
 * 
 * Once we've done any special parsing, we can remove the escape characters by:
 * 
 *      escapedString.stripEscapeCharacters('!')
 *  
 * ... giving us "a b!" once again.
 */
String.prototype.stripEscapeCharacters = function( escapeChar ) {
    var ret = "";
    var cchar = null;
    for ( var i = 0 ; i < this.length ; i++ ) {
        cchar = this.charAt( i );
        if ( cchar == escapeChar ) {
            cchar = this.charAt(++i);
        }
        ret = ret + cchar;
    }
    return ret;
};


//==============================================================================================
//
//                                            JDW_MODAL
//
//==============================================================================================



//-----------------------------------------------------------------------------------------
// ModalsContainer - manages and possibly contains all the modals that can appear on this page.
//-----------------------------------------------------------------------------------------

jdw.ModalsContainer = function() {
    
    // Inside jquery function callbacks, 'this' is reassigned; so we assign a variable here in 
    //  order that we can always get hold of this containing object.
    var containerObj = this;
    
    var state = {
        currentModal : null,
        modalStack : []
    };
    
    var globalCloseButtonShown = false;
    
    // A map of modals that have been added using addModal(), and that can subsequently be shown
    //  by calling showModal with their ids
    var modals = {};
    
    this.setupModal = function() {
        // Add the divs we'll need to display modals, but only do that if they aren't already present 
        //  on the page.  The div structure is as follows:
        //
        // * #jdwModalBackground div provides the greyed-out background that covers the full browser
        //    viewport.
        // * #jdwModalBorder provides the smaller central container that constitutes the modal
        //    dialog itself.  This could feasibly have additional borders and extra styling on a use by 
        //    use basis.
        // * #jdwModalOuterContent provides a container for the modal content (including standard
        //    modal header and footer items such as back and close buttons) that can be hidden from
        //    view whilst content is added and removed, and that can be measured to determine what size
        //    the entire modal background should be based on css widths and heights.
        // * #jdwModalHeader provides a top section for all modal dialogs into which we can place a
        //    title and a close button.
        // * #jdwModalContent is the point into which the bespoke content for a given modal instance is 
        //    added.
        // * #jdwModalFooter provides a bottom section into which we can place a back button.
        if ( $('body', '#jdwModalBackground').length < 1 ) {
            $('body').append(
                    '<div id="jdwModalCloseGlobal">' +
                        '<a href="#">Close<span></span></a>' + 
                    '</div>' +
                    '<div id="jdwModalBackground"></div>' +
                    '<div id="jdwModalBorder">' +
                        '<div id="jdwModalOuterContent">' + 
                            '<div id="jdwModalHeader">' +
                                '<h1 id="jdwModalTitle"></h1>' +
                                '<div id="jdwModalClose" style="display:none;">' +
                                    '<a href="#">Close Window<span></span></a>' +
                                '</div>' +
                            '</div>' +
                            '<div id="jdwModalContent"></div>' +
                            '<div id="jdwModalFooter">' +
                                '<div id="jdwModalBack" style="display:none;">' +
                                    '<a class="prev btn tertiaryBtn icon-leftarrow" href="#">Back</a>' +
                                '</div>' +
                            '</div>' +
                        '</div>' +
                    '</div>'
            );
        }
        
        if ($('#viewBagContainer').length >= 1 ){
        	$('#jdwModalBorder').addClass('pdp-modal-addtobagpromo orderBuilder')// adding class to modals on view bag page
        }
        
        if ($('#accordion').length >= 1 ){
        	$('#jdw-modalContent').addClass('jdwModal-quickview-pdp')//adding additional class for pdp only modal (styles seem to be missing)
        }
        
        // assign some variables representing the content areas from the structure we just added 
        //  into the page
        this.background = $('body #jdwModalBackground');
        this.closeGlobal = $('body #jdwModalCloseGlobal');
        this.contentBorder = $('body #jdwModalBorder');
        this.outerContentContainer = $("body #jdwModalOuterContent");
        this.headerContainer = $('body #jdwModalHeader');
        this.contentContainer = $("body #jdwModalContent");
        this.footerContainer = $('body #jdwModalFooter');
        
        $("#jdwModalClose a").unbind('click').bind('click', function() {
            return dismissAllModals();
        });
        
        $("#jdwModalCloseGlobal").unbind('click').bind('click', function() {
            return dismissAllModals();
        });
        
        this.background.unbind('click').bind('click', function() {
            return dismissAllModals();
        });
        $("#jdwModalBack").unbind('click').bind('click', function() {
            containerObj.hideWebToolkit();
            reshowPreviousModal();
            return false;
        });
    };
    
    this.closeModal = function() {
        return dismissAllModals();
    };
    
    this.hideWebToolkit = function(){
        if($("#jdwModalContent").hasClass("webToolkit")){
            $("#jdwModalContent").removeClass("webToolkit");
        }    
    };
    
    this.showPreviousModal = function(index, url){
        if(url.length>1){
            reshowPreviousModal(index, url);    
        }else{
            reshowPreviousModal(index);
        }
        return false;
    };

    
    this.modalLength = function(){
        return state.modalStack.length;
    };
    
    // Acts as a weak semaphore to stop multiple mouse clicks from causing sync issues.
    this.drawing = false;
    
    // === PUBLIC API ==========================================================================
    
    // Adds a new modal into this container's list of known modal instances, but doesn't show it 
    //  yet.  Modals added in this way can be shown by calling showModal() using the same id as that
    //  specified in the value options.id
    this.addModal = function( options ) {
        modals[options.id] = new jdw.Modal( options );
    };
    
    // Shows a known modal previously added using addModal(), or can be used to create a new unknown
    //  modal which is immediately shown.  The parameter 'idOrOption' is treated as the id of a 
    //  known modal if it is a simple string, otherwise it is treated as an options{} object 
    //  containing config values for a new modal.
    this.showModal = function( idOrOptions, event ) {
        if (typeof event != 'undefined') {
            preventDefault( event );
        }
        
        var modal = ( ( typeof idOrOptions == 'string' ) ? modals[idOrOptions] :
                new jdw.Modal( idOrOptions ) );
        
        if ( modal ) {
            this.drawing = true;
            this.outerContentContainer.css( {opacity:0} );
            modal.load( this.contentContainer, postLoadCallback );
        }
    };
    
    // Looks for any anchor elements in the dom below the specified base element, and checks them
    //  for 'rel' attributes.  Any that have a 'rel' value starting with 'jdwModal' are bound
    //  with an onclick event that will cause their content to be shown in a modal.
    this.bindRelLinks = function( baseElement ) {
        $('a[rel^="jdwModal"]', baseElement).each( function(index, element) {
            var options = parseOptions( element );
            $(element).unbind('click').bind('click', function(event){
                containerObj.showModal( options, event );
            });
        } );
    };
    
    this.reAnimate = function (width,height) {
        containerObj.contentBorder.animate({
            'width': width,
            'height': height,
            'marginLeft': 0 - (width / 2),
            'marginTop' : 0 - (height / 2),
            'opacity': 1.0
        }, 500, function() {
            containerObj.outerContentContainer.css({opacity:1});
            containerObj.drawing = false;
            containerObj.contentBorder.css('opacity','');
            containerObj.outerContentContainer.css('opacity','');
        });
    };
    
    this.modalShown = function() {
        return state.currentModal != null;
    };

    this.isGlobalCloseButtonShown = function() {
        return globalCloseButtonShown;
    };
    
    this.moveCloseButton = function() {
        // Show the close button outside the modal, and hide the inner one,
        //  but only if that isn't already the case ...
        var outsideModal = state.currentModal.isBiggerThan( 
                $("#jdwModalBackground").width(), $("#jdwModalBackground").height() );
    
        if ( outsideModal && !globalCloseButtonShown ) {
            $("#jdwModalCloseGlobal").show();
            $("#jdwModalCloseGlobal").css('opacity', '1.0');
            $("#jdwModalClose").hide();
            globalCloseButtonShown = true;
        } else if ( !outsideModal && globalCloseButtonShown ) {
            $("#jdwModalCloseGlobal").hide();
            $("#jdwModalClose").show();
            globalCloseButtonShown = false;
        } else if ( !outsideModal && !globalCloseButtonShown ) {
            $("#jdwModalClose").show();
        }
        state.currentModal.handleCloseMove( outsideModal );
    };
    
    // === PRIVATE =============================================================================

    // Directly bound to the BACK BUTTON, tells the modal to load its content, which will trigger
    //  the postReloadCallback on success.
    reshowPreviousModal = function(index, content) {
        var modal='';
        containerObj.drawing = true;
        containerObj.outerContentContainer.css( {opacity:0} );
        if(typeof index == 'undefined' && typeof content == 'undefined'){
            modal = state.modalStack.peek();
        }else {
            var data = function() {return content;};
            if(index == 0 && typeof content == 'undefined'){
                state.modalStack.pop();
                modal = state.modalStack[index];
            }else if(index != 0 && typeof content == 'undefined'){
                modal = state.modalStack.peek();
            }else if(index == 0 && content.length>1){
                state.modalStack.pop();
                modal = state.modalStack[index];
                modal.content = data;
            }else{
                modal = state.modalStack.peek();
                modal.content = data;
            }
        }
        modal.load( containerObj.contentContainer, postReloadCallback );
    };
    
    // Called once a new modal has loaded its content
    postLoadCallback = function( modal ) {
        
        var first = ( state.currentModal == null );
        if ( !first ) {
            state.modalStack.push( state.currentModal );
        }
        state.currentModal = modal;
        
        showHeader();
        applyHeaderClass();
        applyContentClass();
        applyFooterClass();
        showBackButton( !first );
        showCloseButton();
        if ( first ) {
            containerObj.background.fadeTo('slow',0.5);
            containerObj.contentBorder.width(0).height(0).show().css( {
                'margin-left': '0px',
                'margin-top' : '0px',
                'opacity': 0
            } );
        }
        animateResizeContent();        
    };

    // Called when reloading the previous modal in the current stack when the back button is used.
    postReloadCallback = function( modal ) {
        state.modalStack.pop();
        var first = ( state.modalStack.length == 0 );
        state.currentModal = modal;
        showHeader();
        applyHeaderClass();
        applyContentClass();
        applyFooterClass();
        showBackButton( !first );
        showCloseButton();
        animateResizeContent();
    };
    
    // Animate content size change from it's current size to a new size ...
    animateResizeContent = function() {
        $("#jdwModalTitle").html( state.currentModal.headingText );

        setTimeout( function(){
            containerObj.contentContainer.width( state.currentModal.width ).height( state.currentModal.height );
            
            var width = containerObj.contentContainer.outerWidth();

            var height = containerObj.outerContentContainer.outerHeight();
            if ( state.currentModal.fullHeight ) {
                height = state.currentModal.fullHeight; 
            }
            
            containerObj.background.show();
            containerObj.contentBorder.show();            
            containerObj.contentBorder.animate({
                'width': width,
                'height': height,
                'marginLeft': 0 - (width / 2),
                'marginTop' : 0 - (height / 2),
                'opacity': 1.0
            }, 500, function() {
                containerObj.outerContentContainer.css({opacity:1});
                containerObj.drawing = false;
                // the next two lines are required to clear the IE specific opacity filter
                // since it causes all sorts of problems when present and 100
                containerObj.contentBorder.css('opacity','');
                containerObj.outerContentContainer.css('opacity','');
            });
            containerObj.moveCloseButton();
            
        },100 );
    };
    
    // Dismiss any current modal, ditch the background greyed-out area, set the current modal to
    //  null and clear the modal stack.
    dismissAllModals= function() {
        if ( !containerObj.drawing ) {
            
            // Call any onClose function that might have been requested ... 
            if ( state.currentModal && state.currentModal.onClose ) {
                if(typeof state.currentModal.onClose === 'function') {
                    state.currentModal.onClose();
                } else {
                    runCallbackFunction(state.currentModal.onClose);
                }
            }
            
            state.currentModal = null;
            state.modalStack = [];
            var fadeTime = 250;
            containerObj.contentBorder.animate( {opacity:0}, fadeTime, function(){
                containerObj.contentBorder.hide()
            });
            containerObj.background.animate( {opacity:0}, fadeTime, function(){
                containerObj.background.hide()
            });
            containerObj.closeGlobal.animate({
                opacity : 0
            }, fadeTime, function() {
                containerObj.closeGlobal.hide()
            });
            containerObj.contentContainer.empty();
        }
        containerObj.hideWebToolkit();
        globalCloseButtonShown = false;
        return false;
    };
    
    // Show or hide the back button
    showBackButton = function( bool ) {
        if ( bool && state.currentModal.backButtonDisabled == false) {
            $("#jdwModalBack").show();
        } else {
            $("#jdwModalBack").hide();
        }
    };

    // Show or hide the close button
    showCloseButton = function() {
        if ( state.currentModal.closeButtonDisabled == false) {
            $("#jdwModalClose").show();
        } else {
            $("#jdwModalClose").hide();
        }
    };
    
    // Show or hide the header
    showHeader = function() {
        if ( state.currentModal.headerDisabled == false) {
            $("#jdwModalHeader").show();
        } else {
            $("#jdwModalHeader").hide();
        }
    };
    
    applyHeaderClass = function() {
        if (typeof state.currentModal.headerClass != "undefined" ) {
            $("#jdwModalHeader").addClass( state.currentModal.headerClass );
        }
    };
    
    applyContentClass = function() {
        if (typeof state.currentModal.contentClass != "undefined" ) {
            $("#jdwModalContent").addClass( state.currentModal.contentClass );
        }
    };
    
    applyFooterClass = function() {
        if (typeof state.currentModal.footerClass != "undefined" ) {
            $("#jdwModalFooter").addClass( state.currentModal.footerClass );
        }
    };
    
    // Parses the 'rel' value of an anchor like :
    //   <a href="content.html" rel="jdwModal,width=600,height=400"></a>
    // ... and creates an options object from it.
    parseOptions = function( hrefElement ) {
        var ret = {
            'id': hrefElement.id,
            'content': hrefElement.href,
            'ajax': true
        };
        
        var splitRel = $(hrefElement).attr('rel').splitWithEscapedCharacters( ',', '\\' );
        for ( var i = 1 ; i < splitRel.length ; i++ ) {
            var splitVal = splitRel[i].splitWithEscapedCharacters( ':', '\\' );
            if (splitVal[0] && splitVal[1]) {
                ret[splitVal[0].stripEscapeCharacters('\\')] = splitVal[1].stripEscapeCharacters('\\');
            }
        }
        return ret;
    };
    
    // Used with onclick events on anchor tags to stop them from trying to go to the page their
    //  href points at (since we want to AJAX that content into a modal instead).
    preventDefault = function( event ) {
        if ( !event ) { event = window.event; }
        if (  event ) {
            if ( event.preventDefault ) {
                event.preventDefault();
            } else {
                event.returnValue = false;
            }
        }
    };
    
    // --- INIT -------------
    
    
    // On creation of this modal container for a given page, we check all links on the page for any
    //  that have a 'rel' attribute value that starts with 'jdwModal'.  For any we find, we extract
    //  all of the additional modal configuration values specified as part of the 'rel' attribute
    //  value, from which we create an options object, and bind an onclick event to the link that
    //  will cause a modal to be shown using those options which the link is clicked.
    this.bindRelLinks( $('body') );
    
    $(window).resize(
        function(event) {
            if ( jdw.modalsContainer.modalShown() ) {
                jdw.modalsContainer.moveCloseButton();
            }
        }
    );
};

//-----------------------------------------------------------------------------------------
// Modal - Contains individual config for a particular modal that can appear on this page
//-----------------------------------------------------------------------------------------

jdw.Modal = function( options ) {
    this.id = options.id;
    this.width = parseInt(options.width);
    this.height = parseInt(options.height);
    if ( options.fullHeight ) {
        this.fullHeight = parseInt(options.fullHeight);
    }
    this.content = options.content;
    this.headingText = options.headingText;
    if ( options.ajax != null ) {
        this.ajax = ( ( typeof options.ajax == "string" ) 
                ? options.ajax.parseBoolean() : options.ajax );
    } else {
        this.ajax = true;
    }
    this.loadStartedCallback = options.loadStartedCallback;
    this.loadCompletedCallback = options.loadCompletedCallback;
    this.contentLoadCallback = options.contentLoadCallback;
    this.closeMoveCallback = options.closeMoveCallback;
    this.linksTriggerModal = options.linksTriggerModal || false;
    this.onClose = options.onClose;
    this.backButtonDisabled = options.backButtonDisabled || false;
    this.closeButtonDisabled = options.closeButtonDisabled || false;
    this.headerDisabled = options.headerDisabled || false;
    this.headerClass = options.headerClass;
    this.contentClass = options.contentClass;
    this.footerClass = options.footerClass;
    
    var modal = this;
    
    // PUBLIC API --------------------------------------------------------------------------
    
    this.load = function( container, postLoadCallback ) {
        if ( modal.loadStartedCallback ) {
            runCallbackFunction(modal.loadStartedCallback);
        }
        if ( this.ajax ) {
            $("#jdwModalTitle").html( modal.headingText );
            container.load( this.content, function(data,status,requestObj) {
                var redirectUrl = requestObj.getResponseHeader('REDIRECT_URL');
                if (redirectUrl != null && redirectUrl.length > 0) {
                    location.href = redirectUrl.split(',')[0];
                } else {
                    bindNewLinks( container );
                    if ( modal.contentLoadCallback ) {
                        runCallbackFunction(modal.contentLoadCallback);
                    }
                    postLoadCallback( modal );
                }
                if ( modal.loadCompletedCallback ) {
                    runCallbackFunction(modal.loadCompletedCallback);
                }
            } );
        } else {
            var extractedContent = $( ( typeof this.content == "function" )
                    ? this.content() : eval( this.content ) );
            container.html( extractedContent );
            
            bindNewLinks( container );
            if ( modal.contentLoadCallback ) {
                runCallbackFunction(modal.contentLoadCallback);
            }
            postLoadCallback( modal );
            if ( modal.loadCompletedCallback ) {
                runCallbackFunction(modal.loadCompletedCallback);
            }
        }
    };
    
    this.handleCloseMove = function( movedOutside ) {
        if (typeof modal.closeMoveCallback != 'undefined') {
            ( function( moveOutsideModal ) { modal.closeMoveCallback( moveOutsideModal ); } )( movedOutside );
        }
    };
    
    this.isBiggerThan = function( width, height ) {        
        var modalHeight = $("#jdwModalBorder").height();
        if ( isNaN(modalHeight) || (modalHeight == 0) ) {
            modalHeight = this.fullHeight;
        }
        if ( isNaN(modalHeight) || (modalHeight == 0) ) {
            modalHeight = this.height;
        }
        //Adjust the modal height so that if the button is half covered, 
        //then the gloabl button will appear outside.
        var modalCloseButtonHeight = $("#jdwModalClose").height();
        modalHeight = modalHeight + modalCloseButtonHeight;
        return ( (width < this.width) || (height < modalHeight) );
    };
    
    // PRIVATE API --------------------------------------------------------------------------
    
    bindNewLinks = function( domRoot ) {
        if ( modal.linksTriggerModal ) {
            // bind click events to all links in the new modal content ...
            $('a', domRoot).not('a[rel^="jdwModal"]').each( function(index, element) {
                var options = {
                    'id': element.id,
                    'content': element.href,
                    'ajax': true,
                    'width': modal.width,
                    'linksTriggerModal': true
                };
                $(element).unbind('click').bind('click', function(event){
                    jdw.modalsContainer.showModal( options, event );
                });
            });
            jdw.modalsContainer.bindRelLinks( domRoot );
        } else {
            // Look for embedded explicit modal links
            jdw.modalsContainer.bindRelLinks( domRoot );
        }
    };
    
    runCallbackFunction = function ( fn ) {
        if ( typeof fn === 'function' ) {
            ( function() { fn(); } )();
        } else if ( typeof fn === 'string' ) {
            eval( fn + '()' );
        }
        
    };
};

// SETUP ---------------------------------------------------------------
if ( !jdw.modalsContainer ) {
    jdw.modalsContainer = new jdw.ModalsContainer();
}

$(document).ready( function() {
    jdw.modalsContainer.setupModal();
    jdw.modalsContainer.bindRelLinks( $('body') );
});
/* complete : /javascript/desktop/common/modal.js*/


/* combine : /javascript/desktop/common/warranties/warrantyModal.js*/
var jdw = jdw || {};

jdw.WarrantyModalContainer = function() {
	
	// Inside jquery function callbacks, 'this' is reassigned; so we assign a variable here in 
	//  order that we can always get hold of this containing object.
	var containerObj = this;
	
	this.showWarrantyModal = function(urlString, closeButtonDisabled, title){
		var modalsContainer = jdw.modalsContainer;
		if(typeof modalsContainer == 'undefined'){
			modalsContainer =  parent.jdw.modalsContainer;
		}
		var options = {headingText: typeof title !== 'undefined' ? title : '',
	            content: urlString,
	            width: 850,
	            height: 360,
	            ajax: true,
	            id: 'moreInfoModal',
	            backButtonDisabled:true,
	            closeButtonDisabled: closeButtonDisabled ? true : false,
	            fullHeight: 460};
		modalsContainer.showModal(options);
		$('#jdwModalContent').addClass('webToolkit');
		$('#jdwModalBorder').addClass('warrantiesContent');
	}
	
};

//SETUP ---------------------------------------------------------------
if ( !jdw.warrantyModalContainer ) {
	jdw.warrantyModalContainer = new jdw.WarrantyModalContainer();
}

$(document).ready(function () {
	$('a').live('click', function (event) {
	    if( $(this).attr('rel')=='warrantyModal'){
		    // prevent default behaviour on click event
		    event.preventDefault();
		    var wmc = jdw.warrantyModalContainer;
			var url=$(this).attr("href");
			var title=$(this).attr("title");
			wmc.showWarrantyModal(url, false, title);
			return false;
	    }
		
	});
});/* complete : /javascript/desktop/common/warranties/warrantyModal.js*/


/* combine : /javascript/common/changeTitle.js*/
$(document).ready(function() {
	if ((typeof(jDisplayChangeTitleOverlay) != "undefined")
			&& (jDisplayChangeTitleOverlay == true)) {
		$.get('/content/changetitle/changeTitle.html', function(data) {
			displayChangeTitleOverlay(data);
		});
	}
});

function displayChangeTitleOverlay(data) {
	openModalJQ(data, null, null, null);
	populateOverlayData();
	}

function populateOverlayData() {
	$('#modal_control, #modal_header').remove();
	$('#modal_container').css({'backgroundColor' : 'transparent', 'border' : '0px', 'height' : '382px', 'overflow' : 'hidden'});
	if (jDisplayChangeTitleOverlaySignedInMessage == true) {
		$('#modal_container').find('#titleOverlayTradingTitle').html(jAccountTitleName);
	} else {
		$('#modal_container').find('#signedInCopy').hide();
		$('#modal_container').find('#modalParam').attr('height', 325);
		$('#changetitleContainer').css({'height' : 255});
	}
	var buttonLabel = 'Go back to ' + jBackRegName;
	var goBackLink = $('#modal_container').find('#titleOverlayGoBackLink');
	goBackLink.html(buttonLabel);
	goBackLink.attr('title', buttonLabel);
	goBackLink.attr('alt', buttonLabel);
	goBackLink.attr('href', 'javascript:returnToPreviousSite();');
	var goShoppingLink = $('#modal_container').find('#titleOverlayGoShoppingLink');
	goShoppingLink.attr('href', 'javascript:goShopping();');
	var welcomeImage = $('#modal_container').find('#titleWelcome');
	welcomeImage.css('backgroundImage', 'url(' +  IMG_SERVER + '/content/images/changetitle/welcometo.png' + ')');
	welcomeImage.attr('title', 'Welcome');
	welcomeImage.attr('alt', 'Welcome');
	var titleImage = $('#modal_container').find('#titleImage');
	titleImage.css('backgroundImage', 'url(' +  $('#brandLogo-2 img').attr('src') + ')');
	titleImage.attr('title', $('#brandLogo-2 a').attr('title'));
	titleImage.attr('alt', $('#brandLogo-2 a').attr('alt'));
}

function returnToPreviousSite() {
	closeModalJQ();
	imageClick(newUrl, jBackUrl);
}

function goShopping() {
	closeModalJQ();
	MANUAL_LINK_CLICK('Go Shopping', jTitle);
}

function imageClick(toURL, destinationServer, destinationPage, coremetricsTag, elementSlot, pageFrom) {
	var splitUrl = toURL.split('newtitle=');
	var titleId = splitUrl[1];
	imageClickChangeTitle(titleId,elementSlot);
}

function changeTitleFreeFormat(titleId, ffpid, cm) {
	$.ajax({
		url: "/shop/changetitle/ajax/ChangeTitleLaunch.action?newtitle=" + titleId,
		type: "GET",
		cache: false,
		dataType: "json",
		success: function(data, status) {
			if(data.successful) {
				setTimeout(function() {performChangeTitleRedirect(data.urlto, data.lastSessionId, "coremetrics="+cm, null, 
						ffpid, null);}, 300);
				
			} else if (data.bagShareNotAllowed) {
				bagShareNotAllowed(data);
			}
		}
	});
}

function ChangeTitleHierarchy(titleId,cm,hierarchyPath) {
	$.ajax({
		url: "/shop/changetitle/ajax/ChangeTitleLaunch.action?newtitle=" + titleId+ "&elementSlot=XSS",
		type: "GET",
		cache: false,
		dataType: "json",
		success: function(data, status) {
			if(data.successful) {
				setTimeout(function() {performChangeTitleRedirect(data.urlto, data.lastSessionId, null, 
						hierarchyPath,null);}, 300);
				
			} else if (data.bagShareNotAllowed) {
				bagShareNotAllowed(data);
			}
		}
	});
}

function ChangeTitleProductDetails(titleId,cm,productDetailsPath) {
	$.ajax({
		url: "/shop/changetitle/ajax/ChangeTitleLaunch.action?newtitle=" + titleId,
		type: "GET",
		cache: false,
		dataType: "json",
		success: function(data, status) {
			if(data.successful) {
				setTimeout(function() {performChangeTitleRedirect(data.urlto, data.lastSessionId, "coremetrics="+cm, 
						null,null,null,productDetailsPath);}, 300);
				
			} else if (data.bagShareNotAllowed) {
				bagShareNotAllowed(data);
			}
		}
	});
}

function changeTitleSuperSites(titleId) {
	$.ajax({
		url: "/shop/changetitle/ajax/ChangeTitleLaunch.action?newtitle=" + titleId + "&elementSlot=SUPERSITE",
		type: "GET",
		cache: false,
		dataType: "json",
		success: function(data, status) {
			if(data.successful) {
				setTimeout(function() {performChangeTitleRedirect(data.urlto, data.lastSessionId, null, 
						null, null, true, null);}, 300);
				
			} else if (data.bagShareNotAllowed) {
				bagShareNotAllowed(data);
			}
		}
	});
}

function imageClickChangeTitle(titleId,elementSlot) {
	$.ajax({
		url: "/shop/changetitle/ajax/ChangeTitleLaunch.action?newtitle=" + titleId + "&elementSlot=S"+elementSlot,
		type: "GET",
		cache: false,
		dataType: "json",
		success: function(data, status) {
			if(data.successful) {
				setTimeout(function() {performChangeTitleRedirect(data.urlto, data.lastSessionId, data.coremetricsTag);}, 300);
			} else if (data.bagShareNotAllowed) {
				bagShareNotAllowed(data);
			}
		}
	});
}

function bagShareNotAllowed(data) {
	$('#proceed_to_link').html('Proceed to ' + data.newTitleName);

	ctNewtitle = data.newtitle;
	ctUrlto = data.urlto;
	ctForm = theForm;

	$('#TITLE_CHANGE_BAG-popup').css({'visibility' : 'visible',
		'display' : 'inline',
		'top' : '400',
		'left' : '100'});
}

function performChangeTitleRedirect(destinationServer, lastSessionId, coremetricsTag, hiararchy,
		ffpid, superSites,productDetailsPath) {
	
	var redirectUrl = destinationServer;
	
	// Add the session id if it is defined
	if (lastSessionId) {
		
		if (redirectUrl.indexOf("?") > -1) {
			redirectUrl = destinationServer + "&lastSessionId=" + lastSessionId;
		} else {
			redirectUrl = destinationServer + "?lastSessionId=" + lastSessionId;
		}
		
		// Add optional elements if they are defined
		if (coremetricsTag) {
			redirectUrl = redirectUrl + "&" + coremetricsTag;
		}
		
		// take to the product details page
		if (productDetailsPath) {
			redirectUrl = redirectUrl + "&productDetailsPath=" + productDetailsPath;
		}

		// Add hierarchy path if the change title will end up in a navigarion page rather than home
		if (hiararchy) {
			redirectUrl = redirectUrl + "&hierarchy=" + hiararchy;
		}
		
		// Add the free format page id 
		if (ffpid) {
			redirectUrl = redirectUrl + "&ffpid=" + ffpid;
		}
		
		// Add supersites flag to allow the action to return SuperSites String
		if (superSites) {
			redirectUrl = redirectUrl + "&superSites=" + superSites;
		}
		
		// Perform redirect
		window.location = redirectUrl;
	}
}

/* complete : /javascript/common/changeTitle.js*/


/* combine : /javascript/common/libraries/jquery/jquery.qtip-1.0.min.js*/

(function($)
{$.fn.qtip=function(options,blanket)
{var i,id,interfaces,opts,obj,command,config,api;if(typeof options=='string')
{if(typeof $(this).data('qtip')!=='object')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_TOOLTIP_PRESENT,false);if(options=='api')
return $(this).data('qtip').interfaces[$(this).data('qtip').current];else if(options=='interfaces')
return $(this).data('qtip').interfaces;}
else
{if(!options)options={};if(typeof options.content!=='object'||(options.content.jquery&&options.content.length>0))options.content={text:options.content};if(typeof options.content.title!=='object')options.content.title={text:options.content.title};if(typeof options.position!=='object')options.position={corner:options.position};if(typeof options.position.corner!=='object')options.position.corner={target:options.position.corner,tooltip:options.position.corner};if(typeof options.show!=='object')options.show={when:options.show};if(typeof options.show.when!=='object')options.show.when={event:options.show.when};if(typeof options.show.effect!=='object')options.show.effect={type:options.show.effect};if(typeof options.hide!=='object')options.hide={when:options.hide};if(typeof options.hide.when!=='object')options.hide.when={event:options.hide.when};if(typeof options.hide.effect!=='object')options.hide.effect={type:options.hide.effect};if(typeof options.style!=='object')options.style={name:options.style};options.style=sanitizeStyle(options.style);opts=$.extend(true,{},$.fn.qtip.defaults,options);opts.style=buildStyle.call({options:opts},opts.style);opts.user=$.extend(true,{},options);};return $(this).each(function()
{if(typeof options=='string')
{command=options.toLowerCase();interfaces=$(this).qtip('interfaces');if(typeof interfaces=='object')
{if(blanket===true&&command=='destroy')
while(interfaces.length>0)interfaces[interfaces.length-1].destroy();else
{if(blanket!==true)interfaces=[$(this).qtip('api')];for(i=0;i<interfaces.length;i++)
{if(command=='destroy')interfaces[i].destroy();else if(interfaces[i].status.rendered===true)
{if(command=='show')interfaces[i].show();else if(command=='hide')interfaces[i].hide();else if(command=='focus')interfaces[i].focus();else if(command=='disable')interfaces[i].disable(true);else if(command=='enable')interfaces[i].disable(false);};};};};}
else
{config=$.extend(true,{},opts);config.hide.effect.length=opts.hide.effect.length;config.show.effect.length=opts.show.effect.length;if(config.position.container===false)config.position.container=$(document.body);if(config.position.target===false)config.position.target=$(this);if(config.show.when.target===false)config.show.when.target=$(this);if(config.hide.when.target===false)config.hide.when.target=$(this);id=$.fn.qtip.interfaces.length;for(i=0;i<id;i++)
{if(typeof $.fn.qtip.interfaces[i]=='undefined'){id=i;break;};};obj=new qTip($(this),config,id);$.fn.qtip.interfaces[id]=obj;if(typeof $(this).data('qtip')=='object')
{if(typeof $(this).attr('qtip')==='undefined')
$(this).data('qtip').current=$(this).data('qtip').interfaces.length;$(this).data('qtip').interfaces.push(obj);}
else $(this).data('qtip',{current:0,interfaces:[obj]});if(config.content.prerender===false&&config.show.when.event!==false&&config.show.ready!==true)
{config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create',{qtip:id},function(event)
{api=$.fn.qtip.interfaces[event.data.qtip];api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');api.cache.mouse={x:event.pageX,y:event.pageY};construct.call(api);api.options.show.when.target.trigger(api.options.show.when.event);});}
else
{obj.cache.mouse={x:config.show.when.target.offset().left,y:config.show.when.target.offset().top};construct.call(obj);}};});};function qTip(target,options,id)
{var self=this;self.id=id;self.options=options;self.status={animated:false,rendered:false,disabled:false,focused:false};self.elements={target:target.addClass(self.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};self.cache={mouse:{},position:{},toggle:0};self.timers={};$.extend(self,self.options.api,{show:function(event)
{var returned,solo;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'show');if(self.elements.tooltip.css('display')!=='none')return self;self.elements.tooltip.stop(true,false);returned=self.beforeShow.call(self,event);if(returned===false)return self;function afterShow()
{if(self.options.position.type!=='static')self.focus();self.onShow.call(self,event);if(jdBrowser.msie)self.elements.tooltip.get(0).style.removeAttribute('filter');};self.cache.toggle=1;if(self.options.position.type!=='static')
self.updatePosition(event,(self.options.show.effect.length>0));if(typeof self.options.show.solo=='object')solo=$(self.options.show.solo);else if(self.options.show.solo===true)solo=$('div.qtip').not(self.elements.tooltip);if(solo)solo.each(function(){if($(this).qtip('api').status.rendered===true)$(this).qtip('api').hide();});if(typeof self.options.show.effect.type=='function')
{self.options.show.effect.type.call(self.elements.tooltip,self.options.show.effect.length);self.elements.tooltip.queue(function(){afterShow();$(this).dequeue();});}
else
{switch(self.options.show.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeIn(self.options.show.effect.length,afterShow);break;case'slide':self.elements.tooltip.slideDown(self.options.show.effect.length,function()
{afterShow();if(self.options.position.type!=='static')self.updatePosition(event,true);});break;case'grow':self.elements.tooltip.show(self.options.show.effect.length,afterShow);break;default:self.elements.tooltip.show(null,afterShow);break;};self.elements.tooltip.addClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_SHOWN,'show');},hide:function(event)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'hide');else if(self.elements.tooltip.css('display')==='none')return self;clearTimeout(self.timers.show);self.elements.tooltip.stop(true,false);returned=self.beforeHide.call(self,event);if(returned===false)return self;function afterHide(){self.onHide.call(self,event);};self.cache.toggle=0;if(typeof self.options.hide.effect.type=='function')
{self.options.hide.effect.type.call(self.elements.tooltip,self.options.hide.effect.length);self.elements.tooltip.queue(function(){afterHide();$(this).dequeue();});}
else
{switch(self.options.hide.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeOut(self.options.hide.effect.length,afterHide);break;case'slide':self.elements.tooltip.slideUp(self.options.hide.effect.length,afterHide);break;case'grow':self.elements.tooltip.hide(self.options.hide.effect.length,afterHide);break;default:self.elements.tooltip.hide(null,afterHide);break;};self.elements.tooltip.removeClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_HIDDEN,'hide');},updatePosition:function(event,animate)
{var i,target,tooltip,coords,mapName,imagePos,newPosition,ieAdjust,ie6Adjust,borderAdjust,mouseAdjust,offset,curPosition,returned
if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updatePosition');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_POSITION_STATIC,'updatePosition');target={position:{left:0,top:0},dimensions:{height:0,width:0},corner:self.options.position.corner.target};tooltip={position:self.getPosition(),dimensions:self.getDimensions(),corner:self.options.position.corner.tooltip};if(self.options.position.target!=='mouse')
{if(self.options.position.target.get(0).nodeName.toLowerCase()=='area')
{coords=self.options.position.target.attr('coords').split(',');for(i=0;i<coords.length;i++)coords[i]=parseInt(coords[i]);mapName=self.options.position.target.parent('map').attr('name');imagePos=$('img[usemap="#'+mapName+'"]:first').offset();target.position={left:Math.floor(imagePos.left+coords[0]),top:Math.floor(imagePos.top+coords[1])};switch(self.options.position.target.attr('shape').toLowerCase())
{case'rect':target.dimensions={width:Math.ceil(Math.abs(coords[2]-coords[0])),height:Math.ceil(Math.abs(coords[3]-coords[1]))};break;case'circle':target.dimensions={width:coords[2]+1,height:coords[2]+1};break;case'poly':target.dimensions={width:coords[0],height:coords[1]};for(i=0;i<coords.length;i++)
{if(i%2==0)
{if(coords[i]>target.dimensions.width)
target.dimensions.width=coords[i];if(coords[i]<coords[0])
target.position.left=Math.floor(imagePos.left+coords[i]);}
else
{if(coords[i]>target.dimensions.height)
target.dimensions.height=coords[i];if(coords[i]<coords[1])
target.position.top=Math.floor(imagePos.top+coords[i]);};};target.dimensions.width=target.dimensions.width-(target.position.left-imagePos.left);target.dimensions.height=target.dimensions.height-(target.position.top-imagePos.top);break;default:return $.fn.qtip.log.error.call(self,4,$.fn.qtip.constants.INVALID_AREA_SHAPE,'updatePosition');break;};target.dimensions.width-=2;target.dimensions.height-=2;}
else if(self.options.position.target.add(document.body).length===1)
{target.position={left:$(document).scrollLeft(),top:$(document).scrollTop()};target.dimensions={height:$(window).height(),width:$(window).width()};}
else
{if(typeof self.options.position.target.attr('qtip')!=='undefined')
target.position=self.options.position.target.qtip('api').cache.position;else
target.position=self.options.position.target.offset();target.dimensions={height:self.options.position.target.outerHeight(),width:self.options.position.target.outerWidth()};};newPosition=$.extend({},target.position);if(target.corner.search(/right/i)!==-1)
newPosition.left+=target.dimensions.width;if(target.corner.search(/bottom/i)!==-1)
newPosition.top+=target.dimensions.height;if(target.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left+=(target.dimensions.width/2);if(target.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top+=(target.dimensions.height/2);}
else
{target.position=newPosition={left:self.cache.mouse.x,top:self.cache.mouse.y};target.dimensions={height:1,width:1};};if(tooltip.corner.search(/right/i)!==-1)
newPosition.left-=tooltip.dimensions.width;if(tooltip.corner.search(/bottom/i)!==-1)
newPosition.top-=tooltip.dimensions.height;if(tooltip.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left-=(tooltip.dimensions.width/2);if(tooltip.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top-=(tooltip.dimensions.height/2);ieAdjust=(jdBrowser.msie)?1:0;ie6Adjust=(jdBrowser.msie&&jdBrowser.version==6)?1:0;if(self.options.style.border.radius>0)
{if(tooltip.corner.search(/Left/)!==-1)
newPosition.left-=self.options.style.border.radius;else if(tooltip.corner.search(/Right/)!==-1)
newPosition.left+=self.options.style.border.radius;if(tooltip.corner.search(/Top/)!==-1)
newPosition.top-=self.options.style.border.radius;else if(tooltip.corner.search(/Bottom/)!==-1)
newPosition.top+=self.options.style.border.radius;};if(ieAdjust)
{if(tooltip.corner.search(/top/)!==-1)
newPosition.top-=ieAdjust
else if(tooltip.corner.search(/bottom/)!==-1)
newPosition.top+=ieAdjust
if(tooltip.corner.search(/left/)!==-1)
newPosition.left-=ieAdjust
else if(tooltip.corner.search(/right/)!==-1)
newPosition.left+=ieAdjust
if(tooltip.corner.search(/leftMiddle|rightMiddle/)!==-1)
newPosition.top-=1};if(self.options.position.adjust.screen===true)
newPosition=screenAdjust.call(self,newPosition,target,tooltip);if(self.options.position.target==='mouse'&&self.options.position.adjust.mouse===true)
{if(self.options.position.adjust.screen===true&&self.elements.tip)
mouseAdjust=self.elements.tip.attr('rel');else
mouseAdjust=self.options.position.corner.tooltip;newPosition.left+=(mouseAdjust.search(/right/i)!==-1)?-6:6;newPosition.top+=(mouseAdjust.search(/bottom/i)!==-1)?-6:6;}
if(!self.elements.bgiframe&&jdBrowser.msie&&jdBrowser.version==6)
{$('select, object').each(function()
{offset=$(this).offset();offset.bottom=offset.top+$(this).height();offset.right=offset.left+$(this).width();if(newPosition.top+tooltip.dimensions.height>=offset.top&&newPosition.left+tooltip.dimensions.width>=offset.left)
bgiframe.call(self);});};newPosition.left+=self.options.position.adjust.x;newPosition.top+=self.options.position.adjust.y;curPosition=self.getPosition();if(newPosition.left!=curPosition.left||newPosition.top!=curPosition.top)
{returned=self.beforePositionUpdate.call(self,event);if(returned===false)return self;self.cache.position=newPosition;if(animate===true)
{self.status.animated=true;self.elements.tooltip.animate(newPosition,200,'swing',function(){self.status.animated=false});}
else self.elements.tooltip.css(newPosition);self.onPositionUpdate.call(self,event);if(typeof event!=='undefined'&&event.type&&event.type!=='mousemove')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_POSITION_UPDATED,'updatePosition');};return self;},updateWidth:function(newWidth)
{var hidden;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateWidth');else if(newWidth&&typeof newWidth!=='number')
return $.fn.qtip.log.error.call(self,2,'newWidth must be of type number','updateWidth');hidden=self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);if(!newWidth)
{if(typeof self.options.style.width.value=='number')
newWidth=self.options.style.width.value;else
{self.elements.tooltip.css({width:'auto'});hidden.hide();if(jdBrowser.msie)
self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'normal'});newWidth=self.getDimensions().width+1;if(!self.options.style.width.value)
{if(newWidth>self.options.style.width.max)newWidth=self.options.style.width.max
if(newWidth<self.options.style.width.min)newWidth=self.options.style.width.min};};};if(newWidth%2!==0)newWidth-=1;self.elements.tooltip.width(newWidth);hidden.show();if(self.options.style.border.radius)
{self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
{$(this).width(newWidth-(self.options.style.border.radius*2));})};if(jdBrowser.msie)
{self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'1'});self.elements.wrapper.width(newWidth);if(self.elements.bgiframe)self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_WIDTH_UPDATED,'updateWidth');},updateStyle:function(name)
{var tip,borders,context,corner,coordinates;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateStyle');else if(typeof name!=='string'||!$.fn.qtip.styles[name])
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.STYLE_NOT_DEFINED,'updateStyle');self.options.style=buildStyle.call(self,$.fn.qtip.styles[name],self.options.user.style);self.elements.content.css(jQueryStyle(self.options.style));if(self.options.content.title.text!==false)
self.elements.title.css(jQueryStyle(self.options.style.title,true));self.elements.contentWrapper.css({borderColor:self.options.style.border.color});if(self.options.style.tip.corner!==false)
{if($('<canvas>').get(0).getContext)
{tip=self.elements.tooltip.find('.qtip-tip canvas:first');context=tip.get(0).getContext('2d');context.clearRect(0,0,300,300);corner=tip.parent('div[rel]:first').attr('rel');coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);drawTip.call(self,tip,coordinates,self.options.style.tip.color||self.options.style.border.color);}
else if(jdBrowser.msie)
{tip=self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');tip.attr('fillcolor',self.options.style.tip.color||self.options.style.border.color);};};if(self.options.style.border.radius>0)
{self.elements.tooltip.find('.qtip-betweenCorners').css({backgroundColor:self.options.style.border.color});if($('<canvas>').get(0).getContext)
{borders=calculateBorders(self.options.style.border.radius)
self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
{context=$(this).get(0).getContext('2d');context.clearRect(0,0,300,300);corner=$(this).parent('div[rel]:first').attr('rel')
drawBorder.call(self,$(this),borders[corner],self.options.style.border.radius,self.options.style.border.color);});}
else if(jdBrowser.msie)
{self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
{$(this).attr('fillcolor',self.options.style.border.color)});};};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_STYLE_UPDATED,'updateStyle');},updateContent:function(content,reposition)
{var parsedContent,images,loadedImages;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateContent');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateContent');parsedContent=self.beforeContentUpdate.call(self,content);if(typeof parsedContent=='string')content=parsedContent;else if(parsedContent===false)return;if(jdBrowser.msie)self.elements.contentWrapper.children().css({zoom:'normal'});if(content.jquery&&content.length>0)
content.clone(true).appendTo(self.elements.content).show();else self.elements.content.html(content);images=self.elements.content.find('img[complete=false]');if(images.length>0)
{loadedImages=0;images.each(function(i)
{$('<img src="'+$(this).attr('src')+'" />').load(function(){if(++loadedImages==images.length)afterLoad();});});}
else afterLoad();function afterLoad()
{self.updateWidth();if(reposition!==false)
{if(self.options.position.type!=='static')
self.updatePosition(self.elements.tooltip.is(':visible'),true);if(self.options.style.tip.corner!==false)
positionTip.call(self);};};self.onContentUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_UPDATED,'loadContent');},loadContent:function(url,data,method)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'loadContent');returned=self.beforeContentLoad.call(self);if(returned===false)return self;if(method=='post')
$.post(url,data,setupContent);else
$.get(url,data,setupContent);function setupContent(content)
{self.onContentLoad.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_LOADED,'loadContent');self.updateContent(content);};return self;},updateTitle:function(content)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateTitle');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateTitle');returned=self.beforeTitleUpdate.call(self);if(returned===false)return self;if(self.elements.button)self.elements.button=self.elements.button.clone(true);self.elements.title.html(content)
if(self.elements.button)self.elements.title.prepend(self.elements.button);self.onTitleUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_TITLE_UPDATED,'updateTitle');},focus:function(event)
{var curIndex,newIndex,elemIndex,returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'focus');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_FOCUS_STATIC,'focus');curIndex=parseInt(self.elements.tooltip.css('z-index'));newIndex=6000+$('div.qtip[qtip]').length-1;if(!self.status.focused&&curIndex!==newIndex)
{returned=self.beforeFocus.call(self,event);if(returned===false)return self;$('div.qtip[qtip]').not(self.elements.tooltip).each(function()
{if($(this).qtip('api').status.rendered===true)
{elemIndex=parseInt($(this).css('z-index'));if(typeof elemIndex=='number'&&elemIndex>-1)
$(this).css({zIndex:parseInt($(this).css('z-index'))-1});$(this).qtip('api').status.focused=false;}})
self.elements.tooltip.css({zIndex:newIndex});self.status.focused=true;self.onFocus.call(self,event);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_FOCUSED,'focus');};return self;},disable:function(state)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'disable');if(state)
{if(!self.status.disabled)
{self.status.disabled=true;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DISABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,'disable');}
else
{if(self.status.disabled)
{self.status.disabled=false;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_ENABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,'disable');};return self;},destroy:function()
{var i,returned,interfaces;returned=self.beforeDestroy.call(self);if(returned===false)return self;if(self.status.rendered)
{self.options.show.when.target.unbind('mousemove.qtip',self.updatePosition);self.options.show.when.target.unbind('mouseout.qtip',self.hide);self.options.show.when.target.unbind(self.options.show.when.event+'.qtip');self.options.hide.when.target.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind('mouseover.qtip',self.focus);self.elements.tooltip.remove();}
else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');if(typeof self.elements.target.data('qtip')=='object')
{interfaces=self.elements.target.data('qtip').interfaces;if(typeof interfaces=='object'&&interfaces.length>0)
{for(i=0;i<interfaces.length-1;i++)
if(interfaces[i].id==self.id)interfaces.splice(i,1)}}
delete $.fn.qtip.interfaces[self.id];if(typeof interfaces=='object'&&interfaces.length>0)
self.elements.target.data('qtip').current=interfaces.length-1;else
self.elements.target.removeData('qtip');self.onDestroy.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DESTROYED,'destroy');return self.elements.target},getPosition:function()
{var show,offset;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getPosition');show=(self.elements.tooltip.css('display')!=='none')?false:true;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();offset=self.elements.tooltip.offset();if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return offset;},getDimensions:function()
{var show,dimensions;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getDimensions');show=(!self.elements.tooltip.is(':visible'))?true:false;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();dimensions={height:self.elements.tooltip.outerHeight(),width:self.elements.tooltip.outerWidth()};if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return dimensions;}});};function construct()
{var self,adjust,content,url,data,method,tempLength;self=this;self.beforeRender.call(self);self.status.rendered=true;self.elements.tooltip='<div qtip="'+self.id+'" '+'class="qtip '+(self.options.style.classes.tooltip||self.options.style)+'"'+'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;'+'position:'+self.options.position.type+';">'+'  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">'+'    <div class="qtip-contentWrapper" style="overflow:hidden;">'+'       <div class="qtip-content '+self.options.style.classes.content+'"></div>'+'</div></div></div>';self.elements.tooltip=$(self.elements.tooltip);self.elements.tooltip.appendTo(self.options.position.container)
self.elements.tooltip.data('qtip',{current:0,interfaces:[self]});self.elements.wrapper=self.elements.tooltip.children('div:first');self.elements.contentWrapper=self.elements.wrapper.children('div:first').css({background:self.options.style.background});self.elements.content=self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));if(jdBrowser.msie)self.elements.wrapper.add(self.elements.content).css({zoom:1});if(self.options.hide.when.event=='unfocus')self.elements.tooltip.attr('unfocus',true);if(typeof self.options.style.width.value=='number')self.updateWidth();if($('<canvas>').get(0).getContext||jdBrowser.msie)
{if(self.options.style.border.radius>0)
createBorder.call(self);else
self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});if(self.options.style.tip.corner!==false)
createTip.call(self);}
else
{self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});self.options.style.border.radius=0;self.options.style.tip.corner=false;$.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,'render');};if((typeof self.options.content.text=='string'&&self.options.content.text.length>0)||(self.options.content.text.jquery&&self.options.content.text.length>0))
content=self.options.content.text;else if(typeof self.elements.target.attr('title')=='string'&&self.elements.target.attr('title').length>0)
{content=self.elements.target.attr('title').replace("\\n",'<br />');self.elements.target.attr('title','');}
else if(typeof self.elements.target.attr('alt')=='string'&&self.elements.target.attr('alt').length>0)
{content=self.elements.target.attr('alt').replace("\\n",'<br />');self.elements.target.attr('alt','');}
else
{content=' ';$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_VALID_CONTENT,'render');};if(self.options.content.title.text!==false)createTitle.call(self);self.updateContent(content);assignEvents.call(self);if(self.options.show.ready===true)self.show();if(self.options.content.url!==false)
{url=self.options.content.url;data=self.options.content.data;method=self.options.content.method||'get';self.loadContent(url,data,method);};self.onRender.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_RENDERED,'render');};function createBorder()
{var self,i,width,radius,color,coordinates,containers,size,betweenWidth,betweenCorners,borderTop,borderBottom,borderCoord,sideWidth,vertWidth;self=this;self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();width=self.options.style.border.width;radius=self.options.style.border.radius;color=self.options.style.border.color||self.options.style.tip.color;coordinates=calculateBorders(radius);containers={};for(i in coordinates)
{containers[i]='<div rel="'+i+'" style="'+((i.search(/Left/)!==-1)?'left':'right')+':0; '+'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if($('<canvas>').get(0).getContext)
containers[i]+='<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';else if(jdBrowser.msie)
{size=radius*2+3;containers[i]+='<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" '+'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/)!==-1)?-2:-1)+'px; '+'margin-left:'+((i.search(/Right/)!==-1)?coordinates[i][2]-3.5:-1)+'px; '+'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';};containers[i]+='</div>';};betweenWidth=self.getDimensions().width-(Math.max(width,radius)*2);betweenCorners='<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; '+'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';borderTop='<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['topLeft']+containers['topRight']+betweenCorners;self.elements.wrapper.prepend(borderTop);borderBottom='<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['bottomLeft']+containers['bottomRight']+betweenCorners;self.elements.wrapper.append(borderBottom);if($('<canvas>').get(0).getContext)
{self.elements.wrapper.find('canvas').each(function()
{borderCoord=coordinates[$(this).parent('[rel]:first').attr('rel')];drawBorder.call(self,$(this),borderCoord,radius,color);})}
else if(jdBrowser.msie)self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');sideWidth=Math.max(radius,(radius+(width-radius)))
vertWidth=Math.max(width-radius,0);self.elements.contentWrapper.css({border:'0px solid '+color,borderWidth:vertWidth+'px '+sideWidth+'px'})};function drawBorder(canvas,coordinates,radius,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.arc(coordinates[0],coordinates[1],radius,0,Math.PI*2,false);context.fill();};function createTip(corner)
{var self,color,coordinates,coordsize,path;self=this;if(self.elements.tip!==null)self.elements.tip.remove();color=self.options.style.tip.color||self.options.style.border.color;if(self.options.style.tip.corner===false)return;else if(!corner)corner=self.options.style.tip.corner;coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);self.elements.tip='<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; '+'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; '+'margin:0 auto; line-height:0.1px; font-size:1px;">';if($('<canvas>').get(0).getContext)
self.elements.tip+='<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';else if(jdBrowser.msie)
{coordsize=self.options.style.tip.size.width+','+self.options.style.tip.size.height;path='m'+coordinates[0][0]+','+coordinates[0][1];path+=' l'+coordinates[1][0]+','+coordinates[1][1];path+=' '+coordinates[2][0]+','+coordinates[2][1];path+=' xe';self.elements.tip+='<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" '+'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; '+'line-height:0.1px; display:inline-block; behavior:url(#default#VML); '+'vertical-align:'+((corner.search(/top/)!==-1)?'bottom':'top')+'"></v:shape>';self.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';self.elements.contentWrapper.css('position','relative');};self.elements.tooltip.prepend(self.elements.tip+'</div>');self.elements.tip=self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);if($('<canvas>').get(0).getContext)
drawTip.call(self,self.elements.tip.find('canvas:first'),coordinates,color);if(corner.search(/top/)!==-1&&jdBrowser.msie&&jdBrowser.version==6)
self.elements.tip.css({marginTop:-4});positionTip.call(self,corner);};function drawTip(canvas,coordinates,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.moveTo(coordinates[0][0],coordinates[0][1]);context.lineTo(coordinates[1][0],coordinates[1][1]);context.lineTo(coordinates[2][0],coordinates[2][1]);context.fill();};function positionTip(corner)
{var self,ieAdjust,paddingCorner,paddingSize,newMargin;self=this;if(self.options.style.tip.corner===false||!self.elements.tip)return;if(!corner)corner=self.elements.tip.attr('rel');ieAdjust=positionAdjust=(jdBrowser.msie)?1:0;self.elements.tip.css(corner.match(/left|right|top|bottom/)[0],0);if(corner.search(/top|bottom/)!==-1)
{if(jdBrowser.msie)
{if(jdBrowser.version==6)
positionAdjust=(corner.search(/top/)!==-1)?-3:1;else
positionAdjust=(corner.search(/top/)!==-1)?1:2;};if(corner.search(/Middle/)!==-1)
self.elements.tip.css({left:'50%',marginLeft:-(self.options.style.tip.size.width/2)});else if(corner.search(/Left/)!==-1)
self.elements.tip.css({left:self.options.style.border.radius-ieAdjust});else if(corner.search(/Right/)!==-1)
self.elements.tip.css({right:self.options.style.border.radius+ieAdjust});if(corner.search(/top/)!==-1)
self.elements.tip.css({top:-positionAdjust});else
self.elements.tip.css({bottom:positionAdjust});}
else if(corner.search(/left|right/)!==-1)
{if(jdBrowser.msie)
positionAdjust=(jdBrowser.version==6)?1:((corner.search(/left/)!==-1)?1:2);if(corner.search(/Middle/)!==-1)
self.elements.tip.css({top:'50%',marginTop:-(self.options.style.tip.size.height/2)});else if(corner.search(/Top/)!==-1)
self.elements.tip.css({top:self.options.style.border.radius-ieAdjust});else if(corner.search(/Bottom/)!==-1)
self.elements.tip.css({bottom:self.options.style.border.radius+ieAdjust});if(corner.search(/left/)!==-1)
self.elements.tip.css({left:-positionAdjust});else
self.elements.tip.css({right:positionAdjust});};paddingCorner='padding-'+corner.match(/left|right|top|bottom/)[0];paddingSize=self.options.style.tip.size[(paddingCorner.search(/left|right/)!==-1)?'width':'height'];self.elements.tooltip.css('padding',0);self.elements.tooltip.css(paddingCorner,paddingSize);if(jdBrowser.msie&&jdBrowser.version==6)
{newMargin=parseInt(self.elements.tip.css('margin-top'))||0;newMargin+=parseInt(self.elements.content.css('margin-top'))||0;self.elements.tip.css({marginTop:newMargin});};};function createTitle()
{var self=this;if(self.elements.title!==null)self.elements.title.remove();self.elements.title=$('<div class="'+self.options.style.classes.title+'">').css(jQueryStyle(self.options.style.title,true)).css({zoom:(jdBrowser.msie)?1:0}).prependTo(self.elements.contentWrapper);if(self.options.content.title.text)self.updateTitle.call(self,self.options.content.title.text);if(self.options.content.title.button!==false&&typeof self.options.content.title.button=='string')
{self.elements.button=$('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>').css(jQueryStyle(self.options.style.button,true)).html(self.options.content.title.button).prependTo(self.elements.title).click(function(event){if(!self.status.disabled)self.hide(event)});};};function assignEvents()
{var self,showTarget,hideTarget,inactiveEvents;self=this;showTarget=self.options.show.when.target;hideTarget=self.options.hide.when.target;if(self.options.hide.fixed)hideTarget=hideTarget.add(self.elements.tooltip);if(self.options.hide.when.event=='inactive')
{inactiveEvents=['click','dblclick','mousedown','mouseup','mousemove','mouseout','mouseenter','mouseleave','mouseover'];function inactiveMethod(event)
{if(self.status.disabled===true)return;clearTimeout(self.timers.inactive);self.timers.inactive=setTimeout(function()
{$(inactiveEvents).each(function()
{hideTarget.unbind(this+'.qtip-inactive');self.elements.content.unbind(this+'.qtip-inactive');});self.hide(event);},self.options.hide.delay);};}
else if(self.options.hide.fixed===true)
{self.elements.tooltip.bind('mouseover.qtip',function()
{if(self.status.disabled===true)return;clearTimeout(self.timers.hide);});};function showMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.when.event=='inactive')
{$(inactiveEvents).each(function()
{hideTarget.bind(this+'.qtip-inactive',inactiveMethod);self.elements.content.bind(this+'.qtip-inactive',inactiveMethod);});inactiveMethod();};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.timers.show=setTimeout(function(){self.show(event);},self.options.show.delay);};function hideMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.fixed===true&&self.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&$(event.relatedTarget).parents('div.qtip[qtip]').length>0)
{event.stopPropagation();event.preventDefault();clearTimeout(self.timers.hide);return false;};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.elements.tooltip.stop(true,true);self.timers.hide=setTimeout(function(){self.hide(event);},self.options.hide.delay);};if((self.options.show.when.target.add(self.options.hide.when.target).length===1&&self.options.show.when.event==self.options.hide.when.event&&self.options.hide.when.event!=='inactive')||self.options.hide.when.event=='unfocus')
{self.cache.toggle=0;showTarget.bind(self.options.show.when.event+'.qtip',function(event)
{if(self.cache.toggle==0)showMethod(event);else hideMethod(event);});}
else
{showTarget.bind(self.options.show.when.event+'.qtip',showMethod);if(self.options.hide.when.event!=='inactive')
hideTarget.bind(self.options.hide.when.event+'.qtip',hideMethod);};if(self.options.position.type.search(/(fixed|absolute)/)!==-1)
self.elements.tooltip.bind('mouseover.qtip',self.focus);if(self.options.position.target==='mouse'&&self.options.position.type!=='static')
{showTarget.bind('mousemove.qtip',function(event)
{self.cache.mouse={x:event.pageX,y:event.pageY};if(self.status.disabled===false&&self.options.position.adjust.mouse===true&&self.options.position.type!=='static'&&self.elements.tooltip.css('display')!=='none')
self.updatePosition(event);});};};function screenAdjust(position,target,tooltip)
{var self,adjustedPosition,adjust,newCorner,overflow,corner;self=this;if(tooltip.corner=='center')return target.position
adjustedPosition=$.extend({},position);newCorner={x:false,y:false};overflow={left:(adjustedPosition.left<$.fn.qtip.cache.screen.scroll.left),right:(adjustedPosition.left+tooltip.dimensions.width+2>=$.fn.qtip.cache.screen.width+$.fn.qtip.cache.screen.scroll.left),top:(adjustedPosition.top<$.fn.qtip.cache.screen.scroll.top),bottom:(adjustedPosition.top+tooltip.dimensions.height+2>=$.fn.qtip.cache.screen.height+$.fn.qtip.cache.screen.scroll.top)};adjust={left:(overflow.left&&(tooltip.corner.search(/right/i)!=-1||(tooltip.corner.search(/right/i)==-1&&!overflow.right))),right:(overflow.right&&(tooltip.corner.search(/left/i)!=-1||(tooltip.corner.search(/left/i)==-1&&!overflow.left))),top:(overflow.top&&tooltip.corner.search(/top/i)==-1),bottom:(overflow.bottom&&tooltip.corner.search(/bottom/i)==-1)};if(adjust.left)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left+target.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x
newCorner.x='Left';}
else if(adjust.right)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left-tooltip.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x-tooltip.dimensions.width;newCorner.x='Right';};if(adjust.top)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top+target.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y
newCorner.y='top';}
else if(adjust.bottom)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top-tooltip.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y-tooltip.dimensions.height;newCorner.y='bottom';};if(adjustedPosition.left<0)
{adjustedPosition.left=position.left;newCorner.x=false;};if(adjustedPosition.top<0)
{adjustedPosition.top=position.top;newCorner.y=false;};if(self.options.style.tip.corner!==false)
{adjustedPosition.corner=new String(tooltip.corner);if(newCorner.x!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/Left|Right|Middle/,newCorner.x);if(newCorner.y!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/top|bottom/,newCorner.y);if(adjustedPosition.corner!==self.elements.tip.attr('rel'))
createTip.call(self,adjustedPosition.corner);};return adjustedPosition;};function jQueryStyle(style,sub)
{var styleObj,i;styleObj=$.extend(true,{},style);for(i in styleObj)
{if(sub===true&&i.search(/(tip|classes)/i)!==-1)
delete styleObj[i];else if(!sub&&i.search(/(width|border|tip|title|classes|user)/i)!==-1)
delete styleObj[i];};return styleObj;};function sanitizeStyle(style)
{if(typeof style.tip!=='object')style.tip={corner:style.tip};if(typeof style.tip.size!=='object')style.tip.size={width:style.tip.size,height:style.tip.size};if(typeof style.border!=='object')style.border={width:style.border};if(typeof style.width!=='object')style.width={value:style.width};if(typeof style.width.max=='string')style.width.max=parseInt(style.width.max.replace(/([0-9]+)/i,"$1"));if(typeof style.width.min=='string')style.width.min=parseInt(style.width.min.replace(/([0-9]+)/i,"$1"));if(typeof style.tip.size.x=='number')
{style.tip.size.width=style.tip.size.x;delete style.tip.size.x;};if(typeof style.tip.size.y=='number')
{style.tip.size.height=style.tip.size.y;delete style.tip.size.y;};return style;};function buildStyle()
{var self,i,styleArray,styleExtend,finalStyle,ieAdjust;self=this;styleArray=[true,{}];for(i=0;i<arguments.length;i++)
styleArray.push(arguments[i]);styleExtend=[$.extend.apply($,styleArray)];while(typeof styleExtend[0].name=='string')
{styleExtend.unshift(sanitizeStyle($.fn.qtip.styles[styleExtend[0].name]));};styleExtend.unshift(true,{classes:{tooltip:'qtip-'+(arguments[0].name||'defaults')}},$.fn.qtip.styles.defaults);finalStyle=$.extend.apply($,styleExtend);ieAdjust=(jdBrowser.msie)?1:0;finalStyle.tip.size.width+=ieAdjust;finalStyle.tip.size.height+=ieAdjust;if(finalStyle.tip.size.width%2>0)finalStyle.tip.size.width+=1;if(finalStyle.tip.size.height%2>0)finalStyle.tip.size.height+=1;if(finalStyle.tip.corner===true)
finalStyle.tip.corner=(self.options.position.corner.tooltip==='center')?false:self.options.position.corner.tooltip;return finalStyle;};function calculateTip(corner,width,height)
{var tips={bottomRight:[[0,0],[width,height],[width,0]],bottomLeft:[[0,0],[width,0],[0,height]],topRight:[[0,height],[width,0],[width,height]],topLeft:[[0,0],[0,height],[width,height]],topMiddle:[[0,height],[width/2,0],[width,height]],bottomMiddle:[[0,0],[width,0],[width/2,height]],rightMiddle:[[0,0],[width,height/2],[0,height]],leftMiddle:[[width,0],[width,height],[0,height/2]]};tips.leftTop=tips.bottomRight;tips.rightTop=tips.bottomLeft;tips.leftBottom=tips.topRight;tips.rightBottom=tips.topLeft;return tips[corner];};function calculateBorders(radius)
{var borders;if($('<canvas>').get(0).getContext)
{borders={topLeft:[radius,radius],topRight:[0,radius],bottomLeft:[radius,0],bottomRight:[0,0]};}
else if(jdBrowser.msie)
{borders={topLeft:[-90,90,0],topRight:[-90,90,-radius],bottomLeft:[90,270,0],bottomRight:[90,270,-radius]};};return borders;};function bgiframe()
{var self,html,dimensions;self=this;dimensions=self.getDimensions();html='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; '+'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';self.elements.bgiframe=self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');};$(document).ready(function()
{$.fn.qtip.cache={screen:{scroll:{left:$(window).scrollLeft(),top:$(window).scrollTop()},width:$(window).width(),height:$(window).height()}};var adjustTimer;$(window).bind('resize scroll',function(event)
{clearTimeout(adjustTimer);adjustTimer=setTimeout(function()
{if(event.type==='scroll')
$.fn.qtip.cache.screen.scroll={left:$(window).scrollLeft(),top:$(window).scrollTop()};else
{$.fn.qtip.cache.screen.width=$(window).width();$.fn.qtip.cache.screen.height=$(window).height();};for(i=0;i<$.fn.qtip.interfaces.length;i++)
{var api=$.fn.qtip.interfaces[i];if(api.status.rendered===true&&(api.options.position.type!=='static'||api.options.position.adjust.scroll&&event.type==='scroll'||api.options.position.adjust.resize&&event.type==='resize'))
{api.updatePosition(event,true);}};},100);})
$(document).bind('mousedown.qtip',function(event)
{if($(event.target).parents('div.qtip').length===0)
{$('.qtip[unfocus]').each(function()
{var api=$(this).qtip("api");if($(this).is(':visible')&&!api.status.disabled&&$(event.target).add(api.elements.target).length>1)
api.hide(event);})};})});$.fn.qtip.interfaces=[]
$.fn.qtip.log={error:function(){return this;}};$.fn.qtip.constants={};$.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:'bottomRight',tooltip:'topLeft'},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:'absolute',container:false},show:{when:{target:false,event:'mouseover'},effect:{type:'fade',length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:'mouseout'},effect:{type:'fade',length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};$.fn.qtip.styles={defaults:{background:'white',color:'#111',overflow:'hidden',textAlign:'left',width:{min:0,max:250},padding:'5px 9px',border:{width:1,radius:0,color:'#d3d3d3'},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:'#e1e1e1',fontWeight:'bold',padding:'7px 12px'},button:{cursor:'pointer'},classes:{target:'',tip:'qtip-tip',title:'qtip-title',button:'qtip-button',content:'qtip-content',active:'qtip-active'}},cream:{border:{width:3,radius:0,color:'#F9E98E'},title:{background:'#F0DE7D',color:'#A27D35'},background:'#FBF7AA',color:'#A27D35',classes:{tooltip:'qtip-cream'}},light:{border:{width:3,radius:0,color:'#E2E2E2'},title:{background:'#f1f1f1',color:'#454545'},background:'white',color:'#454545',classes:{tooltip:'qtip-light'}},dark:{border:{width:3,radius:0,color:'#303030'},title:{background:'#404040',color:'#f3f3f3'},background:'#505050',color:'#f3f3f3',classes:{tooltip:'qtip-dark'}},red:{border:{width:3,radius:0,color:'#CE6F6F'},title:{background:'#f28279',color:'#9C2F2F'},background:'#F79992',color:'#9C2F2F',classes:{tooltip:'qtip-red'}},green:{border:{width:3,radius:0,color:'#A9DB66'},title:{background:'#b9db8c',color:'#58792E'},background:'#CDE6AC',color:'#58792E',classes:{tooltip:'qtip-green'}},blue:{border:{width:3,radius:0,color:'#ADD9ED'},title:{background:'#D0E9F5',color:'#5E99BD'},background:'#E5F6FE',color:'#4D9FBF',classes:{tooltip:'qtip-blue'}}};})(jQuery);/* complete : /javascript/common/libraries/jquery/jquery.qtip-1.0.min.js*/


/* combine : /javascript/desktop/common/jdw_commonPageLoadFunctions.js*/
/* 
 * Capture the click event of all <a> tags with rel="modal" OR 
 * all <a> tags with an href urls containing request param "modal" 
 * with value "true" e.g. "/shop/warranties.jsp?modal=true"
 */ 
$(document).ready(function () {
	$(document).delegate("a","click",function(event){
	    var url = $(this).attr('href');
	    var fromBack = $(this).attr('modalBack') ? true : false;
	    var disableClose = $(this).attr('disableModalClose') ? true : false;
	    var showScrollbars = $(this).attr('showscrollbars') ? true : false;
	    
        if($(this).attr("jdwPrefix") != undefined) {
            $prefix = $(this).attr("jdwPrefix");
            var selectedColour = $("#" + $prefix + "_optionColourSelect").attr("value");
            var selectedSize = $("#" + $prefix + "_optionSizeSelect").attr("value");
            var selectedFitting = $("#" + $prefix + "_fittingSelect").attr("value");
            
            $sizeDrop =$("#" + $prefix + "_optionSize").children('option[value="'+ selectedSize +'"]')
            $colourDrop=$("#" + $prefix + "_optionColour").children('option[value="'+ selectedColour +'"]')
            $fittingDrop=$("#" + $prefix + "_fitting").children('option[value="'+ selectedFitting +'"]');
            $currentModalContent = $('div.quickViewModalContent');
        }
        
	    if( $(this).attr('rel')=='modal' || jQuery.url.setUrl(url).param('modal')=='true' ){
		    // prevent default behaviour on click event
		    event.preventDefault(); 
		    
		    var modalCallBack = function (data) {
   		        openModalJQ(data,url,fromBack,disableClose, showScrollbars);
       		};
       		modalCallBack.hideUpdatingOverlay = true;
       		
			ajaxGet(this, modalCallBack);		
		}
	});
});

$(document).ready(function() {
	$(document).delegate('a[rel="ajaxSubmit"]','click',function(event){
    	event.preventDefault();
    	
		var urlString = $(this).attr('href'); 	
    	if (urlString == null || urlString.length == 0) { 
			urlString = $(this).parents("form").attr('action');
		}
		
		performAjaxRequest(	urlString,
							eval($(this).attr('beforeSend')),
							eval($(this).attr('completeLoading')), 
							$(this).attr('dataType'),
							$(this).parents("form").serialize(), 
							eval($(this).attr('successLoading')), 
							eval($(this).attr('errorLoading')), 
							$(this).parents("form").prop('method'),
							getUniqueClass(this)
		);
	});
});

/*
 * Generate the dynamic tooltip elements.
 * Content is read from the static dropdown element, then edited to rename id attributes.
 * This avoids having elements with duplicate ids on the page.
 * Also added unique name element for each link, as this is required by LiveView.
 * Setting prerender to true enables the coremetrics script to attach events to the dynamic links at onload.
 */
$(document).ready(function () {
    $('#topNavigation .topNavItemWithMenu').each(function() {
        var target = $('.topnav', this);
        var content = $('.categoryDropNavContainer', this);

		var editedContent = content.clone();
		editedContent.find('a').attr('id', function() {
		  return 'DDM_'+this.id;
		});
		editedContent.find('a').attr('name', function() {
		  return this.id;
		});

        target.qtip({
            content: {
            	prerender: true,
                text: editedContent.html()
            },
            position: { 
                corner: getCorner(),
                adjust: {
                	screen: true,
                	scroll: false
                }
            },
            hide: { 
                when: 'mouseout', fixed: true 
            },
            style: {
                background: 'transparent',
                width: calculateColumnWidth(),
                padding: 0,
                border: {
                    width: 0,
                    radius: 0
                }
            },
            api: {
                onShow: function() {
                    target.addClass('hovered');
                },
                onHide: function() {
                    target.removeClass('hovered');
                }
            },
            show : {
            	delay: 0
            }
        });
        
        function calculateColumnWidth(){        	
        	var colWidth = calculateWidth();
        	var maxLeftPosition = $('#topNavigation').width() - colWidth;
        	var offset = getWidthWithMargin($('.promoColumnMiddle', content));
        	colWidth+=offset;
        	if(colWidth>maxLeftPosition){
        		colWidth-=offset;        		
        	}
        	return colWidth;        	
        }
        
        function getCorner() {
            var leftPosition = target.offset().left - $('#topNavigation').offset().left;
            var maxLeftPosition = $('#topNavigation').width() - calculateWidth();  
            
            if (leftPosition > maxLeftPosition) {
                return { target: 'bottomRight', tooltip: 'topRight' };
            } else {
                return { target: 'bottomLeft', tooltip: 'topLeft' };
            }
        }
        
        function calculateWidth() {
            var width = getWidthWithMargin($('.refinementsColumn', content));
            width +=  getWidthWithMargin($('.promoMiddleColumnSize1', content));
            width +=  getWidthWithMargin($('.promoMiddleColumnSize2', content));
            width +=  getWidthWithMargin($('.promoMiddleColumnSize3', content));
            width +=  getWidthWithMargin($('.promoMiddleColumnSize4', content));
            width +=  getWidthWithMargin($('.promoColumnRight', content));
            width +=  getCssDimension($('.categoryDropNavContent', content),'border-left-width');
            width +=  getCssDimension($('.categoryDropNavContent', content),'border-right-width');
            width +=  getCssDimension($('.topNavSpacer1', content),'width');
            width +=  getCssDimension($('.topNavSpacer2', content),'width');
            width +=  getCssDimension($('.topNavSpacer3', content),'width');
            width +=  getCssDimension($('.topNavSpacer4', content),'width');
            width +=  getCssDimension($('.topNavSpacer5', content),'width');
 
            return width;
        }
        
        function getWidthWithMargin(element) {
            var width = getCssDimension(element,'width');
            width += getCssDimension(element,'margin-left');
            width += getCssDimension(element,'margin-right');
            
            return width;
        }
        
        function getCssDimension(element, cssClass) {
            if (element.css(cssClass)) {
                return parseInt(element.css(cssClass).replace('px', ''));
            }
            return 0;
        }     
    });
});

/* 
 * NEW js method for calculating how much of a sub-navigation will be off screen.
 * Adjusts the left offset position accordingly.
*/
    
$(document).ready(function () {
	var navRow = $('.mainNav');
	if (! navRow) return;
	if (! navRow.offset()) return;
	var rightEdge = navRow.offset().left + navRow.outerWidth();
	
	$('.navColumnContainer').each(function(){
		var dropDown = $(this);
		var ddLeft = dropDown.offset().left;
		var ddTop = dropDown.offset().top;
		var ddRightEdge = ddLeft + dropDown.outerWidth();
		var overhang = rightEdge - ddRightEdge;
		if (overhang < 0) {
			dropDown.offset({left: ddLeft + overhang, top: ddTop });
		}
	});
});
    
/*
 * The following functions need to run on each page load in order to maintain a user based 
 * set of footer logos. The logos below will be removed based on the customers account type,
 * and also whether 3d secure has been turned on or off.
 */

$(document).ready(function(){
	if (typeof removeCreditLogo != 'undefined') {
		if (removeCreditLogo == 'true') {
			$("div[id='personalAccount']").remove();
		}
	}
});
$(document).ready(function(){
	if (typeof display3DSecureFooterLogos != 'undefined') {
		if (display3DSecureFooterLogos == 'false') {
			$("img[title='Verified by Visa']").remove();
			$("img[title='MasterCard Securecode']").remove();
		}
	}
});

/*
 * Apply a click event to all links with 'backtotop' classes. Predominantly these exist on PDP
 * @return false so that the link href is not followed
 */
$(document).ready(function () {
	$('.backtotop').find('a').click(function(){
		$("html,body").animate({scrollTop:0}, '500');
		return false;
    });
});

/*
 * Apply a click handler to all the links with close-mega-menu classes.
 * this click handler will be applied to the close buttons in the top
 * right of the dropdown topnav menus for tablet.
 */
$(document).ready(function () {
	$('.close-mega-menu').click(function(){
		$.megaSpark();
		return false;
    });
});/* complete : /javascript/desktop/common/jdw_commonPageLoadFunctions.js*/


/* combine : /javascript/desktop/common/affiliateSitesPromoCodeModalPopup.js*/
/***********************************************************************************************
 * Static data and functions are all contained within the "affiliateSitesPromoModal" object, 
 * to avoid namespace conflicts. 
 ***********************************************************************************************/
var affiliateSitesPromoModal = {
	getUrlParam: function(param) {
		param = param.replace(/([\[\](){}*?+^$.\\|])/g, "\\$1");
		var regex = new RegExp("[?&]" + param + "=([^&#]*)");
		var url   = decodeURIComponent(window.location.href);
		var match = regex.exec(url);
		return match ? match[1] : "";
	},

	displayAffiliateSiteOverlay: function(data) {
		openModalJQ(data, null, null, null);
		affiliateSitesPromoModal.populateOverlayData();
	
		enableCloseModalJQByClickingOutsideBorder();
	},

	populateOverlayData: function() {
		$('#modal_outer').find('#modal_header').remove();
		$('#modal_outer').find('#modal_control').remove();
		$('#modal_outer').find('#tradingTitleImage').html(jTitle);
		$('#modal_outer').css({'margin-left' : '-300px'});
	
		var goShoppingLink = $('#modal_outer').find('#promoOverlayGoShoppingLink');
		goShoppingLink.attr('href', 'javascript:goShopping();');
		goShoppingLink.html("Shop at " + jTitle);
	},

	goShopping: function() {
		closeModalJQ();
	
	}
};

$(document).ready(function() {
	var param = affiliateSitesPromoModal.getUrlParam("promo");
    if (param != null && param != "" && param == jAffiliatedSitesPromoCode) {
		$.getJSON('/shop/affiliatesites/getdetails.action', function(data) {	  
			var actionStatus = data.status;
			if (actionStatus != null && actionStatus != 'undefined' && actionStatus == "error") {
				return;
			}
			
			$.get('/shop/affiliatesites/show.action', function(data) {	  
					affiliateSitesPromoModal.displayAffiliateSiteOverlay(data);
				});
        });
	}
});
/* complete : /javascript/desktop/common/affiliateSitesPromoCodeModalPopup.js*/


/* combine : /javascript/common/jdw_commonHeaderFunctions_wpi.js*/
(function() {
	if ((typeof(jDisplayChangeTitleOverlay) != "undefined")
		&& (jDisplayChangeTitleOverlay == true)) {
		$.get('/content/changetitle/changeTitle.html', function(data) {
			displayChangeTitleOverlay(data)
		});
	}
})();

$(document).ready(function () {
	var googleAnalyticsContent = $('#googleAnalyticsContent');
	if (googleAnalyticsContent.length > 0) {
		googleAnalyticsContent.load("/shop/3rdparty/get-google-analytics.action");
	}
  
});

/* ----------------------------------------------------------------------------*/
/* Global location for methods required when adding warranties to products.
 * Moved here to avoid duplication and a new javascript file.
 */
function updateBagItems( numberOfBasketItems ) {
	//To set the contents of a div...below
	if(top != self) {
		top.$('#numItemsInBag').html(numberOfBasketItems);
	} else {
		$('#numItemsInBag').html(numberOfBasketItems);
	}
}

/* -------------------------------- Minibag Functions -------------------------*/

/*
 * The jQuery below generates the qTip used by the minibag. Coremetrics tags are also included
 * below.
 */
$(document).ready(function () {
	if (activateMinibag) {
		var target = '#gotoCheckOutContainerLink';		
		
		if(target.length !== 0) {
			$(target).qtip({ 
				content: {
					url: '/shop/minibag/show.action',
					// IE will cache the ajax request unless POST is used.
					method: 'post'
				},		
				position: {
					corner: {
						target: 'bottomLeft',
						tooltip: 'topRight'
					},
					adjust: {
						x: calculateXaxis(), y: -25
					}			
				},
				show: {
					delay: 300
				},
				hide: {		
					fixed: true,
					when: 'mouseout', 
					delay: 100
				},
				style: {
					background: 'transparent',
					border: {
						width: 0,
						radius: 0,
						colour: '#181818'
					},
					width: calculateWidth()
				},
				api: {
					beforeShow: function() {		
						this.loadContent(this.options.content.url,this.options.content.data,this.options.content.method);
					},
					onShow: function() {
						// Generate a click event for celebrus to track the qtip opening.
						$(target).click();
					}
				}
			});
		}
		
		if (document.getElementById("noMinibag")) {
			$(target).qtip('destroy');
			$(target).removeData('qtip');
		}
	}		
});

function calculateXaxis(){
//	if(!showJDWRecentlyViewed){
//		return 450;
//	}
	return 195;
}

function calculateWidth() {
//	if(!showJDWRecentlyViewed){
//		return 292;
//	}
	if(jdBrowser.msie){
		return 527;
	} return 531;
}

function miniBagCMEvent(e, name) {
	MANUAL_LINK_CLICK_EX(e.target.href, titleUID + ' - MINBAG - ' + name, titleUID + ' - MINIBAG');
}

(function() {
	/* View minibag item */
	$("a[name='minibagView']").on('click', function(e) {		
		miniBagCMEvent(e, 'VIEW BAG ITEM');
	});
	
	/* Remove minibag item */
	$("a[name='minibagRemove']").on('click', function(e) {
		miniBagCMEvent(e, 'REMOVE BAG ITEM');
	});
	
	/* View recently viewed item */
	$("a[name='recentView']").on('click', function(e) {
		miniBagCMEvent(e, 'VIEW RECENT ITEM');
	});

	/* Continue to checkout */
	$("a[name='minibagCheckout']").on('click', function(e) {
		miniBagCMEvent(e, 'CHECKOUT');
	});	
})();

var itemRemoved;
var numberItemsInBasket;
var deleteOptions;
var refreshOptions;

function ajaxMinibagDelete(lineitem, lpUid) {
	deleteOptions = {
		url : '/shop/minibag/json/minibagRemoveItem.action?lineitem='+lineitem+'&pdLpUid='+lpUid,
		handler: handleAjaxMinibagDelete
	};
	submitMinibagAjax(deleteOptions);
}

function handleAjaxMinibagDelete(returnObj) {
	var dataLayerEvent = jQuery.parseJSON(returnObj.gapDataLayer);
    window.dataLayer.push(dataLayerEvent);
	itemRemoved = returnObj.itemRemoved;
	numberItemsInBasket = returnObj.numberItemsInBasket;
	if (itemRemoved) {
		$('#numItemsInBag').html(numberItemsInBasket);
		$('#shoppingBagSize').html(numberItemsInBasket);
		eval(returnObj.celebrusData); // for mini bag remove
		
		refreshOptions = {
			url: '/shop/minibag/show.action',
			dataType: 'html',
			handler: handleAjaxMinibagRefresh				
		};
		submitMinibagAjax(refreshOptions);
	}
}

function handleAjaxMinibagRefresh(returnObj) {
	$('#minibagOuter').html(returnObj);
	$('#qtip-0').width(calculateWidth());
}

/* -------------------------------- Top-nav Search Functions -------------------------*/

/**
 * Apply events to search category/search button
 * 
 * @param searchAreaSelector: CSS selector for search div/form
 * @param searchCategorySelector: CSS selector for search category drop-down
 * @param searchKeywordSelector: CSS selector for search keyword input box
 * @param defaultSearchText: Default text on search box
 */
function applySearchBoxEvents(searchAreaSelector, searchCategorySelector, searchKeywordSelector, searchButtonSelector, defaultSearchText, searchTerm) {

	// Set action on search button
	$(searchButtonSelector).click(function() {
		submitSearch(defaultSearchText,
					$(searchCategorySelector).val(), 
					$(searchKeywordSelector).val());			
	});
	
	// Hide default search text when click on search keywords box
	$(searchKeywordSelector).focus( function(){
		if ($(this).val() == defaultSearchText) {
			$(this).val('');
		}
	});
	
	// When enter key is pressed, press search button
	applyEventOnEnterKey($(searchButtonSelector), $(searchAreaSelector));
}

/**
 * Submits a search query
 * 
 * @param defaultText
 * @param categoryUrl
 * @param searchKeywords
 * @return: True if validation was successful, or false
 */
function submitSearch(defaultText, categoryUrl, searchKeywords) {	
   	// If search value equals default value then set to empty string
   	if( searchKeywords == defaultText) {
   		searchKeywords = '';
   	}
   		
   	// Validate empty input
   	var idx;
   	if ( searchKeywords.length > 1 )
   	{
     	for(idx=0;idx < searchKeywords.length;idx++) 
     	{
       		if ( searchKeywords.charAt(idx) != " " ) 
       		{				
       			// Valid input -> re-direct to search page url
   				window.location = generateSearchPageUrl(categoryUrl, searchKeywords);
   				return true;
       		}
     	}
   	}
   	
   	alert("Please enter a search value");
 	return false;		
}

/**
 * Generate a search page Url
 * 
 * @param categoryUrl: The generic url for the category
 * @param searchKeywords: Search keywords
 * @return: The url of the search page
 */
function generateSearchPageUrl(categoryUrl, searchKeywords) {		
	var productAction = "/products/show.action";	
	
	// WebSphere cannot deal with URLs that have a ; in the base part - so strip these
	var escapedSearchKeywords = encodeURIComponent(searchKeywords.replace(/;|\//g,"")).replace(/%20/g, "+");
	// Append Ntt parameter into URL - immediately before product action component
	var replacement = "/Ntt-" + escapedSearchKeywords + productAction;
	var searchAction = categoryUrl.replace(productAction, replacement);

	return searchAction;
}	

/**
 * Autocomplete function for search terms
 * 
 * @param searchTermSelector: CSS selector for search term input box
 * @param searchCategorySelector: CSS selector for category drop-down
 * @param formSelector: CSS selector for form containing search term and category selector
 * @return: Nothing
 */
function applySearchAutoCompleteFunction(searchTermSelector, searchCategorySelector, searchButtonSelector, searchActionUrl) {

	// Define function to generate autocomplete entries for search box
	function searchSourceFunction ( request, response ) {
		var searchPageAction = generateSearchPageUrl($(searchCategorySelector).val(),	$(searchTermSelector).val());
		params = searchPageAction.substring(
							searchPageAction.indexOf('_'),
							searchPageAction.indexOf("/products/show.action"));

		$.ajax({
			type: "GET",
			url: searchActionUrl,
			dataType: "json",
			data: {
				term: request.term, endecaParams: params
			},
				contentType: "application/json; charset=utf-8",
			success: function( data ) {
				response(data.model);
			}
		});
	}
	
	// Apply generic autocomplete function using reference function just created
	applyAutoCompleteFunction(searchTermSelector, searchButtonSelector, searchSourceFunction);
}


/* -------------------------------- Utility Functions -------------------------*/

/**
 * Utility function for submitting AJAX requests. 
 *
 * options = { url : url of AJAX request, 
 *	 handler: function to handle AJAX callback, 
 *	 formId: optiiona, used to sumbit form data along with AJAX request, 
 *	 dataType: data type for expected data, defualts to JSON
 * }
*/
function submitMinibagAjax(options) {
	var defaults = {dataType: 'json'};
	var options = $.extend({}, defaults, options); 
	
	performAjaxRequest(options.url,null,null,options.dataType,null,
		options.handler,null,'POST',null);
}

function updateAvailableToSpend(availableToSpend) {
	if (top != self) {
		top.$('#logInTitleCreditValue').html(availableToSpend);
	} else {
		$('#logInTitleCreditValue').html(availableToSpend);
	}
}

function convertCurrencySymbols(amount) {
	var ret = '';
	if (amount) {
		ret = amount.replace(/&euro;/g, '\u20AC');
		ret = amount.replace(/&pound;/g, '\u00A3');
	}
	return ret;
}


/**
 * Apply an autocomplete function to perform some action as a user is typing into an input box
 * 
 * @param searchTermSelector: CSS selector for the input box containing the search term
 * @param formSelector: CSS selector for form, which will be submitted when the desired search term has been selected
 * @param searchSourceFunction: The function to perform each time a letter is added/deleted
 * @return
 */
function applyAutoCompleteFunction(searchTermSelector, searchButtonSelector, searchSourceFunction) {
	var termTemplate = "<span class='ui-autocomplete-term'>%s</span>";
	
	$( searchTermSelector ).autocomplete({
		source: searchSourceFunction,
		minLength: 3,
		select: function( event, ui ) {
			$(searchTermSelector).val(ui.item.label);
			$(searchButtonSelector).click();
		},
		open: function( event, ui ) {
		  //Change the Z-index so that the autocomplete drop down appears on top
		  //of everything else.
		  $( this ).autocomplete( "widget" ).css('z-index', '999');
		  
		  //Add alternative line styling
		  $( this ).autocomplete( "widget" )
		    .find( "ui-menu-item-alternate" )
		      .removeClass( "ui-menu-item-alternate" )
		    .end()
		    .find( "li.ui-menu-item:odd a" )
		      .addClass( "ui-menu-item-alternate" );

		  //High light the search term the user has entered in the search result.
          var
            acData = $(this).data('ui-autocomplete'),
            trimedSearchterm = jQuery.trim(acData.term),
            trimedSearchterm = trimedSearchterm.toLowerCase(),
            styledTerm = termTemplate.replace('%s', trimedSearchterm);

          acData
            .menu
            .element
            .find('li.ui-menu-item a')
            .each(function() {
                var me = $(this);
                me.html( me.text().replace(trimedSearchterm, styledTerm) );
            });
		}
	});	
}

/**
 * Apply a click event to an object when enter is pressed on a trigger area
 * @param clickableTarget: The object to apply the click event to
 * @param triggerArea: The area on which to detect events
 * @return
 */
function applyEventOnEnterKey(clickableTarget, triggerArea) {	
	// Trigger target when enter is pressed
	triggerArea.keydown( function(e) {
        var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
        if(key == 13) {
        	clickableTarget.click();
        }
    });	
}
/* complete : /javascript/common/jdw_commonHeaderFunctions_wpi.js*/


/* combine : /javascript/desktop/common/actionTags.js*/
// actionTags.js

function writeDynamicTag( tagCode ) {
	if ( tagCode ) {
			$('#dynamicTagScript').append( '<script type="text/javascript">try { ' + tagCode + ' } catch(e){}</script>');
	}
}
//overture parameters
var pm_tagname = "universalTag.txt";
var pm_accountid;
var pm_customargs;

//rocket fule vars
var cachebust = (Math.random() + "").substr(2);
//shopzilla parameters
var mid;
var cust_type;
var order_value;
var order_id;
var units_ordered;

//google parameters
var google_conversion_id;
var google_conversion_language = "en_GB";
var google_conversion_format = "1";
var google_conversion_color = "FFFFFF";
var google_conversion_value;
var google_conversion_label;


//doubleclick parameters
var axel = Math.random()+"";
var a = axel * 10000000000000;

//shopping.com
var merchant_id;
var order_id;
var order_amt;
var category_id = "";
var category_name = "";
var product_id = "";
var product_name = "";

//nexTag
var id;
var rev;
var order;
var cats = "";
var prods = "";
var units = "";

// mediaplex CACHEBUSTER value
var mpt = new Date();
var mpts = mpt.getTimezoneOffset() + mpt.getTime();

//channel advisor checkout complete
function channel_adv_cc(clientId) {
	//channel advisor checkout complete
	document.writeln('<IMG SRC="https://tracking.searchmarketing.com/thankyou.asp?' +
		'SMCID='+ clientId +'&oVal='+ escape(jTotalValue) +
		'&OrderID=' + escape(jOrderid) +
		'&ProductID=' +	escape(jProductUids) + '" ' +
		'WIDTH="1" HEIGHT="1" BORDER="0">');
}

function affiliateWindow_dwin(merchantId) {
	$(document).ready(function() {
		var tag = '<script src="https://www.dwin1.com/'+merchantId+'.js" type="text/javascript"></script>';
		$('#dynamicTagScript').append(tag);
	  });
}

//affiliate window checkout completed
function affiliateWindow_cc(merchantId) {
	(jNewWebCustomer == 'Y') ? customerType="new" : customerType="existing";
	affiliateWindow_cc_product(merchantId, customerType);

	document.writeln('<script type="text/javascript">');
	document.writeln('var AWIN={};');
	document.writeln('AWIN.Tracking={};');
	document.writeln('AWIN.Tracking.Sale={};');
	document.writeln('AWIN.Tracking.Sale.amount="' + escape(jTotalValue) + '";');
	document.writeln('AWIN.Tracking.Sale.currency="' + escape(jCurrency) + '";');
	document.writeln('AWIN.Tracking.Sale.orderRef="' + escape(jOrderid) + '";');
	document.writeln('AWIN.Tracking.Sale.parts="' + customerType + ':' + escape(jTotalValue) + '";');
	document.writeln('AWIN.Tracking.Sale.voucher="";');
	document.writeln('AWIN.Tracking.Sale.test="0";');
	document.writeln('</script>');
	document.writeln('<script src="https://www.dwin1.com/'+merchantId+'.js" type="text/javascript" defer="defer"></script>');
}

function affiliateWindow_cc_product(merchantId, customerType) {
	document.writeln('<form style="display:none;" name="aw_basket_form">');
	document.writeln('<textarea wrap="physical" id="aw_basket">');

	var productIds = jProductUidsMT.split("|");
	var productNames = jProductNamesMT.split("|");
	var productPrices = jProductPricesMT.split("|");
	var productQuantities = jProductQuantitiesMT.split("|");
	var d = '|';

	for (var i=0; i<productIds.length; i++ ) {
		var s = 'AW:P' + d
			+ merchantId + d
			+ jOrderid + d
			+ productIds[i] + d
			+ productNames[i] + d
			+ productPrices[i] + d
			+ productQuantities[i] + d
			+ '' + d
			+ customerType + d
			+ '';
		document.writeln(s);
	}
	document.writeln('</textarea>');
	document.writeln('</form>');
}

function google(conversion_id, label, conversion_format, conversion_value) {
    google_conversion_id =  conversion_id;
    google_conversion_value = conversion_value ? conversion_value : 1.0;
	google_conversion_label =  label;
	google_conversion_format = conversion_format;
}

function googleUrchin(code) {
    //_uacct = "UA-245925-1"; VLD
    //_uacct = "UA-245925-2"; PMA
    //_uacct = "UA-245925-3"; NAT
    _uacct = code;
	urchinTracker();
}

function getProtocol() {
	return isSecureProtocol() ? "https://" : "http://";
}

function isSecureProtocol() {
	return location.href.indexOf("https") === 0;
}


function facebook_tracking(id, h) {
	try {  FB.Insights.impression({
	     'id': id,
	     'h' : h  });
	} catch (e) {}
}

//responsys checkout complete - UK titles
function responsys_cc_uk() {
	responsys_cc('X0Gzc2X%3DWQpglLjHJlTQGrizfmGfr2rsYHeAdeGcX6AO', 'Em6kwSd_Zf9OrW5gM0fktuw');
}

//responsys checkout complete - IRISH titles
function responsys_cc_irish() {
	responsys_cc('X0Gzc2X%3DWQpglLjHJlTQGmwzai1azdqTT3w6zbzbsqRuzbzfG', 'EsiGhFlmEtiGNUyZwIdzjqM');
}

//responsys checkout complete - common code.
function responsys_cc(firstParameter, secondParameter) {
	document.writeln('<img src="' + getProtocol()
		+ 'link.e-comms.net/pub/cct?_ri_=' + firstParameter
		+ '&_ei_=' + secondParameter
		+ '&action=once'
		+ '&OrderID=' + escape(jOrderid)
		+ '&OrderTotal=' + escape(jTotalValue)
		+ '&numItems=' + escape(jQuantity)
		+ '&customerID=' + escape(jAccountid)
		+ '&Type=purchase'
		+ '" height="1" width="1">');
}

// Responsys conversion pixel.
function responsys_conversionpixel_cc(id,seg){
	document.writeln('<script src="' + getProtocol() + 'secure.adnxs.com/px?id='+id+'&seg='+seg+'&order_id='+escape(jOrderid)+'&value='+escape(jTotalValue)+'&t=1" type="text/javascript"></script>');
}

//responsys signin complete cookie
function responsys_signin_complete() {
	document.writeln('<!-- BEGIN: Responsys Signin complete pixel -->');
	document.writeln('<script type="text/javascript" src="' + getProtocol() + 'tag.yieldoptimizer.com/ps/ps?t=s&p=1332&u=$lookup(CUSTOMER_ID_)$"></script>');
	document.writeln('<!-- END: Responsys Signin complete pixel -->');
}

//Responsys create customer (encrypted) email address image pixel.
function responsys_create_customer_email_address_pixel(){
	if (typeof(jEncryptedCustomerEmailAddressPixel) === "undefined"){
		// No encrypted customer email address pixel.
		return;
	}
	document.writeln(jEncryptedCustomerEmailAddressPixel);
}

//Get dressipi widget loader from Dressipi
//Is called by atlasActiontags.properties and takes widget functions as an array to be called
//after the widget_loader is finished and prevent sync problems.
function dressipiGetJS(dressipiFunctionsArray) {
	if(dressipiEnabled){
		$.getScript('https://' + dressipiHost + '/assets/widget_loader.js').done(function() {
			for (var i=0; i<dressipiFunctionsArray.length;i++) {
				dressipiFunctionsArray[i]();
			}
		});	
	}
}

//Generate dressipi pdp size widget if the appropiate div exists (will only exist if properties
//enabled).
function dressipiPDPSizeWidget() {
	if (dressipiSizingWidgetEnabled) {
		Dressipi.initSizingWidget($("#dressipiPDPSizeWidget").get(0), {
			callback: function(element, message) {
				if (element && message && message === 'loaded') {
					element.classList.add("dressipiPDPSizeWidgetShow");
					element.classList.remove("dressipiPDPSizeWidgetHide");
				}
			},
			productCode: offeredProductId.substring(0, 5)
		});
	}
}
	
//Generate dressipi pdp outfit widget if the appropiate div exists (will only exist if properties
//enabled).
function dressipiPDPOutfitWidget() {
	if (dressipiPDPWidgetEnabled) {
		Dressipi.initOutfitsWidget($("#dressipiPDPOutfitWidget").get(0), {
			callback: function(element, message) {
				if (element && message && message === 'loaded') {
					element.classList.add("dressipiPDPOutfitWidgetShow");
					element.classList.remove("dressipiPDPOutfitWidgetHide");
				}
			}, 
			productCode: offeredProductId.substring(0, 5)
		});
		
	}
}

function dressipiPLPWidget(){
	$(document).ready(function(){
		if(plpWidgetEnabled && dressipiHierarchyPath) {
			if ($("#dressipiPLPWidget").is(':empty')) {
				Dressipi.initPlpWidget($("#dressipiPLPWidget").get(0), {
					callback: function(element, message) {
						if (element && message && message === 'loaded') {
							element.classList.add("dressipiPLPWidgetShow");
							element.classList.remove("dressipiPLPWidgetHide");
						}
					}, 
					plpType: dressipiHierarchyPath
				});	
			}
		}	
	});
}

function dressipiPLPTracking(){
	if(dressipiEnabled && typeof Dressipi != "undefined") {
        Dressipi.initPlpTracking({"listing": {"items":productArray, 
                           "filters": [] }, "page": {"breadcrumb": dressipiHierarchyPath}});
	}
}

//Generate dressipi view bag widget if the appropiate div exists (will only exist if properties
//enabled).
function dressipiViewBagWidget() {
	if (dressipiViewBagWidgetEnabled) {
		var itemsArray = [];
		if (dataLayer[0] && dataLayer[0].BagItems && dataLayer[0].BagItems.shoppingBagItems) {
			var bagEntries = dataLayer[0].BagItems.shoppingBagItems;
			for(var i=0; i<bagEntries.length; i++) {
				var itemRow = {};
				// dressipi SKU is a combination of productId and selected OptionId
				itemRow.id = bagEntries[i].productId.value+bagEntries[i].optionId.value;
				itemsArray.push(itemRow);
			}
			if (itemsArray.length > 0) {
				Dressipi.initShoppingBasketWidget($("#dressipiViewBagWidget").get(0),{
					callback: function(element, message) {
						if (element && message && message === 'loaded') {
							element.classList.add("dressipiViewBagWidgetShow");
							element.classList.remove("dressipiViewBagWidgetHide");
						}
					},
					items: itemsArray
				});	
			}
		} 
	}
}/* complete : /javascript/desktop/common/actionTags.js*/


/* combine : /javascript/desktop/common/prettyCheckboxes.js*/
/* ------------------------------------------------------------------------
	prettyCheckboxes
	
	Developped By: Stephane Caron (http://www.no-margin-for-errors.com)
	Inspired By: All the non user friendly custom checkboxes solutions ;)
	Version: 1.1
	
	Copyright: Feel free to redistribute the script/modify it, as
			   long as you leave my infos at the top.
------------------------------------------------------------------------- */
	
	jQuery.fn.prettyCheckboxes = function(settings) {
		settings = jQuery.extend({
					checkboxWidth: 17,
					checkboxHeight: 17,
					className : 'prettyCheckbox',
					display: 'list'
				}, settings);

		$(this).each(function(){
			// Find the label
			$label = $('label[for="'+$(this).attr('id')+'"]');

			// Add the checkbox holder to the label
			$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");

			// If the checkbox is checked, display it as checked
			if($(this).is(':checked')) { $label.addClass('checked'); };

			// Assign the class on the label
			$label.addClass(settings.className).addClass($(this).attr('type')).addClass(settings.display);

			// Assign the dimensions to the checkbox display
			$label.find('span.holderWrap').width(settings.checkboxWidth).height(settings.checkboxHeight);
			$label.find('span.holder').width(settings.checkboxWidth);

			// Hide the checkbox
			$(this).addClass('hiddenCheckbox');

			// Associate the click event
			$label.bind('click',function(){
				$('input#' + $(this).attr('for')).triggerHandler('click');
				
				if($('input#' + $(this).attr('for')).is(':checkbox')){
					$(this).toggleClass('checked');
					$('input#' + $(this).attr('for')).checked = true;
					
					$(this).find('span.holder').css('top',0);
				}else{
					$toCheck = $('input#' + $(this).attr('for'));

					// Uncheck all radio
					$('input[name="'+$toCheck.attr('name')+'"]').each(function(){
						$('label[for="' + $(this).attr('id')+'"]').removeClass('checked');	
					});

					$(this).addClass('checked');
					$toCheck.attr('checked', 'checked');
				};
			});
			
			$('input#' + $label.attr('for')).bind('keypress',function(e){
				if(e.keyCode == 32){
					if(jdBrowser.msie){
						$('label[for="'+$(this).attr('id')+'"]').toggleClass("checked");
					}else{
						$(this).trigger('click');
					}
					return false;
				};
			});
		});
	};
	
	checkAllPrettyCheckboxes = function(caller, container){
		if($(caller).is(':checked')){
			// Find the label corresponding to each checkbox and click it
			$(container).find('input[type=checkbox]:not(:checked)').each(function(){
				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
				if(jdBrowser.msie){
					$(this).attr('checked','checked');
				}else{
					$(this).trigger('click');
				};
			});
		}else{
			$(container).find('input[type=checkbox]:checked').each(function(){
				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
				if(jdBrowser.msie){
					$(this).attr('checked','');
				}else{
					$(this).trigger('click');
				};
			});
		};
	};/* complete : /javascript/desktop/common/prettyCheckboxes.js*/


/* combine : /javascript/desktop/common/jdw_search_wpi.min.js*/

var jdw=jdw||{};var searchActionUrl="/shop/search/typeahead/search.action";jdw.SearchFunction=function(options){this.searchAreaSelector=options.searchAreaSelector;this.searchCategorySelector=options.searchCategorySelector;this.searchKeywordSelector=options.searchKeywordSelector;this.searchButtonSelector=options.searchButtonSelector;this.defaultSearchText=options.defaultSearchText;this.autoCompleteEnabled=options.autoCompleteEnabled;this.showSearchText=options.showSearchText;var ob=this;this.load=function(){bindSearchEvents();if(this.autoCompleteEnabled){bindAutoComplete();}};this.enableAutoComplete=function(){this.autoCompleteEnabled=true;};var submitSearch=function(newSearchTerm){if(typeof(newSearchTerm)=='string'){$(ob.searchKeywordSelector).val(newSearchTerm);}
if(validateSearchKeywords()){window.location=getSearchPageUrl();}};var getAutoCompleteTermsFunction=function(request,response){var searchPageAction=getSearchPageUrl();params=searchPageAction.substring(searchPageAction.indexOf('_'),searchPageAction.indexOf("/products/show.action"));$.ajax({type:"GET",url:searchActionUrl,dataType:"json",data:{term:request.term,endecaParams:params},contentType:"application/json; charset=utf-8",success:function(data){response(data.model);}});};var bindSearchEvents=function(){$(ob.searchButtonSelector).unbind('click').bind('click',submitSearch);applyEventOnEnterKey($(ob.searchButtonSelector),$(ob.searchAreaSelector));};var bindAutoComplete=function(){var options={"selectTermCallback":submitSearch,"getTermsCallback":getAutoCompleteTermsFunction,"callingTextBox":ob.searchKeywordSelector}
var autoComplete=new jdw.AutoComplete(options);$(ob.searchKeywordSelector).autocomplete(autoComplete.getData);};var getSearchPageUrl=function(){var productAction="/products/show.action";var searchKeywords=$(ob.searchKeywordSelector).val();var categoryUrl=$(ob.searchCategorySelector).val();var escapedSearchKeywords=encodeURIComponent(searchKeywords.replace(/;|\//g,"")).replace(/%20/g,"+");var replacement="/Ntt-"+escapedSearchKeywords+productAction;var searchAction=categoryUrl.replace(productAction,replacement);return searchAction;};var validateSearchKeywords=function(){var searchKeywords=$(ob.searchKeywordSelector).val();if(ob.showSearchText&&searchKeywords==ob.defaultSearchText){$(ob.searchKeywordSelector).val('');}else{var idx;if(searchKeywords.length>1){for(idx=0;idx<searchKeywords.length;idx++){if(searchKeywords.charAt(idx)!=" "){return true;}}}}
if($(ob.searchKeywordSelector).val().length==0){$(ob.searchKeywordSelector).focus();alert("Please enter a search value");}else{$(ob.searchKeywordSelector).focus();alert("Please enter a bigger search value");}
return false;};};jdw.AutoComplete=function(options){this.getTermsCallback=options.getTermsCallback;this.selectTermCallback=options.selectTermCallback;this.callingTextBox=options.callingTextBox;var ob=this;this.getData={appendTo:$(ob.callingTextBox).parent()[0],source:this.getTermsCallback,minLength:3,select:function(event,ui){var textBoxId="searchForm/"+$(ob.callingTextBox)[0].id;var textBoxName=$(ob.callingTextBox)[0].name;celReportTextChanged(ui.item.label,textBoxId,textBoxName);ob.selectTermCallback(ui.item.label);},open:function(event,ui){$(this).autocomplete("widget").css('z-index','999');$(this).autocomplete("widget").find("ui-menu-item-alternate").removeClass("ui-menu-item-alternate").end().find("li.ui-menu-item:odd a").addClass("ui-menu-item-alternate");var termTemplate="<span class='ui-autocomplete-term'>%s</span>";var
acData=$(this).data('ui-autocomplete'),trimedSearchterm=jQuery.trim(acData.term),trimedSearchterm=trimedSearchterm.toLowerCase(),styledTerm=termTemplate.replace('%s',trimedSearchterm);acData.menu.element.find('li.ui-menu-item').each(function(){var me=$(this);me.html('<a href="#">'+me.text().replace(trimedSearchterm,styledTerm)+'</a>');});}}};jdw.ApplySearchEventsToSearchAgain=function(){var optionsAgain={"searchAreaSelector":"#searchAgainBox #searchAgainForm","searchCategorySelector":"#searchAgainBox #searchAgainForm #autoCompleteMainUrl","searchKeywordSelector":"#searchAgainBox #searchAgainForm #searchString","searchButtonSelector":"#searchAgainBox #searchAgainForm #button","showSearchText":false};jdw.searchAgain=new jdw.SearchFunction(optionsAgain);jdw.searchAgain.load();};(function(){var options={"searchAreaSelector":"#searchArea-4 #searchForm","searchCategorySelector":"#searchArea-4 #searchForm #autoCompleteMainUrl","searchKeywordSelector":"#searchArea-4 #searchForm #searchKeyWords","searchButtonSelector":"#searchArea-4 #searchForm #searchButton","defaultSearchText":"Keyword or Catalogue Number","autoCompleteEnabled":this.autoCompleteEnabled,"showSearchText":true};jdw.search=new jdw.SearchFunction(options);$(document).ready(function(){var initSearch=function(){jdw.search.load();$(options.searchKeywordSelector).unbind('focusin',initSearch);};$(options.searchKeywordSelector).focusin(initSearch);});})();/* complete : /javascript/desktop/common/jdw_search_wpi.min.js*/


/* combine : /javascript/desktop/common/jdw_outletSearch.js*/
var jdw = jdw || {};
var searchActionUrl = "/shop/search/typeahead/search.action"

//==============================================================================================
//
//												JDW_SEARCH
//
//==============================================================================================
	
	
//-----------------------------------------------------------------------------------------
// Search - Defines function to apply search triggers to top navigation bar
//-----------------------------------------------------------------------------------------

jdw.OutletSearchFunction = function(options) {
	
	this.searchAreaSelector = options.searchAreaSelector;
	this.searchCategorySelector = options.searchCategorySelector;
	this.searchKeywordSelector = options.searchKeywordSelector;
	this.searchButtonSelector = options.searchButtonSelector;
	this.defaultSearchText = options.defaultSearchText;
	this.autoCompleteEnabled = options.autoCompleteEnabled;
	this.showSearchText = options.showSearchText;

	// Inside jquery function callbacks, 'this' is reassigned; so we assign a variable here in 
	//  order that we can always get hold of this containing object.
	var ob = this;

	// === PUBLIC ==============================================================================
	
	// Bind search and autocomplete events
	this.load = function() {
		bindSearchEvents();
	};
	
	// === CALLBACK FUNCTIONS ==================================================================	
	
	// Submits the search	
	var submitSearch = function(newSearchTerm) {

		// Update search term on page if new one is specified
		if (typeof(newSearchTerm) == 'string') {
			$(ob.searchKeywordSelector).val(newSearchTerm);
		}
		
		if (validateSearchKeywords()) {
			// Valid input -> re-direct to search page url
			window.location = getSearchPageUrl();
		}
	};	
	
	// === PRIVATE ==============================================================================
		
	// Bind search events
	var bindSearchEvents = function() {
		// Bind click and enter key to submit
		$(ob.searchButtonSelector).unbind('click').bind('click', submitSearch);
		applyEventOnEnterKey($(ob.searchButtonSelector), $(ob.searchAreaSelector));
	}
	
	
	// Get the URL for the search page
	var getSearchPageUrl = function() {
		
		var productAction = "/products/show.action";
		var searchKeywords = $(ob.searchKeywordSelector).val();
		var categoryUrl = $(ob.searchCategorySelector).val();
		
		var escapedSearchKeywords = encodeURIComponent(searchKeywords.replace(/;|\//g,"")).replace(/%20/g, "+");
		// Append Ntt parameter into URL - immediately before product action component
		var replacement = "/Ntt-" + escapedSearchKeywords + productAction;
		var searchAction = categoryUrl.replace(productAction, replacement);
		return searchAction;
	};
	
	// Validate the current keywords
	var validateSearchKeywords = function() {
		var searchKeywords = $(ob.searchKeywordSelector).val();			
	 	// If search value equals default value then set to empty string
		if( ob.showSearchText && searchKeywords == ob.defaultSearchText) {
			$(ob.searchKeywordSelector).val('');
		}else{
			 // Validate empty input
		   	var idx;
		   	if ( searchKeywords.length > 1) {
		     	for(idx=0;idx < searchKeywords.length;idx++) {
		       		if ( searchKeywords.charAt(idx) != " " ) {	       			
		   				return true;
		       		}
		     	}
		   	}
		}
		if ( $(ob.searchKeywordSelector).val().length == 0) {	
			$(ob.searchKeywordSelector).focus();
			alert("Please enter a search value");
		}else{
			$(ob.searchKeywordSelector).focus();
			alert("Please enter a bigger search value");	
		}	   	
	 	return false;			   	
	};
}


var options = {
		"searchAreaSelector" : "#outletSearchForm",
		"searchCategorySelector" : "#outletSearchForm #autoCompleteOutletUrl",
		"searchKeywordSelector" : "#outletSearchForm #searchKeyWords",
		"searchButtonSelector" : "#outletSearchForm #outletSearchButton",
		"defaultSearchText" : "Search outlet",
		"showSearchText" : true
};		
jdw.outletSearch = new jdw.OutletSearchFunction( options );

$(document).ready( function() {
	jdw.outletSearch.load();
});/* complete : /javascript/desktop/common/jdw_outletSearch.js*/


/* combine : /javascript/common/libraries/jquery/jquery.cookie.js*/
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};/* complete : /javascript/common/libraries/jquery/jquery.cookie.js*/


/* combine : /javascript/common/swfobject.js*/
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();/* complete : /javascript/common/swfobject.js*/


/* combine : /javascript/common/libraries/jquery/jquery.pdfobject.js*/
/* 
	PDFObject, copyright (C) 2008 Philip Hutchison (pipwerks.com)
	Documentation and examples are at www.pdfobject.com 
	Version 1.2, April 2011
	MIT style license
*/

/*global ActiveXObject, window */


var PDFObject = function (obj){
	
	if(!obj || !obj.url){ return false; }

	var pdfobjectversion = "1.2",
		//Set reasonable defaults
		id = obj.id || false,
		width = obj.width || "100%",
		height = obj.height || "100%",
		pdfOpenParams = obj.pdfOpenParams,
		url,
		pluginTypeFound;
	

	/* ----------------------------------------------------
	   Supporting functions
	   ---------------------------------------------------- */

	//Tests specifically for Adobe Reader (aka Acrobat) in Internet Explorer
	var hasReaderActiveX = function (){

		var axObj = null;
		
		if (window.ActiveXObject) {
			
			axObj = new ActiveXObject("AcroPDF.PDF");
				
			//If "AcroPDF.PDF" didn't work, try "PDF.PdfCtrl"
			if(!axObj){
				axObj = new ActiveXObject("PDF.PdfCtrl");
			}
			
			//If either "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
			if (axObj !== null) {
				return true;
			}
	
		}
		
		//If you got to this point, there's no ActiveXObject for PDFs
		return false;
		
	};



	//Tests specifically for Adobe Reader (aka Adobe Acrobat) in non-IE browsers
	var hasReader = function (){
	
		var i,
			n = navigator.plugins,
			count = n.length,
			regx = /Adobe Reader|Adobe PDF|Acrobat/gi;
		
		for(i=0; i<count; i++){
			if(regx.test(n[i].name)){
				return true;
			}
		}
		
		return false;
	
	};


	//Detects unbranded PDF support
	var hasGeneric = function (){
		var plugin = navigator.mimeTypes["application/pdf"];
		return (plugin && plugin.enabledPlugin);
	};
	

	//Determines what kind of PDF support is available: Adobe or generic
	var pluginFound = function (){
	
		var type = null;
		
		if(hasReader() || hasReaderActiveX()){
			
			type = "Adobe";
		
		} else if(hasGeneric()) {
		
			type = "generic";
		
		}
		
		return type;
	
	};


	//If setting PDF to fill page, need to handle some CSS first
	var setCssForFullWindowPdf = function (){
		
		var html = document.getElementsByTagName("html");
		if(!html){ return false; }
		
		var html_style = html[0].style,
			body_style = document.body.style;
		
		html_style.height = "100%";
		html_style.overflow = "hidden";	
		body_style.margin = "0";
		body_style.padding = "0";
		body_style.height = "100%";
		body_style.overflow = "hidden";
		
	};


	//Creating a querystring for using PDF Open parameters when embedding PDF
	var buildQueryString = function(pdfParams){
		
		var string = "",
			prop;
		
		if(!pdfParams){ return string; }
		
		for (prop in pdfParams) {
			
			if (pdfParams.hasOwnProperty(prop)) {
				
				string += prop + "=";
				
				if(prop === "search") {
					
					string += encodeURI(pdfParams[prop]);
				
				} else {
					
					string += pdfParams[prop];
					
				}	
				
				string += "&";
				
			}
			
		}
		
		//Remove last ampersand
		return string.slice(0, string.length - 1);
	
	};


	//Simple function for returning values from PDFObject
	var get = function(prop){

		var value = null;

		switch(prop){
			case "url" : value = url; break;
			case "id" : value = id; break;
			case "width" : value = width; break;
			case "height" : value = height; break;
			case "pdfOpenParams" : value = pdfOpenParams; break;
			case "pluginTypeFound" : value = pluginTypeFound; break;
			case "pdfobjectversion" : value = pdfobjectversion; break;
		}

		return value;

	};


	/* ----------------------------------------------------
	   PDF Embedding functions
	   ---------------------------------------------------- */

	
	var embed = function(targetID){

		if(!pluginTypeFound){ return false; }

		var targetNode = null;

		if(targetID){

			//Allow users to pass an element OR an element's ID
			targetNode = (targetID.nodeType && targetID.nodeType === 1) ? targetID : document.getElementById(targetID);
			
			//Ensure target element is found in document before continuing
			if(!targetNode){ return false; }

		} else {

			targetNode = document.body; 
			setCssForFullWindowPdf();
			width = "100%";
			height = "100%";

		}

		targetNode.innerHTML = '<object	data="' +url +'" type="application/pdf" width="' +width +'" height="' +height +'" id="' +id +'"></object>';

		return targetNode.getElementsByTagName("object")[0];

	};

	//The hash (#) prevents odd behavior in Windows
	//Append optional Adobe params for opening document
	url = encodeURI(obj.url) + "#" + buildQueryString(pdfOpenParams);
	pluginTypeFound = pluginFound();
	
	this.get = function(prop){ return get(prop); };
	this.embed = function(id){ return embed(id); };
	
	return this;
	
};/* complete : /javascript/common/libraries/jquery/jquery.pdfobject.js*/


/* combine : /javascript/common/p13n-1.2.js*/
/*! p13n.js Copyright 2007-2017 RichRelevance, Inc. All Rights Reserved. Build V1.2.3.20170406 */
/* Document.write had to be removed from p13n.js to work in C3 after ajax refresh
 * This line writes the appropriate div to the page without document.write
 * If p13n.js is ever replaced then this line must be included and document.write removed
 */
function r3_generic(){this.createScript=function(a){return a}}function rr_addLoadEvent(a){RR.ol(a)}function r3_item(){this.setId=function(a){RR.set.call(this,a,"id")},this.setName=function(a){RR.set.call(this,a,"name")},this.setRecommendable=function(a){RR.set.call(this,a,"recommendable")},this.setPrice=function(a){RR.set.call(this,a,"price")},this.setSalePrice=function(a){RR.set.call(this,a,"salePrice")},this.setBrand=function(a){RR.set.call(this,a,"brand")},this.addAttribute=function(a,b){var c=a+":"+b;RR.add.call(this,c,"attributes")},this.setEndDate=function(a){RR.set.call(this,a,"endDate")},this.setImageId=function(a){RR.set.call(this,a,"imageId")},this.setLinkId=function(a){RR.set.call(this,a,"linkId")},this.setRating=function(a){RR.set.call(this,a,"rating")},this.setReleaseDate=function(a){RR.set.call(this,a,"releaseDate")},this.addCategory=function(a,b){var c=a+":"+b;RR.add.call(this,c,"categories")},this.addCategoryId=function(a){RR.add.call(this,a,"categoryIds")},this.createScript=function(a){return this.categories&&(a+="&cs="+encodeURIComponent(this.categories)),this.categoryIds&&(a+="&cis="+encodeURIComponent(this.categoryIds)),this.id&&(a+="&p="+encodeURIComponent(this.id)),this.name&&(a+="&n="+encodeURIComponent(this.name)),this.imageId&&(a+="&ii="+encodeURIComponent(this.imageId)),this.linkId&&(a+="&li="+encodeURIComponent(this.linkId)),this.releaseDate&&(a+="&rd="+encodeURIComponent(this.releaseDate)),this.price&&(a+="&np="+encodeURIComponent(this.price)),this.salePrice&&(a+="&sp="+encodeURIComponent(this.salePrice)),this.endDate&&(a+="&ed="+encodeURIComponent(this.endDate)),this.rating&&(a+="&r="+encodeURIComponent(this.rating)),typeof this.recommendable!=RR.U&&(a+="&re="+encodeURIComponent(this.recommendable)),this.brand&&(a+="&b="+encodeURIComponent(this.brand)),this.attributes&&(a+="&at="+encodeURIComponent(this.attributes)),a}}function r3_category(){this.setId=function(a){RR.set.call(this,a,"id")},this.setName=function(a){RR.set.call(this,a,"name")},this.setParentId=function(a){RR.set.call(this,a,"parentId")},this.setTopName=function(a){RR.set.call(this,a,"topName")},this.addItemId=RR.addItemId,this.createScript=function(a){return this.name&&(a+="&cn="+encodeURIComponent(this.name)),this.id&&(a+="&c="+encodeURIComponent(this.id)),this.parentId&&(a+="&pc="+encodeURIComponent(this.parentId)),this.topName&&(a+="&tcn="+encodeURIComponent(this.topName)),a}}function r3_cart(){this.addItemId=RR.addItemId,this.addItemIdCentsQuantity=RR.addItemIdCentsQuantity,this.addItemIdDollarsAndCentsQuantity=RR.addItemIdDollarsAndCentsQuantity,this.addItemIdPriceQuantity=RR.addItemIdPriceQuantity,this.createScript=function(a){return this.purchasesCents&&(a+="&ppc="+encodeURIComponent(this.purchasesCents)),this.purchasesDollarsAndCents&&(a+="&pp="+encodeURIComponent(this.purchasesDollarsAndCents)),this.quantities&&(a+="&q="+encodeURIComponent(this.quantities)),this.purchasesPrice&&(a+="&pp="+encodeURIComponent(this.purchasesPrice)),a}}function r3_addtocart(){this.addItemIdToCart=RR.addItemIdToCart,this.createScript=function(a){return this.addedToCartItemIds&&(a+="&atcid="+encodeURIComponent(this.addedToCartItemIds)),a}}function r3_purchased(){this.addItemId=RR.addItemIdCentsQuantity,this.addItemIdCentsQuantity=RR.addItemIdCentsQuantity,this.addItemIdDollarsAndCentsQuantity=RR.addItemIdDollarsAndCentsQuantity,this.addItemIdPriceQuantity=RR.addItemIdPriceQuantity,this.setOrderNumber=function(a){this.orderNumber=a},this.createScript=function(a){return this.orderNumber&&(a+="&o="+encodeURIComponent(this.orderNumber)),this.purchasesCents&&(a+="&ppc="+encodeURIComponent(this.purchasesCents)),this.purchasesDollarsAndCents&&(a+="&pp="+encodeURIComponent(this.purchasesDollarsAndCents)),this.quantities&&(a+="&q="+encodeURIComponent(this.quantities)),this.purchasesPrice&&(a+="&pp="+encodeURIComponent(this.purchasesPrice)),a}}function r3_search(){this.addItemId=RR.addItemId,this.setTerms=RR.addSearchTerm,this.createScript=function(a){return a}}function r3_wishlist(){this.addItemId=RR.addItemId,this.createScript=function(a){return a}}function r3_addtoregistry(){this.addItemIdCentsQuantity=RR.addItemIdCentsQuantity,this.createScript=function(a){return a}}function r3_common(){function a(a,b){rr_placement_place_holders.push({elementId:a,placementType:b})}var b={startRow:-1,count:-1,priceRanges:[],filterAttributes:{}};this.baseUrl="http://recs.richrelevance.com/rrserver/",this.jsFileName="p13n_generated.js",this.addCategoryHintId=function(a){RR.add.call(this,a,"categoryHintIds")},this.addClickthruParams=function(a,b){var c=encodeURIComponent(a)+":"+encodeURIComponent(b);RR.add.call(this,c,"clickthruParams")},this.addContext=function(a,b){RR.addObject.call(this,a,"context",b)},this.addFilter=function(a){RR.add.call(this,a,"filters")},this.addFilterBrand=function(a){RR.add.call(this,a,"filterBrands")},this.addFilterCategory=function(a){RR.add.call(this,a,"filterCategories")},this.addItemId=RR.addItemId,this.addItemIdToCart=RR.addItemIdToCart,this.addPlacementType=function(b,c){RR.add.call(this,b,"placementTypes"),c&&a(c,b)},this.addRefinement=function(a,b){var c=a+":"+b;RR.add.call(this,c,"refinements")},this.setRefinementFallback=function(a){var b=Boolean(a)?"t":"f";RR.set.call(this,b,"doRefinementsFallback")},this.addSearchTerm=RR.addSearchTerm,this.addSegment=function(a,b){var c;c=void 0===b?a:a+":"+b,RR.add.call(this,c,"segments")},this.blockItemId=function(a){RR.add.call(this,a,"blockeditemIds")},this.forceDisplayMode=function(){RR.set.call(this,!0,"displayModeForced")},this.forceDevMode=function(){RR.set.call(this,!0,"devModeForced")},this.setApiKey=function(a){RR.set.call(this,a,"apiKey")},this.setBaseUrl=function(a){RR.set.call(this,a,"baseUrl")},this.setCartValue=function(a){RR.set.call(this,a,"cartValue")},this.setChannel=function(a){RR.set.call(this,a,"channel")},this.setClickthruServer=function(a){RR.set.call(this,a,"clickthruServer")},this.setFilterBrandsIncludeMatchingElements=function(a){RR.set.call(this,a,"filterBrandsInclude")},this.setForcedTreatment=function(a){RR.set.call(this,a,"forcedTreatment")},this.setMVTForcedTreatment=function(a){RR.set.call(this,a,"mvtforcedTreatment")},this.setPageBrand=function(a){RR.set.call(this,a,"brand")},this.setImageServer=function(a){RR.set.call(this,a,"imageServer")},this.setRegionId=function(a){RR.set.call(this,a,"regionId")},this.setLanguage=function(a){RR.set.call(this,a,"language")},this.setCurrency=function(a){RR.set.call(this,a,"currency")},this.setRegistryId=function(a){RR.set.call(this,a,"registryId")},this.setRegistryType=function(a){RR.set.call(this,a,"registryType")},this.setSessionId=function(a){RR.set.call(this,a,"sessionId")},this.setUserId=function(a){RR.set.call(this,a,"userId")},this.useDummyData=function(){RR.set.call(this,!0,"dummyDataUsed"),RR.set.call(this,!0,"displayModeForced")},this.RICHSORT={paginate:function(a,c){b.startRow=a,b.count=c},filterPrice:function(a){b.priceRanges=a||[]},filterAttribute:function(a,c){b.filterAttributes[a]=c}},this.initFromParams=function(){var a=RR.checkParamCookieValue("RR Environment","r3_env","r3_envCookie","r3_env");if(a&&""!==a){var b=(0===this.baseUrl.toLowerCase().indexOf("https://")?"https://":"http://")+a+".richrelevance.com/rrserver/";RR.set.call(this,b,"baseUrl")}if(RR.lc("r3_forceDisplay=true")&&(RR.set.call(this,!0,"debugMode"),RR.set.call(this,!0,"displayModeForced")),RR.lc("r3_forceDev=true")&&(RR.set.call(this,!0,"debugMode"),RR.set.call(this,!0,"devModeForced")),RR.lc("r3_rad=true")){RR.set.call(this,!0,"debugMode"),RR.set.call(this,!0,"devModeForced"),RR.set.call(this,!0,"rad");var c=RR.pq("r3_radLevel");""!==c&&RR.set.call(this,c,"radLevel")}RR.lc("r3_useDummyData=true")&&(RR.set.call(this,!0,"debugMode"),RR.set.call(this,!0,"dummyDataUsed"),RR.set.call(this,!0,"devModeForced"));var d=RR.pq("r3_forcedTreatment");d&&""!==d&&RR.set.call(this,d,"forcedTreatment");var e=RR.checkParamCookieValue("RR MVT Treatment","r3_mvtTreatmentId","r3_mvtCookie","r3_mvtTreatmentId");e&&""!==e&&RR.set.call(this,e,"mvtforcedTreatment");var f=RR.pq("r3_ftp");f&&""!==f&&RR.set.call(this,f,"forcedFtp");var g=RR.pq("r3_responseDetails");g&&""!==g&&RR.set.call(this,g,"rap"),RR.lc("r3_debugMode=true")?RR.set.call(this,!0,"debugMode"):RR.lc("r3_debugMode=false")&&RR.set.call(this,!1,"debugMode"),RR.lc("rr_vg=")&&RR.set.call(this,RR.pq("rr_vg"),"viewGuid"),RR.lc("rm=")&&RR.set.call(this,RR.pq("rm"),"fromRichMail"),RR.lc("rr_u=")&&RR.set.call(this,RR.pq("rr_u"),"userId")},this.createScript=function(a,c,d){var e,f,g,h,i,j,k,l,m="",n=[],o=[],p=0,q=new Date;if(this.initFromParams(),a=this.baseUrl+this.jsFileName+"?a="+encodeURIComponent(this.apiKey)+"&ts="+q.getTime()+"&v="+rr_v+(0===this.baseUrl.toLowerCase().indexOf("https://")?"&ssl=t":"")+a,this.placementTypes?a+="&pt="+encodeURIComponent(this.placementTypes):d&&(this.addPlacementType(d),a+="&pt="+encodeURIComponent(d),a+="&pte=t"),this.userId&&(a+="&u="+encodeURIComponent(this.userId)),this.sessionId&&(a+="&s="+encodeURIComponent(this.sessionId)),this.viewGuid&&""!==this.viewGuid&&(a+="&vg="+encodeURIComponent(this.viewGuid)),this.segments&&(a+="&sgs="+encodeURIComponent(this.segments)),this.channel&&(a+="&channelId="+encodeURIComponent(this.channel)),this.clickthruServer&&(a+="&cts="+encodeURIComponent(this.clickthruServer)),this.imageServer&&(a+="&imgsrv="+encodeURIComponent(this.imageServer)),this.addedToCartItemIds&&(a+="&atcid="+encodeURIComponent(this.addedToCartItemIds)),this.cartValue&&(a+="&cv="+encodeURIComponent(this.cartValue)),this.forcedTreatment&&""!==this.forcedTreatment&&(a+="&ftr="+encodeURIComponent(this.forcedTreatment)),this.mvtforcedTreatment&&""!==this.mvtforcedTreatment&&(a+="&mvt_ftr="+encodeURIComponent(this.mvtforcedTreatment)),this.forcedFtp&&""!==this.forcedFtp&&(a+="&ftp="+encodeURIComponent(this.forcedFtp)),this.rap&&""!==this.rap&&(a+="&rap="+encodeURIComponent(this.rap)),this.fromRichMail&&""!==this.fromRichMail&&(a+="&rm="+encodeURIComponent(this.fromRichMail)),this.categoryHintIds&&(a+="&chi="+encodeURIComponent(this.categoryHintIds)),this.brand&&(a+="&fpb="+encodeURIComponent(this.brand)),this.filterBrands&&(a+="&filbr="+encodeURIComponent(this.filterBrands)),this.filterBrandsInclude&&(a+="&filbrinc="+encodeURIComponent(this.filterBrandsInclude)),this.filterCategories&&(a+="&filcat="+encodeURIComponent(this.filterCategories)),this.filterCategoriesInclude&&(a+="&filcatinc="+encodeURIComponent(this.filterCategoriesInclude)),this.clickthruParams&&(a+="&ctp="+encodeURIComponent(this.clickthruParams)),this.regionId&&(a+="&rid="+encodeURIComponent(this.regionId)),this.language&&(a+="&language="+encodeURIComponent(this.language)),this.currency&&(a+="&currency="+encodeURIComponent(this.currency)),this.filters&&(a+="&if="+encodeURIComponent(this.filters)),this.refinements&&(a+="&rfm="+encodeURIComponent(this.refinements),this.doRefinementsFallback&&(a+="&rfb="+encodeURIComponent(this.doRefinementsFallback))),typeof this.rad!=RR.U&&(a+="&rad=t"),typeof this.radLevel!=RR.U&&(a+="&radl="+encodeURIComponent(this.radLevel)),typeof this.context!=RR.U)for(e in this.context)if(f=this.context[e],a+="&"+e+"=",RR.isArray(f))a+=encodeURIComponent(f.join("|"));else if(f===Object(f)){g=[],h="";for(i in f)h=i+":",h+=RR.isArray(f[i])?f[i].join(";"):f[i],g.push(h);a+=encodeURIComponent(g.join("|"))}else a+=encodeURIComponent(f);if(this.registryId&&(a+="&rg="+encodeURIComponent(this.registryId)),this.registryType&&(a+="&rgt="+encodeURIComponent(this.registryType)),typeof this.searchTerms!=RR.U&&(a+="&st="+encodeURIComponent(this.searchTerms)),this.jsonCallback&&(a+="&jcb="+encodeURIComponent(this.jsonCallback)),this.blockeditemIds&&(a+="&bi="+encodeURIComponent(this.blockeditemIds)),this.itemIds&&(a+="&p="+encodeURIComponent(this.itemIds)),b.startRow>0&&(a+="&rssr="+encodeURIComponent(b.startRow)),b.count>0&&(a+="&rsrc="+encodeURIComponent(b.count)),"undefined"!=typeof b.priceRanges&&b.priceRanges.length>0){for(j=b.priceRanges.length;p<j;p+=1)o.push(b.priceRanges[p].join(";"));a+="&rspr="+encodeURIComponent(o.join("|"))}for(k in b.filterAttributes)n.push(k+":"+b.filterAttributes[k].join(";"));return n.length>0&&(a+="&rsfoa="+encodeURIComponent(n.join("|"))),this.debugMode&&(this.displayModeForced&&this.displayModeForced===!0&&(a+="&fdm=t"),this.devModeForced&&this.devModeForced===!0&&(a+="&dev=t"),this.dummyDataUsed&&this.dummyDataUsed===!0&&(a+="&udd=t")),""!==RR.d.referrer&&typeof RR.d.referrer!=RR.U?m=RR.d.referrer:""!==RR.d.referer&&typeof RR.d.referer!=RR.U&&(m=RR.d.referer),""!==m&&(a+="&pref="+encodeURIComponent(m)),l=RR.c("rr_rcs"),l.length&&(a+="&rcs="+l),a+="&l=1"}}function r3_placement(a){var b="rr_placement_"+rr_placement_place_holders.length;$('div.rrPlacement').first().attr('id','rr_placement_' + rr_placement_place_holders.length).removeClass('rrPlacement');rr_placement_place_holders.push({elementId:b,placementType:a})}function r3(a,b,c){typeof c!=RR.U&&c||RR.js()}function rr_flush_onload(){RR.onloadCalled||(RR.onloadCalled=!0,rr_onload_called=!0,rr_flush())}function rr_flush(){}function rr_insert_placement(a,b){RR.insert(a,b,rr_placements)}var rr_v="1.2.3.20170406",rr_onload_called=!1,rr_placements=[],rr_placement_place_holders=[],RR,r3_home,r3_error,r3_personal,r3_brand,R3_COMMON;r3_home=r3_generic,r3_error=r3_generic,r3_personal=r3_generic,r3_brand=r3_generic,RR=function(){function a(b,c){var d,e=b.cloneNode(!1);if("SCRIPT"===e.nodeName)e.text=b.innerHTML,c.appendChild(e);else if("#text"===e.nodeName)c.appendChild(e);else for(c.appendChild(e),d=0;d<b.childNodes.length;d++)a(b.childNodes[d],e)}function b(a){var b=document.createElement("script");b.type="text/javascript",b.charset=RR.charset,b.src=a,b.async=!0,document.getElementsByTagName("head")[0].appendChild(b)}function c(a){var b=a.split(".").reverse(),c=b.length;return c>=3&&b[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)?b[2]+"."+b[1]+"."+b[0]:b[1]+"."+b[0]}return{U:"undefined",charset:"UTF-8",rcsCookieDefaultDuration:730,setCharset:function(a){RR.charset=a},isArray:function(a){return"[object Array]"==Object.prototype.toString.call(a)},fixName:function(a){var b=String(a);return b.indexOf("&amp;")>-1&&(b=b.replace(/&amp;/g,"&")),b.indexOf("&#039;")>-1&&(b=b.replace(/&#039;/g,"'")),b},l:location.href,d:document,c:function(a,b,d,e){if(typeof b==RR.U||null===b){if(d!=-1){if(RR.d.cookie.length>0)for(var f=RR.d.cookie.split(";").reverse(),g=0,h=f.length;g<h;g++){var i=f[g];i="function"==typeof i.trim?i.trim():i.replace(/^\s+|\s+$/g,"");var j=i.indexOf(a+"=");if(0===j){j=j+a.length+1;var k=i.length;return unescape(i.substring(j,k))}}return""}RR.d.cookie=a+"=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT"}else if(d){var l=new Date,m=e?c(window.location.hostname):"";l=new Date(l.getTime()+1e3*d*60*60*24),RR.d.cookie=a+"="+escape(b)+";path=/;domain="+m+";expires="+l.toUTCString()}else RR.d.cookie=a+"="+escape(b)},id:function(a){return RR.d.getElementById(a)},lc:function(a){if(a.indexOf("=")===-1&&(a+="="),a.indexOf("?")===-1&&a.indexOf("&")===-1){var b=RR.l.indexOf("?"+a);return b===-1&&(b=RR.l.indexOf("&"+a)),b!==-1}return RR.l.indexOf(a)!==-1},ol:function(a){if("function"!=typeof window.onload)window.onload=a;else{if(typeof window.rr_onloads==RR.U){var b=window.onload;window.rr_onloads=[b],window.onload=function(a){for(;window.rr_onloads.length>0;){var b=window.rr_onloads.shift();b&&"function"==typeof b&&b.call(window,a)}}}window.rr_onloads.push(a)}},pq:function(a){var b=RR.l.indexOf("?"+a+"=");b==-1&&(b=RR.l.indexOf("&"+a+"="));var c;if(b!==-1){b++;var d=RR.l.indexOf("&",b);c=d!=-1?RR.l.substring(b+a.length+1,d):RR.l.substring(b+a.length+1,RR.l.length)}else c="";return c},debugWindow:function(a){var b=RR.d.createElement("DIV");b.innerHTML=a,b.style.position="absolute",b.style.top="0px",b.style.right="0px",b.style.zIndex="10000",b.style.width="200px",b.style.border="2px solid black",b.style.padding="5px",b.style.background="#DDD",RR.d.body.insertBefore(b,RR.d.body.firstChild)},jsonCallback:function(a){},defaultCallback:function(b){var c,d,e,f,g,h,i,j,k=b.placements,l=rr_placement_place_holders;for(h=0;h<l.length;h++)if(g=!1,c=RR.id(l[h].elementId),c&&typeof c!=RR.U)for(i=0;i<k.length;i++)if(!k[i].used&&k[i].placementType==l[h].placementType){if(k[i].placeholderIndex=h,k[i].used=!0,k[i].html.indexOf("<script")==-1?(c.innerHTML=k[i].html,g=!0):RR.d.implementation.hasFeature("Range","2.0")&&RR.d.createRange&&(e=RR.d.createRange(),e.selectNodeContents&&e.createContextualFragment&&e.detach&&(e.selectNodeContents(c),f=e.createContextualFragment(k[i].html),c.appendChild(f),e.detach(),g=!0)),!g)for(d=RR.d.createElement("div"),d.innerHTML=k[i].html,j=0;j<d.childNodes.length;j++)a(d.childNodes[j],c);break}for(rr_placements=[],i=0;i<k.length;i++)rr_placements[i]=[k[i].used?1:0,k[i].placementType,k[i].html];if(typeof rr_remote_data!==RR.U&&rr_remote_data.length){var m=RR.rcsCookieDuration||RR.rcsCookieDefaultDuration;RR.c("rr_rcs",rr_remote_data.toString(),m,!0)}},onloadCalled:!1,js:function(a){var c="",d=!1,e="";if(typeof R3_COMMON!=RR.U&&typeof R3_COMMON.baseUrl!=RR.U&&typeof R3_COMMON.apiKey!=RR.U)return typeof R3_COMMON.placementTypes!==RR.U&&""!==R3_COMMON.placementTypes||(d=!0),typeof R3_PURCHASED!==RR.U?(e="purchase_complete_page",c=R3_PURCHASED.createScript(c)):typeof R3_CART!==RR.U?(e="cart_page",c=R3_CART.createScript(c)):typeof R3_ADDTOCART!==RR.U?(e="add_to_cart_page",c=R3_ADDTOCART.createScript(c)):typeof R3_ADDTOREGISTRY!==RR.U?(e="add_to_registry_page",c=R3_ADDTOREGISTRY.createScript(c)):typeof R3_ITEM!==RR.U?(e="item_page",c=R3_ITEM.createScript(c)):typeof R3_BRAND!==RR.U?(e="brand_page",c=R3_BRAND.createScript(c)):typeof R3_CATEGORY!==RR.U?(e="category_page",c=R3_CATEGORY.createScript(c)):typeof R3_SEARCH!==RR.U?(e="search_page",c=R3_SEARCH.createScript(c)):typeof R3_WISHLIST!==RR.U?(e="cart_page",c=R3_WISHLIST.createScript(c)):typeof R3_HOME!==RR.U?(e="home_page",c=R3_HOME.createScript(c)):typeof R3_PERSONAL!==RR.U?(e="personal_page",c=R3_PERSONAL.createScript(c)):typeof R3_GENERIC!==RR.U?(e="generic_page",c=R3_GENERIC.createScript(c)):typeof R3_ERROR!==RR.U&&(e="error_page",c=R3_ERROR.createScript(c)),c=R3_COMMON.createScript(c,d,e),a||(setTimeout(function(){b(c)},10),RR.ol(rr_flush_onload)),c},insert:function(b,c,d){var e,f,g,h,j,k;for(j=0;j<d.length;j++)if(e=!1,0===d[j][0]&&d[j][1]==c){if(d[j][0]=1,d[j][2].indexOf("<script")==-1?(b.innerHTML=d[j][2],e=!0):RR.d.implementation.hasFeature("Range","2.0")&&RR.d.createRange&&(g=RR.d.createRange(),g.selectNodeContents&&g.createContextualFragment&&g.detach&&(g.selectNodeContents(b),h=g.createContextualFragment(d[j][2]),b.appendChild(h),g.detach(),e=!0)),!e)for(f=RR.d.createElement("div"),f.innerHTML=d[i][2],k=0;k<f.childNodes.length;k++)a(f.childNodes[k],b);return}},get:function(a){return this[a]},set:function(a,b){return this[b]=RR.fixName(a),this[b]},add:function(a,b){return typeof this[b]==RR.U&&(this[b]=""),this[b]+="|"+RR.fixName(a),this[b]},addObject:function(a,b,c){var d,e,f;(typeof this[b]==RR.U||c)&&(this[b]={});for(d in a)if(e=a[d],void 0===this[b][d])this[b][d]=e;else if(this[b][d]===Object(this[b][d])&&e===Object(e))for(f in e)this[b][d][f]=e[f];else{var g=this[b][d],h=e;RR.isArray(g)||(g=[g]),RR.isArray(e)||(h=[e]),this[b][d]=g.concat(h)}},addItemId:function(a,b){var c=a;typeof b!=RR.U&&(c=c+"~"+b),RR.add.call(window.R3_COMMON,c,"itemIds")},addItemIdToCart:function(a,b){var c=a;typeof b!=RR.U&&(c=c+"~"+b),RR.add.call(this,c,"addedToCartItemIds")},addSearchTerm:function(a){RR.add.call(window.R3_COMMON,a,"searchTerms")},genericAddItemPriceQuantity:function(a,b,c,d,e){typeof c==RR.U&&(c=0),typeof e==RR.U&&(e=-1),e=String(e),e.indexOf(".")!=-1&&(e=e.substring(0,e.indexOf("."))),RR.addItemId.call(this,a,b),RR.add.call(this,c,d),RR.add.call(this,e,"quantities")},addItemIdCentsQuantity:function(a,b,c,d){RR.genericAddItemPriceQuantity.call(this,a,d,b,"purchasesCents",c)},addItemIdDollarsAndCentsQuantity:function(a,b,c,d){RR.genericAddItemPriceQuantity.call(this,a,d,b,"purchasesDollarsAndCents",c)},addItemIdPriceQuantity:function(a,b,c,d){RR.genericAddItemPriceQuantity.call(this,a,d,b,"purchasesPrice",c)},checkParamCookieValue:function(a,b,c,d){var e=RR.pq(b),f=RR.pq(c),g=new RegExp("^\\w+$");if(g.test(e))return"session"===f?RR.c(d,e):isNaN(parseInt(f))?RR.c(d,null,-1):RR.c(d,e,f),RR.debugWindow(a+' set to "'+e+'".'),e;if(e=RR.c(d),e&&g.test(e)){if("remove"!==mvtCookie)return RR.debugWindow(a+' set to "'+e+'". To remove from cookie, add '+c+"=remove to your query parameters."),e;RR.c(d,null,-1)}return null}}}();/* complete : /javascript/common/p13n-1.2.js*/


/* combine : /javascript/common/jdwAffinities.js*/
var titleFunctions = [];
var placements = new Array();
var placementsArray = new Array();
var mobilePlacementIndex=0;
var mobileLastPlacementIndex=0;
var celvar_automatedAffinitiesSource = "rr";;
var insideClickthrough = false;
var localClickthrough;
var RR_pageId;
var R3_COMMON;
var R3_HOME;
var R3_ITEM;
var R3_SEARCH;
var R3_CATEGORY;
var R3_CART;
var R3_PURCHASED;
if(typeof isPdpAffinities == "undefined"){
	isPdpAffinities = false;
}
var currency = "&pound;";
if(typeof dataLayer != "undefined"){
	if( dataLayer[0].Currency === 'EUR'){
		currency="&euro;";
	}
}
var calledBefore = 0;
var offset = 0;

var automatedAffinitiesCallbackReceived = false;
var automatedAffinitiesSupplied = false;
var automatedAffinitiesDocumentReadyFired = false;

var noOfPlacements = 0;
if(typeof manualAffinityProducts != "undefined") {
	noOfPlacements = 1;
}

function jdwAffinitiesDisplayedOnPage() {
	celvar_automatedAffinitiesSource = "jdw";
}

function PlacementProduct(productCode, clickUrl) {
	this.productCode = productCode;
	this.clickUrl = clickUrl;
}

function Placement(index, strategy) {
	this.addProduct = function (product) {
		this.products[product.productCode] = product;
		this.productArray.push(product);
	};
	this.index = index;
	this.strategy = strategy;
	this.products = {};
	this.productArray = new Array();
	this.fragments = "";
	this.placementId = "#rr_placement_" + index;
}

// boolean tracks the first time that we create the click handler for RR carousel clicks as pages
// which refresh their content via ajax (category pages) will call processAffinities each time
// leading to several click handlers stacking up which breaks things.
var clicksDelegated = false;
function processAffinities(affinityData) {
	if(typeof useRetainedRRRecs != 'undefined' && !useRetainedRRRecs) {
		// Store the new RR recommendations via ajax
		RR_storeRRRecommendations(affinityData);
	}
	automatedAffinitiesCallbackReceived = true;
	
	// Add position information to manual affinities carousel for celebrus tracking
	noOfPlacements = noOfPlacements + affinityData.length;
	if(typeof manualAffinityProducts != "undefined") {
		$('#jdw-rr-slider-holder-manual1').attr('name', '1of'+noOfPlacements);
	}
	
	automatedAffinitiesSupplied = affinityData.length > 0;
	if (automatedAffinitiesSupplied) {
		//If page reloads rapidly due to ajax we can end up with more placements returned from RR than
		//we have slots to put them in.
		// This ensures that we only use the most recent results returned.
		if (calledBefore>0){
			offset= (affinityData.length/(++calledBefore));
			affinityData = affinityData.slice(offset);
		}
		placementsArray = affinityData;
		placements.length=0;
		//placements is still used in a few places, have to phase it out in next release.
		for (var placementIndex = 0; placementIndex < affinityData.length; placementIndex++) {
			var currentPlacement = new Placement(placementIndex, affinityData[placementIndex].message);
			placements.push(currentPlacement);
			var placementItemCount = affinityData[placementIndex].items.length;
			// On mobile, show the accordion if there are items to show in in
			if(placementItemCount > 0) {
				$("#affinityWrapper"+(placementIndex+1)).removeClass("beforeResponse");
			}
			for (var itemIndex = 0; itemIndex < placementItemCount; itemIndex++) {
				var productCode = affinityData[placementIndex].items[itemIndex].itemId;
				var clickUrl = affinityData[placementIndex].items[itemIndex].url;
				var placementProduct = new PlacementProduct(productCode, clickUrl);
				currentPlacement.addProduct(placementProduct);
			}
			if(!isPdpAffinities){
				requestFragments(placementIndex);	
			}
		}
		if(isPdpAffinities){
			$.each(affinityData, function (index, affinity){
				//process the items in the array and display in the relevant slots.
				if(affinity.placement_name == 'item_page.rr1'){
					addResponsiveAffinities(1,affinity.items, affinity.message);
				}else if (affinity.placement_name == 'item_page.rr2'){
					addResponsiveAffinities(2,affinity.items, affinity.message);
				}else if (affinity.placement_name == 'item_page.rr3'){
					addResponsiveAffinities(3,affinity.items, affinity.message);
				}else if (affinity.placement_name == 'item_page.mobile_rr2'){
					addMobileAffinities(1,affinity.items, affinity.message,0);
				}else if (affinity.placement_name == 'item_page.mobile_rr3'){
					addMobileAffinities(2,affinity.items, affinity.message,0);
				}else if(affinity.placement_name === "add_to_cart_page.rr1"){
					buildPostAddtoBagSlider(affinity.items, affinity.message);
				}else if(affinity.placement_name==='item_page.search_referrer_rr1' && searchReferrerEnabled){
					buildSearchReferrerSlider(affinity.items, affinity.message, false);
				}else if(affinity.placement_name==='item_page.mobile_search_referrer_rr1'&& searchReferrerEnabled){
					buildSearchReferrerSlider(affinity.items, affinity.message, true);
				}
			});	
		}
	} else {
		if (automatedAffinitiesDocumentReadyFired) {
			// We have not received any items from RR so they must be in listening
			// mode - therefore we need to show our own recently viewed items
			showJdwRecentlyViewedItems();
		}
	}
	
	// New handler for RR clickthroughs etc.
	if( (!clicksDelegated) && !( typeof responsive != 'undefined' && responsive )){
		var placementClass = '.rr_placement';
		$(placementClass).delegate(".productPreview a", "click", function() {
			var placement_div = $(this).parents(placementClass);
			var placement_id = placement_div.prop("id");
			var placement_index = placement_id.substring(placement_id.length-1);
			var placement = placements[placement_index];
			var id = $(this).prop("id");
			var productCode = id.substr(id.indexOf("-") + 1);
			if(!insideClickthrough) {
				insideClickthrough = true;
				$.ajax({
					url: placement.products[productCode].clickUrl
				});
				localClickthrough = $(this);
				setTimeout(function() {
					var e = jQuery.Event("click");
					if(!e.isDefaultPrevented()) {
						//Wait 200 ticks to give the RR ajax call a chance to complete before we
						//navigate away from this page.
						//nb. Suspect this runs in a separate thread and so doesn't actually delay
						//anything or do anything :-\
					}
					insideClickthrough = false;
				}, 200);
				return true;
			} else {
				return false;
			}
		});
		clicksDelegated = true;
	}
}

function addMobileAffinities(divid, itemArray, message, startAt){
	var count=0;
	var colourImages='';
	if(itemArray.length > 0){
		$.each(itemArray, function(index,item){
			if(index >= startAt){
				var url = (item.url).split("ct=");
				if(item.colour_images.trim().length >1){
					colourImages = item.colour_images.split(",");	
				}
				var divtag = '<div id="celid_cms3r3_affinities_pos-'+index+'_item-'+item.itemId+'" class="two-col-grid">';
				divtag += '<div class="productFragment productPreview" itemscope="" itemtype="http://schema.org/Product" itemid="'+item.itemId+'">';
				divtag += '<meta content="'+item.name+'" itemprop="name"><meta itemprop="sku" content="'+item.itemId+'">';
				divtag += '<a id="image-'+item.itemId+'" data-jdw-test-id="productCode_'+item.itemId+'" href="'+unescape(url[1])+'">';
				if(colourImages.length > 1 || item.colour_images.length==0){
					divtag += '<div id="prodItem"><img src="'+item.image+'" alt="'+item.name+'" itemprop="image"></div>';	
				}else{
					var colourImage = colourImages[0].split("|");
					divtag += '<div id="prodItem"><img src="'+colourImage[1]+'" alt="'+item.name+'" itemprop="image"></div>';
				}
				divtag += '<div class="productInfo">';
				divtag += '<h3 itemprop="name">'+item.name+'</h3>';
				divtag += '<p class="savePrice"></p>';
				divtag += '<p class="productPrice">'+ currency + item.saleprice+'</p>';
				divtag += '</div>';
				divtag += '</a>';
				divtag += '</div></div></div>';
				$("div#affinities"+divid).find("div.rr_placement").append(divtag);
				++count;
				return count < view_more_increment;
			}
		});
		if($("div#tab_affinity"+divid+"Details").hasClass("disabled")){
			$("div#tab_affinity"+divid+"Details").removeClass("disabled");	
		}
		$("div#affinities"+divid).css("display", "block");
		$("div#rr_placement_"+divid*1-1).css("display", "block");
		$("div#affinities"+divid).find("div.rr_placement").css("display", "block");
		if($("div#affinityWrapper0").length) {
		   divid = (divid*1)-1;
		}
		$("div#affinityWrapper"+divid).find("h2").html(message);
		$("div#affinityWrapper"+divid).css("display", "block");
	}
}

function mobileViewMorePlacements(divid, placementIndex, startAt) {
	var idstring = divid.split("-");
	addMobileAffinities(idstring[idstring.length-1], placementsArray[placementIndex].items, placementsArray[placementIndex].message, startAt);
	return (startAt+view_more_increment >= placementsArray[placementIndex].items.length
			|| startAt+view_more_increment >= 16);
}

function addResponsiveAffinities(divid, itemArray, message){
	var ulTag = '<ul id="ul-rr_placement_'+divid+'" class="jdw-rr-scroll-content"></ul>';
	var liTag = '';
	var colourImages = '';
	if(itemArray.length > 0){
		$("div#jdw-rr-slider-holder-rr"+divid).find("div.jdw-rr-productHolder").append(ulTag);
		$.each(itemArray, function(index,item){
			var url = (item.url).split("ct=");
			if(item.colour_images.trim().length >1){
				colourImages = item.colour_images.split(",");	
			}
			index=(index*1)+1;
			liTag = '<li id="celid_cms3r3_affinities_pos-'+index+'_item-'+item.itemId+'" class="productPreview" jdw-thumbnail-index="'+index+'">';
			liTag += '<div class="productPreviewTop">';
			liTag += '<a id="image-'+item.itemId+'" href="'+unescape(url[1])+'" title="'+item.name+'" class="affinityimagelink">';
			if(colourImages.length > 1 || item.colour_images.length==0){
				liTag += '<img class="jdw-rr-prodImage" src="'+item.image+'" alt="'+item.name+'"/>';
			}else{
				var colourImage = colourImages[0].split("|");
				liTag += '<img class="jdw-rr-prodImage" src="'+colourImage[1]+'" alt="'+item.name+'"/>';
			}			
			liTag += '</a>';
			if((item.rating).length>1){
				var ratingNum = getRating(item.rating);
				var ratingText = getRatingText(ratingNum);
				liTag += '<div class="jdw-rr-stars rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
				liTag += '<strong class="score '+ratingText+'" title="'+ratingNum+' out of 5 stars">Average customer rating is '+ratingNum+' out of 5 stars.</strong>';
				liTag += '</div>';	
			}else{
				liTag += '<div class="jdw-rr-stars rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"></div>';
			}
			liTag += '<div class="jdw-rr-productInfo"><h2 itemprop="name">'+item.name+'</h2></div>';
			liTag += '</div>';
			liTag += '<div class="productPreviewBottom">';
			liTag += '<div class="jdw-rr-priceInfo"><p class="jdw-rr-priceText">';
			if(item.saleprice != item.price){
				var saveprice = (item.price*1) - (item.saleprice*1) ; 
				liTag += '<p class="salePrice">Save upto '+ currency + saveprice.toFixed(2)+'</p>';
				liTag += '<p class="wasPriceFormat">was up to '+currency + item.price+'</p>';	
			}
			liTag += '<p class="productPrice">'+currency + item.saleprice+'</p>';
			liTag += '</p></div>';
			liTag += '<a id="button-'+item.itemId+'" class="jdw-rr-button" href="/shop/'+item.name+"/"+item.itemId+'/product/details/show.action?pdBoUid='+item.itemId+'" title="'+item.name+'">Shop Now</a>';
			liTag += '</div>';
			$("ul#ul-rr_placement_"+divid).append(liTag);
		});
	}
	$("div#jdw-rr-slider-holder-rr"+divid).closest(".pdp-affinities").children("h3").html(message);
	$("div#jdw-rr-slider-holder-rr"+divid).find("div.jdw-rr-productHolder").css("display", "block");
	$("div#jdw-rr-slider-holder-rr"+divid).closest(".pdp-affinities").removeClass("pdp-affinities-hidden");
	$('.jdw-rr-productHolder').each(function(index) {
		new jdw.simpleScroller().create(this, $(this).children('ul').children('li').length,  index);
	});
}

function buildSearchReferrerSlider(itemArray, message, isMobile){
    var ulTag = $("div#rr-search-referrer-container ul");
    if(isMobile){
           ulTag = $("div.rr-search-referrer-flexslider ul.slides");
    }
    var liTag = '';
    var colourImages = '';
    if(itemArray.length > 0){
           $.each(itemArray, function(index,item){
                  if(index <4){
                	    var url = (item.url).split("ct=");
                        if(item.colour_images.trim().length >1){
                               colourImages = item.colour_images.split(",");   
                        }
                        index=(index*1)+1;
                        liTag = '<li id="celid_cms3r3_affinities_pos-'+index+'_item-'+item.itemId+'" class="rr-search-referrer-column" jdw-thumbnail-index="'+index+'">';
                        liTag += '<a href="'+unescape(url[1])+'">';
                        liTag += '<div class="rr-search-referrer-content">';
                        if(colourImages.length > 1 || item.colour_images.length==0){
                               liTag += '<img src="'+item.image+'" alt="'+item.name+'"/>';
                        }else{
                               var colourImage = colourImages[0].split("|");
                               liTag += '<img src="'+colourImage[1]+'" alt="'+item.name+'"/>';
                        }
                        liTag += '<div class="rr-search-referrer-info">';
                        liTag += '<div class="rsProductName">';
                        liTag += '<span class="rr-search-referrer-product-name">'+item.name+'</span>';
                        liTag += '</div>';
                        if((item.rating).length>1){
                               var ratingNum = getRating(item.rating);
                               var ratingText = getRatingText(ratingNum);
                               liTag += '<div class="jdw-rr-stars rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
                               liTag += '<strong id="rsProductReviewStyle" class="score '+ratingText+'" title="'+ratingNum+' out of 5 stars">Average customer rating is '+ratingNum+' out of 5 stars.</strong>';
                               liTag += '</div>';   
                        }else{
                               liTag += '<div class="jdw-rr-stars rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"></div>';
                        }
                        liTag += '<div class="jdw-rr-priceInfo">';
                        if(item.saleprice != item.price){
                               var saveprice = (item.price*1) - (item.saleprice*1) ; 
                               liTag += '<p id="pSalePrice" class="salePrice">Save upto '+ currency + saveprice.toFixed(2)+'</p>';
                               liTag += '<p id="pWasPrice" class="wasPriceFormat">was up to '+currency + item.price+'</p>';   
                        }
                        liTag += '<p id="pProductPrice" class="productPrice">'+currency + item.saleprice+'</p>';
                        liTag += '</div>';
                        liTag += '</div>';
                        liTag += '</div>';
                        liTag += '</a>';
                        liTag += '</li>';
                        ulTag.append(liTag);
                  }
           });
    }
    $("h3.rr-search-referrer-title").html(message);
    $("div#rr-search-referrer-container").css("display", "block");
    if(isMobile){
    	callTheSlider();
    }
}


function callTheSlider(){
  $('.flexslider').flexslider({
    animation: "slide"
  });
}

function getRatingText(rating){
	var text = "";
	if(rating.indexOf("0.") != -1){
		text = "half";
	}else if(rating.indexOf("1.") != -1){
		text = "one";
		if( (rating*1)>1.5 ){
			text = "oneAndHalf";
		}
	}else if(rating.indexOf("2.") != -1){
		text="two";
		if( (rating*1)>2.5 ){
			text = "twoAndHalf";
		}
	}else if(rating.indexOf("3.") != -1){
		text = "three";
		if( (rating*1)>3.5 ){
			text = "threeAndHalf";
		}
	}else if(rating.indexOf("4.") != -1){
		text = "four";
		if( (rating*1)>4.5 ){
			text = "fourAndHalf";
		}
	}else if(rating.indexOf("5.") != -1){
		text = "five";
	}
	return text;
}

function getRating(ratingUrl){
	var rating = ratingUrl.split("/");
	return rating[rating.length-3];
}
//added this to fix Post addto bag slider
function buildPostAddtoBagSlider(itemArray, message){
	if(rrAffinityData === undefined){
		var productParameters = "";
		$.each(itemArray, function(index,item){
			productParameters += "&productIds=" + item.itemId;
		});
		var ajaxUrlJsonResponse = "/shop/product/ajax/OutfitAffinityProducts.action?displayPriceRanges=true&maxProducts=";
		$.ajax({
			url: ajaxUrlJsonResponse+maxProductsInCarousel + productParameters,
			dataType: "json",
			async:false,
			success: function(data){
				rrAffinityData = data.outfitMap;
				rrAffinityMessage = message;
			},
			error: function (data, status, xhr){
				if (typeof console != "undefined") {
					console.log("Error in fragment request");
				}
			},
			complete: function(){
				jdw.productDetailsOutfitBuilder.openOutfitBuilder(currentAddToBagReturnData);				
			}
		});	
	}
}


function requestFragments(placementIndex, startAt) {
	// Most calls won't provide a startAt value so default to zero
	if(typeof(startAt)==='undefined') startAt = 0;
	
	var placement = placements[placementIndex];
	var productParameters = "";
	
	if(placement.productArray.length == 0) {
		// If RR sent us nothing back don't bother going through the second ajax call to render
		// products.
		return;
	}
	
	for (var i = startAt; i < placement.productArray.length; i++) {
		productParameters += "&productIds=" + placement.productArray[i].productCode;
	}
	
	var ajaxUrl = "/shop/product/fragment/AffinityProductFragmentList.action?displayPriceRanges=true&maxProducts=";
	if(typeof responsive != 'undefined' && responsive) {
		ajaxUrl = "/shop/product/ajax/AffinityProductFragmentListResponsive.action?displayPriceRanges=true&maxProducts=";
	}
	
	var ajaxUrlJsonResponse = "/shop/product/ajax/OutfitAffinityProducts.action?displayPriceRanges=true&maxProducts=";
	
	if(placementIndex == 0) {
		$.ajax({
			url: ajaxUrlJsonResponse+maxProductsInCarousel + productParameters,
			dataType: "json",
			success: function(data){
				rrAffinityData = data.outfitMap;
				rrAffinityMessage = placements[0].strategy;
			},
			error: function (data, status, xhr){
				if (typeof console != "undefined") {
					console.log("Error in fragment request");
				}
			}

		});
	}
	
	
	$.ajax({
		url: ajaxUrl+maxProductsInCarousel + productParameters,
		success: (function (_placements, _placementIndex){
			return function (data, status, xhr){
				_placements[_placementIndex].fragments = data;
				var placementId = _placements[_placementIndex].placementId;
				if ($(placementId).length) {
					populateAutomatedAffinities(_placements, _placementIndex, startAt);
				} else {
					setTimeout(function(){
						if ($(placementId).length) {
							populateAutomatedAffinities(_placements, _placementIndex, startAt);
						} else {
							$(document).ready(function () {populateAutomatedAffinities(_placements, _placementIndex, startAt);});
						}
					}, 500);
				}
			};
		})(placements, placementIndex),
		error: function (data, status, xhr){
			if (typeof console != "undefined") {
				console.log("Error in fragment request");
			}
		}

	});
}

function setupJCarousel(carouselBase, len) {
	var minLengthForCarousel = (typeof MIN_LIST_ITEMS_FOR_JCAROUSEL !== "undefined") ? MIN_LIST_ITEMS_FOR_JCAROUSEL : 4;
	if (((typeof len !== "undefined") ? len : carouselBase.children("li").length) > minLengthForCarousel) {
		if (typeof(carouselBase.jcarousel) == "function") {
			carouselBase.jcarousel();
		}
	}
}

function processPageAffinities(placements, placementIndex) {
	var placement = placements[placementIndex];
	var affinities = $(placement.placementId).parentsUntil(".affinityWrapper", ".carouselContainer").parent();
	affinities.find("h2.carouselHeader").html(placement.strategy);
	var affinityList = affinities.find('ul');
	var affinityCount = affinityList.children("li.carouselElement").length;
	if (affinityCount) {
		if (typeof(initCarousel) == "function") {
			initCarousel(placementIndex);
		}

		affinities.show();
	}
}

function processResponsivePageAffinities(placements, placementIndex) {
	var placement = placements[placementIndex];
	var affinities = $(placement.placementId).parentsUntil(".pdp-affinities").parent();
	affinities.find('h3').html(placement.strategy);
	var posOnPage = placementIndex + 1;
	if(typeof manualAffinityProducts != "undefined") {
		posOnPage = posOnPage + 1;
	}
	$(placement.placementId).parent().attr("name", posOnPage+"of"+noOfPlacements);
	affinities.removeClass('pdp-affinities-hidden');
}

function populateAutomatedAffinities(placements, placementIndex, startAt) {
	var placement = placements[placementIndex];

	var ulTag = '<ul>';
	if(typeof responsive != 'undefined' && responsive === true) {
		ulTag = '<ul class="jdw-rr-scroll-content">';
	}
	
	if(startAt === 0) {
		$(placement.placementId).html(ulTag+placement.fragments+'</ul>').show();
	} else {
		$(placement.placementId + " ul").append(placement.fragments);
	}

	if(typeof responsive != 'undefined' && responsive) {
		processResponsivePageAffinities(placements, placementIndex);
	} else {
		processPageAffinities(placements, placementIndex);
	}
	
	// Call back to the page that the affinities have loaded.
	if(typeof(affinitiesLoaded) !== 'undefined' && affinitiesLoaded.length > placementIndex) {
		affinitiesLoaded[placementIndex](placement.productArray.length);
	}
}

function RR_init(pageId) {
	
	if (!resetForAjax()){
		return false;
	}
	RR_pageId = pageId;
	R3_COMMON = new r3_common();
	R3_COMMON.setApiKey(RR_apiKey);
	R3_COMMON.setBaseUrl(window.location.protocol+'//'+RR_server);
	R3_COMMON.setClickthruServer(window.location.protocol+'//'+window.location.host);
	R3_COMMON.setSessionId(RR_sessionId);
	R3_COMMON.setUserId(RR_userId);
	var isTablet = $('meta[name=jdw-isTablet]').attr("value") == "true";
	var isMobile = $('meta[name=jdw-isMobileDevice]').attr("value") == "true";
	var channel = RR_apiKey;
	if(isTablet) {
		channel += "-tablet";
	} else if(isMobile) {
		channel += "-mobile";
	} else {
		channel += "-desktop";
	}
	R3_COMMON.setChannel(channel);
	return true;
}

function RR_initHome() {
	if (!RR_init("home_page")){
		return false;
	};
	R3_HOME=new r3_home();
	RR_setupHome();
	r3();
}

function RR_initItem() {
	if (!RR_init("item_page")){
		return false;
	}
	R3_ITEM=new r3_item();
	R3_ITEM.setId(RR_item);
	RR_setupItem();
	r3();
}

function RR_initSearch() {
	if (!RR_init("search_page")){
		return false;
	}
	
	R3_SEARCH=new r3_search();
	R3_SEARCH.setTerms(RR_searchTerm);
	RR_setupSearch();
	r3();
}

function RR_initCategory() {
	if (!RR_init("category_page")){
		return false;
	}
	R3_CATEGORY=new r3_category();
	R3_CATEGORY.setId(RR_categoryId);
	R3_CATEGORY.setName(RR_categoryName);
	RR_setupCategory();
	r3();
}

function RR_initCart() {
	// If we have kept hold of existing recommendations, we want to load those existing rather than
	// request new ones
	if(typeof useRetainedRRRecs != 'undefined' && useRetainedRRRecs) {
		RR_loadRetainedRecommendations();
		return false;
	}
	if (!RR_init("cart_page")){
		return false;
	}
	R3_CART=new r3_cart();
	RR_setupCart();
	r3();
}

function RR_initPurchased(title) {
	if (!RR_init("purchased_page")){
		return false;
	}
	R3_PURCHASED=new r3_purchased();
	R3_PURCHASED.setOrderNumber(RR_orderNumber);
	titleFunctions['RR_setupPurchased'+title]();
	r3();
}
// Posts the Rich Relevance recommendations to the PersistRRRecommendationsAction via ajax. The
// action stores the recs as a JSON string in the session so they can be retrieved and re-displayed
// in on-screen carousels.
function RR_storeRRRecommendations(affinityData) {
	$.ajax({
		url: "/shop/viewbag/ajax/StoreRRRecommendations.action",
		data: {recommendationsJson: JSON.stringify(affinityData)},
		error: function() {
			if (typeof console != "undefined") {
				console.log("Failed to store RR recommendations.");
			}
		},
		type: "POST"
	});
}
// Makes an ajax call to the PersistRRRecommendationsAction to retrieve any Rich Relevance
// recommendations stored in the session and passes the retrieved placements array into
// processAffinities to build carousels displaying them.
function RR_loadRetainedRecommendations() {
	$.ajax({
		url: "/shop/viewbag/ajax/RetrieveRRRecommendations.action",
		success: function(data) {
			var affinityData = JSON.parse(data.recommendationsJson);
			processAffinities(affinityData);
		},
		error: function() {
			if (typeof console != "undefined") {
				console.log("Unable to retrieve stored RR recommendations.");
			}
		}
	});
}

function resetForAjax(){
	// Clear the itemObjArray as it seems to be holding onto previous placement details resulting
	// in duplicated carousels in some specific cases (i.e. when the user has no 'recently viewed'
	// items to populate the second placement)
	if(typeof itemObjArray !== "undefined") {
		itemObjArray = new Array();
	}

	rr_placement_place_holders.length=0;
	RR.onloadCalled = false;
	var makeRRCall = true;

	function getHash(){
		try{
			return History.getHash();
		}catch (error){
			return false;
		}
	}

	if (getHash()){
		//this is not the base version of the page

		if (History.stateChanged){
			//page refreshed due to ajax

		}else{
			//*Not* refreshed by ajax, page is about to be reloaded. RR call should be aborted
			makeRRCall=false;
			rr_onload_called = false;
		}
	}
	return makeRRCall;
}

function initCarousel(placementIndex) {
    setProductSlider("#rr_placement_" + placementIndex, getSliderAttributes());
    var x = 1;
}

function setProductSlider(containerSelector, slideArray) {
	var container = $(containerSelector);
	container.addClass("flexslider");
	$(containerSelector+" ul").addClass("slides");
	
	//NB. To prevent problems with revisiting pages refreshed via ajax, the flexslider library has
	//been amended slightly. Line 851 $this.removeData('flexslider'); has been added.
	//This will potentially need to be added if the flexslider library is updated beyond v2.1 
    container.flexslider({
        animation: "slide",
        direction: slideArray.direction,
        controlNav: false,
        touch: false,
        animationLoop: false,
        slideshow: false,
        itemWidth: $(containerSelector +' ul.slides > li').outerWidth(),
        itemHeight: 130,
        itemMargin: 0,
        maxItems: slideArray.items,
        move: 1
    });
    // parseInt($('.rr_placement.flexslider li.carouselElement:first-child').css('margin-right').replace('px', ''))
    setProductSliderCSS(containerSelector, slideArray);
}

function setProductSliderCSS(containerSelector, slideArray) {
	var container = $(containerSelector);
    if ($(containerSelector + " ul > li").length <= slideArray.items) {
        container.find('.flex-prev').hide();
        container.find('.flex-next').hide();
        if (!container.hasClass('inactive')) container.addClass('inactive');
    } else {
        container.find('.flex-prev').show();
        container.find('.flex-next').show();
        if (container.hasClass('inactive')) container.removeClass('inactive');
    }
}

function getSliderAttributes() {
    /* Horizontal by default */
    var direction = $(window).width() > 769 ? "horizontal" : "vertical";
    
    var items = direction == "horizontal" ? 4 : 3;
    if (typeof HORIZONTAL_OVERRIDE !== "undefined" && direction == "horizontal") {
    	items = HORIZONTAL_OVERRIDE;
    }
    if (typeof VERTICAL_OVERRIDE !== "undefined" && direction == "vertical") {
    	items = VERTICAL_OVERRIDE;
    }
    
    return {'direction' : 'horizontal', 'items' : items}; 
}

function showJdwRecentlyViewedItems() {
	if ($("#recentlyViewedContainer").length) {
		$("#recentlyViewedContainer").show();
	} else if ($("#recentlyViewedItems").length) {
		$("#recentlyViewedItems").show();
	}
}

function mobileViewMore(placementIndex, startAt) {
	requestFragments(placementIndex, startAt);
	// Return value, true means there are no more fragments left and the view more button should
	// be disabled.
	return (startAt+view_more_increment >= placements[placementIndex].productArray.length
			|| startAt+view_more_increment >= 16);
}

$(document).ready(function() {
	if (automatedAffinitiesCallbackReceived
		&& !automatedAffinitiesSupplied) {
		// We have not received any items from RR so they must be in listening
		// mode - therefore we need to show our own recently viewed items
		showJdwRecentlyViewedItems();
	}
	automatedAffinitiesDocumentReadyFired = true;
});


// Mobile manual affinities details to allow view more for manual
//Expect an array manualAffinityProducts containing product ids to be defined on the page.
var fragments;
var manualPlacementId = '#manual_placement_0';
function requestManualFragments(startAt) {
	// Most calls won't provide a startAt value so default to zero
	if(typeof(startAt)==='undefined') startAt = 0;
	
	var productParameters = "";
	for (var i = startAt; i < manualAffinityProducts.length; i++) {
		productParameters += "&productIds=" + manualAffinityProducts[i];
	}
	$.ajax({
		url: "/shop/product/fragment/AffinityProductFragmentList.action?displayPriceRanges=true&maxProducts="+maxProductsInCarousel + productParameters,
		success: (function (data, status, xhr){
			fragments = data;
			if ($(manualPlacementId).length) {
				populateManualAffinities(startAt);
			} else {
				setTimeout(function(){
					if ($(manualPlacementId).length) {
						populateManualAffinities(startAt);
					} else {
						$(document).ready(function () {populateManualAffinities(startAt);});
					}
				}, 500);
			}
		}),
		error: function (data, status, xhr){
			if (typeof console != "undefined") {
				console.log("Error in fragment request");
			}
		}
	});
}

function populateManualAffinities(startAt) {
	if(startAt === 0) {
		$(manualPlacementId).html('<ul>'+fragments+'</ul>').show();
	} else {
		$(manualPlacementId + " ul").append(fragments);
	}
}

function manualViewMore(startAt) {
	requestManualFragments(startAt);
	// Return value, true means there are no more fragments left and the view more button should
	// be disabled.
	return (startAt+view_more_increment >= manualAffinityProducts.length
			|| startAt+view_more_increment >= 16);
}/* complete : /javascript/common/jdwAffinities.js*/


/* combine : /javascript/common/libraries/modernizr.custom.min.js*/

window.Modernizr=(function(window,document,undefined){var version='2.8.3',Modernizr={},enableClasses=true,docElement=document.documentElement,mod='modernizr',modElem=document.createElement(mod),mStyle=modElem.style,inputElem=document.createElement('input'),smile=':)',toString={}.toString,prefixes=' -webkit- -moz- -o- -ms- '.split(' '),omPrefixes='Webkit Moz O ms',cssomPrefixes=omPrefixes.split(' '),domPrefixes=omPrefixes.toLowerCase().split(' '),ns={'svg':'http://www.w3.org/2000/svg'},tests={},inputs={},attrs={},classes=[],slice=classes.slice,featureName,injectElementWithStyles=function(rule,callback,nodes,testnames){var style,ret,node,docOverflow,div=document.createElement('div'),body=document.body,fakeBody=body||document.createElement('body');if(parseInt(nodes,10)){while(nodes--){node=document.createElement('div');node.id=testnames?testnames[nodes]:mod+(nodes+1);div.appendChild(node);}}
style=['&#173;','<style id="s',mod,'">',rule,'</style>'].join('');div.id=mod;(body?div:fakeBody).innerHTML+=style;fakeBody.appendChild(div);if(!body){fakeBody.style.background='';fakeBody.style.overflow='hidden';docOverflow=docElement.style.overflow;docElement.style.overflow='hidden';docElement.appendChild(fakeBody);}
ret=callback(div,rule);if(!body){fakeBody.parentNode.removeChild(fakeBody);docElement.style.overflow=docOverflow;}else{div.parentNode.removeChild(div);}
return!!ret;},testMediaQuery=function(mq){var matchMedia=window.matchMedia||window.msMatchMedia;if(matchMedia){return matchMedia(mq)&&matchMedia(mq).matches||false;}
var bool;injectElementWithStyles('@media '+mq+' { #'+mod+' { position: absolute; } }',function(node){bool=(window.getComputedStyle?getComputedStyle(node,null):node.currentStyle)['position']=='absolute';});return bool;},isEventSupported=(function(){var TAGNAMES={'select':'input','change':'input','submit':'form','reset':'form','error':'img','load':'img','abort':'img'};function isEventSupported(eventName,element){element=element||document.createElement(TAGNAMES[eventName]||'div');eventName='on'+eventName;var isSupported=eventName in element;if(!isSupported){if(!element.setAttribute){element=document.createElement('div');}
if(element.setAttribute&&element.removeAttribute){element.setAttribute(eventName,'');isSupported=is(element[eventName],'function');if(!is(element[eventName],'undefined')){element[eventName]=undefined;}
element.removeAttribute(eventName);}}
element=null;return isSupported;}
return isEventSupported;})(),_hasOwnProperty=({}).hasOwnProperty,hasOwnProp;if(!is(_hasOwnProperty,'undefined')&&!is(_hasOwnProperty.call,'undefined')){hasOwnProp=function(object,property){return _hasOwnProperty.call(object,property);};}
else{hasOwnProp=function(object,property){return((property in object)&&is(object.constructor.prototype[property],'undefined'));};}
if(!Function.prototype.bind){Function.prototype.bind=function bind(that){var target=this;if(typeof target!="function"){throw new TypeError();}
var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var F=function(){};F.prototype=target.prototype;var self=new F();var result=target.apply(self,args.concat(slice.call(arguments)));if(Object(result)===result){return result;}
return self;}else{return target.apply(that,args.concat(slice.call(arguments)));}};return bound;};}
function setCss(str){mStyle.cssText=str;}
function setCssAll(str1,str2){return setCss(prefixes.join(str1+';')+(str2||''));}
function is(obj,type){return typeof obj===type;}
function contains(str,substr){return!!~(''+str).indexOf(substr);}
function testProps(props,prefixed){for(var i in props){var prop=props[i];if(!contains(prop,"-")&&mStyle[prop]!==undefined){return prefixed=='pfx'?prop:true;}}
return false;}
function testDOMProps(props,obj,elem){for(var i in props){var item=obj[props[i]];if(item!==undefined){if(elem===false)return props[i];if(is(item,'function')){return item.bind(elem||obj);}
return item;}}
return false;}
function testPropsAll(prop,prefixed,elem){var ucProp=prop.charAt(0).toUpperCase()+prop.slice(1),props=(prop+' '+cssomPrefixes.join(ucProp+' ')+ucProp).split(' ');if(is(prefixed,"string")||is(prefixed,"undefined")){return testProps(props,prefixed);}else{props=(prop+' '+(domPrefixes).join(ucProp+' ')+ucProp).split(' ');return testDOMProps(props,prefixed,elem);}}
tests['flexbox']=function(){return testPropsAll('flexWrap');};tests['flexboxlegacy']=function(){return testPropsAll('boxDirection');};tests['canvas']=function(){var elem=document.createElement('canvas');return!!(elem.getContext&&elem.getContext('2d'));};tests['canvastext']=function(){return!!(Modernizr['canvas']&&is(document.createElement('canvas').getContext('2d').fillText,'function'));};tests['webgl']=function(){return!!window.WebGLRenderingContext;};tests['touch']=function(){var bool;if(('ontouchstart'in window)||window.DocumentTouch&&document instanceof DocumentTouch){bool=true;}else{injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''),function(node){bool=node.offsetTop===9;});}
return bool;};tests['geolocation']=function(){return'geolocation'in navigator;};tests['postmessage']=function(){return!!window.postMessage;};tests['websqldatabase']=function(){return!!window.openDatabase;};tests['indexedDB']=function(){return!!testPropsAll("indexedDB",window);};tests['hashchange']=function(){return isEventSupported('hashchange',window)&&(document.documentMode===undefined||document.documentMode>7);};tests['history']=function(){return!!(window.history&&history.pushState);};tests['draganddrop']=function(){var div=document.createElement('div');return('draggable'in div)||('ondragstart'in div&&'ondrop'in div);};tests['websockets']=function(){return'WebSocket'in window||'MozWebSocket'in window;};tests['rgba']=function(){setCss('background-color:rgba(150,255,150,.5)');return contains(mStyle.backgroundColor,'rgba');};tests['hsla']=function(){setCss('background-color:hsla(120,40%,100%,.5)');return contains(mStyle.backgroundColor,'rgba')||contains(mStyle.backgroundColor,'hsla');};tests['multiplebgs']=function(){setCss('background:url(https://),url(https://),red url(https://)');return(/(url\s*\(.*?){3}/).test(mStyle.background);};tests['backgroundsize']=function(){return testPropsAll('backgroundSize');};tests['borderimage']=function(){return testPropsAll('borderImage');};tests['borderradius']=function(){return testPropsAll('borderRadius');};tests['boxshadow']=function(){return testPropsAll('boxShadow');};tests['textshadow']=function(){return document.createElement('div').style.textShadow==='';};tests['opacity']=function(){setCssAll('opacity:.55');return(/^0.55$/).test(mStyle.opacity);};tests['cssanimations']=function(){return testPropsAll('animationName');};tests['csscolumns']=function(){return testPropsAll('columnCount');};tests['cssgradients']=function(){var str1='background-image:',str2='gradient(linear,left top,right bottom,from(#9f9),to(white));',str3='linear-gradient(left top,#9f9, white);';setCss((str1+'-webkit- '.split(' ').join(str2+str1)+
prefixes.join(str3+str1)).slice(0,-str1.length));return contains(mStyle.backgroundImage,'gradient');};tests['cssreflections']=function(){return testPropsAll('boxReflect');};tests['csstransforms']=function(){return!!testPropsAll('transform');};tests['csstransforms3d']=function(){var ret=!!testPropsAll('perspective');if(ret&&'webkitPerspective'in docElement.style){injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}',function(node,rule){ret=node.offsetLeft===9&&node.offsetHeight===3;});}
return ret;};tests['csstransitions']=function(){return testPropsAll('transition');};tests['fontface']=function(){var bool;injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}',function(node,rule){var style=document.getElementById('smodernizr'),sheet=style.sheet||style.styleSheet,cssText=sheet?(sheet.cssRules&&sheet.cssRules[0]?sheet.cssRules[0].cssText:sheet.cssText||''):'';bool=/src/i.test(cssText)&&cssText.indexOf(rule.split(' ')[0])===0;});return bool;};tests['generatedcontent']=function(){var bool;injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''),function(node){bool=node.offsetHeight>=3;});return bool;};tests['video']=function(){var elem=document.createElement('video'),bool=false;try{if(bool=!!elem.canPlayType){bool=new Boolean(bool);bool.ogg=elem.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,'');bool.h264=elem.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,'');bool.webm=elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');}}catch(e){}
return bool;};tests['audio']=function(){var elem=document.createElement('audio'),bool=false;try{if(bool=!!elem.canPlayType){bool=new Boolean(bool);bool.ogg=elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');bool.mp3=elem.canPlayType('audio/mpeg;').replace(/^no$/,'');bool.wav=elem.canPlayType('audio/wav; codecs="1"').replace(/^no$/,'');bool.m4a=(elem.canPlayType('audio/x-m4a;')||elem.canPlayType('audio/aac;')).replace(/^no$/,'');}}catch(e){}
return bool;};tests['localstorage']=function(){try{localStorage.setItem(mod,mod);localStorage.removeItem(mod);return true;}catch(e){return false;}};tests['sessionstorage']=function(){try{sessionStorage.setItem(mod,mod);sessionStorage.removeItem(mod);return true;}catch(e){return false;}};tests['webworkers']=function(){return!!window.Worker;};tests['applicationcache']=function(){return!!window.applicationCache;};tests['svg']=function(){return!!document.createElementNS&&!!document.createElementNS(ns.svg,'svg').createSVGRect;};tests['inlinesvg']=function(){var div=document.createElement('div');div.innerHTML='<svg/>';return(div.firstChild&&div.firstChild.namespaceURI)==ns.svg;};tests['smil']=function(){return!!document.createElementNS&&/SVGAnimate/.test(toString.call(document.createElementNS(ns.svg,'animate')));};tests['svgclippaths']=function(){return!!document.createElementNS&&/SVGClipPath/.test(toString.call(document.createElementNS(ns.svg,'clipPath')));};function webforms(){Modernizr['input']=(function(props){for(var i=0,len=props.length;i<len;i++){attrs[props[i]]=!!(props[i]in inputElem);}
if(attrs.list){attrs.list=!!(document.createElement('datalist')&&window.HTMLDataListElement);}
return attrs;})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));Modernizr['inputtypes']=(function(props){for(var i=0,bool,inputElemType,defaultView,len=props.length;i<len;i++){inputElem.setAttribute('type',inputElemType=props[i]);bool=inputElem.type!=='text';if(bool){inputElem.value=smile;inputElem.style.cssText='position:absolute;visibility:hidden;';if(/^range$/.test(inputElemType)&&inputElem.style.WebkitAppearance!==undefined){docElement.appendChild(inputElem);defaultView=document.defaultView;bool=defaultView.getComputedStyle&&defaultView.getComputedStyle(inputElem,null).WebkitAppearance!=='textfield'&&(inputElem.offsetHeight!==0);docElement.removeChild(inputElem);}else if(/^(search|tel)$/.test(inputElemType)){}else if(/^(url|email)$/.test(inputElemType)){bool=inputElem.checkValidity&&inputElem.checkValidity()===false;}else{bool=inputElem.value!=smile;}}
inputs[props[i]]=!!bool;}
return inputs;})('search tel url email datetime date month week time datetime-local number range color'.split(' '));}
for(var feature in tests){if(hasOwnProp(tests,feature)){featureName=feature.toLowerCase();Modernizr[featureName]=tests[feature]();classes.push((Modernizr[featureName]?'':'no-')+featureName);}}
Modernizr.input||webforms();Modernizr.addTest=function(feature,test){if(typeof feature=='object'){for(var key in feature){if(hasOwnProp(feature,key)){Modernizr.addTest(key,feature[key]);}}}else{feature=feature.toLowerCase();if(Modernizr[feature]!==undefined){return Modernizr;}
test=typeof test=='function'?test():test;if(typeof enableClasses!=="undefined"&&enableClasses){docElement.className+=' '+(test?'':'no-')+feature;}
Modernizr[feature]=test;}
return Modernizr;};setCss('');modElem=inputElem=null;;(function(window,document){var version='3.7.0';var options=window.html5||{};var reSkip=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;var saveClones=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;var supportsHtml5Styles;var expando='_html5shiv';var expanID=0;var expandoData={};var supportsUnknownElements;(function(){try{var a=document.createElement('a');a.innerHTML='<xyz></xyz>';supportsHtml5Styles=('hidden'in a);supportsUnknownElements=a.childNodes.length==1||(function(){(document.createElement)('a');var frag=document.createDocumentFragment();return(typeof frag.cloneNode=='undefined'||typeof frag.createDocumentFragment=='undefined'||typeof frag.createElement=='undefined');}());}catch(e){supportsHtml5Styles=true;supportsUnknownElements=true;}}());function addStyleSheet(ownerDocument,cssText){var p=ownerDocument.createElement('p'),parent=ownerDocument.getElementsByTagName('head')[0]||ownerDocument.documentElement;p.innerHTML='x<style>'+cssText+'</style>';return parent.insertBefore(p.lastChild,parent.firstChild);}
function getElements(){var elements=html5.elements;return typeof elements=='string'?elements.split(' '):elements;}
function getExpandoData(ownerDocument){var data=expandoData[ownerDocument[expando]];if(!data){data={};expanID++;ownerDocument[expando]=expanID;expandoData[expanID]=data;}
return data;}
function createElement(nodeName,ownerDocument,data){if(!ownerDocument){ownerDocument=document;}
if(supportsUnknownElements){return ownerDocument.createElement(nodeName);}
if(!data){data=getExpandoData(ownerDocument);}
var node;if(data.cache[nodeName]){node=data.cache[nodeName].cloneNode();}else if(saveClones.test(nodeName)){node=(data.cache[nodeName]=data.createElem(nodeName)).cloneNode();}else{node=data.createElem(nodeName);}
return node.canHaveChildren&&!reSkip.test(nodeName)&&!node.tagUrn?data.frag.appendChild(node):node;}
function createDocumentFragment(ownerDocument,data){if(!ownerDocument){ownerDocument=document;}
if(supportsUnknownElements){return ownerDocument.createDocumentFragment();}
data=data||getExpandoData(ownerDocument);var clone=data.frag.cloneNode(),i=0,elems=getElements(),l=elems.length;for(;i<l;i++){clone.createElement(elems[i]);}
return clone;}
function shivMethods(ownerDocument,data){if(!data.cache){data.cache={};data.createElem=ownerDocument.createElement;data.createFrag=ownerDocument.createDocumentFragment;data.frag=data.createFrag();}
ownerDocument.createElement=function(nodeName){if(!html5.shivMethods){return data.createElem(nodeName);}
return createElement(nodeName,ownerDocument,data);};ownerDocument.createDocumentFragment=Function('h,f','return function(){'+'var n=f.cloneNode(),c=n.createElement;'+'h.shivMethods&&('+
getElements().join().replace(/[\w\-]+/g,function(nodeName){data.createElem(nodeName);data.frag.createElement(nodeName);return'c("'+nodeName+'")';})+');return n}')(html5,data.frag);}
function shivDocument(ownerDocument){if(!ownerDocument){ownerDocument=document;}
var data=getExpandoData(ownerDocument);if(html5.shivCSS&&!supportsHtml5Styles&&!data.hasCSS){data.hasCSS=!!addStyleSheet(ownerDocument,'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}'+'mark{background:#FF0;color:#000}'+'template{display:none}');}
if(!supportsUnknownElements){shivMethods(ownerDocument,data);}
return ownerDocument;}
var html5={'elements':options.elements||'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video','version':version,'shivCSS':(options.shivCSS!==false),'supportsUnknownElements':supportsUnknownElements,'shivMethods':(options.shivMethods!==false),'type':'default','shivDocument':shivDocument,createElement:createElement,createDocumentFragment:createDocumentFragment};window.html5=html5;shivDocument(document);}(this,document));Modernizr._version=version;Modernizr._prefixes=prefixes;Modernizr._domPrefixes=domPrefixes;Modernizr._cssomPrefixes=cssomPrefixes;Modernizr.mq=testMediaQuery;Modernizr.hasEvent=isEventSupported;Modernizr.testProp=function(prop){return testProps([prop]);};Modernizr.testAllProps=testPropsAll;Modernizr.testStyles=injectElementWithStyles;Modernizr.prefixed=function(prop,obj,elem){if(!obj){return testPropsAll(prop,'pfx');}else{return testPropsAll(prop,obj,elem);}};docElement.className=docElement.className.replace(/(^|\s)no-js(\s|$)/,'$1$2')+
(enableClasses?' js '+classes.join(' '):'');return Modernizr;})(this,this.document);/* complete : /javascript/common/libraries/modernizr.custom.min.js*/


/* combine : /javascript/common/celebrus/celebrusHelper.js*/
/*
 * The following functions aid in the creation of Celebrus data tags.
 *
 */
//Function to set up object and pass it to the CSA
function reportAddToBasket(addedProductID, addedValue, addedCurrency,
                        displayName, skuNum, addedQuantity, valueIsPerItem)
{
    var eventObj = new Object();
    eventObj.action = "add";
    eventObj.productID = addedProductID;
    eventObj.value = addedValue;
    eventObj.currency = addedCurrency;
    eventObj.productDisplayName = displayName;
    eventObj.skuNumber = skuNum;
    eventObj.quantity = addedQuantity;
    eventObj.valuePerItem = valueIsPerItem;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Failed to add to basket.
function reportFailedToAddToBasket(addedProductID)
{
    var eventObj = new Object();
    eventObj.action = "failedAdd";
    eventObj.productID = addedProductID;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Amend basket entry.
function reportAmendBasket(amendedProductID, updatedQuantity)
{
    var eventObj = new Object();
    eventObj.action = "amend";
    eventObj.productID = amendedProductID;
    eventObj.newQuantity = updatedQuantity;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Remove basket entry.
function reportRemoveBasketItem(removedProductID)
{
    var eventObj = new Object();
    eventObj.action = "remove";
    eventObj.productID = removedProductID;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Basket total.
function reportBasketTotal(basketTotalVal, basketCurrency)
{
    var eventObj = new Object();
    eventObj.action = "basketTotal";
    eventObj.totalValue = basketTotalVal;
    eventObj.currency = basketCurrency;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Basket Purchased.
function reportPurchase(orderNum, basketTotalVal, basketCurrency)
{
    var eventObj = new Object();
    eventObj.action = "purchase";
    eventObj.orderNumber = orderNum;
    eventObj.totalValue = basketTotalVal;
    eventObj.currency = basketCurrency;
    if(window.JDWevent)
        window.JDWevent(eventObj);
}

//Report 'To Follow' message displayed.
function reportToFollowMessage(productID, toFollowPeriod, value, currency)
{
    var targetObj = new Object();
    targetObj.name = "toFollowMessage";
    targetObj.id = productID + '_' + toFollowPeriod;
    targetObj.value = value + '|' + currency;
    targetObj.tagName = 'DIV';
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report substitute product suggested.
function reportSubstituteProductSuggested(originalProductID, value, currency, substituteProductID)
{
    var targetObj = new Object();
    targetObj.name = "substituteProductSuggested";
    targetObj.id = originalProductID + '_' + substituteProductID;
    targetObj.value = value + '|' + currency;
    targetObj.tagName = 'DIV';
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report that one of the alternative images on the product details page has been clicked.
function reportAltImageClick(productID, alternateImageID)
{
    var targetObj = new Object();
    targetObj.name = "alternativeProductDetailsImageClicked";
    targetObj.id = productID;
    targetObj.value = alternateImageID;
    targetObj.tagName = 'DIV';
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report that the main images have been swapped between.
function reportAltImageDisplayed(productID, alternateImageID)
{
    var targetObj = new Object();
    targetObj.name = "alternativeProductDetailsImageChanged";
    targetObj.id = productID;
    targetObj.value = alternateImageID;
    targetObj.tagName = 'DIV';
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report that a product has been added to the wish-list.
function reportAddToWishlistClick(productID)
{
    var targetObj = new Object();
    targetObj.name = "addedToWishlist";
    targetObj.id = productID;
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report personal account protection page click.
function reportPAPPageClick(pageName)
{
    var targetObj = new Object();
    targetObj.id = "stid_paptrans_" + pageName;
    targetObj.name = "stid_paptrans";
    targetObj.value = pageName;
    targetObj.tagName = 'DIV';
    if(window.JDWclick)
        window.JDWclick(targetObj);
}

//Report a click on Amplience Functionality. Captured using the Amplience invokeTenCMSEvent JS
//function in Amplience.html.
function reportAmplienceClick(amplienceEventObject) {
    var targetObj = new Object();
    url = $.trim(amplienceEventObject.url);
    
    targetObj.name = url;
    targetObj.href = url;
    targetObj.value = url;
    targetObj.id = "amplienceClick";
    
    //using ^ as a separator in Celebrus, don't change without also changing Celebrus.
    targetObj.id += "^" + ($.trim(amplienceEventObject.SSID) == "" ? "undefined" : $.trim(amplienceEventObject.SSID));
    targetObj.id += "^" + ($.trim(amplienceEventObject.element) == "" ? "undefined" : $.trim(amplienceEventObject.element));
    targetObj.id += "^" + ($.trim(amplienceEventObject.eventName) == "" ? "undefined" : $.trim(amplienceEventObject.eventName));
    targetObj.id += "^" + ($.trim(amplienceEventObject.moduleID) == "" ? "undefined" : $.trim(amplienceEventObject.moduleID));
    targetObj.id += "^" + ($.trim(amplienceEventObject.parent) == "" ? "undefined" : $.trim(amplienceEventObject.parent));
    targetObj.id += "^" + ($.trim(amplienceEventObject.value) == "" ? "undefined" : $.trim(amplienceEventObject.value));

    if (window.JDWclick)
        window.JDWclick(targetObj);
}

//Reports slider product displayed.
function reportSliderProduct(url, productId, productIndex, prefix) {
    var targetObj = new Object();
    
    targetObj.name = url;
    targetObj.href = url;
    targetObj.value = url;
    targetObj.id = prefix + "SliderProduct_" + productId + "_" + productIndex;
    
    if (window.JDWclick)
        window.JDWclick(targetObj);
}

//Create a Celebrus target object
function createTargetObj(type, category, selection, remainder, state, href) {
    var targetObj = {};
    targetObj.tagName = "DIV";
    var args = Array.prototype.slice.call(arguments);
    var length = args.length;
    targetObj.id = "celid";
    for (var i=0; i<length-1; i++){
            var val = args[i];
            if (val != null) targetObj.id = targetObj.id + "_" + $.trim(val.toLowerCase());
    }
    targetObj.name    = $.trim(href);
    targetObj.href    = $.trim(href);
    targetObj.value    = $.trim(href);
    return targetObj;
}

//Report that a single select refinement group category has been clicked
function reportSingleSelectRefinementGroupCategoryClicked(link) {
    if(window.JDWclick) {    
        var $link = $(link);
        var selection = $.trim($link.clone().children().remove(".count").end().text()).replace(/[\n\r]+\-/g, "");
        var href = document.getElementById($link.attr('id')).href;    // non jQuery so that the absolute path is retrieved consistently
        if (selection != "clear") {
            var remainder = $link.clone().children(".count").text().replace(new RegExp("[()]","gi"), "");
            var category = $link.closest(".availableFiltersContainer").prev(".refinementHeader").children("span:first").text();
            if($link.closest("ul").hasClass("checkList"))
                var state = $link.hasClass("checked") ? "off" : "on";
            else
                var state = "on";
            window.JDWclick(createTargetObj('cmslhnr', category, selection, remainder, state, href));
        }
        else {
            if($link.parent().hasClass("refinementHeader"))
                reportRefinementGroupClearClicked(link);
            else
                reportSelectedFilterClearClicked(link);
        }
    }
}

//Report that a value has been selected from the product window Sort By list
function reportSortBySelected(selected) {
    if(window.JDWclick)
        var href = window.location.protocol + '//' + window.location.host + $(selected).attr('value');    // need to construct the url because the relative path is from a value attribute rather than href
        window.JDWclick(createTargetObj("cmssb", null, $(selected).find("option:selected").text(), null, "on", href));
}

//Report that a value has been selected from the product window custom drop down Sort By list
function reportCustomDropDownSortBySelected(selected) {
    if(window.JDWclick)
        var href = window.location.protocol + '//' + window.location.host + $(selected).attr('data-jdw-link');	// need to construct the url because the relative path is from a data attribute rather than href
        window.JDWclick(createTargetObj("cmssb", null, $(selected).text(), null, "on", href));
}

//Report that a value has been selected from the product window Products Per Page list
function reportProductsPerPageSelected(selected) {
    if(window.JDWclick) {
        var href = window.location.protocol + '//' + window.location.host + $(selected).attr('value');
        var option = $(selected).find("option:selected").text().replace(" products", "");        
        window.JDWclick(createTargetObj("cmsppp", null, option, null, "on", href));
    }
}

//Report that a filtering group concertina has been clicked
function reportFilteringGroupConcertinaClicked(filterGroup) {
    if(window.JDWclick) {
        var $fg = $(filterGroup);
        window.JDWclick(createTargetObj("cmslhcon", $fg.text(), null, null, (!$fg.hasClass("active") ? "on" : "off"), null));
    }
}

//Report that a filtering group browse categories concertina has been clicked
function reportFilteringGroupBrowseCategoriesConcertinaClicked(filterGroup) {
    if(window.JDWclick) {
        var $fg = $(filterGroup);
        window.JDWclick(createTargetObj("cmsbccon", $fg.text(), null, null, (!$fg.hasClass("active") ? "on" : "off"), null));
    }
}

//Report that a navigation page link has been clicked
function reportNavPageLinkClicked(link) {
    if(window.JDWclick) {
        var $link = $(link);
        var method = link.id.substring(link.id.indexOf("-") + 1);
        var pageno;
        var href = document.getElementById($link.attr('id')).href;
        if (!href) href=document.getElementById($link.parent().attr('id')).href; // mobile
        if(method === "Next" || method === "nextResults") {
            method = "next";
            pageno = $link.parent().siblings('span.current').next().children('a:first').text();
            (pageno=="" ? pageno="na" : false);    // mobile does not identify page numbers
        } else if(method === "Prev" || method === "previousResults") {
            method = "prev";
            pageno = $link.parent().siblings('span.current').prev().children('a:first').text();
            (pageno=="" ? pageno="na" : false);
        } else {
            pageno = method;
            method = "direct";
        }
        window.JDWclick(createTargetObj("cmspn", method, pageno, null, "on", href));
    }
}

//Report that products are displayed in the shop window
function reportProductsDisplayed(productListTotal) {
    if(window.JDWclick) {
        window.JDWclick(createTargetObj("cmspl", productListTotal.toString(), null, null, "on", null));
    }
}

//Report that a price slide change has been made
function reportPriceSliderChanged(values) {
    if(window.JDWclick)
        window.JDWclick(createTargetObj("cmslhnps", "priceslider", (values[0] + "-" + values[1]), "na", "on", null));
}

//Report that the clear all link has been clicked
function reportClearAllClicked(link) {
    if(window.JDWclick){
        var $link = $(link);
        var href = document.getElementById($link.attr('id')).href;
        window.JDWclick(createTargetObj("cmslhnca", "all", "clear", "na", "off", href));
    }
}

//Report that the clear link for a refinement group has been clicked
function reportRefinementGroupClearClicked(link) {
    if(window.JDWclick){
        var $link = $(link);
        var href = document.getElementById($link.attr('id')).href;
        window.JDWclick(createTargetObj("cmslhncg", $link.prev().text(), "clear", "na", "off", href));
    }
}

//Report that the clear link for a selected filter has been clicked
function reportSelectedFilterClearClicked(link) {
    if(window.JDWclick){
        var $link = $(link);
        var href = document.getElementById($link.attr('id')).href;
        window.JDWclick(createTargetObj("cmslhncp", 
                $(link).closest("li").text().replace(new RegExp("(clear)", "gi"), ""),
                "clear", "na", "off", href));
    }
}

//Report that the clear link for a selected filter has been clicked
function reportOffCanvasSelectedFilterClearClicked(link) {
    if(window.JDWclick){
        var href = document.getElementById($(link).attr('id')).href;
        window.JDWclick(createTargetObj("cmslhncp", 
                $.trim($(link).text().replace(new RegExp(" \\(.*\\)", "gi"), "")),
                "clear", "na", "off", href));
    }
}

//Report that refine search has been clicked
function reportRefineSearchClicked(selected) {
    if(window.JDWclick) {
        var href = window.location.protocol + '//' + window.location.host + $(selected).attr('value');
        window.JDWclick(createTargetObj("cmslhnsr", $(selected).find("option:first").text(), 
                $(selected).find("option:selected").text(), "na", "on", href));
    }
}

//Report that refine search has been clicked
function reportOffCanvasRefineSearchClicked(selected) {
	if(window.JDWclick) {
		var href = window.location.protocol + '//' + window.location.host + $(selected).attr('href');
		window.JDWclick(createTargetObj("cmslhnsr", $(selected).closest("ul").attr('id').replace(new RegExp("-refinement", "gi"), ""), 
				$(selected).text().replace(new RegExp(" \\(.*\\)", "gi"), ""), "na", "on", href));
	}
}

//Report that an autocomplete text box option has been selected
function reportTextChanged(text, id, name)
{
    var targetObj = new Object();
    targetObj.name = name;
    targetObj.id = id;
    targetObj.value = text;
    targetObj.tagName = 'input';
    targetObj.type = 'text';
    if(window.JDWtextchange)
        window.JDWtextchange(targetObj);
}/* complete : /javascript/common/celebrus/celebrusHelper.js*/


/* combine : /javascript/common/celebrus/celebrusEventWriter.js*/
/*
 * The following functions aid in the creation of Celebrus events.
 *
 */
//Function to set up object and pass it to the CSA
function celReportAddToBasket(addedProductID, addedValue, addedCurrency,
                        displayName, skuNum, addedQuantity, valueIsPerItem)
{
    try {
        reportAddToBasket(addedProductID, addedValue, addedCurrency,
                        displayName, skuNum, addedQuantity, valueIsPerItem);
    } catch (err) {
    }
}

//Failed to add to basket.
function celReportFailedToAddToBasket(addedProductID)
{
    try {
        reportFailedToAddToBasket(addedProductID);
    } catch (err) {
    }
}

//Amend basket entry.
function celReportAmendBasket(amendedProductID, updatedQuantity)
{
    try {
        reportAmendBasket(amendedProductID, updatedQuantity);
    } catch (err) {
    }
}

//Remove basket entry.
function celReportRemoveBasketItem(removedProductID)
{
    try {
        reportRemoveBasketItem(removedProductID);
    } catch (err) {
    }
}

//Basket total.
function celReportBasketTotal(basketTotalVal, basketCurrency)
{
    try {
        reportBasketTotal(basketTotalVal, basketCurrency);
    } catch (err) {
    }
}

//Basket purchased.
function celReportPurchase(orderNum, basketTotalVal, basketCurrency)
{
    try {
        reportPurchase(orderNum, basketTotalVal, basketCurrency);
    } catch (err) {
    }
}

//Report 'To Follow' message displayed.
function celReportToFollowMessage(productID, toFollowPeriod, value, currency)
{
    try {
        reportToFollowMessage(productID, toFollowPeriod, value, currency);
    } catch (err) {
    }
}

//Report substitute product suggested.
function celReportSubstituteProductSuggested(originalProductID, value, currency, substituteProductID)
{
    try {
        reportSubstituteProductSuggested(originalProductID, value, currency, substituteProductID);
    } catch (err) {
    }
}

//Report that one of the alternative images on the product details page has been clicked.
function celReportAltImageClick(productID, alternateImageID)
{
    try {
        reportAltImageClick(productID, alternateImageID);
    } catch (err) {
    }
}

//Report that the main image on the product details page has been changed.
function celReportAltImageDisplayed(productID, alternateImageID)
{
    try {
        reportAltImageDisplayed(productID, alternateImageID);
    } catch (err) {
    }
}

//Report product added to wishlist.
function celReportAddToWishlist(productCode)
{
    try {
        reportAddToWishlistClick(productCode);
    } catch (err) {
    }
}

//Report personal account protection page click.
function celReportPAPPageClick(pageName)
{
    try {
        reportPAPPageClick(pageName);
    } catch (err) {
    }
}

//Report that a single select refinement group category has been clicked
function celReportSingleSelectRefinementGroupCategoryClicked(link) {
    try {
        reportSingleSelectRefinementGroupCategoryClicked(link);
    } catch (err) {
    }
}

//Report that a value has been selected from the product window Sort By list
function celReportSortBySelected(selected) {
    try {
        reportSortBySelected(selected);
    } catch (err) {
    }
}

//Report that a value has been selected from the product window custom drop down Sort By list
function celReportCustomDropDownSortBySelected(selected) {
    try {
        reportCustomDropDownSortBySelected(selected);
    } catch (err) {
    }
}

//Report that a value has been selected from the product window Products Per Page list
function celReportProductsPerPageSelected(selected) {
    try {
        reportProductsPerPageSelected(selected);
    } catch (err) {
    }
}

//Report that a filtering group concertina has been clicked
function celReportFilteringGroupConcertinaClicked(filterGroup) {
    try {
        reportFilteringGroupConcertinaClicked(filterGroup);
    } catch (err) {
    }
}

//Report that a filtering group browse categories concertina has been clicked
function celReportFilteringGroupBrowseCategoriesConcertinaClicked(filterGroup) {
    try {
        reportFilteringGroupBrowseCategoriesConcertinaClicked(filterGroup);
    } catch (err) {
    }
}

//Report that a navigation page link has been clicked
function celReportNavPageLinkClicked(link) {
    try {
        reportNavPageLinkClicked(link);
    } catch (err) {
    }
}

//Report that products are displayed in the shop window
function celReportProductsDisplayed(productListTotal) {
    try {
    	reportProductsDisplayed(productListTotal);
    } catch (err) {
    }
}

//Report that a price slide change has been made
function celReportPriceSliderChanged(values) {
    try {
        reportPriceSliderChanged(values);
    } catch (err) {
    }
}

//Report that a price slide change has been made
function celReportClearAllClicked(link) {
    try {
        reportClearAllClicked(link);
    } catch (err) {
    }
}

//Report that the clear link for a particular refinement has been clicked
function celReportRefinementGroupClearClicked(link) {
    try {
        reportRefinementGroupClearClicked(link);
    } catch (err) {
    }
}

//Report that the clear link for a refinement group has been clicked
function celReportSelectedFilterClearClicked(link) {
    try {
        reportSelectedFilterClearClicked(link);
    } catch (err) {
    }
}

//Report that the clear link for a refinement group has been clicked
function celReportOffCanvasSelectedFilterClearClicked(link) {
    try {
        reportOffCanvasSelectedFilterClearClicked(link);
    } catch (err) {
    }
}

//Report that refine search has been clicked
function celReportRefineSearchClicked(selected) {
    try {
        reportRefineSearchClicked(selected);
    } catch (err) {
    }
}

//Report that refine search has been clicked
function celReportOffCanvasRefineSearchClicked(selected) {
    try {
        reportOffCanvasRefineSearchClicked(selected);
    } catch (err) {
    }
}

//Report that an autocomplete text box option has been selected
function celReportTextChanged(text, id, name) {
    try {
        reportTextChanged(text, id, name);
    } catch (err) {
    }
}
    
//Takes the object generated by Amplience analytic events and converts it into Celebrus clicks events.
function celReportAmplienceClick(amplienceEventObject) {
    try {
        reportAmplienceClick(amplienceEventObject);
    } catch (err) {    
    }
}

//Reports outfit builder slider product displayed
function celReportOutfitSliderProduct(url, productId, productIndex) {
    try {
        reportSliderProduct(url, productId, productIndex, "outfit");
    } catch (err) {
    }
}

//Reports slider product displayed
function celReportAffinitySliderProduct(url, productId, productIndex) {
    try {
        reportSliderProduct(url, productId, productIndex, "affinity");
    } catch (err) {
    }
}
/* complete : /javascript/common/celebrus/celebrusEventWriter.js*/


/* combine : /javascript/common/celebrus/celebrusEventBuffer.js*/
/**
 * Buffer functions to handle Celebrus API calls while the CelebrusInsert.js is still loading.
 * 
 * If calls to the Celebrus API occur before the CelebrusInsert.js file has loaded the Celebrus API 
 * functions then these functions (by the same name) will 'catch' the calls, and forward them on to 
 * the API once it has loaded, subject to a timeout.
 * 
 * This process takes advantage of Javascripts optional parameters - allowing these buffer 
 * functions to be called without their timer parameter initially, and allowing the genuine 
 * Celebrus functions by the same name to accept & ignore the timer parameter if they are called 
 * from these buffer functions.
 */ 

/* Time (milliseconds) to wait between polling for the Celebrus API */
var celAPIPoll_pollDelay = 100;

/* Time (seconds) to continue polling for Celebrus API before giving up */
var celAPIPoll_timeout = 5;

/* Calculated number of polls required before timeout is reached */
var celAPIPoll_limit = celAPIPoll_timeout * 1000 / celAPIPoll_pollDelay;


/**
 * Buffer function to handle Celebrus JDWclick API call while the CelebrusInsert.js is still 
 * loading.
 * @param obj The object which the Celebrus API function will process into an event.
 * @param timer A counter to allow the call stack to exit if the JDWclick Celebrus function
 * does not become available after the number of seconds denoted in celAPIPoll_timeout.
 */
function JDWclick(obj, timer) {
	if (timer == undefined) timer = 0;
	if (timer < celAPIPoll_limit) {
		setTimeout(function(){window.JDWclick(obj, timer+1);}, celAPIPoll_pollDelay);
	}
}

/**
 * Buffer function to handle Celebrus JDWtextchange API call while the CelebrusInsert.js is still 
 * loading.
 * @param obj The object which the Celebrus API function will process into an event.
 * @param timer A counter to allow the call stack to exit if the JDWclick Celebrus function
 * does not become available after the number of seconds denoted in celAPIPoll_timeout.
 */
function JDWtextchange(obj, timer) {
	if (timer == undefined) timer = 0;
	if (timer < celAPIPoll_limit) {
		setTimeout(function(){window.JDWtextchange(obj, timer+1);}, celAPIPoll_pollDelay);
	}
}

/**
 * Buffer function to handle Celebrus JDWformsubmit API call while the CelebrusInsert.js is still 
 * loading.
 * @param obj The object which the Celebrus API function will process into an event.
 * @param timer A counter to allow the call stack to exit if the JDWclick Celebrus function
 * does not become available after the number of seconds denoted in celAPIPoll_timeout.
 */
function JDWformsubmit(obj, timer) {
	if (timer == undefined) timer = 0;
	if (timer < celAPIPoll_limit) {
		setTimeout(function(){window.JDWformsubmit(obj, timer+1);}, celAPIPoll_pollDelay);
	}
}

/**
 * Buffer function to handle Celebrus JDWevent API call while the CelebrusInsert.js is still 
 * loading.
 * @param obj The object which the Celebrus API function will process into an event.
 * @param timer A counter to allow the call stack to exit if the JDWclick Celebrus function
 * does not become available after the number of seconds denoted in celAPIPoll_timeout.
 */
function JDWevent(obj, timer) {
	if (timer == undefined) timer = 0;
	if (timer < celAPIPoll_limit) {
		setTimeout(function(){window.JDWevent(obj, timer+1);}, celAPIPoll_pollDelay);
	}
}
/* complete : /javascript/common/celebrus/celebrusEventBuffer.js*/


/* combine : /javascript/common/placeholders.jquery.min.js*/
/* Placeholders.js v3.0.2 */
(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(D)?(t.removeAttribute(D),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(F),parseInt(n,10)>=0&&(t.setAttribute("maxLength",n),t.removeAttribute(F)),r=t.getAttribute(P),r&&(t.type=r),!0):!1}function a(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(D,"true"),t.value=n,t.className+=" "+I,r=t.getAttribute(F),r||(t.setAttribute(F,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(P),e?t.type="text":"password"===t.type&&M.changeType(t,"text")&&t.setAttribute(P,"password"),!0):!1}function u(t,e){var r,n,a,u,i,l,o;if(t&&t.getAttribute(V))e(t);else for(a=t?t.getElementsByTagName("input"):b,u=t?t.getElementsByTagName("textarea"):f,r=a?a.length:0,n=u?u.length:0,o=0,l=r+n;l>o;o++)i=r>o?a[o]:u[o-r],e(i)}function i(t){u(t,n)}function l(t){u(t,a)}function o(t){return function(){m&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)?M.moveCaret(t,0):n(t)}}function c(t){return function(){a(t)}}function s(t){return function(e){return A=t.value,"true"===t.getAttribute(D)&&A===t.getAttribute(V)&&M.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function d(t){return function(){n(t,A),""===t.value&&(t.blur(),M.moveCaret(t,0))}}function g(t){return function(){t===r()&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)&&M.moveCaret(t,0)}}function v(t){return function(){i(t)}}function p(t){t.form&&(T=t.form,"string"==typeof T&&(T=document.getElementById(T)),T.getAttribute(U)||(M.addEventListener(T,"submit",v(T)),T.setAttribute(U,"true"))),M.addEventListener(t,"focus",o(t)),M.addEventListener(t,"blur",c(t)),m&&(M.addEventListener(t,"keydown",s(t)),M.addEventListener(t,"keyup",d(t)),M.addEventListener(t,"click",g(t))),t.setAttribute(j,"true"),t.setAttribute(V,x),(m||t!==r())&&a(t)}var b,f,m,h,A,y,E,x,L,T,N,S,w,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],k="#ccc",I="placeholdersjs",R=RegExp("(?:^|\\s)"+I+"(?!\\S)"),V="data-placeholder-value",D="data-placeholder-active",P="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",q="data-placeholder-focus",z="data-placeholder-live",F="data-placeholder-maxlength",G=document.createElement("input"),H=document.getElementsByTagName("head")[0],J=document.documentElement,K=t.Placeholders,M=K.Utils;if(K.nativeSupport=void 0!==G.placeholder,!K.nativeSupport){for(b=document.getElementsByTagName("input"),f=document.getElementsByTagName("textarea"),m="false"===J.getAttribute(q),h="false"!==J.getAttribute(z),y=document.createElement("style"),y.type="text/css",E=document.createTextNode("."+I+" { color:"+k+"; }"),y.styleSheet?y.styleSheet.cssText=E.nodeValue:y.appendChild(E),H.insertBefore(y,H.firstChild),w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x&&(x=x.nodeValue,x&&M.inArray(B,N.type)&&p(N));L=setInterval(function(){for(w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x?(x=x.nodeValue,x&&M.inArray(B,N.type)&&(N.getAttribute(j)||p(N),(x!==N.getAttribute(V)||"password"===N.type&&!N.getAttribute(P))&&("password"===N.type&&!N.getAttribute(P)&&M.changeType(N,"text")&&N.setAttribute(P,"password"),N.value===N.getAttribute(V)&&(N.value=x),N.setAttribute(V,x)))):N.getAttribute(D)&&(n(N),N.removeAttribute(V));h||clearInterval(L)},100)}M.addEventListener(t,"beforeunload",function(){K.disable()}),K.disable=K.nativeSupport?e:i,K.enable=K.nativeSupport?e:l}(this);/* complete : /javascript/common/placeholders.jquery.min.js*/


/* combine : /javascript/common/validation.js*/
/**
 * New validation framework. Initially wraps the parsley validation but could be changed to support 
 * future new libraries.
 */

/**
 * Parsley validator for checking valid characters for a name.
 */
var nameFormatRegex = /^[ A-Za-z0-9\u00C0\u00C1\u00C2\u00C4\u00C3\u00C7\u00D0\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D1\u00D2\u00D3\u00D4\u00D6\u00D5\u00D9\u00DA\u00DB\u00DC\u0178\u00DD\u0152\u00E0\u00E1\u00E2\u00E4\u00E3\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F1\u00F2\u00F3\u00F4\u00F6\u00F5\u00F8\u00F0\u00F9\u00FA\u00FB\u00FC\u00FF\u00FD\u00E6\u0153\u00DF&\-,']+$/;
var postcodeRegex = /^(((([a-pr-uwyzA-PR-UWYZ][0-9][0-9a-hjkd-uwA-HJKS-UW]?)|([a-pr-uwyzA-PR-UWYZ][a-hk-yA-HK-Y][0-9][0-9abehmnprv-yABEHMNPRV-Y]?))\s{0,2}[0-9]([abd-hjlnp-uw-zABD-HJLNP-UW-Z]{2})))$/;
var passworRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{6,20}([Ã‚Ã„Ã€Ã�ÃƒÃ…Ã‡Ã‰ÃŠÃ‹ÃˆÃ�ÃŽÃ�ÃŒÃ‘Ã”Ã–Ã’Ã“Ã•Ã›ÃœÃ™ÃšÃ�Ã†Ã¢Ã¤Ã Ã¡Ã£Ã¥Ã§Ã©ÃªÃ«Ã¨Ã­Ã®Ã¯Ã¬Ã±Ã´Ã¶Ã²Ã³ÃµÃ»Ã¼Ã¹ÃºÃ¿Ã½Ã¦ÃŸÂ¤Â°ÂªÂº\-`Â¬!Â£$%^&*()_=+[{\]};:\'#~,<.])*$/;

if (window.ParsleyValidator != undefined) {
	window.ParsleyValidator.addValidator('nameFormat', function (value, requirements) {
		
		return nameFormatRegex.test(value);
	}, 32)
	.addMessage('en', 'The name contains invalid characters.');
	
	window.ParsleyValidator.addValidator('validEntry', function (value, requirements) {
		return validRegex.test(value);
	}, 32)
	.addMessage('en', 'The entry contains invalid characters.');
	
	window.ParsleyValidator.addValidator('postcode', function (value, requirements) {
		return postcodeRegex.test(value);
	}, 32)
	.addMessage('en', 'The postcode is not valid.');
	
	window.ParsleyValidator.addValidator('invalidcharacters', function (value, requirements) {
		return passworRegex.test(value);
	}, 32)
	.addMessage('en', 'Password contains invalid character(s).');
}

/**
 * validation module. provides parsley bindings for common data types.
 * fields can be manually bound by calling the appropriate bind function or they can be
 * bound automatically by calling autoBind. 
 */
var jdw = jdw || {};
jdw.validation = new function() {
	/**
	 * Add the required validation attributes to the element for validating it as a Persons Name.
	 */
	this.bindPersonName = function (element) {
		$(element).attr("data-parsley-required","true")
			.attr("data-parsley-length","[2,30]")
			.attr("data-parsley-nameFormat","")
			.attr("data-parsley-trigger", "keyup focusout focusin change")
			.attr("maxlength","30");
	};
	
	this.bindProduct = function (element) {
		$(element).attr("data-parsley-required","false")
			.attr("data-parsley-length","[7,7]")
			.attr("data-parsley-pattern", "^[a-zA-Z]{2}[0-9]{3}[a-zA-Z0-9]{2}$")
			.attr("data-parsley-trigger", "keyup focusout focusin change")
			.attr("maxlength","7");
	};
	
	/**
	 * Add the required validation attributes to the element for validating it as an EMail.
	 */
	this.bindEmail = function (element) {
		$(element).attr("data-parsley-required", "true")
			.attr("data-parsley-length", "[6,128]")
			.attr("data-parsley-trigger", "keyup focusout focusin")
			.attr("data-parsley-validEntry", "")
			.attr("data-parsley-trim-value", "true")
			.attr("data-parsley-type", "email")
			.attr("maxlength", "128");
	};
	
	/**
	 * Add the required validation attributes to the element for validating it as a Phone Number.
	 */
	this.bindPhoneNumber = function (element) {
		$(element).attr("data-parsley-length", "[9,12]")
			.attr("data-parsley-pattern", "^[0-9]{9,12}$")
			.attr("data-parsley-trigger", "keyup focusout focusin")
			.attr("maxlength","12");
	};
	
	/**
	 * Add the required validation attributes to the element for validating it as a select where 
	 * a choice must be made.
	 */
	this.bindSelectRequired = function (element) {
		$(element).attr("data-parsley-required", "true")
			.attr("data-parsley-trigger", "keyup focusout focusin");
	};
	
	/**
	 * Automatically bind the elements which are children of the parent element.
	 * Elements to be bound must have a data-jdw-validation attribute defined.
	 * Its value indicates the validation to be applied to that element.
	 */
    this.autoBind = function (parent) {
    	var toBind = (parent == undefined) ? $("[data-jdw-validation]") : $(parent).find("[data-jdw-validation]");
    	toBind.each(function() {
    		var validation = $(this).data("jdw-validation");
    		switch (validation) {
			    case "product": jdw.validation.bindProduct(this); break;
			    case "personName": jdw.validation.bindPersonName(this); break;
    			case "email": jdw.validation.bindEmail(this); break;
    			case "phoneNumber": jdw.validation.bindPhoneNumber(this); break;
    			case "selectRequired": jdw.validation.bindSelectRequired(this); break;
    			default: break;
    		}
    	});
    };

};


/**
 * Old validation code --- deprecated.
 */


var addressSupportedChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' +
							'������������������������������������������������������-, ';

var EMAIL_ADDRESS_REQUIRED = "Please enter your email address.",
	EMAIL_INVALID_CHARS = "Please enter a valid email address."

function validateNewsletterEmail () {
	//debugger;
	//alert('validateNewsletterEmail');
	var validator = buildValidator();
	validator.addRule('#newsletterEmail', makeNonEmptyRule(EMAIL_ADDRESS_REQUIRED) );
	validator.addRule('#newsletterEmail', makeValidEmailRegexRule(EMAIL_INVALID_CHARS) );
	var validationResult = validator.validate();
	
	if(validator.hasErrors(validationResult)) {
		$.each(validationResult, function(field, errArray) {
			$.each(errArray, function(i, err) {
				if ( i<1 ) {
					alert(err);
				}
			});
		});
		return false;
	}
	return true;
}

function buildValidator(){
 // Build a validator object, to which validation rules can be added
	var validator = {};

 /* Each validation rule is stored as an object in this array, the rules have a 'validator' property
    containing a validation function, and a 'selector' property which must be a valid jQuery selector
    string. */
	var ruleObjs = [];
	validator.addRule = function(selector, fnValidator){
		ruleObjs.push({'validator' : fnValidator, 'selector' : selector});
	};

 /* This method runs all the validation rules in sequence, and builds an object containing any errors
    that were detected. The resulting object has 1 key for each field that was in error (the key is the
    name of the field), and a corresponding array of error messages that apply to that field. */
	validator.validate = function(){
		var errors = {};
	 // Go through all the rules one at a time
		$.each(ruleObjs, function(i, ruleObj){
			 // Run the jQuery selector for the current rule
				var matches = $(ruleObj.selector);

			 // Pass any matches returned by the selector to the validation function
				var error = ruleObj.validator(matches);

			 /* If the validation function returned a message, then associate the message with all
			    the fields returned by the selector. */
				if (error){
					matches.each(function(){
							if (this.name){
								if (!errors[this.name]){
									errors[this.name] = [];
								}
								errors[this.name].push(error);
							}
						});
				}
			});
		return errors;
	};

 	/* Helper function to determine if an error object contains any errors. */
	validator.hasErrors = function(errObj) {
		var hasError = false;
		$.each(errObj, function(){
				hasError = true;
				return false;
			});
		return hasError;
	};

	/**
	 * Helper function to display form validation errors.
	 *
	 * options:
	 *
	 * errorObj -  the errorObj containing validation errors
	 * formSelector - the selector expression for the form element
	 * errorClass - the CSS error class name for labels and form elements,
	 * 		defaults to 'error'
	 * msgPanelSelector - the selector expression for the error message list
	 * effect - transition effect, defaults to 'slide'
	 *
	 */
	validator.showErrors = function(options) {
		var defaults = { effect: 'slide',
			errorClass : 'error'
		};
		var options = $.extend({}, defaults, options);
		var msgPanel = $(options.msgPanelSelector);

		// clear any previous errors
		this.clearErrors(options.formSelector, options.errorClass, options.msgPanelSelector);

		// display new errors
		$.each(options.errorObj, function(key, value) {
	 		$(options.formSelector + ' #' + key).addClass(options.errorClass);
			$(options.formSelector + ' .' + key + 'Label').addClass(options.errorClass);

			if(value!="") {
				validator.addMessage(value, options.msgPanelSelector);
			}
		});

		msgPanel.find('ul').show(options.effect, null, "slow");
	};

	/**
	 * Helper function to display an action error. Shows the given alertMsg
	 * within an alert box and then displays the acctionError within the
	 * message panel
	 *
	 * options:
	 *
	 * alertMsg - the optioanl message to be shown within an alert box
	 * actionError - the error message to be shown within the message panel
	 * msgPanelSelector - the selector expression for the message panel
	 * effect - transition effect, defaults to 'slide'
	 */
	validator.showActionError = function(options) {
		var defaults = { effect: 'slide',
			errorClass: 'error',
			alertMsg: ''
		};
		var options = $.extend({}, defaults, options);
		var msgList = $(options.msgPanelSelector).find('ul');

		// clear any previous errors
		msgList.hide().html('');

		if(options.alertMsg) {
			alert(options.alertMsg);
		}

		this.addMessage(options.actionError, options.msgPanelSelector);
		msgList.show(options.effect, null, "slow");
	};

	/*
	 * Helper function to append a given message to the given message panel.
	 * Searches for a <UL> element within the message panel and appends an
	 * <LI> containing the message.
	 *
	 * params:
	 *
	 * message, the message to append
	 * msgPanelSelector, the selector expression for the msgPanel
	 */
	validator.addMessage = function(message, msgPanelSelector) {
		$(msgPanelSelector + ' ul').append('<li>' + message + '</li>');
	};

	/*
	 * Helper function to clear validation errors.
	 *
	 * params:
	 *
	 * formSelector, the selector expression for the form element
	 * errorClass, the CSS error class name for labels and form elements
	 * msgPanelSelector, the selector expression for the msgPanel
	 *
	 */
	validator.clearErrors = function(formSelector, errorClass, msgPanelSelector) {
		$(msgPanelSelector + ' ul').hide().html('');

		$(formSelector + ' .' + errorClass).each(function () {
	 		$(this).removeClass(errorClass);
		});
	};

	/*
	 * Helper function to clear form of validation errors.
	 *
	 * params:
	 *
	 * formSelector, the selector expression for the form element
	 * errorClass, the CSS error class name for labels and form elements
	 *
	 */
	validator.clearForm = function(formSelector, errorClass) {
		$(formSelector + ' .' + errorClass).each(function () {
	 		$(this).toggleClass(errorClass);
		});
	};


	return validator;
}


/* Helper function for generating a textual summary of the errors contained in the object returned from the
   validate() method above. */
function makeErrorSummary(errObj){
	var uniqueErrors = [];
	$.each(errObj, function(field, errArray){
			$.each(errArray, function(i, err){
					if ($.inArray(err, uniqueErrors) < 0){
						uniqueErrors.push(err);
					}
				});
		});

	var msg = '';
	$.each(uniqueErrors, function(i, err){
			msg += (err + '\n');
		});

	return msg;
}

/* Helper functions for generating validation functions */

function makeNonEmptyRule(msg){
	 /* Return a function that checks for the presence of AT LEAST 1 value in the specified fields */
		return function(fieldObj){
			var foundValue = false;
			fieldObj.each(function(){
					var fieldValue = this.value;
					if (fieldValue && $.trim(fieldValue)){
						foundValue = true;
						return false; // Stop looking - we found a value
					}
				});

			return foundValue ? null : msg;
		};
	}

function makeNonZeroListIndexRule(msg){
 /* Return a function that checks whether the user has picked a value (other than the first one)
    FROM EACH of the specified lists */
	return function(fieldObj){
		var okSoFar = true;
		fieldObj.each(function(){
				if (this.selectedIndex === 0){
					okSoFar = false;
					return false; // Stop looking - we found a list with no valid value picked
				}
			});

		return okSoFar ? null : msg;
	};
}

function makeLengthRule(msg, minLength, maxLength){
 /* Return a function that checks if the user has entered the required number of characters. Passing a value
    of 0 in one of the length arguments indicates that the corresponding check should not be performed (eg
    to perform a minimum length check only, set maxLength to 0). If the strings MIN or MAX appear in the msg
    text then they will be replaced by the value of the appropriate length argument. */
	return function(fieldObj){
		var value = fieldObj.val();
		var tooShort = minLength && (value.length < minLength);
		var tooLong  = maxLength && (value.length > maxLength);

		if (tooShort || tooLong){
			return msg.replace(/MIN/g, minLength).replace(/MAX/g, maxLength);
		} else {
			return null;
		}
	};
}

 /* Return a function that checks whether all the specified checkboxes have been checked. */
function makeCheckboxCheckedRule(msg){
	return function(fieldObj){
		var foundBoxUnchecked = false;
		fieldObj.each(function(){
				if (! $(this).is(':checked')){
					foundBoxUnchecked = true;
					return false; // Stop looking - we found an unchecked box
				}
			});

		return foundBoxUnchecked ? msg : null;
	};
}

/* Return a function that checks whether one of the named (mutually-exclusive) radio buttons or checkboxes have been checked. */
function makeCheckedRule(msg){
	return function(fieldObj){
		var foundRadioChecked = false;
		fieldObj.each(function(){
				if ($(this).is(':checked')){
					foundRadioChecked = true;
					return true; // Stop looking - we found a checked radio button
				}
			});

		return foundRadioChecked ? null : msg;
	};
}

/* Returns a function which checks that the value of the form element is numeric */
function makeNumericRule(msg){
	return function(fieldObj){
		return illegalChars($.trim(fieldObj.val()),'0123456789') ? msg : null;
	};
}

/* Returns a function which checks that the value of the form element is a valid currency amount. */
function makeCurrencyRule(msg) {
	return function(fieldObj) {
		return (fieldObj.val() != "")
			   && (!fieldObj.val().match(/^\d{1,5}\.\d{2}$/)
			       || (parseFloat(fieldObj.val()) < 0.01)) ? msg : null;
	};
}

/* Returns a function which checks that the value of the form element is a valid cv2 number. */
function makeCv2Rule(msg) {
	return function(fieldObj) {
		return (fieldObj.val() != "")
			   && (!illegalChars($.trim(fieldObj.val()),'0123456789'))
			   && (!fieldObj.val().match(/^[0-9]{3}$/)) ? msg : null;
	};
}

/* Returns a function which checks that the value of the form element is a valid expiry date. */
function makeExpiryDateRule(msg, yearId) {
	return function(fieldObj) {
		var monthObj = fieldObj;
		var yearObj = $(yearId);
		if ((monthObj.val() !== '-1')
			&& (yearObj.val() !== '-1')) {
			var expiryDateValid = false;
			var year = '20' + yearObj.val();
			var month = monthObj.val() - 1;
			var expiryDate = new Date(year, month);
			expiryDate.setMonth(expiryDate.getMonth() + 1);
			expiryDate.setDate(1);
			expiryDate.setDate(expiryDate.getDate() - 1);
			var now = new Date();
			var currentDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
			if (expiryDate.getTime() >= currentDate.getTime()) {
				expiryDateValid = true;
			}
			return expiryDateValid ? null : msg;
		} else {
			return null;
		}
	};
}

/* Returns a function which checks for invalid characters */
function makeUnsupportedCharactersRule(msg) {
	return function(fieldObj){
		var foundUnsupported = false;
		var illegalChar = '';
		fieldObj.each(function(){
			var fieldValue = this.value;
			var illegalCharIndex = indexOfIllegalChars(fieldValue,addressSupportedChars);
			illegalChar = fieldValue.substring(illegalCharIndex,(illegalCharIndex+1));
			if (illegalCharIndex != -1) {
				foundUnsupported = true;
				return false; // break out of the 'each' loop when an illegal character is found!
			}
		});

		return foundUnsupported ? msg.replace(/<char>/g, illegalChar) : false;
	};
}

/* Returns a function which checks for invalid characters based on a validRegex var set in the page
 * by standard include. */
function makeValidRegexRule(msg) {
	
	if (!msg) { // msg is undefined or empty, fall back to a safe default
		msg = 'One of the form fields contains invalid characters';
	}
	
	return function(fieldObj){
		var foundInvalid = false;
		var illegalChar = '';
		fieldObj.each(function(){
			if(!validRegex.test(this.value)) {
				foundInvalid = true;
				return false;
			}
		});

		return foundInvalid ? msg : false;
	};
}

/* Returns a function which checks for invalid characters based on a validRegex string passed in*/
function makeValidEmailRegexRule(msg) {
	
	if (!msg) { // msg is undefined or empty, fall back to a safe default
		msg = 'One of the form fields contains invalid characters';
	}
	
	return function(fieldObj){
		var foundInvalid = false;
		fieldObj.each(function(){
			if(!/^([a-zA-Z0-9_\.\-!#$%&\'\*\+/=?\^_\`~{}])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(this.value)) {
				foundInvalid = true;
				return false;
			}
		});

		return foundInvalid ? msg : false;
	};
}

/* Returns a function which checks for invalid characters based on a validRegex string passed in*/
function makeValidPasswordRegexRule(msg) {
	
	if (!msg) { // msg is undefined or empty, fall back to a safe default
		msg = 'One of the form fields contains invalid characters';
	}
	return function(fieldObj){
		var foundInvalid = false;
		fieldObj.each(function(){
			if(!passworRegex.test(this.value)) {
				foundInvalid = true;
				return false;
			}
		});

		return foundInvalid ? msg : false;
	};
}

function makeTwoValidCharsRule(msg){
	 /* Return a function that checks for the presence of AT LEAST 2 values in the specified fields */
		return function(fieldObj){
			var foundValue = false;
			fieldObj.each(function(){
					var fieldValue = this.value;
					if (fieldValue && ($.trim(fieldValue).length >= 2)){
						foundValue = true;
						return false; // Stop looking - we found a value
					}
				});

			return foundValue ? null : msg;
		};
}

function makeOneHouseSuffixCharaterAllowedRule(msg){
	 // checks that only 1 character has been entered for the house number prefix
		return function(fieldObj){
			var fieldValue = fieldObj.val();
			var alphaCount = 0;

			for(var i=0; i < fieldValue.length; i++){
				if(fieldValue.charAt(i).match(/[a-zA-Z]/)){
					alphaCount++;
				}
			}

			if(alphaCount > 1){
				alphaCount=0;
				return msg;
			}
		};
}

/*
 * Given a predicate and a validator return a new validator that runs the original, but only
 * when predicate is true.
 * parameters:
 *   predicate: a function returning a boolean.
 *   validator: a validator function
 *
 *   returns:
 *     a validator function.
 */
function makeConditionalValidator(predicate, validator) {
	return function(fieldObj) {
		if (predicate()) {
			return validator(fieldObj);
		} else {
			null;
		}
	};
};

function makeConfirmationCheckBox(msg){
	return function(fieldObj){
		var policySummaryBoxUnchecked = false;
		fieldObj.each(function(){
				if (!$(this).is(':checked')){
					policySummaryBoxUnchecked = true;
				}
			});

		return policySummaryBoxUnchecked ? msg : null;
	};
}

/* complete : /javascript/common/validation.js*/


