PageSourceSearch

https://mifia.org/BuiltTheme/whiteboard_maya_blue.v3.0/2b0f5567/Scripts/combined.js

js mifia.org collected 2026-09-28 10:06:15 UTC 493,080 bytes, 5,525 lines download raw bytes

1
2
3/*compiled*/
4/*! jQuery v1.8.2 jquery.com | jquery.org/license v3*/
vendor: 14,535 bytes, lines 4-5
4
5(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(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 cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call("
5? 
vendor: 78,722 bytes, line 5
5")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&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 p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement 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 a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.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]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.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){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(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 bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(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 bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.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=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,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||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=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):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j={top:0,left:0},k=this[0],l=k&&k.ownerDocument;if(!l)return;return(d=l.body)===k?p.offset.bodyOffset(k):(c=l.documentElement,p.contains(c,k)?(typeof k.getBoundingClientRect!="undefined"&&(j=k.getBoundingClientRect()),e=da(l),f=c.clientTop||d.clientTop||0,g=c.clientLeft||d.clientLeft||0,h=e.pageYOffset||c.scrollTop,i=e.pageXOffset||c.scrollLeft,{top:j.top+h-f,left:j.left+i-g}):j)},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.j
5q$=a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);(function(window,document,undefined){var defaults={messages:{required:"The %s field is required.",matches:"The %s field does not match the %s field.","default":"The %s field is still set to default, please change.",valid_email:"The %s field must contain a valid email address.",valid_emails:"The %s field must contain all valid email addresses.",min_length:"The %s field must be at least %s characters in length.",max_length:"The %s field must not exceed %s characters in length.",exact_length:"The %s field must be exactly %s characters in length.",greater_than:"The %s field must contain a number greater than %s.",less_than:"The %s field must contain a number less than %s.",alpha:"The %s field must only contain alphabetical characters.",alpha_numeric:"The %s field must only contain alpha-numeric characters.",alpha_dash:"The %s field must only contain alpha-numeric characters, underscores, and dashes.",numeric:"The %s field must contain only numbers.",integer:"The %s field must contain an integer.",decimal:"The %s field must contain a decimal number.",is_natural:"The %s field must contain only positive numbers.",is_natural_no_zero:"The %s field must contain a number greater than zero.",valid_ip:"The %s field must contain a valid IP.",valid_base64:"The %s field must contain a base64 string.",valid_credit_card:"The %s field must contain a valid credit card number.",is_file_type:"The %s field must contain only %s files.",valid_url:"The %s field must contain a valid URL.",greater_than_date:"The %s field must contain a more recent date than %s.",less_than_date:"The %s field must contain an older date than %s.",greater_than_or_equal_date:"The %s field must contain a date that's at least as recent as %s.",less_than_or_equal_date:"The %s field must contain a date that's %s or older."},onSubmit:function(errors){},onBlurField:function(errors){}};var ruleRegex=/^(.+?)\[(.+)\]$/,numericRegex=/^[0-9]+$/,integerRegex=/^\-?[0-9]+$/,decimalRegex=/^\-?[0-9]*\.?[0-9]+$/,emailRegex=/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,alphaRegex=/^[a-z]+$/i,alphaNumericRegex=/^[a-z0-9]+$/i,alphaDashRegex=/^[a-z0-9_\-]+$/i,naturalRegex=/^[0-9]+$/i,naturalNoZeroRegex=/^[1-9][0-9]*$/i,ipRegex=/^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i,base64Regex=/[^a-zA-Z0-9\/\+=]/i,numericDashRegex=/^[\d\-\s]+$/,urlRegex=/^((http|https):\/\/(\w+:{0,1}\w*@)?(\S+)|)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,dateRegex=/\d{4}-\d{1,2}-\d{1,2}/;var FormValidator=function(options){var formNameOrNode=options.form,autoConfig=!!options.autoConfig||true,fields=options.fields,validateOnBlur=!!options.validateOnBlur||false,onSubmit=options.onSubmit,onBlurField=options.onBlurField;this.formNameOrNode=formNameOrNode;this.onSubmit=onSubmit||defaults.onSubmit;this.onBlurField=onBlurField||defaults.onBlurField;this.errors=[];this.fields={};this.form=this._formByNameOrNode(formNameOrNode)||{};this.messages={};this.handlers={};this.conditionals={};this.validateOnBlur=validateOnBlur;if(autoConfig){fields=this._generateFieldParams();}this._buildMasterFieldsArray(fields);var _onsubmit=this.form.onsubmit;var self=this;this.form.onsubmit=(function(evt){try{return self._validateForm(evt)&&(_onsubmit===undefined||_onsubmit());}catch(e){}});};attributeValue=function(element,attributeName){var i;if((element.length>0)&&(element[0].type==="radio"||element[0].type==="checkbox")){for(i=0,elementLength=element.length;i<elementLength;i++){if(element[i].checked){return element[i][attributeName];}}return;}return element[attributeName];};FormValidator.prototype.setMessage=function(rule,message){this.messages[rule]=message;return this;};FormValidator.prototype.registerCallback=function(name,handler){if(name&&typeof name==="string"&&handler&&typeof handler==="function"){this.handlers[name]=handler;}return this;};FormValidator.prototype.registerConditional=function(name,conditional){if(name&&typeof name==="string"&&conditional&&typeof conditional==="function"){this.conditionals[name]=conditional;}return this;};FormValidator.prototype.validateForm=function(){return this._val
5idateForm();};FormValidator.prototype.isValidateForm=function(){this.errors=[];for(var key in this.fields){this._preValidateField(key);}if(this.errors.length>0){return false;}return true;};FormValidator.prototype._formByNameOrNode=function(formNameOrNode){return(typeof formNameOrNode==="object")?formNameOrNode:document.forms[formNameOrNode];};FormValidator.prototype._generateFieldParams=function(){return jq$("input[data-validate]").map(function(i,el){return{name:jq$(el).attr("name"),display:jq$('[for="'+jq$(el).attr("id")+'"]').text(),rules:jq$(el).data("validate")};}).get();};FormValidator.prototype._buildMasterFieldsArray=function(fields){var self=this;for(var i=0,fieldLength=fields.length;i<fieldLength;i++){var field=fields[i];if((!field.name&&!field.names)||!field.rules){console.warn("basic validate: The following field is being skipped due to a misconfiguration: "+field);continue;}if(field.names){for(var j=0,fieldNamesLength=field.names.length;j<fieldNamesLength;j++){this._addField(field,field.names[j]);}}else{this._addField(field,field.name);}if(this.validateOnBlur){var fieldElement=this.form.querySelector("[name="+field.name+"]");if(fieldElement!==null){fieldElement.addEventListener("blur",function(e){self._onFieldBlur(e);});}}}};FormValidator.prototype._onFieldBlur=function(evt){this.errors=[];var key=evt.target.getAttribute("name");this._preValidateField(key);if(typeof this.onBlurField==="function"){this.onBlurField(this.errors,evt);}};FormValidator.prototype._addField=function(field,nameValue){this.fields[nameValue]={name:nameValue,display:field.display||nameValue,rules:field.rules,depends:field.depends,id:null,element:null,type:null,value:null,checked:null};};FormValidator.prototype._validateForm=function(evt){this.errors=[];for(var key in this.fields){this._preValidateField(key);}if(typeof this.onSubmit==="function"){this.onSubmit(this.errors,evt);}if(this.errors.length>0){WA.stopEventDefault(evt);return false;}return true;};FormValidator.prototype._preValidateField=function(key){if(this.fields.hasOwnProperty(key)){var field=this.fields[key]||{},element=this.form[field.name];if(element&&element!==undefined){field.id=attributeValue(element,"id");field.element=element;field.type=(element.length>0)?element[0].type:element.type;field.value=attributeValue(element,"value");field.checked=attributeValue(element,"checked");if(field.depends&&typeof field.depends==="function"){if(field.depends.call(this,field)){this._validateField(field);}}else{if(field.depends&&typeof field.depends==="string"&&this.conditionals[field.depends]){if(this.conditionals[field.depends].call(this,field)){this._validateField(field);}}else{this._validateField(field);}}}}};FormValidator.prototype._validateField=function(field){var i,j,rules=field.rules.split("|"),indexOfRequired=field.rules.indexOf("required"),isEmpty=(!field.value||field.value===""||field.value===undefined);for(i=0,ruleLength=rules.length;i<ruleLength;i++){var method=rules[i],param=null,failed=false,parts=ruleRegex.exec(method);if(indexOfRequired===-1&&method.indexOf("!callback_")===-1&&isEmpty){continue;}
5if(parts){method=parts[1];param=parts[2];}if(method.charAt(0)==="!"){method=method.substring(1,method.length);}if(typeof this._hooks[method]==="function"){if(!this._hooks[method].apply(this,[field,param])){failed=true;}}else{if(method.substring(0,9)==="callback_"){method=method.substring(9,method.length);if(typeof this.handlers[method]==="function"){if(this.handlers[method].apply(this,[field.value,param,field])===false){failed=true;}}}}if(failed){var source=this.messages[field.name+"."+method]||this.messages[method]||defaults.messages[method],message="An error has occurred with the "+field.display+" field.";if(source){message=source.replace("%s",field.display);if(param){message=message.replace("%s",(this.fields[param])?this.fields[param].display:param);}}var existingError;for(j=0;j<this.errors.length;j+=1){if(field.id===this.errors[j].id){existingError=this.errors[j];}}var errorObject=existingError||{id:field.id,display:field.display,element:field.element,name:field.name,message:message,messages:[],rule:method};errorObject.messages.push(message);if(!existingError){this.errors.push(errorObject);}}}};FormValidator.prototype._getValidDate=function(date){if(!date.match("today")&&!date.match(dateRegex)){return false;}var validDate=new Date(),validDateArray;if(!date.match("today")){validDateArray=date.split("-");validDate.setFullYear(validDateArray[0]);validDate.setMonth(validDateArray[1]-1);validDate.setDate(validDateArray[2]);}return validDate;};FormValidator.prototype._hooks={required:function(field){var value=field.value;if((field.type==="checkbox")||(field.type==="radio")){return(field.checked===true);}return(value!==null&&value!=="");},"default":function(field,defaultName){return field.value!==defaultName;},matches:function(field,matchName){var el=this.form[matchName];if(el){return field.value===el.value;}return false;},valid_email:function(field){return emailRegex.test(field.value);},valid_emails:function(field){var result=field.value.split(/\s*,\s*/g);for(var i=0,resultLength=result.length;i<resultLength;i++){if(!emailRegex.test(result[i])){return false;}}return true;},min_length:function(field,length){if(!numericRegex.test(length)){return false;}return(field.value.length>=parseInt(length,10));},max_length:function(field,length){if(!numericRegex.test(length)){return false;}return(field.value.length<=parseInt(length,10));},exact_length:function(field,length){if(!numericRegex.test(length)){return false;}return(field.value.length===parseInt(length,10));},greater_than:function(field,param){if(!decimalRegex.test(field.value)){return false;}return(parseFloat(field.value)>parseFloat(param));},less_than:function(field,param){if(!decimalRegex.test(field.value)){return false;}return(parseFloat(field.value)<parseFloat(param));},alpha:function(field){return(alphaRegex.test(field.value));},alpha_numeric:function(field){return(alphaNumericRegex.test(field.value));},alpha_dash:function(field){return(alphaDashRegex.test(field.value));},numeric:function(field){return(numericRegex.test(field.value));},integer:function(field){return(integerRegex.test(field.value));},decimal:function(field){return(decimalRegex.test(field.value));},is_natural:function(field){return(naturalRegex.test(field.value));},is_natural_no_zero:function(field){return(naturalNoZeroRegex.test(field.value));},valid_ip:function(field){return(ipRegex.test(field.value));},valid_base64:function(field){return(base64Regex.test(field.value));},valid_url:function(field){return(urlRegex.test(field.value));},valid_credit_card:function(field){if(!numericDashRegex.test(field.value)){return false;}var nCheck=0,nDigit=0,bEven=false;var strippedField=field.value.replace(/\D/g,"");for(var n=strippedField.length-1;n>=0;n--){var cDigit=strippedField.charAt(n);nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9){nDigit-=9;}}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)===0;},is_file_type:function(field,type){if(field.type!=="file"){return true;}var ext=field.value.substr((field.value.lastIndexOf(".")+1)),typeArray=type.split(","),inArray=false,i=0,len=typeArray.length;for(i;i<len;i++){if(ext.toUpperCase()==typeArray[i].toUpperCase()){inArray=true;}}return inArray;},greater_than_date:function(field,date){var enteredDate=this._getValidDate(field.value),validDate=this._getValidDate(date);if(!validDate||!enteredDate){return false;}return enteredDate>validDate;},less_than_date:function(field,date){var enteredDate=this._getValidDate(field.value),validDate=this._getValidDate(date);if(!validDate||!enteredDate){return false;}return enteredDate<validDate;},greater_than_or_equal_date:function(field,date){var enteredDate=this._getValidDate(field.value),validDate=this._getValidDate(date);if(!validDate||!enteredDate){return false;}return enteredDate>=validDate;},less_than_or_equal_date:function(field,date){var enteredDate=this._getValidDate(field.value),validDate=this._getValidDate(date);if(!validDate||!enteredDate){return false;}return enteredDate<=validDate;}};window.FormValidator=FormValidator;})(window,document);(function(window,WA,undefined){if(!window.WaBasicWizard){window.WaBasicWizard=BasicWizard;}function BasicWizard(userOptions){if(!userOptions||!userOptions.element){return;}var defaults={selected:0,stepsBarContainer:"ul",stepsElements:"> * > .step",pagesContainer:".pagesContainer",pagesElements:"*",backButtonSupport:true,useURLhash:true,showStepURLhash:true,anchorSettings:{anchorClickable:true,enableAllAnchors:false,markDoneStep:true,markAllPreviousStepsAsDone:true,removeDoneStepOnNavigateBack:false,enableAnchorOnDoneStep:true},disabledSteps:[]};var self=this,options=$.extend(true,{},defaults,userOptions),main=jq$(options.element),nav=main.children(options.stepsBarContainer),steps=jq$(options.stepsElements,nav),container=main.find(options.pagesContainer),pages=container.children(options.pagesElements),currentIndex=null;init();
5function init(){setElements();var idx=options.selected;idx=getSelectedStepFromUrl(idx);if(idx>0&&options.anchorSettings.markDoneStep&&options.anchorSettings.markAllPreviousStepsAsDone){steps.eq(idx).parent().prevAll().addClass("done");}showStep(idx);}function getSelectedStepFromUrl(idx){if(!options.useURLhash){return idx;}var hash=window.location.hash;if(!hash||hash.length==0){return idx;}var elm=jq$('.step[href*="'+hash+'"]',nav);if(elm.length){var id=steps.index(elm);idx=id>=0?id:idx;}return idx;}function setElements(){main.addClass("basicWizward_main");nav.addClass("bw_nav bw_navTabs bw_stepAnchor");if(options.anchorSettings.enableAllAnchors!==false&&options.anchorSettings.anchorClickable!==false){steps.parent().addClass("clickable");}container.addClass("bw_container bw_tabContent");pages.addClass("bw_stepContent");if(options.disabledSteps&&options.disabledSteps.length>0){jq$.each(options.disabledSteps,function(i,n){steps.eq(n).parent().addClass("disabled");});}return true;}function setEvents(){jq$(steps).on("click",function(e){e.preventDefault();if(options.anchorSettings.anchorClickable===false){return true;}var idx=steps.index(this);if(options.anchorSettings.enableAnchorOnDoneStep===false&&steps.eq(idx).parent().hasClass("done")){return true;}if(idx!==currentIndex){if(options.anchorSettings.enableAllAnchors!==false&&options.anchorSettings.anchorClickable!==false){showStep(idx);}else{if(steps.eq(idx).parent().hasClass("done")){showStep(idx);}}}});if(options.backButtonSupport){jq$(window).on("hashchange",function(e){if(!options.useURLhash){return true;}if(window.location.hash){var elm=jq$('.step[href*="'+window.location.hash+'"]',nav);if(elm&&elm.length>0){e.preventDefault();showStep(steps.index(elm));}}});}return true;}function showNext(){var si=currentIndex+1;for(var i=si;i<steps.length;i++){if(!steps.eq(i).parent().hasClass("disabled")){si=i;break;}}if(steps.length<=si){return false;}showStep(si);return true;}function showPrevious(){var si=currentIndex-1;for(var i=si;i>=0;i--){if(!steps.eq(i).parent().hasClass("disabled")){si=i;break;}}if(0>si){return false;}showStep(si);return true;}function showStep(idx){if(!steps.eq(idx)){return false;}if(idx==currentIndex){return false;}loadStepContent(idx);return true;}function loadStepContent(idx){var curTab=steps.eq(currentIndex);var stepDirection="";var elm=steps.eq(idx);if(currentIndex!==null&&currentIndex!==idx){stepDirection=currentIndex<idx?"forward":"backward";}if(currentIndex!==null&&triggerEvent("leaveStep",[curTab,currentIndex,stepDirection])===false){return false;}transitPage(idx);return true;}function transitPage(idx){var curTab=steps.eq(currentIndex);var curPage=curTab.length>0?jq$(curTab.attr("href"),main):null;var selTab=steps.eq(idx);var selPage=selTab.length>0?jq$(selTab.attr("href"),main):null;var stepDirection="";if(currentIndex!==null&&currentIndex!==idx){stepDirection=currentIndex<idx?"forward":"backward";}var stepPosition="middle";if(idx===0){stepPosition="first";}else{if(idx===steps.length-1){stepPosition="final";}}if(curPage&&curPage.length>0){curPage.hide();}selPage.show();setURLHash(selTab.attr("href"));setAnchor(idx);currentIndex=idx;triggerEvent("showStep",[selTab,currentIndex,stepDirection,stepPosition]);return true;}function setAnchor(idx){steps.eq(currentIndex).parent().removeClass("active loading");if(options.anchorSettings.markDoneStep!==false&&currentIndex!==null){steps.eq(currentIndex).parent().addClass("done");if(options.anchorSettings.removeDoneStepOnNavigateBack!==false){steps.eq(idx).parent().nextAll().removeClass("done");}}steps.eq(idx).parent().removeClass("done loading").addClass("active");return true;}function triggerEvent(name,params){var e=jq$.Event(name);main.trigger(e,params);if(e.isDefaultPrevented()){return false;}return e.result;}function setURLHash(hash){if(options.showStepURLhash&&window.location.hash!==hash){window.location.hash=hash;}}self.next=next;self.prev=prev;self.getStep=getStep;self.reset=reset;self.showModalStep=showModalStep;self.hideModalStep=hideModalStep;function next(){showNext();}function prev(){showPrevious();}function getStep(){return +currentIndex;}function reset(){if(triggerEvent("beginReset")===false){return false;}pages.hide();currentIndex=null;setURLHash(steps.eq(options.selected).attr("href"));steps.removeClass();steps.parents().removeClass();steps.data("has-content",false);init();triggerEvent("endReset");}function showModalStep(name){pages.hide();steps.hide();jq$(name,main).show();}function hideModalStep(name){reset();}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaGoogleMapsGadgetsManager){window.WaGoogleMapsGadgetsManager=new GoogleMapsGadgetsManager();}function GoogleMapsGadgetsManager(){if(!WA){return;}var pThis=this,typeName="WaGoogleMapsGadgetsManager";pThis.toString=function(){return typeName;};pThis.Dispose=WA.Tools.EventHandlers.createHandlers(pThis,{id:"Dispose"});pThis.GoogleMapsApiLoaded=WA.Tools.EventHandlers.createHandlers(pThis,{id:"GoogleMapsApiLoaded",type:WA.Tools.EventHandlers.Type.Long});pThis.createGadget=createGadget;pThis.onGoogleMapsApiLoaded=onGoogleMapsApiLoaded;var gadgets={},isDisposed=false,apiUrlTemplate="https://maps.googleapis.com/ma
5ps/api/js?"+"key={key}"+"&libraries={libraries}"+"&callback={callback}",apiLoadOptions={key:"",callback:typeName+".onGoogleMapsApiLoaded",libraries:[]},apiScriptId="id_waGoogleApiScript";function onGadgetDispose(sender,args){delete gadgets[args&&args.id];}function createGadget(gadgetConstructor,model,args){model=model||{};args=args||{};var gadgetId=model.id;if(gadgets.hasOwnProperty(gadgetId)&&gadgets[gadgetId].dispose){gadgets[gadgetId].dispose();}args.parentComponent=pThis;gadgets[gadgetId]=new gadgetConstructor(model,args);gadgets[gadgetId].Dispose.addHandler(onGadgetDispose);if(!(window.google&&window.google.maps)&&!WA.$(apiScriptId,window)){loadGoogleMapsApi(model);}}function loadGoogleMapsApi(model){var apiScript=document.createElement("script");apiLoadOptions.key=model.apiKey||apiLoadOptions.key;apiLoadOptions.libraries=(model.libraries||apiLoadOptions.libraries).join(",");apiScript.id=apiScriptId;apiScript.src=WA.String.formatNamed(apiUrlTemplate,apiLoadOptions);document.getElementsByTagName("head")[0].appendChild(apiScript);}function onGoogleMapsApiLoaded(){pThis.GoogleMapsApiLoaded.fireHandlers();}function init(){if(window.google&&window.google.maps){onGoogleMapsApiLoaded();}}function dispose(){if(isDisposed){return;}isDisposed=true;pThis.Dispose.fireHandlers();window[typeName]=null;gadgets=null;pThis.Dispose=null;pThis.GoogleMapsApiLoaded=null;}BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED,init,BonaPage.HANDLERTYPE_ALWAYS);BonaPage.addPageStateHandler(BonaPage.PAGE_UNLOADED,dispose,BonaPage.HANDLERTYPE_ALWAYS);}})(window,window.WA);!function($,window,document){function Linkified(element,options){this._defaults=defaults,this.element=element,this.setOptions(options),this.init();}var defaults={tagName:"a",newLine:"\n",target:"_blank",linkClass:null,linkClasses:[],linkAttributes:null};Linkified.prototype={constructor:Linkified,init:function(){1===this.element.nodeType?Linkified.linkifyNode.call(this,this.element):this.element=Linkified.linkify.call(this,this.element.toString());},setOptions:function(options){this.settings=Linkified.extendSettings(options,this.settings);},toString:function(){return this.element.toString();}},Linkified.extendSettings=function(options,settings){var prop;settings=settings||{};for(prop in defaults){settings[prop]||(settings[prop]=defaults[prop]);}for(prop in options){settings[prop]=options[prop];}return settings;},Linkified.linkMatch=new RegExp(["(",'\\s|[^a-zA-Z0-9.\\+_\\/"\\>\\-]|^',")(?:","(","[a-zA-Z0-9\\+_\\-]+","(?:","\\.[a-zA-Z0-9\\+_\\-]+",")*@",")?(","http:\\/\\/|https:\\/\\/|ftp:\\/\\/",")?(","(?:(?:[a-z0-9][a-z0-9_%\\-_+]*\\.)+)",")(","(?:com|ca|co|edu|gov|net|org|dev|biz|cat|int|pro|tel|mil|aero|asia|coop|info|jobs|mobi|museum|name|post|travel|local|[a-z]{2})",")(","(?::\\d{1,5})",")?(","(?:","[\\/|\\?]","(?:","[\\-a-zA-Z0-9_%#*&+=~!?,;:.\\/]*",")*",")","[\\-\\/a-zA-Z0-9_%#*&+=~]","|","\\/?",")?",")(",'[^a-zA-Z0-9\\+_\\/"\\<\\-]|$',")"].join(""),"g"),Linkified.emailLinkMatch=/(<[a-z]+ href=\")(http:\/\/)([a-zA-Z0-9\+_\-]+(?:\.[a-zA-Z0-9\+_\-]+)*@)/g,Linkified.linkify=function(text,options){var attr,settings,linkClasses,linkReplace=[];this.constructor===Linkified&&this.settings?(settings=this.settings,options&&(settings=Linkified.extendSettings(options,settings))):settings=Linkified.extendSettings(options),linkClasses=settings.linkClass?settings.linkClass.split(/\s+/):[],linkClasses.push.apply(linkClasses,settings.linkClasses),text=text.replace(/</g,"&lt;").replace(/(\s)/g,"$1$1"),linkReplace.push("$1<"+settings.tagName,'href="http://$2$4$5$6$7"'),linkReplace.push('class="linkified'+(linkClasses.length>0?" "+linkClasses.join(" "):"")+'"'),settings.target&&linkReplace.push('target="'+settings.target+'"');for(attr in settings.linkAttributes){linkReplace.push([attr,'="',settings.linkAttributes[attr].replace(/\"/g,"&quot;").replace(/\$/g,"&#36;"),'"'].join(""));}return linkReplace.push(">$2$3$4$5$6$7</"+settings.tagName+">$8"),text=text.replace(Linkified.linkMatch,linkReplace.join(" ")),text=text.replace(Linkified.emailLinkMatch,"$1mailto:$3"),text=text.replace(/(\s){2}/g,"$1"),text=text.replace(/\n/g,settings.newLine);},Linkified.linkifyNode=function(node){var children,childNode,childCount,dummyElement,i;if(node&&"object"==typeof node&&1===node.nodeType&&"a"!==node.tagName.toLowerCase()&&!/[^\s]linkified[\s$]/.test(node.className)){for(children=[],dummyElement=Linkified._dummyElement||document.createElement("div"),childNode=node.firstChild,childCount=node.childElementCount;childNode;){if(3===childNode.nodeType){for(;dummyElement.firstChild;){dummyElement.removeChild(dummyElement.firstChild);}for(dummyElement.innerHTML=Linkified.linkify.call(this,childNode.textContent||childNode.innerText||childNode.nodeValue),children.push.apply(children,dummyElement.childNodes);dummyElement.firstChild;){dummyElement.removeChild(dummyElement.firstChild);}}else{1===childNode.nodeType?children.push(Linkified.linkifyNode(childNode)):children.push(childNode);}childNode=childNode.nextSibling;}for(;node.firstChild;){node.removeChild(node.firstChild);}for(i=0;i<children.length;i++){node.appendChild(children[i]);}}return node;},Linkified._dummyElement=document.createElement("div"),$.fn.linkify=function(options){return this.each(function(){var linkified;(linkified=$.data(this,"plugin-linkify"))?(linkified.setOptions(options),linkified.init()):$.data(this,"plugin-linkify",new Linkified(this,options));});},$.fn.linkify.Constructor=Linkified,$(window).on("load",function(){$("[data-linkify]").each(function(){var $target,$this=$(this),target=$this.attr("data-linkify"),options={tagName:$this.attr("data-linkify-tagname"),newLine:$this.attr("data-linkify-newline"),target:$this.attr("data-linkify-target"),linkClass:$this.attr("data-linkify-linkclass")};for(var option in options){"undefined"==typeof options[option]&&delete options[option];}$target="this"===target?$this:$this.find(target),$target.linkify(options);});}),$("body").on("click",".linkified",function(){var $link=$(this),url=$link.attr("href"),isEmail=/^mailto:/i.test(url),target=$link.attr("target");return isEmail?window.location.href=url:window.open(url,target),!1;});}(jQuery,window,document);(function(){function activeStateIeFix(){var authenticateLoginLink=jq$("a.wa-authenticateLoginLink");authenticateLoginLink.mouseup(function(){jq$(this).addClass("activeState");});authenticateLoginLink.mouseout(function(){jq$(this).removeClass("activeState");});}jq$(document).ready(activeStateIeFix);})();jq$.iFormValidate={build:function(user_options){var defaults={showSummary:true,validateOnLoad:false,errorMessageHeader:null};return jq$(this).each(function(){var options=jq$.extend(defaults,user_options);var $validators=jq$(this).find("span").filter(function(){var validator=jq$(this).attr("validatorType");return validator!=null;});var $suppressValidationControls=jq$(this).find("input").filter(function(){var causesValidation=jq$(this).attr("causesValidation");return causesValidation=="false";});jq$(this).submit(function(){var isValid=jq$.iFormValidate.validateForm($validators,options.showSummary,options.errorMessageHeader);return isValid;});jq$.iFormValidate.setValidators($validators);jq$.iFormValidate.createValidatorsCollection($validators,$suppressValidationControls);if(options.validateOnLoad){jq$.iFormValidate.validateForm($validators,false);}else{var $onLoadValidators=$validators.filter(function(){var validator=jq$(this).attr("validateOnLoad");return(validator!=null&&validator=="true");});if($onLoadValidators!=null&&$onLoadValidators.length>0){jq$.iFormValidate.validateForm($onLoadValidators,false);}}});},suppressValidation:false,validatorCollection:{},createValidatorsCollection:function($validators,$suppressValidationControls){$validators.each(putIntoCollection);$suppressValidationControls.each(suppressValidation);function putIntoCollection(){var id=jq$(this).attr("controlToValidate");if(id!=null&&id.length>0){if(jq$.iFormValidate.validatorCollection[id]==null||jq$.iFormValidate.validatorCollection[id]=="undefined"){jq$.iFormValidate.validatorCollection[id]=jq$([]);}jq$.iFormValidate.validatorCollection[id].push($(this));}}function suppressValidation(){jq$(this).click(function(){jq$.iFormValidate.suppressValidation=true;});}},setValidators:function($validators){var alreadySet=[];$validators.each(setDefaultAttributes);$validators.each(setValidator);function setDefaultAttributes(){var type=jq$(this).attr("validatorType");if(type=="required"){if(jq$(this).attr("validateOnType")!="false"){jq$(this).attr("validateOnType","true");}}if(type=="minLength"||type=="email"||type=="passwordCompare"){if(jq$(this).attr("validateOnBlur")!="false"){jq$(this).attr("validateOnBlur","true");}}}function setValidator(){var validatorType=jq$(this).attr("validatorType");var id=jq$(this).attr("controlToValidate");var testErrorMessage=jq$(this).attr("errorMessage");if((validatorType!="method")&&(id==null||id=="undefined"||id.length==0)){throw ("Undefined controlToValidate attribute. ValidatorType: "+validatorType);}if(testErrorMessage==null||testErrorMessage=="undefined"||testErrorMessage.length==0){throw ("Undefined errorMessage attribute. ValidatorType: "+validatorType);}if(alreadySet[id]==null&&(validatorType!="method")){alreadySet[id]={};var $control=jq$("#"+id);
5$control.keyup(function(){jq$.iFormValidate.validateControl(this,"validateOnType");});$control.blur(function(){jq$.iFormValidate.validateControl(this,"validateOnBlur");});$control.filter("select").change(function(){jq$.iFormValidate.validateControl(this);});}}},validateControl:function(inputObject,validationEventName){var $validators=jq$.iFormValidate.validatorCollection[inputObject.id];if(validationEventName){$validators=$validators.filter(function(){var attribute=jq$(this).attr(validationEventName);return attribute!=null&&attribute=="true";});}if($validators!=null&&$validators.length>0){jq$.iFormValidate.validateForm($validators,false);}},validateForm:function($validators,showSummaryAlert,errorMessageHeader){if(jq$.iFormValidate.suppressValidation){return true;}var isValid=false;var errorMessage="";$validators.each(jq$.iFormValidate.validate);var stopValidations=$validators.filter(function(){return $(this).attr("shouldStopValidation")!=null;});if(stopValidations&&stopValidations.length>0){return false;}var $errors=$validators.filter(function(){return $(this).attr("invalid")!=null;});if($errors.length>0){if(showSummaryAlert){if(errorMessageHeader!=null){errorMessage+=errorMessageHeader+"\n\n";}$errors.each(collectErrors);alert(errorMessage);var $errorControl=jq$("#"+$errors.first().attr("controlToValidate"));if($errorControl!=null){$errorControl.trigger("focus");}}isValid=false;}else{isValid=true;}function collectErrors(){var message=jq$(this).attr("errorMessage");if(message!=null&&message.length>0){errorMessage+="- "+message+"\n";}}return isValid;},validate:function(){var validatorType=jq$(this).attr("validatorType");var $controlToValidate=null;if(validatorType!="method"){$controlToValidate=jq$("#"+$(this).attr("controlToValidate"));}var error=null;switch(validatorType){case"passwordCompare":error=new jq$.iFormValidate.validator.passwordCompare(jq$(this),$controlToValidate).validate();break;case"email":error=new jq$.iFormValidate.validator.email(jq$(this),$controlToValidate).validate();break;case"minLength":error=new jq$.iFormValidate.validator.minLength(jq$(this),$controlToValidate).validate();break;case"required":error=new jq$.iFormValidate.validator.required(jq$(this),$controlToValidate).validate();break;case"method":validationResult=new jq$.iFormValidate.validator.method(jq$(this)).validate();error=validationResult.error;if(validationResult.shouldStopValidation){jq$(this).attr("shouldStopValidation","true");}else{jq$(this).removeAttr("shouldStopValidation");}break;case"date":error=new jq$.iFormValidate.validator.date(jq$(this),$controlToValidate).validate();break;default:throw ("Validator type not supported: "+validatorType);}if(error!=null&&error.length>0){jq$(this).attr("invalid","true");if(validatorType!="method"){setErrorStyle(jq$(this));}}else{jq$(this).removeAttr("invalid");if(validatorType!="method"){setNormalStyle(jq$(this));}}function setErrorStyle($validator){var displayType=$validator.attr("display");switch(displayType){case"dynamic":$validator.css("display","block");default:$validator.css("visibility","visible");break;}}function setNormalStyle($validator){var displayType=$validator.attr("display");switch(displayType){case"dynamic":$validator.css("display","none");default:$validator.css("visibility","hidden");break;}}},validator:{passwordCompare:function($validator,$controlToValidate){var pThis=this;var val=$controlToValidate.val();var $compareWithControl=jq$("#"+$validator.attr("compareWith"));var compareWithValue=$compareWithControl.val();pThis.validate=validate;function init(){if($compareWithControl==null){throw ("Invalid compareWith attribute");}if(compareWithValue==null||compareWithValue=="undefined"){throw ("Invalid compareWith attribute");}}function validate(){if(val!=null&&compareWithValue!=null&&val!="undefined"&&compareWithValue!="undefined"&&val===compareWithValue){return"";}return $validator.attr("errorMessage");}init();},minLength:function($validator,$controlToValidate){var pThis=this;var val=$controlToValidate.val();var minLengthValue=parseInt($validator.attr("minLengthValue"),10);pThis.validate=validate;
5function init(){if(isNaN(minLengthValue)||minLengthValue<0){throw ("Invalid minLengthValue");}}function validate(){if(val==null||val.length==0||val.length>=minLengthValue){return"";}return $validator.attr("errorMessage");}init();},email:function($validator,$controlToValidate){var pThis=this;var Regex=/^\s*[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\s*$/;var val=$controlToValidate.val();pThis.validate=validate;function validate(){if(val==null||val.length==0||Regex.test(val)){return"";}return $validator.attr("errorMessage");}},date:function($validator,$controlToValidate){var pThis=this;var Regex=/^([\d]|1[0,1,2]|0[1-9])(\-|\/|\.)([0-9]|[0,1,2][0-9]|3[0,1])(\-|\/|\.)\d{4}$/;var val=$controlToValidate.val();pThis.validate=validate;function validate(){if(Regex.test(val)){return"";}return $validator.attr("errorMessage");}},required:function($validator,$controlToValidate){var pThis=this;var val=$controlToValidate.val();pThis.validate=validate;function validate(){if(val!=null&&val!="undefined"&&val.length>0){return"";}return $validator.attr("errorMessage");}},method:function($validator){var pThis=this;pThis.validate=validate;function validate(){var validationResult={result:true,shouldStopValidation:false};$validator.trigger("wavalidate",[validationResult]);if(validationResult.result){return{error:"",shouldStopValidation:validationResult.shouldStopValidation};}return{error:$validator.attr("errorMessage"),shouldStopValidation:validationResult.shouldStopValidation};}}}};jq$.fn.FormValidate=jq$.iFormValidate.build;(function(window,document){function getIanaTimeZone(){return Intl.DateTimeFormat().resolvedOptions().timeZone;}function processItem(itemElement,ianaTimeZone,timezoneRegex,timeRegex){var clientTimeZone=itemElement.getAttribute("client-tz-item");if(clientTimeZone===ianaTimeZone){return;}var formattedTimezone=itemElement.getAttribute("client-tz-formatted");if(formattedTimezone&&!timezoneRegex.test(itemElement.innerText)){if(itemElement.tagName==="A"){updateAnchorTitle(itemElement,formattedTimezone,timeRegex);}else{appendTimezone(itemElement,formattedTimezone);}}}function updateAnchorTitle(itemElement,formattedTimezone,timeRegex){var originalTitle=itemElement.getAttribute("title");var formattedTitle=originalTitle.replace(timeRegex,function(match){return match+formattedTimezone;});itemElement.setAttribute("title",formattedTitle);}function appendTimezone(itemElement,formattedTimezone){itemElement.innerText+=formattedTimezone;}function init(){var timezoneRegex=/\(\w+\/[A-Za-z_\/-]+\)|\([A-Z]{2,9}\)$/;var timeRegex=/\b(\d{1,2}:\d{2})(?:\s?(AM|PM))?\b/g;var items=document.querySelectorAll("[client-tz-item]");if(items.length===0){return;}var ianaTimeZone=getIanaTimeZone();for(var i=0;i<items.length;i++){processItem(items[i],ianaTimeZone,timezoneRegex,timeRegex);}}BonaPage.addPageStateHandler(BonaPage.PAGE_LOADED,init,BonaPage.HANDLERTYPE_ALWAYS);})(window,document);(function(window,document){if(!window.WA.WaitlistCancellationDialog){window.WA.WaitlistCancellationDialog=WaitlistCancellationDialog;}function WaitlistCancellationDialog(confirmRemovalFromWaitlistDialogTitle,closeButtonText,leaveWaitListButtonText,waitListConfirmationQuestion,removeFromWaitListText,isButton,eventId){var cancellationDialog;window.onCancelClick=function(registrationId){if(!cancellationDialog){cancellationDialog=createWaitlistCancellationDialog(registrationId);}cancellationDialog.show();return false;};window.onRemoveFromWaitlistClick=function onRemoveFromWaitlistClick(){if(!waitlistCancellationDialog){var waitlistCancellationDialog=createWaitlistCancellationDialog(eventId);}waitlistCancellationDialog.show();};function createWaitlistCancellationDialog(registrationId){var dialogId="waitlistCancellationDialog";var leaveWaitListButtonId=dialogId+"_LeaveWaitList";var closeButtonId=dialogId+"_CloseButton";var dialog=WA.UI.WaWindowManager.createDialog(dialogId,{width:400,height:200,isModal:true,hideCloseButton:true});dialog.addMainContainerCssClass("waitlistCancellationDialog");dialog.setTitle(confirmRemovalFromWaitlistDialogTitle);var contentModel={confirmationMessage:waitListConfirmationQuestion};dialog.setContent(waitlistCancellationDialogContentTemplate(contentModel));var footerModel={cancelButtonId:leaveWaitListButtonId,cancelButtonText:leaveWaitListButtonText,closeButtonId:closeButtonId,closeButtonText:closeButtonText};dialog.setFooter(waitlistCancellationDialogFooterTemplate(footerModel));var closeButton=new WA.UI.Button({id:closeButtonId},{parentComponent:dialog});closeButton.ButtonClick.addHandler(function(){dialog.hide();});closeButton.renderComplete();var cancelButton=new WA.UI.Button({id:leaveWaitListButtonId},{parentComponent:dialog});cancelButton.ButtonClick.addHandler(function(){onRemoveWaitlistButtonClick(registrationId,dialog);});cancelButton.renderComplete();return dialog;}function waitlistCancellationDialogContentTemplate(model){var containerTemplate=WA.UI.ContainerTemplate;return containerTemplate({cssClass:"waitlistCancellationDialogContent",contentHTML:containerTemplate({cssClass:"confirmMessage",contentHTML:model.confirmationMessage})});}function waitlistCancellationDialogFooterTemplate(model){var buttonTemplate=WA.UI.WaButtonTemplate;return WA.UI.ContainerTemplate({cssClass:"actionButtons",contentHTML:buttonTemplate({id:model.cancelButtonId,name:model.cancelButtonText,enabled:true},{color:WA.UI.WaButton.ButtonColor.Green})+buttonTemplate({id:model.closeButtonId,name:model.closeButtonText},{color:WA.UI.WaButton.ButtonColor.Green})});}function setDisplayStyleForElements(className,displayStyle){var elements=document.getElementsByClassName(className);for(var i=0;i<elements.length;i++){elements[i].style.display=displayStyle;}}function hideMessagesPopup(){var messagePopup=document.getElementById("WA_messagePopup");if(messagePopup){messagePopup.style.display="none";}}function onRemoveWaitlistButtonClick(registrationId,dialog){var cancellationComment="";sendWaitlistCancellationRequest(registrationId,cancellationComment,dialog);}function sendWaitlistCancellationRequest(registrationId,cancellationComment,dialog){var model={registrationId:registrationId,comment:cancellationComment,waitlistCancellation:true};var cancelRegistrationUrl="/Sys/Finances/MemberProfileAction/CancelRegistration";var sessionKeyField=document.getElementById("jsCookieHiddenField");if(sessionKeyField&&sessionKeyField.value){try{var sessionCookies=JSON.parse(sessionKeyField.value);if(sessionCookies&&sessionCookies.length>0&&sessionCookies[0].cookieValue){cancelRegistrationUrl+="?sk="+encodeURIComponent(sessionCookies[0].cookieValue);}}catch(e){}}WA.Ajax({url:cancelRegistrationUrl,dataType:"text",contentType:"application/json; charset=utf-8",global:false,type:"POST",data:JSON.stringify(model),success:function(){if(!isButton){var row=document.querySelector('tr[data-registration-id="'+registrationId+'"]');if(row){row.parentNode.removeChild(row);}}else{setDisplayStyleForElements("cancelMessageBox","block");setDisplayStyleForElements("warningMessageBox","none");setDisplayStyleForElements("paymentMessageBox","none");setDisplayStyleForElements("infoMessageBox","none");
5setDisplayStyleForElements("removeWaitlistButton","none");setDisplayStyleForElements("actionInvoiceButton","none");setDisplayStyleForElements("newRegistrationButton","none");setDisplayStyleForElements("completeRegistrationButton","none");hideMessagesPopup();}dialog.hide();}});}function getRemoveWaitListLink(item){if(!item.IsWaitList||item.isPast){return"";}return'&nbsp;<a class="noLine" href="#" onclick="onCancelClick('+item.registrationId+');">'+removeFromWaitListText+"</a>";}function processWaitlistLinks(){var elements=document.querySelectorAll("div[data-is-waitList]");for(var i=0;i<elements.length;i++){var IsWaitList=elements[i].getAttribute("data-is-waitList")==="true";var registrationId=elements[i].getAttribute("data-registration-id");var isPast=elements[i].getAttribute("data-is-past")==="true";var item={IsWaitList:IsWaitList,registrationId:registrationId,isPast:isPast};var link=getRemoveWaitListLink(item);if(link){elements[i].innerHTML+=link;}}}if(isButton){var removeWaitlistButton=WA.$(removeFromWaitListText,window);WA.addHandler(removeWaitlistButton,"click",onRemoveFromWaitlistClick);}else{processWaitlistLinks();}}})(window,document);(function(jq$){if(!window.OAuthButtons){window.OAuthButtons=OAuthButtons;}function OAuthButtons(args){if(!args.id){throw new Error("id was not defined!");}var container,form;function onContainerClick(e){var attr=e.target.getAttribute("provider");if(!attr){return;}switch(attr){case"Facebook":case"GooglePlus":case"Microsoft":case"Apple":submitExternalAuthForm(attr);break;default:throw new Error("unsupported provider: "+attr);}}function submitExternalAuthForm(providerName){var providerField=jq$(form).find(".oAuthProvider");providerField.val(providerName);jq$(form).submit();}function init(){var containerId=args.id+"_container";container=document.getElementById(containerId);form=document.getElementById(args.formId);var browserCapabilitiesField=document.getElementById(args.id+"_browserCapabilities");var browserData=browserInfo.getBrowserCapabilitiesData();browserCapabilitiesField.value=browserData;if(!container){throw new Error("Could not find container by id: "+containerId);}if(!form){throw new Error("Could not find form by id: "+args.formId);}jq$(container).click(onContainerClick);}init();}})(window.jq$);(function(window){if(window.BlogHelper){return;}window.BlogHelper=new Object();var hiddenFormFormCommentExists=null;var commentBottom=null;var formDisabled=false;var commentLengthValidator=null;var oldValidatorMessage;window.BlogHelper.previousReplyLink=null;function setUrlFragment(value,w){var wnd=w||window;if(!wnd.location){return"";}var match=(/#([^#]*)$/gi).exec(wnd.location.toString()),activeUrl=wnd.location.toString(),newUrl=match?activeUrl.replace(/#([^#]+)$/gi,"#"+value):activeUrl+"#"+value;wnd.location.replace(newUrl);}BlogHelper.replyToComment=function(replyLink){var comment=BlogHelper.getCommentContainer(replyLink);if(!comment){return;}var messageId=comment.getAttribute("messageId");if(!messageId){return false;}var addNewCommentFormContainer=WA.$("idAddNewCommentFormContainer",window);var replyToCommentHidden=WA.$(BlogHelper.idReplyToCommentId,window);if(formDisabled){return;}if(DataChangeWatcher){var checkResult=DataChangeWatcher.confirmIfDataChanged();DataChangeWatcher.resumeWatching();if(!checkResult){return;}}if(commentBottom){commentBottom.style.display="";}var commentBottom=BlogHelper.getCommentBottomBlock(comment);var replyFormContainer=comment;do{replyFormContainer=replyFormContainer.nextSibling;}while(replyFormContainer&&replyFormContainer.nodeType!=1);if(commentBottom){commentBottom.style.display="none";}if(window.BlogHelper.previousReplyLink){window.BlogHelper.previousReplyLink.style.display="inline";}window.BlogHelper.previousReplyLink=replyLink;window.BlogHelper.replyingOnCommentId=getReplyId();if(!replyToCommentHidden){replyToCommentHidden=WA.$(BlogHelper.idReplyToCommentId,window);}replyToCommentHidden.value=messageId;commentLengthValidator=window.setTimeout("BlogHelper.validateCommentLength()",300);};BlogHelper.showReplyIfAwailable=function(replyLink){var comment=BlogHelper.getCommentContainer(replyLink);if(!comment){return true;}var messageId=comment.getAttribute("messageId");if(!messageId){return true;}if(window.BlogHelper.replyingOnCommentId!=messageId){return true;}WA.$("idAddNewCommentFormContainer",window).style.display="";return false;};BlogHelper.hideButtonsIfJsEnabled=function(){var commentsContainer=WA.$("idBlogCommentsListContainer",window);var buttons=commentsContainer.getElementsByTagName("INPUT");var links=commentsContainer.getElementsByTagName("A");for(var i=0;i<buttons.length;i++){if(buttons[i].attributes["HideIfJsEnabled"]){buttons[i].style.display="none";}}for(var i=0;i<links.length;i++){if(links[i].attributes["ShowIfJsEnabled"]){links[i].style.display="";}}};BlogHelper.hideCommentForm=function(){var addNewCommentFormContainer=WA.$("idAddNewCommentFormContainer",window);var commentText=WA.$(BlogHelper.idCommentText,window);if(WA.String.gtrim(commentText.value).length>0){DataChangeWatcher.setChanged();}
5else{DataChangeWatcher.setNotChanged();}if(DataChangeWatcher&&DataChangeWatcher.confirmIfDataChanged()){addNewCommentFormContainer.style.display="none";commentText.value="";if(commentLengthValidator){window.clearTimeout(commentLengthValidator);}if(commentBottom){commentBottom.style.display="";}if(window.BlogHelper.previousReplyLink){window.BlogHelper.previousReplyLink.style.display="";}return true;}return true;};BlogHelper.validateComment=function(){var commentText,commentLength,message,captchaCode;commentText=WA.$(BlogHelper.idCommentText,window);commentLength=BlogHelper.getCommentLength();message="";if(commentText.value.trim().length==0){message=BlogHelper.strCommentIsEmpty;}if(commentLength>BlogHelper.intMaxCommentLength){message=BlogHelper.strCommentLengthExeededAlertMessage;}captchaCode=WA.$(BlogHelper.idCaptchaCodeId,window);if(captchaCode&&captchaCode.value.trim().length==0){if(message!=""){message+="\r\n";}message+=BlogHelper.strCaptchaCodeIsEmpty;}if(message!=""){alert(message);return false;}Page_IsValid=true;Page_BlockSubmit=false;return true;};BlogHelper.validateCommentLength=function(){var commentText,commentLength,errorContainer,errorText,newValidatorMessage;if(!(commentText=WA.$(BlogHelper.idCommentText,window))){return;}commentLength=BlogHelper.getCommentLength();errorText=WA.$("errorMessage",window);errorContainer=WA.$(BlogHelper.idErrorMessageContainer,window);newValidatorMessage=commentLength>BlogHelper.intMaxCommentLength?BlogHelper.strCommentLengthExeededValidatorMessage.toString().replace(/\[0\]/,commentLength):"";if(oldValidatorMessage!=newValidatorMessage){oldValidatorMessage=errorText.innerHTML=newValidatorMessage;}errorContainer.style.display=errorText.innerHTML!=""?"block":"none";commentLengthValidator=window.setTimeout("BlogHelper.validateCommentLength()",300);};BlogHelper.getCommentLength=function(){return WA.$(BlogHelper.idCommentText,window).value.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n").length;};BlogHelper.disableCommentForm=function(){if(DataChangeWatcher){DataChangeWatcher.pauseWatching();}window.setTimeout(function(){WA.$(BlogHelper.idPostCommentButton,window).disabled=true;WA.$(BlogHelper.idCommentText,window).disabled=true;var captchaCode=WA.$(BlogHelper.idCaptchaCodeId,window);var captchaReload=WA.$(BlogHelper.idCaptchaReloadId,window);var anonimousAuthorTextBox=WA.$(BlogHelper.idAnonimousAuthorTextBoxId,window);if(captchaCode){captchaCode.disabled=true;}if(captchaReload){captchaReload.style.display="none";}if(anonimousAuthorTextBox){anonimousAuthorTextBox.disabled=true;}formDisabled=true;},10);};BlogHelper.disablePostForm=function(){if(DataChangeWatcher){DataChangeWatcher.pauseWatching();}window.setTimeout(function(){if(Page_IsValid){formDisabled=true;}},100);};BlogHelper.deleteComment=function(){};BlogHelper.stokeComment=function(anyCommentInnerObject,enabled){var comment;if(comment=BlogHelper.getCommentContainer(anyCommentInnerObject)){comment.className=enabled?"commentViewContainer Stoked":"commentViewContainer";}};BlogHelper.getCommentContainer=function(innerObject){var comment=innerObject;if(!comment){return null;}while(!comment.getAttribute("messageId")&&comment.tagName!="BODY"){comment=comment.parentNode;}return(comment.tagName!="BODY")?comment:null;};BlogHelper.getCommentBottomBlock=function(comment){var elements,i;if(comment.className=="commentBottom"||comment.className=="postBottom"){return comment;}elements=comment.getElementsByTagName("DIV");for(i=0;i<elements.length;i++){if(elements[i].className=="commentBottom"||elements[i].className=="postBottom"){return elements[i];}}};BlogHelper.AutoexpandReplyFormIfNeeded=function(){var replyId=getReplyId();var commentOnPost=isAddingCommentToPost();var replyOnMessage;if(replyId){replyOnMessage=findMessageByMessageId(replyId);setUrlFragment(replyId,window);BlogHelper.replyToComment(replyOnMessage);}else{if(commentOnPost){replyOnMessage=WA.$(BlogHelper.postContainerId,window);BlogHelper.replyToComment(replyOnMessage);}}};BlogHelper.AutoScrollToAnchor=function(anchorParamName){var searchPattern=new RegExp(anchorParamName+"=([0-9a-zA-Z]+)");var match=searchPattern.exec(window.location);if(match!=null){setUrlFragment(match[1],window);}};BlogHelper.getTwoDigitsNumber=function(number){return number<10?"0"+number:number;};BlogHelper.ValidateBody=function(sender,args){var box,value;if(WidgetMode==1){if(box=WA.$(BodyTextBoxId,window)){args.IsValid=(box.value.replace(/^\s*|\s*$/g,"")!="");}return;}if(!top||!WA.BonaEditor.EditorsManager){return;}box=WA.BonaEditor.EditorsManager.getEditorById(BlogHelper.idEditor);if(box==null){return;}value=box.getHtmlData().replace(/&nbsp;|\s|<br>|<p>|<\/p>/ig,"");args.IsValid=value.length>0;};BlogHelper.ValidateBodyLength=function(sender,args){var box,value,valueLength;if(WidgetMode==1){if(box=WA.$(BodyTextBoxId,window)){args.IsValid=(box.value.replace(/^\s*|\s*$/g,"").length<=BlogHelper.intMaxPostLength);}return;}if(!top||!WA.BonaEditor.EditorsManager){return;}box=WA.BonaEditor.EditorsManager.getEditorById(BlogHelper.idEditor);if(box==null){return;}valueLength=box.getHtmlDataLength();args.IsValid=(valueLength<=BlogHelper.intMaxPostLength);};BlogHelper.OnLoad=function(){BlogHelper.AutoScrollToAnchor("anch
5or");BlogHelper.AutoexpandReplyFormIfNeeded();};function getReplyId(){var url=window.location?window.location.toString():"";var searchRegExs=[/replyTo\=(\d+)/i,/#replyTo(\d+)$/i];for(var i=0;i<searchRegExs.length;i++){var match=searchRegExs[i].exec(url);if(match){return match[1];}}return 0;}function isAddingCommentToPost(){var url=window.location?window.location.toString():"";var searchRegEx=/#addComment$/i;var match=searchRegEx.exec(url);return match?true:false;}function findMessageByMessageId(messageId){var elements=document.getElementsByTagName("DIV");for(var i=0;i<elements.length;i++){var element=elements[i];var attribute=element.getAttribute("messageId");if(attribute==messageId){return element;}}return null;}})(window);if(window.BonaPage){BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED,BlogHelper.OnLoad);}jq$(function(){if(jq$(".blogEntryContainer #idAddNewCommentFormContainer").size()){$("body").animate({scrollTop:$("#idAddNewCommentFormContainer").offset().top},0);}});(function(window,WA,undefined){if(!window.WaContentGadgetResizer){window.WaContentGadgetResizer=WaContentGadgetResizer;}function WaContentGadgetResizer(initModel){var pThis=this,typeName="WaContentGadgetResizer",viewModel=initModel;pThis.toString=function(){return typeName;};var isDisposed=false,container,editableContainer,editableAttribute="data-editableArea",setHeightTimeout=50,editableHeightAttribute="data-areaHeight";function resetEditableContainerHeight(){WA.removeHandler(this,"load",resetEditableContainerHeight);WA.throttle(setEditableContainerHeight,{timeout:setHeightTimeout});}function setEditableContainerHeight(){if(isDisposed){return;}var gadgetHeight=container.offsetHeight-WA.Style.getElementStyleInt(container,"paddingBottom",window),gadgetPosition=container.style.position||"",heightMeter=document.createElement("waContentHeightMeter"),editableContainerHeight,height;heightMeter.style.display="block";heightMeter.style["float"]="none";heightMeter.style["clear"]="both";heightMeter.style.height="0px";heightMeter.style.fontSize="0px";container.style.position="relative";container.appendChild(heightMeter);editableContainerHeight=editableContainer.offsetHeight-WA.Style.getElementStyleInt(editableContainer,"paddingTop",window)-WA.Style.getElementStyleInt(editableContainer,"paddingBottom",window);height=Math.max(editableContainerHeight+gadgetHeight-heightMeter.offsetTop,0);container.removeChild(heightMeter);heightMeter=null;container.style.position=gadgetPosition;editableContainer.style.height=height+"px";editableContainer.setAttribute(editableHeightAttribute,height,0);}function init(){var containerImages,i,len;container=WA.$(viewModel.id,window);if(!container){return;}editableContainer=container.querySelector("["+editableAttribute+"]");if(editableContainer){editableContainer.style.height="";containerImages=container.getElementsByTagName("img");for(i=0,len=containerImages.length;i<len;i++){if(!containerImages[i]["complete"]){WA.addHandler(containerImages[i],"load",resetEditableContainerHeight);}}resetEditableContainerHeight();}}function dispose(){if(isDisposed){return;}WA.clearThrottle(setEditableContainerHeight);viewModel=null;container=null;editableContainer=null;isDisposed=true;}BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED,init,BonaPage.HANDLERTYPE_ALWAYS);BonaPage.addPageStateHandler(BonaPage.PAGE_UNLOADED,dispose,BonaPage.HANDLERTYPE_ALWAYS);}})(window,window.WA);(function(){if(!window.Bonasource){window.Bonasource=new Object();}if(window.Bonasource.ControlTooltip){return;}window.Bonasource.ControlTooltip=controlTooltip;function controlTooltip(elementId,tooltipCssClass,tooltipHTML){var _tooltipShowDelegate=null;var _tooltipHideDelegate=null;var _tooltipMoveDelegate=null;var _tooltipDiv=null;var _tooltipHTML=tooltipHTML;var _tooltipCssClass=tooltipCssClass;var _element=WA.$(elementId,window);var _pThis=this;addStateHandlers(elementId);function addStateHandlers(elementId){BonaPage.addHandler(_element,"mouseover",element_OnMouseOver);BonaPage.addHandler(_element,"mouseout",element_OnMouseOut);BonaPage.addHandler(_element,"mousemove",element_OnMouseOver);}function getTooltipDiv(){if(!_tooltipDiv){_tooltipDiv=document.createElement("div");_tooltipDiv.className=_tooltipCssClass;_tooltipDiv.innerHTML=_tooltipHTML;_tooltipDiv.style.position="absolute";_tooltipDiv.style.zIndex=1000;_tooltipDiv.style.display="none";document.body.appendChild(_tooltipDiv);BonaPage.addHandler(_tooltipDiv,"mouseover",element_OnMouseOver);BonaPage.addHandler(_tooltipDiv,"mouseout",element_OnMouseOut);}return _tooltipDiv;}var _tooltipX;var _tooltipY;var _mouseOverTimeout;var _mouseOutTimeout;function element_OnMouseOver(evt){if(_mouseOverTimeout){clearTimeout(_mouseOverTimeout);}if(_mouseOutTimeout){clearTimeout(_mouseOutTimeout);}var mouseXY=WA.getEventMouseCoords(evt);_tooltipY=mouseXY.top;_tooltipX=mouseXY.left;_mouseOverTimeout=setTimeout(showDiv,10);}function element_OnMouseOut(evt){if(_mouseOutTimeout){clearTimeout(_mouseOutTimeout);}_mouseOutTimeout=setTimeout(hideDiv,10);}function showDiv(){try{var div=getTooltipDiv();div.style.display="block";div.style.top=_tooltipY+21+"px";div.style.left=_tooltipX+11+"px";}catch(err){}}function hideDiv(){var div=getTooltipDiv();div.style.display="none";}return _pThis;}})();(function(){if(window.ForumHelper){return;}window.ForumHelper=new Object();function $(id){return document.getElementById(id);}
5ForumHelper.navigateToTopic=function(topicUrl){window.location=topicUrl;};ForumHelper.highlight=function(elem){jq$(elem).removeClass("normal").addClass("highlight");};ForumHelper.normlight=function(elem){jq$(elem).removeClass("highlight").addClass("normal");};ForumHelper.subscribeForum=function(forumId){var subscribeLink=$(ForumHelper.subscribeLinkID);var subscribingLabel=$(ForumHelper.subscribingLabelID);subscribingLabel.style.display="inline-block";subscribeLink.style.display="none";try{WA.Ajax({url:ForumModel.Urls.SubscribeForum,cache:false,global:false,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({forumId:forumId}),type:"POST",success:ForumHelper.subscribedSuccessfully,error:ForumHelper.subscriptionFailed});}catch(e){return true;}return false;};ForumHelper.unsubscribeForum=function(forumId){var unsubscribeLink=$(ForumHelper.unsubscribeLinkID);var unsubscribingLabel=$(ForumHelper.unsubscribingLabelID);unsubscribingLabel.style.display="inline-block";unsubscribeLink.style.display="none";try{WA.Ajax({url:ForumModel.Urls.UnsubscribeForum,cache:false,global:false,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({forumId:forumId}),type:"POST",success:ForumHelper.unsubscribedSuccessfully,error:ForumHelper.unsubscriptionFailed});}catch(e){return true;}return false;};ForumHelper.subscribedSuccessfully=function(){var unsubscribeLink=$(ForumHelper.unsubscribeLinkID);var subscribingLabel=$(ForumHelper.subscribingLabelID);var unsubscribingLabel=$(ForumHelper.unsubscribingLabelID);unsubscribeLink.style.display="inline-block";subscribingLabel.style.display="none";unsubscribingLabel.style.display="none";};ForumHelper.subscriptionFailed=function(){var subscribeLink=$(ForumHelper.subscribeLinkID);var subscribingLabel=$(ForumHelper.subscribingLabelID);var unsubscribingLabel=$(ForumHelper.unsubscribingLabelID);subscribeLink.style.display="inline-block";subscribingLabel.style.display="none";unsubscribingLabel.style.display="none";};ForumHelper.unsubscribedSuccessfully=function(){var subscribeLink=$(ForumHelper.subscribeLinkID);var subscribingLabel=$(ForumHelper.unsubscribingLabelID);var unsubscribingLabel=$(ForumHelper.unsubscribingLabelID);subscribeLink.style.display="inline-block";subscribingLabel.style.display="none";unsubscribingLabel.style.display="none";};ForumHelper.unsubscriptionFailed=function(){var unsubscribeLink=$(ForumHelper.unsubscribeLinkID);var subscribingLabel=$(ForumHelper.subscribingLabelID);var unsubscribingLabel=$(ForumHelper.unsubscribingLabelID);unsubscribeLink.style.display="inline-block";subscribingLabel.style.display="none";unsubscribingLabel.style.display="none";};ForumHelper.subscribeTopic=function(topicId){var subscribeTopicLink=$(ForumHelper.subscribeTopicLinkID);var subscribingTopicLabel=$(ForumHelper.subscribingTopicLabelID);subscribingTopicLabel.style.display="inline-block";subscribeTopicLink.style.display="none";try{WA.Ajax({url:ForumModel.Urls.SubscribeTopic,cache:false,global:false,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({topicId:topicId}),type:"POST",success:ForumHelper.subscribedTopicSuccessfully,error:ForumHelper.subscriptionTopicFailed});}catch(e){return true;}return false;};ForumHelper.unsubscribeTopic=function(topicId){var unsubscribeTopicLink=$(ForumHelper.unsubscribeTopicLinkID);var unsubscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);unsubscribingTopicLabel.style.display="inline-block";unsubscribeTopicLink.style.display="none";WA.Ajax({url:ForumModel.Urls.UnsubscribeTopic,cache:false,global:false,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({topicId:topicId}),type:"POST",success:ForumHelper.unsubscribedTopicSuccessfully,error:ForumHelper.unsubscriptionTopicFailed});return false;};ForumHelper.subscribedTopicSuccessfully=function(){var unsubscribeTopicLink=$(ForumHelper.unsubscribeTopicLinkID);var subscribingTopicLabel=$(ForumHelper.subscribingTopicLabelID);var unsubscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);unsubscribeTopicLink.style.display="inline-block";subscribingTopicLabel.style.display="none";unsubscribingTopicLabel.style.display="none";};ForumHelper.subscriptionTopicFailed=function(){var subscribeTopicLink=$(ForumHelper.subscribeTopicLinkID);var subscribingTopicLabel=$(ForumHelper.subscribingTopicLabelID);var unsubscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);subscribeTopicLink.style.display="inline-block";subscribingTopicLabel.style.display="none";unsubscribingTopicLabel.style.display="none";};ForumHelper.unsubscribedTopicSuccessfully=function(){var subscribeTopicLink=$(ForumHelper.subscribeTopicLinkID);var subscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);var unsubscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);subscribeTopicLink.style.display="inline-block";subscribingTopicLabel.style.display="none";unsubscribingTopicLabel.style.display="none";};ForumHelper.unsubscriptionTopicFailed=function(){var unsubscribeTopicLink=$(ForumHelper.unsubscribeTopicLinkID);var subscribingTopicLabel=$(ForumHelper.subscribingTopicLabelID);var unsubscribingTopicLabel=$(ForumHelper.unsubscribingTopicLabelID);unsubscribeTopicLink.style.display="inline-block";subscribingTopicLabel.style.display="none";unsubscribingTopicLabel.style.display="none";};ForumHelper.existedCategorySelected=function(){var existingCategoryDiv=$(ForumHelper.idExistingCategoryDiv);var newCategoryDiv=$(ForumHelper.idNewCategoryDiv);existingCategoryDiv.style.display="";newCategoryDiv.style.display="none";};ForumHelper.newCategorySelected=function(){var existingCategoryDiv=$(ForumHelper.idExistingCategoryDiv);var newCategoryDiv=$(ForumHelper.idNewCategoryDiv);existingCategoryDiv.style.display="none";newCategoryDiv.style.display="";};})();jq$(function(){jq$(".WaGadgetForumStateTopicList .boxBodyOuterContainer .threadImage img[src*=stickies]").each(function(){jq$(this).parent().addClass("stickyForumTopic");});});jq$(function(){if(jq$(".WaGadgetForumStateEditTopic, .WaGadgetForumStateAddTopic, .WaGadgetForumStateNewMessage, .WaGadgetForumStateEditMessage").size()){$("body").animate({scrollTop:$("#idAuthorLabelContainer").offset().top},0);}});
5function redirectToUrl(urlString){window.location.href=urlString;return false;}function changeStateAndSubmit(buttonId,state,hiddehId){var button=document.getElementById(buttonId);var hidden=document.getElementById(hiddehId);if(button!=null&&hidden!=null){hidden.value=state;button.click();}return false;}function submitClick(buttonId){var button=document.getElementById(buttonId);if(button!=null){button.click();}return false;}(function(window,WA,undefined){if(!window.WaFacebookPagePlugin){window.WaFacebookPagePlugin=FacebookPagePlugin;}function FacebookPagePlugin(initModel,initArgs){if(!WA){return;}initArgs=initArgs||{};var pThis=this,typeName="WaFacebookPagePlugin",viewModel=initModel,parentComponent=initArgs.parentComponent,facebookPagePluginContainerId=initArgs.facebookPagePluginContainerId;pThis.toString=function(){return typeName;};pThis.Dispose=WA.Tools.EventHandlers.createHandlers(pThis,{id:"Dispose"});pThis.dispose=dispose;function onFacebookSdkLoaded(sender,args){var sdk=args&&args.sdk,facebookPagePluginContainer=WA.$(facebookPagePluginContainerId,window);sdk.XFBML.parse(facebookPagePluginContainer);}function onGadgetDeleted(sender,args){args=args||{};if(args.componentId==viewModel.id){dispose();}}function init(){parentComponent.Dispose.addHandler(dispose);parentComponent.FacebookSdkLoaded.addHandler(onFacebookSdkLoaded,{period:"once"});WA.Gadgets.GadgetDeleted.addHandler(onGadgetDeleted);}function dispose(){pThis.Dispose.fireHandlers({id:viewModel.id});parentComponent.FacebookSdkLoaded.removeHandler(onFacebookSdkLoaded);WA.Gadgets.GadgetDeleted.removeHandler(onGadgetDeleted);parentComponent.Dispose.removeHandler(dispose);viewModel=null;parentComponent=null;pThis.RenderComplete=null;pThis.Dispose=null;}init();}})(window,window.WA);(function(window,WA,undefined){if(!window.WaFacebookPagePluginManager){window.WaFacebookPagePluginManager=new FacebookPagePluginManager();}function FacebookPagePluginManager(){if(!WA){return;}var pThis=this,typeName="WaFacebookPagePluginManager";pThis.toString=function(){return typeName;};pThis.Dispose=WA.Tools.EventHandlers.createHandlers(pThis,{id:"Dispose"});pThis.FacebookSdkLoaded=WA.Tools.EventHandlers.createHandlers(pThis,{id:"FacebookSdkLoaded",type:WA.Tools.EventHandlers.Type.Long});pThis.createGadget=createGadget;var gadgets={},sdkScriptSrc="//connect.facebook.net/en_US/all.js#xfbml=1&status=0",sdkScriptId="facebook-jssdk",fbRootId="fb-root";function onFbSdkReady(){FB.Event.subscribe("xfbml.render",onXfbmlRendered);pThis.FacebookSdkLoaded.fireHandlers({sdk:FB});}function onGadgetDispose(sender,args){delete gadgets[args&&args.id];}function createGadget(model,args){model=model||{};args=args||{};var gadgetId=model.id;if(gadgets.hasOwnProperty(gadgetId)&&gadgets[gadgetId].dispose){gadgets[gadgetId].dispose();}args.parentComponent=pThis;gadgets[gadgetId]=new WaFacebookPagePlugin(model,args);gadgets[gadgetId].Dispose.addHandler(onGadgetDispose);createFbRootElement();if(window.FB&&FB.XFBML&&FB.XFBML.parse){onFbSdkReady();return;}if(!WA.$(sdkScriptId,window)){loadFacebookSdk();}}function onXfbmlRendered(){WA.Gadgets.notifyGadgetChanged();}function createFbInitCallback(){var oldFbAsyncInit=window.fbAsyncInit;window.fbAsyncInit=function(){if(typeof oldFbAsyncInit=="function"){oldFbAsyncInit();}onFbSdkReady();};}function loadFacebookSdk(){var sdkScript=document.createElement("script");sdkScript.id=sdkScriptId;sdkScript.async=true;sdkScript.src=sdkScriptSrc;document.getElementsByTagName("head")[0].appendChild(sdkScript);}function createFbRootElement(){var fbRoot=WA.$(fbRootId,window);if(fbRoot){return;}fbRoot=document.createElement("div");fbRoot.id=fbRootId;document.body.appendChild(fbRoot);}function init(){if(window.FB&&FB.XFBML&&FB.XFBML.parse){onFbSdkReady();return;}createFbInitCallback();}function dispose(){if(window.FB&&FB.XFBML&&FB.XFBML.parse){FB.Event.unsubscribe("xfbml.render",onXfbmlRendered);}pThis.Dispose.fireHandlers();window[typeName]=null;gadgets=null;pThis.Dispose=null;pThis.FacebookSdkLoaded=null;}BonaPage.addPageStateHandler(BonaPage.PAGE_PARSED,init,BonaPage.HANDLERTYPE_ALWAYS);BonaPage.addPageStateHandler(BonaPage.PAGE_UNLOADED,dispose,BonaPage.HANDLERTYPE_ALWAYS);}})(window,window.WA);(function(){if(window.ForumSummaryHelper){return;}window.ForumSummaryHelper=new Object();function $(id){return document.getElementById(id);}
5ForumSummaryHelper.navigateToTopic=function(topicUrl){window.location=topicUrl;};ForumSummaryHelper.highlight=function(elem){jq$(elem).removeClass("normal").addClass("highlight");};ForumSummaryHelper.normlight=function(elem){jq$(elem).removeClass("highlight").addClass("normal");};ForumSummaryHelper.allForumsRadioSelected=function(){var selectForumsListDiv=$(ForumSummaryHelper.selectForumsListId);selectForumsListDiv.style.display="none";};ForumSummaryHelper.selectedForumsRadioSelected=function(){var selectForumsListDiv=$(ForumSummaryHelper.selectForumsListId);selectForumsListDiv.style.display="";};})();(function(window,WA,undefined){if(!window.WaGoogleMap){window.WaGoogleMap=GoogleMap;}function GoogleMap(initModel,initArgs){if(!WA){return;}initArgs=initArgs||{};var pThis=this,typeName="WaGoogleMap",viewModel=initModel,parentComponent=initArgs.parentComponent,address=initArgs.address||"",zoom=initArgs.zoom||13,mapWindow=initArgs.mapWindow||window,mapContainerId=initArgs.mapContainerId;pThis.toString=function(){return typeName;};pThis.Dispose=WA.Tools.EventHandlers.createHandlers(pThis,{id:"Dispose"});pThis.dispose=dispose;var isDisposed=false,api;function getCoordinates(){if(isDisposed){return;}var geocoder=new api.Geocoder();geocoder.geocode({address:address},function(locResult,status){if(status==api.GeocoderStatus.OK){setGoogleMap(locResult[0].geometry.location.lat(),locResult[0].geometry.location.lng());}else{}});}function setGoogleMap(x,y){if(isDisposed){return;}var mapContainer=mapContainerId&&WA.$(mapContainerId,mapWindow),mapOptions,map,markerOptions,marker;mapOptions={center:new api.LatLng(x,y),zoom:zoom,mapTypeId:api.MapTypeId.ROADMAP};map=new api.Map(mapContainer,mapOptions);markerOptions={map:map,position:new api.LatLng(x,y)};marker=new api.Marker(markerOptions);dispose();}function onGoogleMapsApiLoaded(){api=google.maps;if(address!=""){getCoordinates();}else{setGoogleMap(0,0);}}function onGadgetDeleted(sender,args){args=args||{};if(args.componentId==viewModel.id){dispose();}}function init(){parentComponent.Dispose.addHandler(dispose);parentComponent.GoogleMapsApiLoaded.addHandler(onGoogleMapsApiLoaded);WA.Gadgets.GadgetDeleted.addHandler(onGadgetDeleted);}function dispose(){isDisposed=true;pThis.Dispose.fireHandlers({id:viewModel.id});parentComponent.GoogleMapsApiLoaded.removeHandler(onGoogleMapsApiLoaded);WA.Gadgets.GadgetDeleted.removeHandler(onGadgetDeleted);parentComponent.Dispose.removeHandler(dispose);viewModel=null;parentComponent=null;api=null;pThis.RenderComplete=null;pThis.Dispose=null;}init();}})(window,window.WA);jq$(function(){jq$(".WaGadgetLoginForm").each(function(){if(jq$(this).find(".orientationHorizontal").size()){var forgotPassword=jq$(this).find(".loginPasswordForgot").clone();jq$(this).find(".loginActionRememberMe").after(forgotPassword);jq$(this).find(".loginPasswordForgot ~ .loginPasswordForgot").remove();}});});(function(){if(!window.ContactAdvancedSearch){window.ContactAdvancedSearch={};}var contactAdvancedSearch=window.ContactAdvancedSearch;var anyConditionValue=-1;var textBoxConditionValue={Empty:4,NotEmpty:5};var dateConditionValue={ThisMonth:4,ThisYear:5,LastMonth:7,LastYear:8,NotDefined:9,AnyDate:10,NextYear:11,NextMonth:12};var conditionSelectorState={Empty:0,NotEmpty:1,Same:2};var selectorTypeId={String:0,RadioButtonList:1,CheckBoxList:2,Date:3,Dropdown:4,Int:5,Decimal:6};var dropdownTypeId=4;var checkCriteriaChangedTimeout;contactAdvancedSearch.initialize=function(optionItems){contactAdvancedSearch.optionItems=optionItems||contactAdvancedSearch.optionItems;contactAdvancedSearch.initialized=true;};contactAdvancedSearch.dispose=function(){if(!contactAdvancedSearch.initialized){return;}contactAdvancedSearch.initialized=false;};contactAdvancedSearch.validateCriteriaSelected=function(source,args){for(var i=0;i<contactAdvancedSearch.optionItems.length;i++){var conditionSelector=WA.$(contactAdvancedSearch.optionItems[i].csId,window);if(conditionSelector.value!=anyConditionValue){args.IsValid=true;return;}}args.IsValid=false;};contactAdvancedSearch.prepareValidators=function(){for(var i=0;i<contactAdvancedSearch.optionItems.length;i++){var conditionSelector=WA.$(contactAdvancedSearch.optionItems[i].csId,window);if(conditionSelector.value==anyConditionValue){disableValidators(contactAdvancedSearch.optionItems[i].vIds);continue;}if(contactAdvancedSearch.optionItems[i].t==selectorTypeId.String&&!requiredTextBoxConditionSelected(conditionSelector)){disableValidators(contactAdvancedSearch.optionItems[i].vIds);continue;}if(contactAdvancedSearch.optionItems[i].t==selectorTypeId.Date&&!requiredDateConditionSelected(conditionSelector)){disableValidators(contactAdvancedSearch.optionItems[i].vIds);continue;}enableValidators(contactAdvancedSearch.optionItems[i].vIds);}};contactAdvancedSearch.dateConditionSelector=function(controlId,linkedControlId){var dropDownList=WA.$(controlId,window);var dateControlContainer=WA.$(linkedControlId,window).parentNode;var newReadOnlyContainer=document.createElement("DIV");var readOnlyContainerId="readOnlyContainer_"+linkedControlId;newReadOnlyContainer.setAttribute("id",readOnlyContainerId);newReadOnlyContainer.setAttribute("class","fieldItem");var readOnlyContainer=WA.$(readOnlyContainerId,window);var dateTextThisMonth=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextThisMonth;var dateTextThisYear=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextThisYear;var dateTextLastMonth=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextLastMonth;var dateTextLastYear=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextLastYear;var dateTextNextYear=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextNextYear;var dateTextNextMonth=MemberDirectoryAdvancedSearchCriteriaList.Labels.DateTextNextMonth;function setReadonlyContainerText(text){if(!readOnlyContainer){newReadOnlyContainer.innerHTML=text;newReadOnlyContainer.style.display="block";dateControlContainer.parentNode.appendChild(newReadOnlyContainer);}else{readOnlyContainer.innerHTML=text;readOnlyContainer.style.display="block";}dateControlContainer.style.display="none";}var selectedValue=dropDownList.options[dropDownList.selectedIndex].value;if(selectedValue==anyConditionValue||selectedValue==dateConditionValue.NotDefined||selectedValue==dateConditionValue.AnyDate){dateControlContainer.style.display="none";if(readOnlyContainer){readOnlyContainer.innerHTML="";readOnlyContainer.style.display="none";}return;}if(selectedValue==dateConditionValue.ThisMonth){setReadonlyContainerText(dateTextThisMonth);return;}if(selectedValue==dateConditionValue.LastMonth){setReadonlyContainerText(dateTextLastMonth);return;}if(selectedValue==dateConditionValue.ThisYear){setReadonlyContainerText(dateTextThisYear);return;}if(selectedValue==dateConditionValue.LastYear){setReadonlyContainerText(dateTextLastYear);return;}if(selectedValue==dateConditionValue.NextYear){setReadonlyContainerText(dateTextNextYear);return;}if(selectedValue==dateConditionValue.NextMonth){setReadonlyContainerText(dateTextNextMonth);return;}dateControlContainer.style.display="block";if(readOnlyContainer){readOnlyContainer.innerHTML="";readOnlyContainer.style.display="none";}};contactAdvancedSearch.textBoxConditionSelector=function(controlId,linkedControlContainerId){var control=WA.$(controlId,window);var linkedControlContainer=WA.$(linkedControlContainerId,window);if(control.value==textBoxConditionValue.Empty||control.value==textBoxConditionValue.NotEmpty){linkedControlContainer.style.display="none";}else{linkedControlContainer.style.display="block";}};contactAdvancedSearch.disposeCriteriaChangeScript=function(){checkCriteriaChangedTimeout=null;};contactAdvancedSearch.initCriteriaChangeScript=function(){for(var i=0;i<optionItems.length;i++){var valuesContainer=WA.$(optionItems[i].vsCId,window);if(optionItems[i].t==selectorTypeId.Dropdown){optionItems[i].inputs=valuesContainer.getElementsByTagName("SELECT");}else{optionItems[i].inputs=valuesContainer.getElementsByTagName("INPUT");}optionItems[i].conditionSelector=WA.$(optionItems[i].csId,window);}runCriteriaChanged();};function runCriteriaChanged(){for(var i=0;i<optionItems.length;i++){var changeStateTo=getChangeDirection(optionItems[i]);applyChangeDirection(optionItems[i],changeStateTo);clearValueIfConditionEmpty(optionItems[i]);}checkCriteriaChangedTimeout=setTimeout(function(){runCriteriaChanged();},300);}function getChangeDirection(item){if(!item.inputs||item.inputs.length==0||!item.inputs[0]){return;}if(item.t==selectorTypeId.Dropdown){var change=conditionSelectorState.Same;if(item.prevSelectedIndex!=item.inputs[0].selectedIndex&&item.inputs[0].selectedIndex!=0){change=conditionSelectorState.NotEmpty;}else{if(item.inputs[0].selectedIndex==0){change=conditionSelectorState.Empty;}}item.prevSelectedIndex=item.inputs[0].selectedIndex;return change;}else{if(item.t==selectorTypeId.String||item.t==selectorTypeId.Int||item.t==selectorTypeId.Decimal||item.toLocaleStr
5ing==selectorTypeId.Date){return item.inputs[0].value?conditionSelectorState.NotEmpty:conditionSelectorState.Empty;}else{if(item.t==selectorTypeId.CheckBoxList){for(var i=0;i<item.inputs.length;i++){if(item.inputs[i].checked){return conditionSelectorState.NotEmpty;}}return conditionSelectorState.Empty;}else{if(item.t==selectorTypeId.RadioButtonList){for(var i=0;i<item.inputs.length;i++){if(item.inputs[i].checked){var change=item.prevSelectedIndex!=i?conditionSelectorState.NotEmpty:conditionSelectorState.Same;item.prevSelectedIndex=i;return change;}}return conditionSelectorState.Same;}}}}}function applyChangeDirection(item,changeStateTo){if(item.prevChangeStateTo!=changeStateTo&&changeStateTo!=conditionSelectorState.Same){if(changeStateTo==conditionSelectorState.Empty&&item.conditionSelector.selectedIndex!=conditionSelectorState.Empty&&!((item.t==selectorTypeId.String||item.t==selectorTypeId.Int||item.t==selectorTypeId.Decimal)&&(item.conditionSelector.value==textBoxConditionValue.Empty||item.conditionSelector.value==textBoxConditionValue.NotEmpty))){item.conditionSelector.selectedIndex=conditionSelectorState.Empty;}if(changeStateTo==conditionSelectorState.NotEmpty&&item.conditionSelector.selectedIndex==conditionSelectorState.Empty){item.conditionSelector.selectedIndex=conditionSelectorState.NotEmpty;}}item.prevChangeStateTo=changeStateTo;}function clearValueIfConditionEmpty(item){if(!item.inputs||item.inputs.length==0||!item.inputs[0]){return;}if(item.conditionSelector.selectedIndex!=0){return;}if(item.t==selectorTypeId.Dropdown){item.prevSelectedIndex=item.inputs[0].selectedIndex;if(item.inputs[0].selectedIndex!==0){item.inputs[0].selectedIndex=0;}}else{if(item.t==selectorTypeId.String||item.t==selectorTypeId.Int||item.t==selectorTypeId.Decimal||item.toLocaleString==selectorTypeId.Date){item.inputs[0].value="";}else{if(item.t==selectorTypeId.CheckBoxList){for(var i=0;i<item.inputs.length;i++){item.inputs[i].checked=false;}}else{if(item.t==selectorTypeId.RadioButtonList){for(var i=0;i<item.inputs.length;i++){if(item.inputs[i].checked){item.prevSelectedIndex=i;}item.inputs[i].checked=false;}}}}}}function requiredDateConditionSelected(conditionSelector){if(conditionSelector.value!=dateConditionValue.ThisMonth&&conditionSelector.value!=dateConditionValue.ThisYear&&conditionSelector.value!=dateConditionValue.NextYear&&conditionSelector.value!=dateConditionValue.NextMonth&&conditionSelector.value!=dateConditionValue.LastMonth&&conditionSelector.value!=dateConditionValue.LastYear&&conditionSelector.value!=dateConditionValue.NotDefined&&conditionSelector.value!=dateConditionValue.AnyDate){return true;}return false;}function requiredTextBoxConditionSelected(conditionSelector){if(conditionSelector.value!=textBoxConditionValue.Empty&&conditionSelector.value!=textBoxConditionValue.NotEmpty){return true;}return false;}function enableValidators(vIds){for(var i=0;i<vIds.length;i++){WA.$(vIds[i],window).enabled=true;}}function disableValidators(vIds){for(var i=0;i<vIds.length;i++){WA.$(vIds[i],window).enabled=false;}}})();function ContactAdvancedSearch_Page_Parsed(){ContactAdvancedSearch.initialize(optionItems);}
6
7/*compiled*/
8var MemberDirectoryListRenderer;
9
10(function() {
11// start of MemberDirectoryListRenderer singleton
12
13  var $ = function (id) { return document.getElementById(id); };
14
15  if(MemberDirectoryListRenderer == null) 
16  {
17    MemberDirectoryListRenderer = new Object();
18
19    /*debug*/var logEnabled = false; function log(text) { if (logEnabled && WA.Log) { WA.Log.add('MemberDirectoryListRenderer', text); } }
20
21    MemberDirectoryListRenderer.FormId = 0;
22    MemberDirectoryListRenderer.DataSourceId = 0;
23
24    MemberDirectoryListRenderer.outputBlockId = 'memberDirectory';
25    MemberDirectoryListRenderer.foundBlockId = 'membersFound';
26    MemberDirectoryListRenderer.pagingBlockId = 'idPagingData';
27    MemberDirectoryListRenderer.pagingBlock2Id = 'idPagingData2';
28    MemberDirectoryListRenderer.waitMessagesBlockId = 'idWaitMessages';
29    MemberDirectoryListRenderer.reloadLinkId = 'idReloadData';
30    MemberDirectoryListRenderer.selectedMembersFieldId = '';
31    MemberDirectoryListRenderer.titleLabelId = '';
32    MemberDirectoryListRenderer.titleTemplate = '';
33    MemberDirectoryListRenderer.imgTemplateRelativePath = '';
34    MemberDirectoryListRenderer.MemberDirectoryListWebServiceUrl_LoadMembers = '';
35    MemberDirectoryListRenderer.notifyGadgetChangedTimeout = 27;
36
37    MemberDirectoryListRenderer.labels = 
38    {
39      serverLoadingStarted    :  '<img src="/Admin/html_res/images/asyncloadprogress.gif">Loading...'
40     ,serverLoadingError      : 'Loading error&nbsp;'
41     ,serverLoadingErrorAlert : 'Server error while loading data.<br>Please contact us at [email protected] and let us know what led to this error.<br><br>Sorry for inconvenience.'
42     ,processingServerData    : 'Processing data, please wait...'
43     ,processingCachedData    : 'Processing cache...'
44     ,searchingKeywords       : 'searching...'
45     ,searchingEmpty          : 'loading...'
46     ,displayingFound         : 'displaying...'
47     ,pagingTemplate          : 'Show:{0}'
48     ,noMembersInDatabase     : 'No members in your database.'
49     ,noMembersFound          : 'No members found. Edit your search text or clear search box to show all members.'
50     ,detailsUrlTitle         : 'Go to member details'
51     ,viewDetails             : 'View details'
52     ,headers                 : { column1: '', column2: '', column3: '', column4: '' }
53    };
54
55    // public methods
56    MemberDirectoryListRenderer.init = init;
57    MemberDirectoryListRenderer.highlightRowAndNext = highlightRowAndNext;
58    MemberDirectoryListRenderer.normlightRowAndNext = normlightRowAndNext;
59    MemberDirectoryListRenderer.highlightRowAndPrev = highlightRowAndPrev;
60    MemberDirectoryListRenderer.normlightRowAndPrev = normlightRowAndPrev;
61    MemberDirectoryListRenderer.redirectToMemberDetails = redirectToMemberDetails;
62    MemberDirectoryListRenderer.pagerChanged = pagerChanged;
63  }
64
65  // state vars
66  var isInited = false;
67  var directoryData;
68  var searchAsyncData;
69  var forceNextAskSearch = false;
70  var lastSeachBoxAskValue = '';
71  var isCached = false;
72  var cache;
73
74  // timeouts and intervals
75  var searchBoxAskTimeout;
76  var processSearchTimeout;
77  var searchAsyncTimeout;
78  var notifyGadgetChangedTimeout = MemberDirectoryListRenderer.notifyGadgetChangedTimeout;
79  
80  // consts
81  var pagerRangeNameLength = 4;
82  var pagerRangeLevelLength = 5;
83  var maxDisplayRecords = 50;
84  var searchBoxAskIntervalMs = 50;
85  var processSearchTimeoutMs = 250;
86  var searchAsyncTimeoutMs = 10;
87  var searchAsyncMaxRecords = 1000;
88
89  //filter
90  var maxFilterQty = 4;
91  var filterValues = new Array (null, null, null, null);
92  var filterOptionCounters = new Array (null, null, null, null);
93  var filterOptionNames = new Array (null, null, null, null);
94  
95  // templates
96
97  var footerTemplate = '</table>';
98  var pagerTemplate = [
99    '<select onchange="MemberDirectoryListRenderer.pagerChanged(this);">'
100  , '</select>'];
101  var pagerOptionTemplate = [
102    '<option value="'
103  , '">'
104  , '-'
105  , '</option>'];
106  var tableStart = '<table id="membersTable" class="membersTable" cellspacing="0"><thead><tr>';
107  var thTemplate = [
108    '<th width="'
109  , '%">'
110  , '</th>'];
111  var headerEnd = "</tr></thead>"
112  var tdTemplate = [
113    '<td class="'
114  , '" width="'
115  , '%">'
116  , '</td>'];
117  var linkTemplate = [
118    '<h5><a title="'
119  , '" onclick="globalUtils.stopEventPropogation(event)" href="'
120  , '">'
121  , '</a></h5>'];
122  var bottomRowTemplate = [
123    '</tr><tr class="normal" bottomrow=\'true\' onclick="MemberDirectoryListRenderer.redirectToMemberDetails(\''
124  , '\')" onmouseover="MemberDirectoryListRenderer.highlightRowA
124ndPrev(this)" onmouseout="MemberDirectoryListRenderer.normlightRowAndPrev(this)"><td class=\'memberDirectoryBottomRow\' colspan=\''
125  , '\'><div class=\'mainDiv\'>'
126  , '</div></td>'];
127  var memberTemplate = [
128    '<tr class="normal" onclick="MemberDirectoryListRenderer.redirectToMemberDetails(\''
129  , '\')" onmouseover="MemberDirectoryListRenderer.highlightRowAndNext(this)" onmouseout="MemberDirectoryListRenderer.normlightRowAndNext(this)">'
130  , '</tr>'];
131  var imgTemplate = [
132    '<img src=\''
133  , '?memberId='
134  , '&id='
135  , '&t='
136  , '\'></img>'];
137  var emailTemplate = [
138    '<a href="mailto:'
139  , '" onclick="window.location=this.href;BonaPage.stopEvent(event);">'
140  , '</a>'];
141
142  var emailReplaceTemplate = '<a href="mailto:$1" onclick="window.location=this.href;BonaPage.stopEvent(event);">$1</a>';
143
144  // reexp
145  var emailReplace1 = /([\w#%\"\*\.!\$\+\-\=\?\^\'\{\}\|\~\&]+@(?:[a-zA-Z0-9_-]+\.)+[a-zA-Z]{1,20})/gim;
146
147  /*****************************************************/
148  /***   INITIALIZATION AND DISPOSING                ***/
149  /*****************************************************/
150
151  function init()
152  {
153    /*debug*/log('init');
154
155    disableSearch();
156    initDisposeEvents();    
157    loadRecordsAsync();
158    initCache();
159    initFilter();
160
161    WA.Gadgets.GadgetDeleted.addHandler(onGadgetDeleted);
162
163    isInited = true;
164  }  
165  
166  function initDisposeEvents()
167  {
168    /*debug*/log('initDisposeEvents');
169
170    if (document.all)
171      window.attachEvent('onunload', dispose);
172    else
173      window.addEventListener('unload', dispose, false);
174  }
175  
176  function dispose()
177  {
178    /*debug*/log('dispose');
179
180    isInited = false;
181
182    WA.Gadgets.GadgetDeleted.removeHandler(onGadgetDeleted);
183
184    disposeAllTimeouts();
185    disposeSearchData();
186    directoryData = null;
187  }
188
189
190  function onGadgetDeleted(sender, args)
191  {
192    /*debug*/log('onGadgetDeleted');
193    args = args || {};
194
195    var versionData = MemberDirectoryListRenderer.VersionData;
196
197    if (versionData && args.componentId && args.componentId == versionData.componentId)
198    {
199      dispose();
200    }
201  }
202
203  
204  function disposeAllTimeouts()
205  {
206    /*debug*/log('disposeAllTimeouts');
207
208    WA.clearThrottle(doNotifyGadgetChanged);
209
210    if (searchBoxAskTimeout)
211      clearTimeout(searchBoxAskTimeout);
212  
213    if (processSearchTimeout)
214      clearTimeout(processSearchTimeout);
215
216    terminateAsyncSearch();
217  }
218  
219  function disposeSearchData()
220  {
221    /*debug*/log('disposeSearchData');
222
223    searchData = null;
224  }
225
226  /*****************************************************/
227  /***   CACHE HELPERS                               ***/
228  /*****************************************************/
229  
230  function initCache()
231  {
232    /*debug*/log('initCache');
233
234    if (!cache)
235    {
236      cache = new Object();
237    }
238  
239    try
240    {
241      top.cache = cache;
242    }
243    catch(e){}
244          
245    if (!cache.memberDirectory)
246    {
247      cache.memberDirectory = {
248        isReady : false,
249        serverResponse : null,
250        totalCount : null,
251        colTitlesData : null,
252        membersData : null,
253        searchData : null,
254        safeData : null,
255        foundCount: null
256      };     
257    }
258  }
259  
260  function clearCache()
261  {
262    /*debug*/log('clearCache');
263
264    if (cache && cache.memberDirectory)
265    {
266      cache.memberDirectory = null;
267    }
268    
269    initCache();
270  }
271
272  function getCachedDirectoryData()
273  {
274    /*debug*/log('getCachedDirectoryData');
275
276    initCache();
277    return cache.memberDirectory;
278  }
279
280  /*****************************************************/
281  /***   DISPLAY MESSAGES HELPERS                    ***/
282  /*****************************************************/
283  
284  function setMessage(message)
285  {
286    /*debug*/log('setMessage');
287
288    var messageBlock = $(MemberDirectoryListRenderer.waitMessagesBlockId);
289    if (messageBlock)
290    {
291      messageBlock.innerHTML = message;
292      messageBlock.style.display = message ? 'inline' : 'none';
293    }
294  }
295
296  function setFound(found)
297  {
298    /*debug*/log('setFound');
299
300    var foundBlock = $(MemberDirectoryListRenderer.foundBlockId);
301
302    if (foundBlock)
303    {
304      if (found != 0 && (found == null || found == ''))
305      {
306        foundBlock.innerHTML = '';
307        foundBlock.style.display = 'none';
308        hideReload()
309        hidePaging();
310      }
311      else
312      {
313        foundBlock.innerHTML = found;
314        foundBlock.style.display = 'inline';
315      }
316    }
317  }
318  
319  function hideReload()
320  {
321    /*debug*/log('hideReload');
322
323    $(MemberDirectoryListRenderer.reloadLinkId).style.display = 'none';
324  }
325  
326  function showReload()
327  {
328    /*debug*/log('showReload');
329
330    var reloadLink = $(MemberDirectoryListRenderer.reloadLinkId);
331    reloadLink.style.display = 'inline';
332    reloadLink.onclick = null;
333    reloadLink.onclick = reloadData;
334  }
335  
336  function setPaging(selectHTML, seletedValue)
337  {
338    /*debug*/log('setPaging');
339
340    var pagers = [
341      $(MemberDirectoryListRenderer.pagingBlockId),
342      $(MemberDirectoryListRenderer.pagingBlock2Id)
343    ]
344    var i;
345    var oi;
346    
347    for (i = 0; i < pagers.length; i++)
348    {
349      pagers[i].innerHTML = MemberDirectoryListRenderer.labels.pagingTemplate.replace(/\{0\}/g, selectHTML); 
350      pagers[i].style.display = 'inline';
351
352      var pagerSelect = pagers[i].getElementsByTagName('SELECT')[0];
353      for (oi = 0; oi < pagerSelect.options.length; oi++)
354      {
355        if (pagerSelect.options[oi].value == seletedValue)
356        {
357          pagerSelect.options[oi].selected = true;
358          break;
359        }
360      }
361    }
362  }
363  
364  function hidePaging()
365  {
366    /*debug*/log('hidePaging');
367
368    var pagingBlock = $(MemberDirectoryListRenderer.pagingBlockId);
369    if (pagingBlock)
370    {
371      pagingBlock.style.display = 'none';
372    }
373    var pagingBlock2 = $(MemberDirectoryListRenderer.pagingBlock2Id);
374    if(pagingBlock2)
375    {
376      pagingBlock2.style.display = 'none';
377    }
378  }
379  
380  function isPagerHidden()
381  {
382    /*debug*/log('isPagerHidden');
383
384    return $(MemberDirectoryListRenderer.pagingBlockId) && ($(MemberDirectoryListRenderer.pagingBlockId).style.dysplay != 'inline');
385  }
386  function setDirectoryOutput(html, encodeHtml)
387  {
388    /*debug*/log('setDirectoryOutput');
389
390    var outputBlock = $(MemberDirectoryListRenderer.outputBlockId);
391    
392    if (!outputBlock)
393    {
394      return;
395    }
396    
397    if (encodeHtml == true) //encodeHtml may not be bool
398    {
399      outputBlock[document.all ? "innerText" : "textContent"] = html ? html : '';
400    }
401    else
402    {
403      outputBlock.innerHTML = html ? html : '';
404    }
405  }
406
407  /*****************************************************/
408  /***   SEARCHBOX                                   ***/
409  /*****************************************************/
410
411  function getSearchKeywords()
412  {
413    /*debug*///log('getSearchKeywords');
414
415    var searchBoxElem = $(MemberDirectoryListRenderer.searchBoxId);
416    
417    if (!searchBoxElem)
418    {
419      dispose();
420      return false;
421    }
422    
423    var normalizedSearchPhrase = searchBoxElem.value.replace(/\s+/g, ' ');
424    normalizedSearchPhrase = normalizedSearchPhrase.replace(/^\s*(.*?)\s*$/, '$1');
425    return normalizedSearchPhrase;
426  }
427
428  function convertKeywordsToArray(keywords)
429  {
430    /*debug*/log('convertKeywordsToArray');
431
432    if (!keywords)
433      return new Array();
434    
435    var keywordsBeforeEncode = keywords.toLowerCase().split(' ');
436    var result = new Array();
437    
438    for (var i = 0; i < keywordsBeforeEncode.length; i++)
439    {
440      result[i] = BonaPage.encodeHtml(keywordsBeforeEncode[i]);
441    }
442    
443    return result;
444  }
445
446  function enableSearch(searchValue, autofocus)
447  {
448    /*debug*/log('enableSearch');
449
450    var searchBox;
451
452    autofocus = autofocus === undefined ? true : autofocus;
453
454    if (!WA.AdminPanel || !WA.AdminPanel.PageMode || WA.AdminPanel.PageMode.Mode() != WA.AdminPanel.PageModeType.Edit)
455    {
456      searchBox = $(MemberDirectoryListRenderer.searchBoxId);
457
458      if (searchValue)
459        searchBox.value = searchValue;
460
461      searchBox.onkeypress = searchBoxIgnoreEnter;
462      searchBox.disabled = false;
463      try 
464      {
465        if(autofocus)
466        {
467          searchBox.focus();
468        }
469     } catch (e) {}
470    }
471    
472    if (searchBoxAskTimeout)
473      clearTimeout(searchBoxAskTimeout);
474      
475    searchBoxAskTimeout = setTimeout(searchBoxAsk, searchBoxAskIntervalMs);
476  }
477  
478  function disableSearch()
479  {
480    /*debug*/log('disableSearch');
481
482    if (searchBoxAskTimeout)
483      clearTimeout(searchBoxAskTimeout);
484
485    var searchBox = $(MemberDirectoryListRenderer.searchBoxId);
486    //searchBox.disabled = true;
487  }
488  
489  function stopAskSearchBox()
490  {
491    /*debug*/log('stopAskSearchBox');
492
493    if (searchBoxAskTimeout)
494      clearTimeout(searchBoxAskTimeout);
495  }
496  
497  function searchBoxIgnoreEnter(e)
498  {
499    /*debug*/log('searchBoxIgnoreEnter');
500
501    if (!isInited) 
502      return false;
503
504    if (!e) 
505      e = event;
506
507    if (e.keyCode == 13)
508    {
509      forceNextAskSearch = true;
510      return false;
511    }
512  }
513
514  function searchBoxAsk()
515  {
516    if (searchBoxAskTimeout)
517      clearTimeout(searchBoxAskTimeout);
518
519    if (!isInited) { return; }
520
521    /*debug*///log('searchBoxAsk');
522
523    var searchKeywords = getSearchKeywords();
524    
525    if (searchKeywords == lastSeachBoxAskValue && !forceNextAskSearch)
526    {
527      searchBoxAskTimeout = setTimeout(searchBoxAsk, searchBoxAskIntervalMs);
528      return;
529    }
530
531    forceNextAskSearch = false;      
532    lastSeachBoxAskValue = searchKeywords;
533
534    if (processSearchTimeout) 
535      clearTimeout(processSearchTimeout);
536
537    terminateAsyncSearch();
538
539    var searchMessage = searchKeywords ? 
540      MemberDirectoryListRenderer.labels.searchingKeywords :
541      MemberDirectoryListRenderer.labels.searchingEmpty;
542    
543    setFound();
544    setMessage(searchMessage);
545
546    notifyGadgetChanged();
547
548    processSearchTimeout = setTimeout(function() { searchAndRenderAsync(searchKeywords); }, processSearchTimeoutMs);
549    searchBoxAskTimeout = setTimeout(searchBoxAsk, searchBoxAskIntervalMs);
550  }
551  function setTitle(count)
552  {
553    /*debug*/log('setTitle');
554
555    return;
556    var titleLabel = $(MemberDirectoryListRenderer.titleLabelId);
557    titleLabel.innerHTML = MemberDirectoryListRenderer.titleTemplate.replace(/\{0\}/g, count); 
558    titleLabel.style.visibility = 'visible';
559  }
560  /*****************************************************/
561  /***   DATA LOADING AND PROCESSING                 ***/
562  /*****************************************************/
563
564  function loadRecordsAsync()
565  {
566    /*debug*/log('loadRecordsAsync');
567
568    directoryData = getCachedDirectoryData();
569
570    isCached = false;
571    setFound(MemberDirectoryListRenderer.labels.serverLoadingStarted);
572
573    notifyGadgetChanged();
574    
575    /*
576    var match = document.body.id.match(/pageid_(\d+)/i);
577    
578    if (match != null) 
579    {
580	    var pageId = match[1];
581    } 
582    */
583
584    var formData = { 'formId' : MemberDirectoryListRenderer.FormId };
585
586    if (MemberDirectoryListRenderer.VersionData)
587    {
588      formData.pageId = MemberDirectoryListRenderer.VersionData.pageId;
589      formData.versionId = MemberDirectoryListRenderer.VersionData.versionId;
590      formData.componentId = MemberDirectoryListRenderer.VersionData.componentId;
591    }
592
593    // AJAX call
594    WA.Ajax({
595      url : MemberDirectoryListRenderer.MemberDirectoryListWebServiceUrl_LoadMembers,
596      data : formData,
597      type : 'POST',
598      success : loadRecordsCallback,
599      error : loadRecordsErrorCallback
600    });
601  }
602  
603  function loadRecordsErrorCallback(result)
604  {
605    /*debug*/log('loadRecordsErrorCallback');
606
607    setFound(MemberDirectoryListRenderer.labels.serverLoadingError);
608    setMessage();    
609    showReload();
610    setDirectoryOutput(MemberDirectoryListRenderer.labels.serverLoadingErrorAlert);
611    notifyGadgetChanged();
612  }
613  
614  function loadRecordsCallback(result)
615  {
616    /*debug*/log('loadRecordsCallback');
617
618    setFound(result.TotalCount);
619    setMessage(MemberDirectoryListRenderer.labels.processingServerData);
620    directoryData.serverResponse = result;
621    notifyGadgetChanged();
622    setTimeout(processServerData, 10);
623  }
624
625  function processCachedData()
626  {
627    /*debug*/log('processCachedData');
628
629    lastSeachBoxAskValue = directoryData.lastKeywords;
630    forceNextAskSearch = false;
631    enableSearch(lastSeachBoxAskValue);
632    searchAndRenderAsync(directoryData.lastKeywords, directoryData.lastRenderIndex);
633  }
634 
635
636
637
638  function processServerData()
639  {
640    /*debug*/log('processServerData');
641
642    var jsonStructure;
643    eval('jsonStructure = ' + directoryData.serverResponse.JsonStructure + ';');
644	
645	//directoryData.serverResponse = createMembers(20000);
646	//jsonStructure=directoryData.serverResponse.JsonStructure;
647
648    directoryData.totalCount = directoryData.serverResponse.TotalCount;
649    directoryData.serverResponse = null;
650    directoryData.layout = jsonStructure.layout;
651    directoryData.membersData = jsonStructure.members;
652
653    prepareSearchData();
654    setTitle(directoryData.totalCount);    
655    jsonStructure = null;
656    directoryData.statuses = null;
657
658    directoryData.isReady = true;
659    forceNextAskSearch = true;
660    enableSearch(undefined, false);
661  }
662
663
664
665
666  function prepareSearchData()
667  {
668    /*debug*/log('prepareSearchData');
669
670    directoryData.searchData = new Array();
671    directoryData.safeData = new Array();
672    directoryData.counterData = new Array();
673    var searchData = directoryData.searchData;
674    var safeData = directoryData.safeData;
675    var counterData = directoryData.counterData;
676    var totalCount = directoryData.totalCount;
677    var searchableMembersData = directoryData.membersData[0];
678    var searchDataForMember = new Array();
679    
680    for (i = 0; i < totalCount; i++)
681    {
682      pushColumnToSearchableData(searchDataForMember, searchableMembersData[i].c1);
683      pushColumnToSearchableData(searchDataForMember, searchableMembersData[i].c2);
684      pushColumnToSearchableData(searchDataForMember, searchableMembersData[i].c3);
685      pushColumnToSearchableData(searchDataForMember, searchableMembersData[i].c4);
686      pushColumnToSearchableData(searchDataForMember, searchableMembersData[i].c5);
687      
688      searchData.push(searchDataForMember.join(' '));
689      safeData.push(searchDataForMember.join(' '));
690
691
692      searchDataForMember = new Array();
693    }
694  }
695  function pushColumnToSearchableData(searchData, column)
696  {
697    /*debug*///log('pushColumnToSearchableData');
698
699    if (!column)
700      {
701        return;
702      }
703      
704      for (var j = 0; j < column.length; j++)
705      {
706        if (column[j].fft != 12)// picture
707        {
708          searchData.push(column[j].v.toLowerCase());          
709        }
710      }
711  }
712
713
714  function reloadData()
715  {
716    /*debug*/log('reloadData');
717
718    disposeAllTimeouts();
719    hideReload();
720    hidePaging();
721    setFound();
722    disableSearch();
723    lastSeachBoxAskValue = '';
724    clearCache();
725    setDirectoryOutput();
726    notifyGadgetChanged();
727
728    setTimeout(loadRecordsAsync, 10);
729  }
730//------------
731//filter stuff
732//------------
733	function isFilterEnabled()
734	{
735    /*debug*/log('isFilterEnabled');
736
737    return $("idFilterColumns");
738	}
739
740	function initFilter()
741	{
742    /*debug*/log('initFilter');
743
744    var i, j;
745	var optColumn;
746	var options;
747
748	for (i = 1; i <= maxFilterQty; i++)
749	{
750		optColumn = $("idF"+i+"Options");
751
752		if (optColumn)
753		{
754			$("idF"+i+"Change").onclick=changeClick;
755			filterOptionCounters[i-1]=new Array();
756			filterOptionNames[i-1]=new Array();
757	 		options=WA.$$('.optionLink', optColumn);
758
759      if (options)
760      {
761        for (j = 0; j < options.length; j++)
762        {
763          options[j].onclick = optionClick;
764          filterOptionCounters[i - 1]['opt' + options[j].getAttribute("fId", 0)] = 0;
765          filterOptionNames[i - 1]['opt' + options[j].getAttribute("fId", 0)] = options[j].innerHTML;
766        }
767      }
768		}
769 	}
770  }
771
772
773  function optionClick()
774  {
775    /*debug*/log('optionClick');
776
777    var curRow = this.parentNode.parentNode.parentNode.id.substr(3,1);
778  	  $("idF"+curRow+"Options").style.display = "none";
779  	  $("idF"+curRow+"Selected").style.display = "block";
780  	  $("idF"+curRow+"SelName").innerHTML = '&raquo; ' + filterOptionNames[curRow - 1]['opt'+this.getAttribute("fId", 0)];
781  	  filterValues[curRow-1] = this.getAttribute("fId", 0);
782  	  applyFilters();
783  	  return false;
784  }
785
786  function changeClick()
787  {
788    /*debug*/log('changeClick');
789
790    var curRow = this.id.substr(3,1);
791  	  $("idF"+curRow+"Options").style.display = "block";
792  	  $("idF"+curRow+"Selected").style.display = "none";
793  	  $("idF"+curRow+"SelName").innerHTML = "";
794  	  filterValues[curRow-1] = null;
795  	  applyFilters();
796  	  return false;
797  }
798
799	function filterIsOn()
800	{
801    /*debug*/log('filterIsOn');
802
803    var i;
804		var l = filterValues.length;
805		var cnt = 0;
806
807		for (i = 0; i < l; i++)
808		{
809			if (filterValues[i] != null)
810			{
811				cnt++;
812			}
813		}
814		return cnt;
815	}
816
817	function applyFilters()
818	{
819    /*debug*/log('applyFilters');
820
821    var i, j, l;
822		var matchCount = 0;
823		var totalCount = directoryData.totalCount;
824		var filterVal = filterIsOn();
825
826		//preparing
827		setFound();
828	    setMessage(MemberDirectoryListRenderer.labels.searchingKeywords);
829
830		for (i = 0; i < totalCount; i++)
831		{
832			directoryData.searchData[i]=directoryData.safeData[i];
833		}
834
835		if (filterVal)
836		{
837			for (i = 0; i < totalCount; i++)
838			{
839				matchCount = 0;
840
841				for (l = 1; l < maxFilterQty+1; l++)
842				{
843					if (filterValues[l-1] == null) //no filter is set for column
844					{
845						matchCount++;
846						continue;
847					}
848
849					var memberFilterValue = directoryData.membersData[0][i]['f' + l];
850
851					if (!memberFilterValue)
852					{
853						continue;
854					}
855
856					for (j = 0; j < memberFilterValue.length; j++)  
857					{
858						if (memberFilterValue[j] == filterValues[l-1])
859						{
860							matchCount++;
861							break;
862						}
863					}
864				}
865
866				if (matchCount != maxFilterQty)
867				{
868					directoryData.searchData[i] = '';
869				}
870			}
871		}
872
873
874		searchAndRenderAsync(getSearchKeywords());
875    notifyGadgetChanged();
876	}
877
878
879	function updateCounters(searchInResults)
880	{
881    /*debug*/log('updateCounters');
882
883    var i, l, m;
884		var memberFilterValue;
885
886		if (!isFilterEnabled) return;
887
888		var finalIndex = searchInResults ? searchAsyncData.foundIndexes.length : directoryData.totalCount;
889		
890		resetCounters();
891
892		for (i = 0; i < finalIndex; i++)
893		{
894			for (l = 1; l < maxFilterQty+1; l++)
895			{
896				if (filterValues[l-1]) //filter is set, why bother updating invisible numbers?
897				{
898					continue;
899				}
900				memberFilterValue = searchInResults ? directoryData.membersData[0][searchAsyncData.foundIndexes[i]]['f' + l] : directoryData.membersData[0][i]['f' + l];
901
902				if (memberFilterValue)
903				{
904					for (m = 0; m < memberFilterValue.length; m++)
905					{
906					    if (filterOptionCounters[l-1])
907					    {
908						    filterOptionCounters[l-1]['opt'+memberFilterValue[m]]++;
909						}
910					}
911				}
912
913			}
914		}
915
916		drawCounters();
917	}
918
919
920	function resetCounters()
921	{
922    /*debug*/log('resetCounters');
923
924    var l, m;
925
926		for (l = 0; l < filterOptionCounters.length; l++)
927		{
928			if (filterOptionCounters[l])
929			{
930				for (m in filterOptionCounters[l])
931				{
932					if (typeof(filterOptionCounters[l][m]) == "number")
933					{
934						filterOptionCounters[l][m] = 0;
935					}
936				}
937			}
938		}
939	}
940
941	function drawCounters()
942	{
943    /*debug*/log('drawCounters');
944
945    var i, j;
946		var optColumn;
947		var options;
948		var qty, name;
949		var whereIsSpace;
950
951	    for (i = 1; i <= maxFilterQty; i++)
952	    {
953	    	optColumn=jq$("#idF"+i+"Options");
954
955
956		 	if (optColumn)
957		 	{
958		 		options = jq$("#idF"+i+"Options .optionLink");
959
960        if (options)
961        {
962          for (j = 0; j < options.length; j++)
963          {
964            qty = filterOptionCounters[i - 1]['opt' + options[j].getAttribute("fId", 0)] * 1;
965            name = WA.String.gtrim(filterOptionNames[i - 1]['opt' + options[j].getAttribute("fId", 0)]);
966
967
968            whereIsSpace = name.lastIndexOf(' ');
969
970            if (whereIsSpace >= 0)
971            {
972              name = name.slice(0, whereIsSpace) + ' <nobr>' + name.slice(whereIsSpace + 1);
973            } else
974            {
975              name = '<nobr>' + name;
976            }
977
978            options[j].innerHTML = name + ' ' + '<span class="optionCounter">(' + qty + ')</span></nobr>';
979            options[j].className = (qty && qty > 0) ? "optionLink" : "optionLink emptyName";
980          }
981        }
982		 	}
983		}
984	}
985
986  /*****************************************************/
987  /***   SEARHCING                                   ***/
988  /*****************************************************/
989
990  function searchAndRenderAsync(keywords, renderStartIndex)
991  {
992    /*debug*/log('searchAndRenderAsync');
993
994    terminateAsyncSearch();
995
996    directoryData.lastKeywords = keywords;
997
998    if (!searchAsyncData)
999    {
1000      searchAsyncData = new Object();
1001      searchAsyncData.sessionId = 0;
1002    }
1003
1004    var sessionId = searchAsyncData.sessionId + 1;
1005    searchAsyncData.sessionId = sessionId;
1006    searchAsyncData.inProgress = true;
1007    searchAsyncData.foundCount = 0;
1008    searchAsyncData.nextIndex = 0;
1009    searchAsyncData.sourceKeywords = keywords;
1010    searchAsyncData.keywordsArray = convertKeywordsToArray(keywords);
1011    searchAsyncData.foundIndexes = new Array();
1012    searchAsyncData.pagerHtml = null;
1013    
1014    if (searchAsyncData.keywordsArray.length > 0 || filterIsOn())
1015    {
1016      searchAsyncTimeout = setTimeout(function() { searchAsync(sessionId, renderStartIndex); }, 5);
1017    }
1018    else
1019    {
1020      searchAsyncData.foundCount = directoryData.totalCount;      
1021      searchAsyncData.nextIndex = searchAsyncData.foundCount;
1022      searchAsyncData.inProgress = false;
1023      renderAsync(renderStartIndex);
1024      updateCounters(false);
1025    }
1026  }
1027
1028
1029
1030
1031  function searchAsync(sessionId, renderStartIndex)
1032  {
1033    /*debug*/log('searchAsync');
1034
1035    if (searchAsyncTimeout)
1036      clearTimeout(searchAsyncTimeout);
1037  
1038    if (!searchAsyncData || sessionId != searchAsyncData.sessionId)
1039    {
1040      terminateAsyncSearch();
1041      return;
1042    }
1043    
1044    if (searchAsyncData.nextIndex >= directoryData.totalCount)
1045    {
1046      terminateAsyncSearch();
1047      searchAsyncData.inProgress = false;
1048      //search is over
1049      updateCounters(true);
1050      renderAsync(renderStartIndex);
1051      return;
1052    }
1053
1054    var keywordsArray = searchAsyncData.keywordsArray;
1055    var searchIndexData = directoryData.searchData;
1056    var stopCycleIndex = Math.min(directoryData.totalCount, searchAsyncData.nextIndex + searchAsyncMaxRecords);
1057
1058    var keywordsArrayLength = keywordsArray.length;
1059
1060
1061    for (i = searchAsyncData.nextIndex; i < stopCycleIndex; i++)
1062    {
1063
1064      var searchIndexDataLength = searchIndexData[i].length;
1065
1066      if (searchIndexDataLength == 0)
1067      {
1068      	  continue;
1069      }
1070
1071      for (j = 0; j < keywordsArrayLength; j++)
1072      {
1073        if (searchIndexData[i].indexOf(keywordsArray[j]) == -1)
1074          break;
1075      }
1076      
1077      if (j == keywordsArrayLength)
1078      {
1079        searchAsyncData.foundCount++;
1080        searchAsyncData.foundIndexes.push(i);
1081      }
1082    }
1083
1084    searchAsyncData.nextIndex = stopCycleIndex;
1085
1086    searchAsyncTimeout = setTimeout(function() { searchAsync(sessionId, renderStartIndex); }, searchAsyncTimeoutMs);
1087  }
1088  
1089  
1090
1091
1092
1093  function terminateAsyncSearch()
1094  {
1095    /*debug*/log('terminateAsyncSearch');
1096
1097    if (searchAsyncTimeout)
1098      clearTimeout(searchAsyncTimeout);
1099  }
1100  
1101  /*****************************************************/
1102  /***   RENDERING                                   ***/
1103  /*****************************************************/
1104
1105  function renderAsync(startIndex)
1106  {
1107    /*debug*/log('renderAsync');
1108
1109    if (!searchAsyncData || searchAsyncData.inProgress)
1110      return;
1111    
1112    hidePaging();
1113    //setMessage(MemberDirectoryListRenderer.labels.displayingFound);
1114
1115    startIndex = parseInt(startIndex);
1116    if (!startIndex)
1117      startIndex = 0;
1118
1119    setTimeout(function() { render(startIndex); }, 10);
1120  }
1121  function prepareHeader()
1122  {
1123    /*debug*/log('prepareHeader');
1124
1125    var layout = directoryData.layout;
1126    var headerTemplate = new Array();
1127    
1128    headerTemplate.push(tableStart);
1129    addHeaderIfReq(headerTemplate, layout.c1);
1130    addHeaderIfReq(headerTemplate, layout.c2);
1131    addHeaderIfReq(headerTemplate, layout.c3);
1132    addHeaderIfReq(headerTemplate, layout.c4); 
1133    headerTemplate.push(headerEnd);
1134    
1135    return headerTemplate.join('');
1136  }
1137  function addHeaderIfReq(headerTemplate, column)
1138  {
1139    /*debug*/log('addHeaderIfReq');
1140
1141    if (column.v == true) // visible
1142    {
1143      headerTemplate.splice(headerTemplate.length, 0,
1144        thTemplate[0], column.w, // width
1145        thTemplate[1], column.h, // header
1146        thTemplate[2]);
1147    }
1148  }  
1149  function render(startIndex)
1150  {
1151    /*debug*/log('render');
1152
1153    if (!searchAsyncData || searchAsyncData.inProgress)
1154    {
1155      notifyGadgetChanged();
1156      return;
1157    }
1158    
1159    directoryData.lastRenderIndex = startIndex;
1160
1161    var keywordsDefined = searchAsyncData.keywordsArray.length > 0 || filterIsOn();
1162    
1163    if (searchAsyncData.foundCount > 0)
1164    {
1165      var i;  
1166      var a = new Array();
1167      
1168      a.splice(a.length, 0, prepareHeader());
1169
1170      stopRenderIndex = Math.min(startIndex + maxDisplayRecords, searchAsyncData.foundCount);
1171
1172      var realIndex,
1173          detailsUrlTooltip = MemberDirectoryListRenderer.labels.detailsUrlTitle,
1174          searchableMembersData = directoryData.membersData[0],
1175          otherMembersData = directoryData.membersData[1],
1176          detailsUrlPrefix = MemberDirectoryListRenderer.detailsUrlTemplate,
1177          formId = MemberDirectoryListRenderer.FormId;
1178     
1179      for (i = startIndex; i < stopRenderIndex; i++)
1180      {
1181        realIndex = keywordsDefined ? searchAsyncData.foundIndexes[i] : i;
1182        a.splice(a.length, 0, 
1183          memberTemplate[0], createDetailsUrl(detailsUrlPrefix, otherMembersData[realIndex], formId),
1184          memberTemplate[1], prepareColumn(searchableMembersData[realIndex], otherMembersData[realIndex]),
1185          memberTemplate[2]
1186        );
1187      }
1188
1189      a.push(footerTemplate);
1190      
1191      setDirectoryOutput(a.join(''));
1192      a = null;
1193    }
1194    else
1195    {
1196      // no records
1197      setDirectoryOutput(keywordsDefined ?
1198        MemberDirectoryListRenderer.labels.noMembersFound.replace(/\{0\}/g, searchAsyncData.sourceKeywords) :
1199        MemberDirectoryListRenderer.labels.noMembersInDatabase, true);
1200    }
1201
1202    setMessage();
1203    setFound(searchAsyncData.foundCount);
1204    
1205    if (isCached)
1206      showReload();
1207    
1208    renderPager(startIndex);
1209    notifyGadgetChanged();
1210  }
1211
1212
1213  function notifyGadgetChanged()
1214  {
1215    /*debug*/log('notifyGadgetChanged');
1216
1217    WA.throttle(doNotifyGadgetChanged, notifyGadgetChangedTimeout);
1218  }
1219
1220
1221  function doNotifyGadgetChanged()
1222  {
1223    /*debug*/log('doNotifyGadgetChanged');
1224
1225    WA.Gadgets.notifyGadgetChanged();
1226  }
1227
1228
1229  function createDetailsUrl(detailsUrlPrefix, memberId, formId)
1230  {
1231    /*debug*///log('createDetailsUrl');
1232
1233    var url;
1234
1235    if (formId == 0)
1236    {
1237      url = detailsUrlPrefix + memberId;
1238    } 
1239    else
1240    {
1241      url = detailsUrlPrefix + memberId + '/' + formId; 
1242    }
1243
1244    return url;
1245  }
1246  function prepareColumn(memberData, memberId)
1247  {
1248    /*debug*/log('prepareColumn');
1249
1250    var layout = directoryData.layout; 
1251    var memberTdTemplate = new Array();
1252    var detailsUrlTooltip = MemberDirectoryListRenderer.labels.detailsUrlTitle;    
1253    
1254    var columnsCount = new Object();
1255    columnsCount.value = 0;
1256    addColumnIfReq(layout.c1, memberData.c1, memberTdTemplate, columnsCount, memberId, true);
1257    addColumnIfReq(layout.c2, memberData.c2, memberTdTemplate, columnsCount, memberId, false);
1258    addColumnIfReq(layout.c3, memberData.c3, memberTdTemplate, columnsCount, memberId, false);
1259    addColumnIfReq(layout.c4, memberData.c4, memberTdTemplate, columnsCount, memberId, false);
1260    addBottomRowIfReq(layout.c5, memberData.c5, memberTdTemplate, columnsCount, memberId, false);
1261
1262    return memberTdTemplate.join('');
1263  }
1264  function addColumnIfReq(layoutColumn, memberColumn, memberTdTemplate, columnsCount, memberId, makeLink)
1265  {
1266    /*debug*///log('addColumnIfReq');
1267
1268    if (layoutColumn.v != true) 
1269    {
1270      return;
1271    }
1272    
1273    ++columnsCount.value;
1274  
1275    memberTdTemplate.splice(memberTdTemplate.length, 0, 
1276      tdTemplate[0], 'memberDirectoryColumn' + columnsCount.value,
1277      tdTemplate[1], layoutColumn.w,
1278      tdTemplate[2], getValueFromColumn(memberColumn, memberId, makeLink),
1279      tdTemplate[3]);
1280  }    
1281  function addBottomRowIfReq(bottomRow, memberColumn, memberTdTemplate, columnsCount, memberId)
1282  {
1283    /*debug*///log('addBottomRowIfReq');
1284
1285    var url = MemberDirectoryListRenderer.detailsUrlTemplate + memberId;
1286    
1287    if (bottomRow.v != true) // visible
1288    {
1289      return;
1290    }
1291    
1292    memberTdTemplate.splice(memberTdTemplate.length, 0, 
1293      bottomRowTemplate[0], url,
1294      bottomRowTemplate[1], columnsCount.value,
1295      bottomRowTemplate[2], getValueFromColumn(memberColumn, memberId, false),
1296      bottomRowTemplate[3]);
1297  }    
1298  
1299  function getValueFromColumn(memberColumn, memberId, makeLink)
1300  {
1301    /*debug*///log('getValueFromColumn');
1302
1303    var inner = '';
1304      
1305    if (!memberColumn)
1306    {
1307      return inner;
1308    }
1309
1310    for (var i = 0; i < memberColumn.length; i++)
1311    {
1312      var ar;
1313      var value = memberColumn[i].v;
1314      var imgValue = value;
1315
1316      if (i == 0)
1317      {
1318        var ix = imgValue.lastIndexOf(' (');
1319
1320        if (ix >= 0)
1321        {
1322          imgValue = imgValue.substr(0, ix);
1323        }
1324      }
1325
1326      var fieldType = memberColumn[i].fft;
1327      
1328      // check for email
1329      if(fieldType != 5 && emailReplace1.test(BonaPage.decodeHtml(value))) 
1330      {
1331        value = BonaPage.decodeHtml(value).replace(emailReplace1, emailReplaceTemplate);
1332      }
1333      
1334      if (fieldType == 12) //Picture
1335      {
1336        if (value != '')
1337        {
1338          ar = new Array();
1339          ar.splice(ar.length, 0,
1340            imgTemplate[0], MemberDirectoryListRenderer.imgTemplateRelativePath,
1341            imgTemplate[1], memberId,
1342            imgTemplate[2], imgValue,
1343            imgTemplate[3], (new Date()).getTime(),
1344            imgTemplate[4]);
1345          value = ar.join('');
1346        }
1347      }
1348      else if (fieldType == 5 && !(makeLink == true && i == 0)) // Email
1349      {
1350        if (value != '')
1351        {
1352          ar = new Array();
1353          ar.splice(ar.length, 0,
1354            emailTemplate[0], value,
1355            emailTemplate[1], value,
1356            emailTemplate[2]);
1357          value = ar.join('');
1358          ar = new Array();
1359        }
1360      }
1361      else if (value != '' && !(makeLink == true && i == 0))
1362      {
1363        var reLinkReplace1 = new RegExp("(\\s|^|\\>|\\<|\\}
1363|\\]|\\[|\\{)((http|https|ftp)://[^\\n\\s\\<\\>\\[\\{\\]\\}]+)", "gi");
1364        var reLinkReplace2 = new RegExp("(\\s|^|\\>|\\<|\\}|\\]|\\[|\\{)(([io]?www\.|ftp\.)[^\\n\\s\\<\\>\\[\\{\\]\\}]+)", "gi");
1365        var processedValue = 
1366        value = (reLinkReplace1.test(value))
1367          ? value.replace(reLinkReplace1, '$1<a onclick="window.open(\'$2\');BonaPage.stopEvent(event);" href="$2" target=_blank>$2</a>')
1368          : value.replace(reLinkReplace2, '$1<a onclick="window.open(\'http://$2\');BonaPage.stopEvent(event);" href="http://$2" target=_blank>$2</a>');
1369      }
1370
1371      if (i === 0 && makeLink === true)
1372      {
1373        var ar = new Array();
1374        ar.splice(ar.length, 0,
1375          linkTemplate[0], MemberDirectoryListRenderer.labels.detailsUrlTitle,
1376          linkTemplate[1], createDetailsUrl(MemberDirectoryListRenderer.detailsUrlTemplate, memberId, MemberDirectoryListRenderer.FormId),
1377          linkTemplate[2], value == '' ? MemberDirectoryListRenderer.labels.viewDetails : value,
1378          linkTemplate[3]);
1379        value = ar.join('');
1380      }
1381
1382      if (value != '')
1383      {
1384        inner += '<div class=\'memberValue\'>' + value + '</div>';
1385      }
1386    }
1387    
1388    return inner;
1389  }
1390  function renderPager(startIndex)
1391  {
1392    /*debug*/log('renderPager');
1393
1394    if (!searchAsyncData || searchAsyncData.inProgress || searchAsyncData.foundCount <= maxDisplayRecords)
1395    {
1396      hidePaging();
1397      return;
1398    }
1399
1400    if (!searchAsyncData.pagerHtml)
1401    {
1402      var i;
1403      var a = new Array();
1404      var useSearchData = (searchAsyncData.keywordsArray.length > 0) || filterIsOn();
1405      var value;
1406      var firstIndex;
1407      var lastIndex;
1408      var recordsFirstIndex;
1409      var recordsLastIndex;
1410
1411      a.push(pagerTemplate[0]);
1412      
1413      for (i = 0; i < searchAsyncData.foundCount; i = i + maxDisplayRecords)
1414      {
1415        value = i;
1416        firstIndex = i;
1417        lastIndex = Math.min(searchAsyncData.foundCount - 1, i + maxDisplayRecords - 1);
1418        recordsFirstIndex = firstIndex + 1;
1419        recordsLastIndex = lastIndex + 1;
1420
1421        if (useSearchData)
1422        {
1423          firstIndex = searchAsyncData.foundIndexes[firstIndex];
1424          lastIndex = searchAsyncData.foundIndexes[lastIndex];
1425        }
1426
1427        a.splice(a.length, 0, 
1428          pagerOptionTemplate[0], value,
1429/*
1430          pagerOptionTemplate[1], preparePagerRangeWord(firstIndex, true),
1431          pagerOptionTemplate[2], preparePagerRangeWord(lastIndex, false),
1432          pagerOptionTemplate[3], recordsFirstIndex,
1433          pagerOptionTemplate[4], recordsLastIndex,
1434*/
1435          pagerOptionTemplate[1], recordsFirstIndex,
1436          pagerOptionTemplate[2], recordsLastIndex,
1437          pagerOptionTemplate[3]);
1438      }
1439      
1440      a.push(pagerTemplate[1]);
1441      searchAsyncData.pagerHtml = a.join('');
1442
1443    }
1444
1445
1446    if (isPagerHidden())
1447    {
1448      setPaging(searchAsyncData.pagerHtml, startIndex);
1449    }
1450  }
1451  
1452  function preparePagerRangeWord(index, appendSpacesBefore)
1453  {
1454    /*debug*/log('preparePagerRangeWord');
1455
1456    var v = directoryData.membersData[0][index].c1[0].v;
1457    var value = v == '' ? 'View details' : v;
1458    var word = value.split(',')[0].substr(0, pagerRangeNameLength);
1459    word = word.replace(/\s/g, "&nbsp;");
1460    return word;
1461  }
1462  
1463  function pagerChanged(pagerSelect)
1464  {
1465    /*debug*/log('pagerChanged');
1466
1467    try { $(MemberDirectoryListRenderer.searchBoxId).focus(); } catch (e) {}
1468    var startIndex = pagerSelect.options[pagerSelect.selectedIndex].value;
1469    render(parseInt(startIndex));
1470  }
1471  
1472  /*****************************************************/
1473  /***   MEMBER RECORD EVENTS                        ***/
1474  /*****************************************************/
1475
1476  function highlightRowAndNext(memberTr)
1477  {
1478    /*debug*/log('highlightRowAndNext');
1479
1480    SetClassToRowAndNext(memberTr, 'hover');
1481  }
1482  function normlightRowAndNext(memberTr)
1483  {
1484    /*debug*/log('normlightRowAndNext');
1485
1486    SetClassToRowAndNext(memberTr, 'normal');
1487  }
1488  function SetClassToRowAndNext(memberTr, className)
1489  {
1490    /*debug*/log('SetClassToRowAndNext');
1491
1492    memberTr.className = className;
1493    
1494    var nextSibling = memberTr.nextSibling;
1495    
1496    if (!nextSibling)
1497    {
1498      return;
1499    }
1500    
1501    while (nextSibling.nodeType != 1)
1502    {
1503      nextSibling = nextSibling.nextSibling;
1504        
1505      if (!nextSibling)
1506      {
1507        return;
1508      }
1509    }
1510    
1511    if (nextSibling.getAttribute('bottomrow', 0) == 'true')
1512    {
1513        nextSibling.className = className;
1514    }
1515  }  
1516  function highlightRowAndPrev(memberTr)
1517  {
1518    /*debug*/log('highlightRowAndPrev');
1519
1520    SetClassToRowAndPrev(memberTr, 'hover');
1521  }
1522
1523  function normlightRowAndPrev(memberTr)
1524  {
1525    /*debug*/log('normlightRowAndPrev');
1526
1527    SetClassToRowAndPrev(memberTr, 'normal');
1528  }
1529  
1530  function SetClassToRowAndPrev(memberTr, className)
1531  {
1532    /*debug*/log('SetClassToRowAndPrev');
1533
1534    memberTr.className = className;
1535    
1536    var previousSibling = memberTr.previousSibling;
1537    
1538    if (!previousSibling)
1539    {
1540      return;
1541    }
1542    
1543    while (previousSibling.nodeType != 1)
1544    {
1545      previousSibling = previousSibling.previousSibling;
1546        
1547      if (!previousSibling)
1548      {
1549        return;
1550      }
1551    }
1552    
1553    previousSibling.className = className;
1554  }  
1555
1556  function redirectToMemberDetails(url)
1557  {
1558    /*debug*/log('redirectToMemberDetails');
1559
1560    window.location = url;
1561    return false;
1562  }
1563  
1564  MemberDirectoryListRenderer.GetSelectedMembersId  = function()
1565  {
1566    /*debug*/log('GetSelectedMembersId');
1567
1568    if (!searchBoxAskTimeout) {
1569      return false;
1570    }
1571    var element = document.getElementById(MemberDirectoryListRenderer.selectedMembersFieldId);
1572    if (element == null) {
1573      return false;
1574    }
1575    try {
1576      element.value = GetCurrentMembersSelectionIdStr();
1577      if (element.value == '') {
1578        return false;
1579      }
1580    } catch (error) {
1581    }
1582  }
1583  
1584  MemberDirectoryListRenderer.ValidateEmailMembersList = function(sender, args) {
1585    /*debug*/log('ValidateEmailMembersList');
1586
1587    var element = document.getElementById(MemberDirectoryListRenderer.selectedMembersFieldId);
1588      if (element == null || element.value == '') {
1589         args.IsValid = false;
1590      }
1591  }
1592  
1593  function GetCurrentMembersSelectionIdStr()
1594  {
1595    /*debug*/log('GetCurrentMembersSelectionIdStr');
1596
1597    if (!searchAsyncData || searchAsyncData.inProgress)
1598          return;
1599      var otherMembersData = directoryData.membersData[1];
1600      if (searchAsyncData.foundCount == 0) {
1601        return '';
1602      }
1603      var realIndex;
1604      var keywordsDefined = searchAsyncData.keywordsArray.length > 0;
1605      var result = '';
1606      var foundCount = searchAsyncData.foundCount;
1607      for (var i = 0; i < foundCount; i++) {
1608        realIndex = keywordsDefined ? searchAsyncData.foundIndexes[i] : i;
1609        if (otherMembersData[realIndex][1] != 0) {
1610          result += otherMembersData[realIndex][0];
1611          if (foundCount - i > 1)
1612           result += ',';
1613        }
1614      }
1615      return result;
1616  }
1617
1618// end of MemberDirectoryListRenderer singleton
1619}) ();
1620jq$(function(){var service=WaOnlineStoreCart.getInstance().getService();service.savingCompleted=showCart;var cart=service.localLoad()||{};showCart(cart);function showCart(cart){if(!cart.items||cart.items.length===0){jq$(".cart-gadget_count").text("");jq$(".cart-gadget_quantity").removeClass("cart-gadget_quantity__filled");return;}var quantity=0;cart.items.forEach(function(item){quantity+=item.quantity;});jq$(".cart-gadget_count").text(quantity);jq$(".cart-gadget_quantity").addClass("cart-gadget_quantity__filled");return quantity;}});(function(){if(!window.PhotoAlbumGadget){window.PhotoAlbumGadget={};}var albumParam="";var processingText="Please wait...";var deleteConfirmation="Are you sure you want to delete?";var deletePhotoConfirmation="Are you sure you want to delete this photo?";var saveAction=false;var photosHolder=false;
1620var photosHolderHeight=false;var titleTextBox=false;var descriptionTextBox=false;var saveButton=false;var altSaveButton=false;var saveLinkButton=false;var deleteButton=false;var cancelButton=false;var uploadButton=false;var uploadAction=false;var viewModeRadioContainer=false;var uploadButtonContainer=false;var descriptionContainer=false;var descriptionHeightUrlKey=false;var countPhotosPerRowUrlKey=false;var pagingKey=false;var saveAlbumDialogInited=false;var uploadPhotosDialogInited=false;var photoItemId=false;var photoItemTimeout=false;var actionIsRunning=false;var pendingSender=false;var pendingImageDivId=false;var pendingFullDescriptionDivId=false;var pendingSmallDescriptionDivId=false;PhotoAlbumGadget.InitPhotoGallery=initPhotoGallery;PhotoAlbumGadget.InitJsFunctions=initJsFunctions;PhotoAlbumGadget.Page_Parsed=pageParsed;PhotoAlbumGadget.Page_Unloading=pageUnloading;PhotoAlbumGadget.CloseSaveAlbumDialog=closeSaveAlbumDialog;PhotoAlbumGadget.CloseUploadPhotosDialog=closeUploadPhotosDialog;PhotoAlbumGadget.Get_SaveAction=getSaveAction;PhotoAlbumGadget.Get_SaveTitle=getSaveTitle;PhotoAlbumGadget.Get_SaveDescription=getSaveDescription;PhotoAlbumGadget.Get_SaveButton=getSaveButton;PhotoAlbumGadget.Get_DeleteButton=getDeleteButton;PhotoAlbumGadget.Get_UploadButton=getUploadButton;PhotoAlbumGadget.Get_UploadAction=getUploadAction;PhotoAlbumGadget.ProcessingButton_OnClick=processingButtonClick;PhotoAlbumGadget.DeleteButton_OnClick=deleteButtonClick;PhotoAlbumGadget.UploadButton_OnClick=uploadButtonClick;PhotoAlbumGadget.SaveButton_OnClick=saveButtonClick;PhotoAlbumGadget.ImageMenu_OnMouseOver=imageMenuMouseOver;PhotoAlbumGadget.ImageMenu_OnMouseOut=imageMenuMouseOut;PhotoAlbumGadget.MenuButton_OnMouseOver=menuButtonMouseOver;PhotoAlbumGadget.MenuButton_OnMouseOut=menuButtonMouseOut;PhotoAlbumGadget.MenuButton_OnClick=menuButtonClick;PhotoAlbumGadget.NavigateToList=navigateToList;PhotoAlbumGadget.CheckLength=checkLength;function initPhotoGallery(p){if(p.albumParam){albumParam=p.albumParam;}if(p.processingText){processingText=p.processingText;}if(p.deleteConfirmation){deleteConfirmation=p.deleteConfirmation;}if(p.deletePhotoConfirmation){deletePhotoConfirmation=p.deletePhotoConfirmation;}if(p.photosHolderId){photosHolder=WA.$(p.photosHolderId,window);}if(p.saveActionId){saveAction=WA.$(p.saveActionId,window);}if(p.titleTextBoxId){titleTextBox=WA.$(p.titleTextBoxId,window);}if(p.descriptionTextBoxId){descriptionTextBox=WA.$(p.descriptionTextBoxId,window);}if(p.saveButtonId){saveButton=WA.$(p.saveButtonId,window);}if(p.altSaveButtonId){altSaveButton=WA.$(p.altSaveButtonId,window);}if(p.saveLinkButtonId){saveLinkButton=WA.$(p.saveLinkButtonId,window);}if(p.deleteButtonId){deleteButton=WA.$(p.deleteButtonId,window);}if(p.cancelButtonId){cancelButton=WA.$(p.cancelButtonId,window);}if(p.uploadButtonId){uploadButton=WA.$(p.uploadButtonId,window);}if(p.uploadActionId){uploadAction=WA.$(p.uploadActionId,window);}if(p.viewModeRadioContainerId){viewModeRadioContainer=WA.$(p.viewModeRadioContainerId,window);}if(p.uploadButtonContainerId){uploadButtonContainer=WA.$(p.uploadButtonContainerId,window);}if(p.descriptionContainerId){descriptionContainer=WA.$(p.descriptionContainerId,window);}if(p.descriptionHeightUrlKey){descriptionHeightUrlKey=p.descriptionHeightUrlKey;}if(p.countPhotosPerRowUrlKey){countPhotosPerRowUrlKey=p.countPhotosPerRowUrlKey;}if(p.pagingUrlKey){pagingKey=p.pagingUrlKey;}}function initJsFunctions(){setDisplayInline(saveLinkButton);setDisplayInline(uploadButton);setDisplay(viewModeRadioContainer);setDisplay(uploadButtonContainer);}function pageParsed(){initJsFunctions();}function pageUnloading(){setDisabled(saveButton);setDisabled(uploadButton);setDisabled(deleteButton);if(saveLinkButton){setDisabled(saveLinkButton);setDisabled(altSaveButton);setDisabled(cancelButton);}}function setDisplay(element){if(element){element.style.display="";}}function setDisplayInline(element){if(element){element.style.display="inline";}}function setDisplayBlock(element){if(element){element.style.display="block";}}function setDisplayNone(element){if(element){element.style.display="none";}}function setDisabled(element){if(element){element.disabled=true;}}function closeSaveAlbumDialog(){PhotoAlbumsDialog.saveAlbumDialog.close();}function closeUploadPhotosDialog(){PhotoAlbumsDialog.uploadPhotosDialog.close();}function getSaveAction(){return saveAction;}function getSaveTitle(){return titleTextBox;}function getSaveDescription(){return descriptionTextBox;}function getSaveButton(){return saveButton;}function getDeleteButton(){return deleteButton;}function getUploadButton(){return uploadButton;}function getUploadAction(){return uploadAction;}function processingButtonClick(sender,otherIds){if(sender){sender.value=processingText;}
1620if(otherIds&&otherIds.length){for(var i=0;i<otherIds.length;i++){var btn=WA.$(otherIds[i],window);if(btn&&btn.id!=sender.id){btn.disabled=true;}}}return true;}function deleteButtonClick(sender,otherIds){if(confirm(deleteConfirmation)){return processingButtonClick(sender,otherIds);}return false;}function uploadButtonClick(){if(!uploadPhotosDialogInited){PhotoAlbumsDialog.uploadPhotosDialog.initialize({albumParam:albumParam});uploadPhotosDialogInited=true;}if(uploadAction.value=="1"){uploadAction.value="";if(uploadButton){uploadButton.value=processingText;}WA.reloadCurrentPage(pagingKey,window);return;}PhotoAlbumsDialog.uploadPhotosDialog.open(null,{"PhotoGallery":PhotoGallery});}function saveButtonClick(){if(!saveAlbumDialogInited){PhotoAlbumsDialog.saveAlbumDialog.initialize({albumParam:albumParam});saveAlbumDialogInited=true;}if(saveAction.value=="1"){saveAction.value="";if(saveButton){saveButton.value=processingText;}return true;}PhotoAlbumsDialog.saveAlbumDialog.open(null,{"PhotoGallery":PhotoGallery});return false;}function imageMenuMouseOver(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(photoItemTimeout&&photoItemId==imageDivId){clearTimeout(photoItemTimeout);photoItemTimeout=false;return;}if(actionIsRunning){return;}sender.parentNode.style.height=sender.offsetHeight+"px";WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhotoHover";sender.className="photoInnerContainerOver";sender.style.zIndex=sender.style.zIndex+1;var fullDescriptionDiv=WA.$(fullDescriptionDivId,window);setDisplayBlock(fullDescriptionDiv);setDisplayNone(WA.$(smallDescriptionDivId,window));if(photosHolder){photosHolderHeight=photosHolder.offsetHeight;if(!photosHolder.Y){WA.Dimensions.getXY(photosHolder);}if(!fullDescriptionDiv.Y){WA.Dimensions.getXY(fullDescriptionDiv);}var outHeigth=fullDescriptionDiv.Y+fullDescriptionDiv.offsetHeight-photosHolder.Y-photosHolderHeight;if(outHeigth>0){photosHolder.style.height=(photosHolderHeight+outHeigth+10)+"px";}}}function doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhoto";sender.className="photoInnerContainer";sender.style.zIndex=sender.style.zIndex-1;setDisplayNone(WA.$(fullDescriptionDivId,window));setDisplayBlock(WA.$(smallDescriptionDivId,window));if(photosHolderHeight&&photosHolder.offsetHeight>photosHolderHeight){photosHolder.style.height=photosHolderHeight+"px";}photoItemId=false;photoItemTimeout=false;}function imageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(actionIsRunning){if(!pendingSender){pendingSender=sender;pendingImageDivId=imageDivId;pendingFullDescriptionDivId=fullDescriptionDivId;pendingSmallDescriptionDivId=smallDescriptionDivId;}return;}if(photoItemTimeout&&photoItemId==imageDivId){return;}photoItemId=imageDivId;photoItemTimeout=setTimeout(function(){doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId);},10);}function menuButtonMouseOver(sender){sender.className="overButton";}function menuButtonMouseOut(sender){sender.className="outButton";}function menuButtonClick(linkId,secondButtonId,processingContainerId,confirmVariableName){var linkobj=WA.$(linkId,window);if(linkobj){setDisplayNone(linkobj);var secondButton=WA.$(secondButtonId,window);var processingContainer=WA.$(processingContainerId,window);setDisplayNone(secondButton);setDisplayBlock(processingContainer);if(confirmVariableName){actionIsRunning=true;if(!confirm(eval(confirmVariableName))){actionIsRunning=false;setDisplayNone(processingContainer);setDisplay(secondButton);setDisplay(linkobj);if(pendingSender){imageMenuMouseOut(pendingSender,pendingImageDivId,pendingFullDescriptionDivId,pendingSmallDescriptionDivId);pendingSender=false;}return;}}actionIsRunning=false;eval(linkobj.href.substr(11).replace(/\%20/g," ").replace(/\%22/g,'"'));}}function navigateToList(url){var descriptionHeight=(descriptionContainer)?descriptionContainer.offsetHeight:0;var countPhotosPerRow=0;if(photosHolder){var y=0;var bulets=photosHolder.getElementsByTagName("LI");for(var i=0;i<bulets.length;i++){WA.Dimensions.getXY(bulets[i]);if(i==0){y=bulets[i].Y;}else{if(y<bulets[i].Y){countPhotosPerRow=i;break;}}}}if(descriptionHeightUrlKey&&countPhotosPerRowUrlKey){var index=url.indexOf("?",0);url=index==-1?url+"?":url+"&";url+=descriptionHeightUrlKey+"="+descriptionHeight+"&"+countPhotosPerRowUrlKey+"="+countPhotosPerRow;}url+="#photo";window.location=url;}function checkLength(e,oObject,maxLength){if(oObject.value.length<maxLength){return true;}else{var keyID=(window.event)?event.keyCode:e.keyCode;if((keyID>=37&&keyID<=40)||(keyID==8)||(keyID==46)){if(window.event){e.returnValue=true;}}else{if(window.event){e.returnValue=false;}else{e.preventDefault();}}}}})();(function(window,WA){if(!WA){return;}if(!window.PhotoAlbumsDialog){window.PhotoAlbumsDialog={};}PhotoAlbumsDialog.uploadPhotosDialog=new WA.topWindow.BonaDialogHandler({name:"PhotoAlbumsDialog_UploadPhotosDialog",dialogParameters:{clipContainerId:"idClipMainContainer",mainContainerId:"contentDiv",directURLTemplate:"/Content/Members/PhotoGallery/UploadPhotosDialog.aspx?frameMode=0{albumParam}&version="+WA.version,reloadURLTemplate:"/Content/Pictures/PhotoGallery/UploadPhotosInnerDialog.aspx?version="+WA.version+"{albumParam}",top:null,left:null,width:430,height:355,minWidth:430,minHeight:355,isMoveable:true,isResizeable:false,isModal:true,isScrollable:false,callBackParameters:{}},onDialogClose:function(){if(PhotoGallery.Get_UploadAction().value=="1"){PhotoGallery.Get_UploadButton().click();}}});})(window,window.WA);jq$(function(){if(jq$(".WaGadgetPhotoAlbumStatePhoto .editCaptionTextBox").size()){$("body").animate({scrollTop:$(".WaGadgetPhotoAlbumStatePhoto .editCaptionTextBox").offset().top},0);}});(function(){if(!window.PhotoAlbumSummaryGadget){window.PhotoAlbumSummaryGadget={};}PhotoAlbumSummaryGadget.FieldArrow=PhotoAlbumSummaryFieldArrow;function PhotoAlbumSummaryFieldArrow(container,direction,callBackClick){var pThis=this,arrowContainer;function draw(){arrowContainer=document.createElement("div");if(direction==="left"){arrowContainer.id="button_leftphotoAlbumSummary";arrowContainer.setAttribute("class","button_leftphotoAlbumSummary");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M0.666666667,10 C0.847222222,10 1.00347222,9.93815104 1.13541667,9.81445312 L1.13541667,9.81445312 L5.80208333,5.43945312 C5.93402778,5.31575521 6,5.16927083 6,5 C6,4.83072917 5.93402778,4.68424479 5.80208333,4.56054687 L5.80208333,4.56054687 L1.13541667,0.185546875 C1.00347222,0.0618489583 0.847222222,0 0.666666667,0 C0.486111111,0 0.329861111,0.0618489583 0.197916667,0.185546875 C0.0659722222,0.309244792 0,0.455729167 0,0.625 L0,0.625 L0,9.375 C0,9.54427083 0.0659722222,9.69075521 0.197916667,9.81445312 C0.329861111,9.93815104 0.486111111,10 0.666666667,10 Z" id="?" fill="#000000" fill-rule="nonzero" transform="translate(3.000000, 5.000000) scale(-1, -1) translate(-3.000000, -5.000000) "></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");
1620svgElement.setAttribute("width","6px");svgElement.setAttribute("height","10px");svgElement.setAttribute("viewBox","0 0 6 10");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="right"){arrowContainer.id="button_rightphotoAlbumSummary";arrowContainer.setAttribute("class","button_rightphotoAlbumSummary");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M0.666666667,10 C0.847222222,10 1.00347222,9.93815104 1.13541667,9.81445312 L1.13541667,9.81445312 L5.80208333,5.43945312 C5.93402778,5.31575521 6,5.16927083 6,5 C6,4.83072917 5.93402778,4.68424479 5.80208333,4.56054687 L5.80208333,4.56054687 L1.13541667,0.185546875 C1.00347222,0.0618489583 0.847222222,0 0.666666667,0 C0.486111111,0 0.329861111,0.0618489583 0.197916667,0.185546875 C0.0659722222,0.309244792 0,0.455729167 0,0.625 L0,0.625 L0,9.375 C0,9.54427083 0.0659722222,9.69075521 0.197916667,9.81445312 C0.329861111,9.93815104 0.486111111,10 0.666666667,10 Z" id="?" fill="#000000" fill-rule="nonzero" transform="translate(3.000000, 5.000000) scale(1, -1) translate(-3.000000, -5.000000) "></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");svgElement.setAttribute("width","6px");svgElement.setAttribute("height","10px");svgElement.setAttribute("viewBox","0 0 6 10");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="buttonLeft"){arrowContainer.setAttribute("class","leftFullScreen");arrowContainer.id="pasLeftFullScreen";var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M31.3593002,62.7186005 C31.8280484,62.7186005 32.2030482,62.5779758 32.4842976,62.2967265 L32.4842976,62.2967265 L33.6092949,61.1717292 C33.8905442,60.8904798 34.0311689,60.51548 34.0311689,60.0467318 C34.0311689,59.5779837 33.8905442,59.1561097 33.6092949,58.7811099 L33.6092949,58.7811099 L6.04686058,31.3593002 L33.6092949,3.93749061 C33.8905442,3.56249079 34.0311689,3.1406168 34.0311689,2.67186863 C34.0311689,2.20312046 33.8905442,1.82812064 33.6092949,1.54687131 L33.6092949,1.54687131 L32.4842976,0.421873994 C32.2030482,0.140624665 31.8280484,0 31.3593002,0 C30.8905521,0 30.5155522,0.140624665 30.2343029,0.421873994 L30.2343029,0.421873994 L0.421873994,30.2343029 C0.140624665,30.5155522 0,30.8905521 0,31.3593002 C0,31.8280484 0.140624665,32.2030482 0.421873994,32.4842976 L0.421873994,32.4842976 L30.2343029,62.2967265 C30.5155522,62.5779758 30.8905521,62.7186005 31.3593002,62.7186005 Z" id="?" fill="#FFFFFF" fill-rule="nonzero"></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");svgElement.setAttribute("width","34px");svgElement.setAttribute("height","63px");svgElement.setAttribute("viewBox","0 0 34 63");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="buttonRight"){arrowContainer.setAttribute("class","rightFullScreen");arrowContainer.id="pasRightFullScreen";var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M2.67186863,62.7186005 C3.1406168,62.7186005 3.51561662,62.5779758 3.79686595,62.2967265 L3.79686595,62.2967265 L33.6092949,32.4842976 C33.8905442,32.2030482 34.0311689,31.8280484 34.0311689,31.3593002 C34.0311689,30.8905521 33.8905442,30.5155522 33.6092949,30.2343029 L33.6092949,30.2343029 L3.79686595,0.421873994 C3.51561662,0.140624665 3.1406168,0 2.67186863,0 C2.20312046,0 1.82812064,0.140624665 1.54687131,0.421873994 L1.54687131,0.421873994 L0.421873994,1.54687131 C0.140624665,1.82812064 0,2.20312046 0,2.67186863 C0,3.1406168 0.140624665,3.56249079 0.421873994,3.93749061 L0.421873994,3.93749061 L27.9843083,31.3593002 L0.421873994,58.7811099 C0.140624665,59.1561097 0,59.5779837 0,60.0467318 C0,60.51548 0.140624665,60.8904798 0.421873994,61.1717292 L0.421873994,61.1717292 L1.54687131,62.2967265 C1.82812064,62.5779758 2.20312046,62.7186005 2.67186863,62.7186005 Z" id="?" fill="#FFFFFF" fill-rule="nonzero"></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");
1620svgElement.setAttribute("width","34px");svgElement.setAttribute("height","63px");svgElement.setAttribute("viewBox","0 0 34 63");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}}}}}pThis.show=function(){arrowContainer.style.opacity="0.9";arrowContainer.addEventListener("click",onClick);};pThis.hide=function(){arrowContainer.style.opacity="0.5";arrowContainer.removeEventListener("click",onClick);};pThis.enable=function(){arrowContainer.className=arrowContainer.className.replace(/\s+disabled/g,"");arrowContainer.addEventListener("click",onClick);};pThis.disable=function(){if(!(/\s+disabled/).test(arrowContainer.className)){arrowContainer.className+=" disabled";}arrowContainer.removeEventListener("click",onClick);};pThis.displayShow=function(){arrowContainer.style.visibility="visible";arrowContainer.addEventListener("click",onClick);};pThis.displayHide=function(){arrowContainer.style.visibility="hidden";arrowContainer.removeEventListener("click",onClick);};function onClick(){if(typeof(callBackClick)==="function"){callBackClick();}}draw();}})();(function(){if(!window.PhotoAlbumSummaryGadget){window.PhotoAlbumSummaryGadget={};}PhotoAlbumSummaryGadget.ScrollBar=PhotoAlbumSummaryScrollBar;function PhotoAlbumSummaryScrollBar(renderGallery,gadgetContainer,rows,numberOfColumns,lengthThumbnails,buttonLeft,buttonRight){var slider=gadgetContainer.querySelector('DIV[class="PhotoAlbumSummaryGadgetSlider"]'),scrollBar=gadgetContainer.querySelector('DIV[class="PhotoAlbumSummaryGadgetScrollBar"]'),scrollElement=gadgetContainer.querySelector('DIV[class="PhotoAlbumSummaryGadgetScrollElement"]');var scrollBarWidth,quantityCell,lengthCell;var numberCell=0,previousCell=0;var shiftX,realPosition;var pThis=this;this.setImages=function(thumbnailsCount){pThis.lengthThumbnails=thumbnailsCount;};function init(){slider.addEventListener("mousedown",mouseDown);scrollBar.addEventListener("mousedown",scrollBarMouseDown);styleScrollBar();}pThis.resizeStyleScroll=function(){renderGallery.resizeScrollGallery(numberCell);};pThis.resizeStyleScrollBar=function(resizeColumns){styleScrollBar(resizeColumns);realPositionSlider();renderGallery.resizeScrollGallery(numberCell);};function scrollBarMouseDown(event){if(event.button===2){return;}numberCell=Math.floor((event.clientX-scrollBar.getBoundingClientRect().left)/lengthCell);realPositionSlider();quantityCellScroll(numberCell);}function quantityCellScroll(scrollCel){var rate=scrollCel-previousCell;previousCell=scrollCel;if(rate>0){renderGallery.scrollGallery(true,rate,false);}else{if(rate<0){renderGallery.scrollGallery(false,-rate,false);}}}function mouseDown(event){event.stopPropagation();if(event.button===2){return;}document.addEventListener("mousemove",onMouseMove);document.addEventListener("mouseup",onMouseUp);document.addEventListener("dragstart",dragDropStop);shiftX=event.clientX-slider.getBoundingClientRect().left;}function onMouseMove(event){var limit=scrollBarWidth-slider.getBoundingClientRect().width;realPosition=event.clientX-shiftX-scrollBar.getBoundingClientRect().left;if(realPosition>=limit){realPosition=limit;}else{if(realPosition<=0){realPosition=0;}}numberCell=Math.floor((realPosition+lengthCell/2)/lengthCell);quantityCellScroll(numberCell);slider.style.left=realPosition+"px";slider.setAttribute("class","PhotoAlbumSummaryGadgetSliderPress");}function styleScrollBar(columns){if(columns){numberOfColumns=columns;}if(lengthThumbnails<=rows*numberOfColumns){buttonLeft.displayHide();buttonRight.displayHide();scrollElement.style.position="absolute";scrollElement.style.left="-4000px";scrollElement.style.top="-4000px";}else{buttonLeft.displayShow();buttonRight.displayShow();scrollElement.style.position="";scrollElement.style.left="";scrollElement.style.top="";}scrollBarWidth=scrollBar.getBoundingClientRect().width;quantityCell=Math.ceil(lengthThumbnails/rows)-numberOfColumns+1;lengthCell=scrollBarWidth/quantityCell;slider.style.width=lengthCell+"px";}function realPositionSlider(){realPosition=Math.ceil(lengthCell*numberCell);slider.style.left=realPosition+"px";if(numberCell===0){if(lengthThumbnails<=rows*numberOfColumns){buttonLeft.disable();buttonRight.disable();}else{buttonLeft.disable();buttonRight.enable();}}else{if(numberCell===(quantityCell-1)){buttonRight.disable();buttonLeft.enable();}else{buttonLeft.enable();buttonRight.enable();}}if(realPosition>=scrollBar.getBoundingClientRect().width){realPosition=Math.ceil(lengthCell*(quantityCell-1));slider.style.left=realPosition+"px";}}pThis.positionSlider=function(shiftScroll,direction){if(direction){if(numberCell<quantityCell-1){shiftScroll>=quantityCell-numberCell?numberCell=quantityCell-1:numberCell=numberCell+shiftScroll;}}else{if(numberCell>0){numberCell-shiftScroll<=0?numberCell=0:numberCell=numberCell-shiftScroll;}}previousCell=numberCell;realPositionSlider();};function onMouseUp(){realPositionSlider();slider.setAttribute("class","PhotoAlbumSummaryGadgetSlider");document.removeEventListener("mousemove",onMouseMove);document.removeEventListener("mouseup",onMouseUp);document.removeEventListener("dragstart",dragDropStop);}function dragDropStop(e){e.stopPropagation();e.preventDefault();}init();}})();(function(){if(!window.PhotoAlbumSummaryGadget){window.PhotoAlbumSummaryGadget={};}PhotoAlbumSummaryGadget.RenderSummary=RenderAlbumSummary;
1620function RenderAlbumSummary(gadgetId,numberOfRows,columns,size,resolution){var gallery,pThis=this;var gadgetContainer=document.getElementById("idPhotoAlbumSummaryGadget_Container_"+gadgetId),gadgetScrollbar=gadgetContainer.querySelector('DIV[class="PhotoAlbumSummaryGadgetScrollElement"]'),innerContainer=gadgetContainer.querySelector('DIV[class="containerPhotoInner"]'),outerContainer=gadgetContainer.querySelector('DIV[class="containerPhotoOuter"]');var numberOfColumns=null;var marginHorizontal=9,marginVertical=9;var isThumbnailSizeFixed=false;var isThumbnailMarginFixed=true;var startTouchEventX,startTime;var focusGallery,scrollBar,thumbnailQuantity,thumbnailSize=null,thumbnails=[];var buttonLeft,buttonRight;var activeElementIndex=0;var i=0;numberOfRows=Number(numberOfRows);function getAlbums(){var albums=[],container=document.querySelector('DIV[data-componentId="'+gadgetId+'"]'),element,elements,i;if(!container){return null;}elements=container.querySelectorAll("DIV[data-thumb]");for(i=0;i<elements.length;i++){element=elements[i];albums.push({"albumId":element.getAttribute("data-target"),"count":element.getAttribute("data-count"),"name":element.getAttribute("data-title"),"origin":element.getAttribute("data-src"),"thumbnail":element.getAttribute("data-thumb")});}return albums;}this.init=function(){gallery=getAlbums();createAlbumGallery();if(focusGallery){focusGallery.addEventListener("focus",pThis.onFocus);focusGallery.addEventListener("blur",pThis.onBlur);}outerContainer.addEventListener("scroll",scrollReverse);gadgetContainer.addEventListener("touchstart",eventSwipeTouchStart);gadgetContainer.addEventListener("touchend",eventSwipeTouchEnd);window.addEventListener("resize",resizeGalleryBasic);};function eventSwipeTouchStart(e){startTouchEventX=e.changedTouches[0].screenX;startTime=new Date().getTime();}function eventSwipeTouchEnd(e){if(new Date().getTime()-startTime>100){if(e.changedTouches[0].screenX-startTouchEventX>50){scrollLeftButton();}else{if(e.changedTouches[0].screenX-startTouchEventX<-50){scrollRightButton();}}}}function scrollReverse(){showVisible();scrollBar.resizeStyleScroll();}function resizeGalleryBasic(){pThis.resizeGallery();resizeGalleryReserve();}function resizeGalleryReserve(){setTimeout(pThis.resizeGallery,100);}pThis.resizeGallery=function(){styleAlbumsGallery();var newHeight=0;for(i=0;i<thumbnails.length;i++){var height=thumbnails[i].resizeThumbnail(thumbnailSize,marginHorizontal,marginVertical);if(height>newHeight){newHeight=height;}}scrollBar.resizeStyleScrollBar(thumbnailQuantity);var thumbnailsByRow=numberOfColumns;if(thumbnailsByRow==null){thumbnailsByRow=Math.floor(innerContainer.clientWidth/(thumbnailSize+marginHorizontal));}if(thumbnails.length>=thumbnailsByRow*numberOfRows){thumbnailsByRow=Math.ceil(thumbnails.length/numberOfRows);}innerContainer.style.height=(numberOfRows*newHeight+numberOfRows*marginVertical)+"px";innerContainer.style.width=(thumbnailsByRow*(thumbnailSize+marginHorizontal))+"px";showVisible();};function styleAlbumsGallery(){var outerContainerWidth=outerContainer.getBoundingClientRect().width;if(isThumbnailSizeFixed){thumbnailQuantity=Math.floor(outerContainerWidth/thumbnailSize);if(outerContainerWidth<thumbnailSize){thumbnailQuantity=1;}if(thumbnailQuantity===1){marginHorizontal=Math.floor(outerContainerWidth%thumbnailSize/thumbnailQuantity);}else{marginHorizontal=Math.floor(outerContainerWidth%thumbnailSize/(thumbnailQuantity-1));}}if(isThumbnailMarginFixed){thumbnailQuantity=numberOfColumns;thumbnailSize=Math.floor((outerContainerWidth+marginHorizontal)/thumbnailQuantity)-marginHorizontal;}innerContainer.style.height=(numberOfRows*thumbnailSize+numberOfRows*marginVertical)+"px";}function createAlbumGallery(){var str="";focusGallery=gadgetContainer.querySelector('DIV[class="PhotoAlbumSummaryGadgetFocus"]');if(resolution==="NumberOfThumbnails"){numberOfColumns=Number(columns);isThumbnailSizeFixed=false;isThumbnailMarginFixed=true;}else{if(resolution==="SizeOfThumbnails"){thumbnailSize=Number(size);isThumbnailSizeFixed=true;isThumbnailMarginFixed=false;}}styleAlbumsGallery();for(i=0;i<gallery.length;i++){thumbnails.push(new PhotoAlbumSummaryGadget.Thumbnail(pThis,innerContainer,gallery[i],i));}for(i=0;i<thumbnails.length;
1620i++){str+=thumbnails[i].render(thumbnailSize,marginHorizontal,marginVertical);}innerContainer.innerHTML=str;for(i=0;i<thumbnails.length;i++){thumbnails[i].init(innerContainer);}if(buttonLeft==null){buttonLeft=new PhotoAlbumSummaryGadget.FieldArrow(gadgetScrollbar,"left",scrollLeftButton);}if(buttonRight==null){buttonRight=new PhotoAlbumSummaryGadget.FieldArrow(gadgetScrollbar,"right",scrollRightButton);}if(scrollBar==null){scrollBar=new PhotoAlbumSummaryGadget.ScrollBar(pThis,gadgetContainer,numberOfRows,thumbnailQuantity,thumbnails.length,buttonLeft,buttonRight);}else{scrollBar.setImages(thumbnails.length);}showVisible();setTimeout(pThis.resizeGallery,250);}pThis.scrollGallery=function(direction,multiplier,resolution){if(direction){outerContainer.scrollLeft+=(thumbnailSize+marginHorizontal)*multiplier;}else{if(!direction){outerContainer.scrollLeft-=(thumbnailSize+marginHorizontal)*multiplier;}}if(resolution){scrollBar.positionSlider(multiplier,direction);}};pThis.resizeScrollGallery=function(resizeScroll){outerContainer.scrollLeft=(thumbnailSize+marginHorizontal)*resizeScroll;};function scrollLeftButton(){pThis.scrollGallery(false,thumbnailQuantity,true);}function scrollRightButton(){pThis.scrollGallery(true,thumbnailQuantity,true);}function showVisible(){for(var i=0;i<thumbnails.length;i++){thumbnails[i].checkVisibility();}}pThis.onFocus=function(){gadgetContainer.addEventListener("keydown",addDocumentEventFocus);var activeElement=gadgetContainer.querySelector('DIV[data-indeximg="'+activeElementIndex+'"]');activeElement.style.border="3px ridge rgba(255, 255, 255, 1)";};pThis.onBlur=function(){gadgetContainer.querySelector('DIV[data-indeximg="'+(activeElementIndex)+'"]').style.border="";gadgetContainer.removeEventListener("keydown",addDocumentEventFocus);};function addDocumentEventFocus(event){if(event.key==="ArrowUp"||event.key==="Up"){if(activeElementIndex%numberOfRows!==0){setActiveThumbnail(event,activeElementIndex,(activeElementIndex-1));}}else{if(event.key==="ArrowDown"||event.key==="Down"){if(activeElementIndex%numberOfRows!==(numberOfRows-1)&&activeElementIndex<thumbnails.length-1){setActiveThumbnail(event,activeElementIndex,(activeElementIndex+1));}}else{if((event.key==="ArrowLeft"||event.key==="Left")){if(activeElementIndex>=numberOfRows){setActiveThumbnail(event,activeElementIndex,activeElementIndex-numberOfRows,false);}}else{if((event.key==="ArrowRight"||event.key==="Right")){if(activeElementIndex<thumbnails.length-numberOfRows){setActiveThumbnail(event,activeElementIndex,activeElementIndex+numberOfRows,true);}else{setActiveThumbnail(event,activeElementIndex,thumbnails.length-1,true);}}else{if(event.key==="Enter"){gadgetContainer.querySelector('DIV[data-indeximg="'+Number(activeElementIndex)+'"]').click();}}}}}}function setActiveThumbnail(event,currentIndex,newIndex,isRightDirection){thumbnails[currentIndex].setViewState(false);thumbnails[newIndex].setViewState(true,isRightDirection);activeElementIndex=newIndex;event.preventDefault();event.stopPropagation();}pThis.init();}})();(function(){if(!window.PhotoAlbumSummaryGadget){window.PhotoAlbumSummaryGadget={};}PhotoAlbumSummaryGadget.Thumbnail=Thumbnail;function Thumbnail(renderGallery,parentContainer,item,ind){var borderSize=3,container,image,isVisible=false,pThis=this;pThis.imageUrl=item.origin;pThis.init=function(parentContainer){container=parentContainer.querySelector('DIV[data-indeximg="'+ind+'"]');image=parentContainer.querySelector('IMG[data-indeximg="'+ind+'"]');};pThis.render=function(thumbnailSize,marginHorizontal,marginVertical){return'<a href="/'+item.albumId+'">'+(item.name?'<div class="img_invisible" style="height:'+thumbnailSize+"px;width:"+thumbnailSize+"px;margin:0 "+marginHorizontal+"px "+marginVertical+'px 0;" data-indeximg="'+ind+'">'+'<img data-src="'+item.thumbnail+'" data-indeximg="'+ind+'" alt="" src="" />'+'<div class="img_caption" id="img_caption'+ind+'" style="max-width:'+(thumbnailSize-borderSize*2)+'px;">'+'<span class="caption_text" id="caption_text'+ind+'">'+item.name+"</span>"+'<span class="caption_count"> ('+item.count+")</span>"+"</div>"+"</div>":'<div class="img_invisible" style="height:'+thumbnailSize+"px;width:"+thumbnailSize+"px;margin: 0 "+marginHorizontal+"px "+marginVertical+'px 0;" data-indeximg="'+ind+'">'+'<img data-src="'+item.thumbnail+'" data-indeximg="'+ind+'" alt="" src="" />'+"</div>")+"</a>";};pThis.renderFullPhoto=function(){return item.origin;};pThis.resizeThumbnail=function(size,marginHorizontal,marginVertical){var caption=document.getElementById("img_caption"+ind),captionHeight=0,captionText=document.getElementById("caption_text"+ind);if(caption){var margins=(marginVertical*2);if(caption.clientHeight>margins){captionHeight=caption.clientHeight-margins+30;}else{captionHeight=caption.clientHeight+30;}var allowedChars=measureTextInALine(captionText.innerText,caption.clientWidth-marginHorizontal)*2;if(captionText.innerText.length>allowedChars){captionText.innerText=captionText.innerText.substr(0,allowedChars-8)+"...";}caption.style.width=(size-borderSize*2)+"px";image.style.height=(size-borderSize*2)+"px";}
1620var containerHeight=size+captionHeight;container.style.width=size+"px";container.style.height=containerHeight+"px";container.style.margin=0+"px "+marginHorizontal+"px "+marginVertical+"px "+0+"px";return containerHeight;};pThis.checkVisibility=function(){if(!isVisible&&getIsVisible(false)){isVisible=true;if(item.count>0){image.setAttribute("src",image.getAttribute("data-src"));image.removeAttribute("data-src");setClasses();}else{image.removeAttribute("data-src");}}};pThis.setViewState=function(isActive,isRightDirection){container.style.border=(isActive?borderSize+"px ridge rgba(255, 255, 255, 1)":"");if(isActive&&!getIsVisible(isRightDirection)){if(isRightDirection){renderGallery.scrollGallery(true,1,true);}else{renderGallery.scrollGallery(false,1,true);}}};function getIsVisible(isRightCorner){var parentRect=parentContainer.getBoundingClientRect(),rect=container.getBoundingClientRect();return(isRightCorner?rect.right:rect.left)<(parentRect.left+parentRect.width)&&(isRightCorner?rect.right:rect.left-parentRect.left)-container.scrollLeft>=0;}function measureTextInALine(text,targetWidth){var fit=text.length,i,span=document.createElement("span");document.body.appendChild(span);span.style.whiteSpace="nowrap";for(i=0;i<fit;++i){span.innerHTML+=text[i];if(span.offsetWidth>targetWidth){fit=i-1;break;}}document.body.removeChild(span);return i;}function setClasses(){if(image.naturalWidth&&image.naturalHeight){container.setAttribute("class",((image.naturalHeight>image.naturalWidth)?"img_vertical":"img_horizontal"));}else{setTimeout(setClasses,100);}}}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.FieldArrow=FieldArrow;function FieldArrow(container,direction,callBackClick){var pThis=this,arrowContainer;function draw(){arrowContainer=document.createElement("div");if(direction==="left"){arrowContainer.setAttribute("class","button_leftPhotoGallery");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M0.666666667,10 C0.847222222,10 1.00347222,9.93815104 1.13541667,9.81445312 L1.13541667,9.81445312 L5.80208333,5.43945312 C5.93402778,5.31575521 6,5.16927083 6,5 C6,4.83072917 5.93402778,4.68424479 5.80208333,4.56054687 L5.80208333,4.56054687 L1.13541667,0.185546875 C1.00347222,0.0618489583 0.847222222,0 0.666666667,0 C0.486111111,0 0.329861111,0.0618489583 0.197916667,0.185546875 C0.0659722222,0.309244792 0,0.455729167 0,0.625 L0,0.625 L0,9.375 C0,9.54427083 0.0659722222,9.69075521 0.197916667,9.81445312 C0.329861111,9.93815104 0.486111111,10 0.666666667,10 Z" id="?" fill="#000000" fill-rule="nonzero" transform="translate(3.000000, 5.000000) scale(-1, -1) translate(-3.000000, -5.000000) "></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");svgElement.setAttribute("width","6px");svgElement.setAttribute("height","10px");svgElement.setAttribute("viewBox","0 0 6 10");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="right"){arrowContainer.setAttribute("class","button_rightPhotoGallery");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M0.666666667,10 C0.847222222,10 1.00347222,9.93815104 1.13541667,9.81445312 L1.13541667,9.81445312 L5.80208333,5.43945312 C5.93402778,5.31575521 6,5.16927083 6,5 C6,4.83072917 5.93402778,4.68424479 5.80208333,4.56054687 L5.80208333,4.56054687 L1.13541667,0.185546875 C1.00347222,0.0618489583 0.847222222,0 0.666666667,0 C0.486111111,0 0.329861111,0.0618489583 0.197916667,0.185546875 C0.0659722222,0.309244792 0,0.455729167 0,0.625 L0,0.625 L0,9.375 C0,9.54427083 0.0659722222,9.69075521 0.197916667,9.81445312 C0.329861111,9.93815104 0.486111111,10 0.666666667,10 Z" id="?" fill="#000000" fill-rule="nonzero" transform="translate(3.000000, 5.000000) scale(1, -1) translate(-3.000000, -5.000000) "></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");
1620svgElement.setAttribute("width","6px");svgElement.setAttribute("height","10px");svgElement.setAttribute("viewBox","0 0 6 10");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="buttonLeft"){arrowContainer.setAttribute("class","leftFullScreen");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M31.3593002,62.7186005 C31.8280484,62.7186005 32.2030482,62.5779758 32.4842976,62.2967265 L32.4842976,62.2967265 L33.6092949,61.1717292 C33.8905442,60.8904798 34.0311689,60.51548 34.0311689,60.0467318 C34.0311689,59.5779837 33.8905442,59.1561097 33.6092949,58.7811099 L33.6092949,58.7811099 L6.04686058,31.3593002 L33.6092949,3.93749061 C33.8905442,3.56249079 34.0311689,3.1406168 34.0311689,2.67186863 C34.0311689,2.20312046 33.8905442,1.82812064 33.6092949,1.54687131 L33.6092949,1.54687131 L32.4842976,0.421873994 C32.2030482,0.140624665 31.8280484,0 31.3593002,0 C30.8905521,0 30.5155522,0.140624665 30.2343029,0.421873994 L30.2343029,0.421873994 L0.421873994,30.2343029 C0.140624665,30.5155522 0,30.8905521 0,31.3593002 C0,31.8280484 0.140624665,32.2030482 0.421873994,32.4842976 L0.421873994,32.4842976 L30.2343029,62.2967265 C30.5155522,62.5779758 30.8905521,62.7186005 31.3593002,62.7186005 Z" id="?" fill="#FFFFFF" fill-rule="nonzero"></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");svgElement.setAttribute("width","34px");svgElement.setAttribute("height","63px");svgElement.setAttribute("viewBox","0 0 34 63");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}else{if(direction==="buttonRight"){arrowContainer.setAttribute("class","rightFullScreen");var svgContent='<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M2.67186863,62.7186005 C3.1406168,62.7186005 3.51561662,62.5779758 3.79686595,62.2967265 L3.79686595,62.2967265 L33.6092949,32.4842976 C33.8905442,32.2030482 34.0311689,31.8280484 34.0311689,31.3593002 C34.0311689,30.8905521 33.8905442,30.5155522 33.6092949,30.2343029 L33.6092949,30.2343029 L3.79686595,0.421873994 C3.51561662,0.140624665 3.1406168,0 2.67186863,0 C2.20312046,0 1.82812064,0.140624665 1.54687131,0.421873994 L1.54687131,0.421873994 L0.421873994,1.54687131 C0.140624665,1.82812064 0,2.20312046 0,2.67186863 C0,3.1406168 0.140624665,3.56249079 0.421873994,3.93749061 L0.421873994,3.93749061 L27.9843083,31.3593002 L0.421873994,58.7811099 C0.140624665,59.1561097 0,59.5779837 0,60.0467318 C0,60.51548 0.140624665,60.8904798 0.421873994,61.1717292 L0.421873994,61.1717292 L1.54687131,62.2967265 C1.82812064,62.5779758 2.20312046,62.7186005 2.67186863,62.7186005 Z" id="?" fill="#FFFFFF" fill-rule="nonzero"></path></g>';var svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg");svgElement.setAttribute("width","34px");svgElement.setAttribute("height","63px");svgElement.setAttribute("viewBox","0 0 34 63");svgElement.setAttribute("xmlns","http://www.w3.org/2000/svg");svgElement.innerHTML=svgContent;arrowContainer.appendChild(svgElement);container.appendChild(arrowContainer);}}}}}pThis.show=function(){arrowContainer.style.opacity="0.9";arrowContainer.addEventListener("click",onClick);};pThis.hide=function(){arrowContainer.style.opacity="0.5";arrowContainer.removeEventListener("click",onClick);};pThis.enable=function(){arrowContainer.className=arrowContainer.className.replace(/\s+disabled/g,"");arrowContainer.addEventListener("click",onClick);};pThis.disable=function(){if(!(/\s+disabled/).test(arrowContainer.className)){arrowContainer.className+=" disabled";}arrowContainer.removeEventListener("click",onClick);};pThis.displayShow=function(){arrowContainer.style.visibility="visible";arrowContainer.addEventListener("click",onClick);};pThis.displayHide=function(){arrowContainer.style.visibility="hidden";arrowContainer.removeEventListener("click",onClick);};function onClick(){if(typeof(callBackClick)==="function"){callBackClick();}}draw();}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.PhotoGallery=PhotoGallery;function PhotoGallery(gadgetId,numberOfRows,numberOfColumns,marginHorizontal,resolution,sort){var pictures=getPictures();var sortBy=sort;function getPictures(){var i,pics=[],elements,container=document.querySelector('DIV[data-componentId="'+gadgetId+'"]');if(!container){return null;}elements=container.querySelectorAll("DIV[data-thumb]");for(i=0;i<elements.length;i++){pics[i]={"thumbnail":elements[i].getAttribute("data-thumb"),"origin":elements[i].getAttribute("data-src"),"date":"June.03.2019","name":elements[i].getAttribute("data-src").replace(/.*?\/([^\/]+)$/,"$1")};}return pics;}pictures.sort(function(a,b){var sortA=null,sortB=null;if(sortBy==="Date"){sortA=new Date(a.date);sortB=new Date(b.date);}else{if(sortBy==="Name"){sortA=a.name;sortB=b.name;}}if(sortA>sortB){return 1;}else{if(sortA<sortB){return -1;}else{if(sortA===sortB){return 0;}}}});if(pictures){new PhotoGalleryGadget.RenderGallery(gadgetId,pictures,numberOfRows,numberOfColumns,marginHorizontal,resolution);}}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.LightBox=LightBox;function LightBox(renderGallery,gadgetContainer,objThumbnails,focusGallery){var darkLayer,WaGadgetPhotoGalleryPhotoContainer,arrowLeft,arrowRight,indexPhoto;var currentPhoto;var containerImg,containerDivImg,containerImgNaturalHeight,containerImgNaturalWi
1620dth,containerDivImgHeight,containerDivImgWidth,widthDefaultScrollBar;var objThumbnailsLength=objThumbnails.length;var ratioContainerPlane;var fullScreenContainerQuantityPhotos;var plane,close_arrow;var pThis=this;function init(){document.getElementById("close_arrowFullScreen").addEventListener("click",closeEventDark);document.getElementById("ContainerImageFullScreen").addEventListener("mousemove",photoContainerPlane);document.getElementById("ContainerImageFullScreen").addEventListener("click",ContainerImageFullScreenPlane);document.getElementById("WaGadgetPhotoGalleryPhotoContainer").addEventListener("mousemove",WaGadgetPhotoGalleryPhotoContainerPlane);document.addEventListener("keydown",addDocumentHandlers);window.addEventListener("resize",resizeFullPhoto);}function resizeFullPhoto(){ratioContainerPlane=document.documentElement.clientWidth/document.documentElement.clientHeight;fullPhotoSizeCheck();}pThis.draw=function(e){renderGallery.onBlur();if(!e.target.getAttribute("data-indeximg")){return;}createDarkLayer();drawFullImage();indexPhoto=e.target.getAttribute("data-indeximg");arrowLeft=new PhotoGalleryGadget.FieldArrow(document.querySelector('DIV[class="containerLeftFullScreen"]'),"buttonLeft",scrollLeft);arrowRight=new PhotoGalleryGadget.FieldArrow(document.querySelector('DIV[class="containerRightFullScreen"]'),"buttonRight",scrollRight);arrowLeft.hide();arrowRight.hide();fullScreenContainerQuantityPhotos=document.getElementById("fullScreenContainerQuantityPhotos");currentPhoto=(Number(indexPhoto)+1);fullScreenContainerQuantityPhotos.innerHTML="Image "+currentPhoto+" / "+objThumbnailsLength;ratioContainerPlane=document.documentElement.clientWidth/document.documentElement.clientHeight;styleElementControls();loadImage(indexPhoto);init();};function addDocumentHandlers(event){if(event.key==="ArrowRight"||event.key==="Right"){scrollRight();}else{if(event.key==="ArrowLeft"||event.key==="Left"){scrollLeft();}else{if(event.key==="Esc"||event.key==="Escape"){closeEventDark();}else{if(event.key==="Enter"||event.key==="Tab"){event.preventDefault();event.stopPropagation();}}}}}function WaGadgetPhotoGalleryPhotoContainerPlane(event){if(event.target===(document.querySelector('DIV[class="containerRightFullScreen"]'))||event.target===(document.querySelector('DIV[class="rightFullScreen"]'))){arrowRight.show();closeArrowHide();styleElementControlsRight();}else{if(event.target===(document.querySelector('DIV[class="containerLeftFullScreen"]'))||event.target===(document.querySelector('DIV[class="leftFullScreen"]'))){arrowLeft.show();closeArrowHide();styleElementControlsLeft();}}}function photoContainerPlane(event){stylePlane();if(event.target===document.getElementById("photoGalleryImageFullScreen")){closeArrowHide();}if(event.target===(document.querySelector('DIV[class="containerRightFullScreen"]'))){arrowRight.show();closeArrowHide();styleElementControlsRight();}else{if(event.target===(document.getElementById("containerRightFullScreen"))){arrowLeft.show();closeArrowHide();styleElementControlsLeft();}}ContainerPlane(event);}function stylePlane(){if(plane===4||plane===2){closeArrowShow();arrowLeft.hide();arrowRight.hide();}else{if(plane===1){styleElementControlsLeft();closeArrowHide();arrowRight.hide();}else{if(plane===3){styleElementControlsRight();closeArrowHide();arrowLeft.hide();}}}}function ContainerImageFullScreenPlane(event){ContainerPlane(event);stylePlane();if(plane===4||plane===2){if(event.target===document.getElementById("photoGalleryImageFullScreen")){closeArrowHide();return;}closeEventDark();}else{if(plane===1){scrollLeft();}else{if(plane===3){scrollRight();}}}}function closeArrowHide(){close_arrow.setAttribute("class","close_arrowFullScreenHover");}function closeArrowShow(){close_arrow.setAttribute("class","close_arrowFullScreen");close_arrow.style.cursor="pointer";}function styleElementControlsLeft(){if(indexPhoto<=0){arrowLeft.hide();}else{arrowLeft.show();}}function styleElementControlsRight(){if(indexPhoto>=objThumbnailsLength-1){arrowRight.hide();}else{arrowRight.show();}}function styleElementControls(){if(indexPhoto<=0){arrowLeft.displayHide();}else{arrowLeft.displayShow();}if(indexPhoto>=objThumbnailsLength-1){arrowRight.displayHide();}else{arrowRight.displayShow();}}function ContainerPlane(event){var y1=event.clientX/(-ratioContainerPlane)+document.documentElement.clientHeight;var y2=event.clientX/ratioContainerPlane;if(y1>
1620event.clientY&&y2<event.clientY){plane=1;}else{if(y1<event.clientY&&y2<event.clientY){plane=2;}else{if(y1<event.clientY&&y2>event.clientY){plane=3;}else{if(y1>event.clientY&&y2>event.clientY){plane=4;}}}}}function scrollLeft(){if(indexPhoto>0){indexPhoto--;loadImage(indexPhoto);}styleElementControls();currentPhoto=(Number(indexPhoto)+1);fullScreenContainerQuantityPhotos.innerHTML="Image "+currentPhoto+" / "+objThumbnailsLength;}function scrollRight(){if(indexPhoto<objThumbnailsLength-1){indexPhoto++;loadImage(indexPhoto);}styleElementControls();currentPhoto=(Number(indexPhoto)+1);fullScreenContainerQuantityPhotos.innerHTML="Image "+currentPhoto+" / "+objThumbnailsLength;}function createDarkLayer(){widthDefaultScrollBar=window.innerWidth-document.querySelector("html").getBoundingClientRect().width;darkLayer=document.createElement("div");darkLayer.id="darkLayer";darkLayer.setAttribute("class","photoGalleryShadingWhite");setTimeout(function(){darkLayer.setAttribute("class","photoGalleryShadingDark");},100);document.body.appendChild(darkLayer);renderGallery.resizeGallery();document.body.style.paddingRight=hiddenDefaultScrollBar(getComputedStyle(document.body).paddingRight,10)+widthDefaultScrollBar+"px";document.body.style.overflow="hidden";}function hiddenDefaultScrollBar(parsedPaddingRight,base){var parsed=parseInt(parsedPaddingRight,base);if(isNaN(parsed)){return 0;}return parsed;}function drawFullImage(){WaGadgetPhotoGalleryPhotoContainer=document.createElement("div");WaGadgetPhotoGalleryPhotoContainer.id="WaGadgetPhotoGalleryPhotoContainer";WaGadgetPhotoGalleryPhotoContainer.setAttribute("class","photoGalleryPhotoContainer");WaGadgetPhotoGalleryPhotoContainer.innerHTML='<div id="fullScreenContainerQuantityPhotos" class="fullScreenContainerQuantityPhotos">quantityPhotos</div>'+'<div class="containerLeftFullScreen"></div>'+'<div id="ContainerImageFullScreen"><img id="photoGalleryImageFullScreen" src="" alt=""></div>'+'<div class="containerRightFullScreen"><div class="close_arrowFullScreen" id="close_arrowFullScreen">'+'<svg width="45px" height="45px" viewBox="0 0 45 45" xmlns="http://www.w3.org/2000/svg" >'+'<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">'+'<path d="M40.7109375,45 C41.0390618,45 41.2968757,44.9062493 41.484375,44.71875 L41.484375,44.71875 L44.71875,41.484375 C44.9062493,41.2968757 45,41.0390618 45,40.7109375 C45,40.3828132 44.9062493,40.1249993 44.71875,39.9375 L44.71875,39.9375 L27.28125,22.5 L41.765625,8.015625 L44.71875,5.0625 C44.9062493,4.87500072 45,4.61718678 45,4.2890625 C45,3.96093822 44.9062493,3.70312428 44.71875,3.515625 L44.71875,3.515625 L41.484375,0.28125 C41.2968757,0.0937507153 41.0390618,0 40.7109375,0 C40.3828132,0 40.1249993,0.0937507153 39.9375,0.28125 L39.9375,0.28125 L22.5,17.71875 L5.0625,0.28125 C4.87500072,0.0937507153 4.61718678,0 4.2890625,0 C3.96093822,0 3.70312428,0.0937507153 3.515625,0.28125 L3.515625,0.28125 L0.28125,3.515625 C0.0937507153,3.70312428 0,3.96093822 0,4.2890625 C0,4.61718678 0.0937507153,4.87500072 0.28125,5.0625 L0.28125,5.0625 L17.71875,22.5 L0.28125,39.9375 C0.0937507153,40.1249993 0,40.3828132 0,40.7109375 C0,41.0390618 0.0937507153,41.2968757 0.28125,41.484375 L0.28125,41.484375 L3.515625,44.71875 C3.70312428,44.9062493 3.96093822,45 4.2890625,45 C4.61718678,45 4.87500072,44.9062493 5.0625,44.71875 L5.0625,44.71875 L22.5,27.28125 L39.9375,44.71875 C40.1249993,44.9062493 40.3828132,45 40.7109375,45 Z" id="?" fill="#FFFFFF" fill-rule="nonzero"></path>'+"</g></svg></div></div>";document.body.appendChild(WaGadgetPhotoGalleryPhotoContainer);}function checkSizeContainer(){var sizeWidthArrow,containerLeft=document.querySelector('DIV[class="containerLeftFullScreen"]'),containerRight=document.querySelector('DIV[class="containerRightFullScreen"]');close_arrow=document.getElementById("close_arrowFullScreen");containerDivImg=document.getElementById("ContainerImageFullScreen");sizeWidthArrow=document.documentElement.clientWidth*4/100;containerDivImgHeight=document.documentElement.clientHeight*90/100;containerDivImgWidth=document.documentElement.clientWidth-sizeWidthArrow*2;if(sizeWidthArrow>76){containerLeft.style.width=76+"px";containerRight.style.width=76+"px";close_arrow.style.height=76+"px";}else{containerLeft.style.width=sizeWidthArrow+"px";containerRight.style.width=sizeWidthArrow+"px";close_arrow.style.height=sizeWidthArrow+"px";}if(containerDivImgWidth>1770||containerDivImgHeight>921){containerDivImg.style.width=1770+"px";containerDivImg.style.height=921+"px";}else{containerDivImg.style.width=containerDivImgWidth+"px";containerDivImg.style.height=containerDivImgHeight+"px";}}function loadImage(ind){containerImg=document.getElementById("photoGalleryImageFullScreen");containerImg.addEventListener("load",onLoad);containerImg.style.visibility="hidden";containerImg.setAttribute("src",objThumbnails[ind].renderFullPhoto());if(indexPhoto<=0){arrowLeft.hide();}else{if(indexPhoto>=objThumbnailsLength-1){arrowRight.hide();}}}function onLoad(){fullPhotoSizeCheck();}function fullPhotoSizeCheck(){checkSizeContainer();var ratioImgNatural;containerImgNaturalHeight=containerImg.naturalHeight;
1620containerImgNaturalWidth=containerImg.naturalWidth;if(containerImgNaturalHeight<containerDivImgHeight&&containerImgNaturalWidth<containerDivImgWidth){containerImg.style.height=containerImgNaturalHeight+"px";containerImg.style.width=containerImgNaturalWidth+"px";containerDivImg.setAttribute("class","imageFullScreen_smallSize");}else{if(containerImgNaturalHeight>=containerImgNaturalWidth){containerDivImg.setAttribute("class","imageFullScreen_vertical");ratioImgNatural=containerImgNaturalHeight/containerImgNaturalWidth;if(containerImgNaturalHeight>containerDivImgHeight){containerImgNaturalHeight=containerDivImgHeight;containerImgNaturalWidth=containerDivImgHeight/ratioImgNatural;}if(containerImgNaturalWidth>containerDivImgWidth){containerImgNaturalWidth=containerDivImgWidth;containerImgNaturalHeight=containerImgNaturalWidth*ratioImgNatural;}}else{if(containerImgNaturalHeight<containerImgNaturalWidth){containerDivImg.setAttribute("class","imageFullScreen_vertical");ratioImgNatural=containerImgNaturalWidth/containerImgNaturalHeight;if(containerImgNaturalWidth>containerDivImgWidth){containerImgNaturalWidth=containerDivImgWidth;containerImgNaturalHeight=containerDivImgWidth/ratioImgNatural;}if(containerImgNaturalHeight>containerDivImgHeight){containerImgNaturalHeight=containerDivImgHeight;containerImgNaturalWidth=containerDivImgHeight*ratioImgNatural;}}}}containerImg.style.width=containerImgNaturalWidth+"px";containerImg.style.height=containerImgNaturalHeight+"px";containerImg.style.visibility="visible";}function closeEventDark(){document.body.style.paddingRight=hiddenDefaultScrollBar(getComputedStyle(document.body).paddingRight,10)-widthDefaultScrollBar+"px";document.body.style.overflow="";renderGallery.resizeGallery();document.getElementById("close_arrowFullScreen").removeEventListener("click",closeEventDark);document.getElementById("ContainerImageFullScreen").removeEventListener("mousemove",photoContainerPlane);document.getElementById("ContainerImageFullScreen").removeEventListener("click",ContainerImageFullScreenPlane);document.getElementById("WaGadgetPhotoGalleryPhotoContainer").removeEventListener("mousemove",WaGadgetPhotoGalleryPhotoContainerPlane);document.removeEventListener("keydown",addDocumentHandlers);window.removeEventListener("resize",resizeFullPhoto);document.getElementById("WaGadgetPhotoGalleryPhotoContainer").parentNode.removeChild(document.getElementById("WaGadgetPhotoGalleryPhotoContainer"));document.getElementById("darkLayer").parentNode.removeChild(document.getElementById("darkLayer"));if(document.activeElement===focusGallery){renderGallery.onFocus();}}}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.RenderGallery=RenderGallery;function RenderGallery(gadgetId,gallery,numberOfRows,columns,size,resolution){var pThis=this;var gadgetContainer=document.getElementById("idPhotoGalleryGadget_Container_"+gadgetId),photoContainer=gadgetContainer.querySelector('DIV[class="containerPhotoInner"]'),innerContainer=gadgetContainer.querySelector('DIV[class="containerPhotoOuter"]'),photoGalleryGadgetScrollElement=gadgetContainer.querySelector('DIV[class="photoGalleryGadgetScrollElement"]');var numberOfColumns=null;var thumbnailsSizes=null;var marginHorizontal=9,marginVertical=9;var isThumbnailSizeFixed=false;var isThumbnailMarginFixed=true;var objThumbnails=[];var startTouchEventX,startTime;var quantityThumbnails,lightBox,scrollBar,focusGallery;var buttonLeft,buttonRight;var activeElementIndex=0;var i=0;numberOfRows=Number(numberOfRows);function init(){createGallery();if(focusGallery){focusGallery.addEventListener("focus",pThis.onFocus);focusGallery.addEventListener("blur",pThis.onBlur);}innerContainer.addEventListener("scroll",scrollReverse);gadgetContainer.addEventListener("touchstart",eventSwipeTouchStart);gadgetContainer.addEventListener("touchend",eventSwipeTouchEnd);window.addEventListener("resize",resizeGalleryBasic);}function eventSwipeTouchStart(e){startTouchEventX=e.changedTouches[0].screenX;startTime=new Date().getTime();}function eventSwipeTouchEnd(e){if(new Date().getTime()-startTime>100){if(e.changedTouches[0].screenX-startTouchEventX>50){scrollLeftButton();}else{if(e.changedTouches[0].screenX-startTouchEventX<-50){scrollRightButton();}}}}function scrollReverse(){showVisible();scrollBar.resizeStyleScroll();}function resizeGalleryBasic(){pThis.resizeGallery();resizeGalleryReserve();}function resizeGalleryReserve(){setTimeout(pThis.resizeGallery,100);}pThis.resizeGallery=function(){styleGallery();for(i=0;i<objThumbnails.length;i++){objThumbnails[i].resizeThumbnail(thumbnailsSizes,marginHorizontal,marginVertical);}innerContainer.style.height=(numberOfRows*thumbnailsSizes+numberOfRows*marginVertical)+"px";scrollBar.resizeStyleScrollBar(quantityThumbnails);var thumbnailsByRow=numberOfColumns;if(thumbnailsByRow==null){thumbnailsByRow=Math.floor(photoContainer.clientWidth/(thumbnailsSizes+marginHorizontal));}if(objThumbnails.length>
1620=thumbnailsByRow*numberOfRows){thumbnailsByRow=Math.ceil(objThumbnails.length/numberOfRows);}photoContainer.style.width=(thumbnailsByRow*(thumbnailsSizes+marginHorizontal))+"px";showVisible();};function styleGallery(){var widthInnerContainer=innerContainer.getBoundingClientRect().width;if(isThumbnailSizeFixed){quantityThumbnails=Math.floor(widthInnerContainer/thumbnailsSizes);if(widthInnerContainer<thumbnailsSizes){quantityThumbnails=1;}if(quantityThumbnails===1){marginHorizontal=Math.floor(widthInnerContainer%thumbnailsSizes/quantityThumbnails);}else{marginHorizontal=Math.floor(widthInnerContainer%thumbnailsSizes/(quantityThumbnails-1));}}if(isThumbnailMarginFixed){quantityThumbnails=numberOfColumns;thumbnailsSizes=Math.floor((widthInnerContainer+marginHorizontal)/quantityThumbnails)-marginHorizontal;}innerContainer.style.height=(numberOfRows*thumbnailsSizes+numberOfRows*marginVertical)+"px";}function createGallery(){var str="";focusGallery=gadgetContainer.querySelector('DIV[class="photoGalleryGadgetFocus"]');if(resolution==="NumberOfThumbnails"){numberOfColumns=Number(columns);isThumbnailSizeFixed=false;isThumbnailMarginFixed=true;}else{if(resolution==="SizeOfThumbnails"){thumbnailsSizes=Number(size);isThumbnailSizeFixed=true;isThumbnailMarginFixed=false;}}styleGallery();for(i=0;i<gallery.length;i++){objThumbnails.push(new PhotoGalleryGadget.Thumbnail(pThis,innerContainer,gallery[i],i));}for(i=0;i<objThumbnails.length;i++){str+=objThumbnails[i].render(thumbnailsSizes,marginHorizontal,marginVertical);}photoContainer.innerHTML=str;for(i=0;i<objThumbnails.length;i++){objThumbnails[i].init(photoContainer);}buttonLeft=new PhotoGalleryGadget.FieldArrow(photoGalleryGadgetScrollElement,"left",scrollLeftButton);buttonRight=new PhotoGalleryGadget.FieldArrow(photoGalleryGadgetScrollElement,"right",scrollRightButton);lightBox=new PhotoGalleryGadget.LightBox(pThis,gadgetContainer,objThumbnails,focusGallery);scrollBar=new PhotoGalleryGadget.ScrollBar(pThis,gadgetContainer,numberOfRows,quantityThumbnails,objThumbnails.length,buttonLeft,buttonRight);innerContainer.addEventListener("click",lightBox.draw);showVisible();setTimeout(pThis.resizeGallery,250);}pThis.scrollGallery=function(direction,multiplier,resolution){if(direction){innerContainer.scrollLeft+=(thumbnailsSizes+marginHorizontal)*multiplier;}else{if(!direction){innerContainer.scrollLeft-=(thumbnailsSizes+marginHorizontal)*multiplier;}}if(resolution){scrollBar.positionSlider(multiplier,direction);}};pThis.resizeScrollGallery=function(resizeScroll){innerContainer.scrollLeft=(thumbnailsSizes+marginHorizontal)*resizeScroll;};function scrollLeftButton(){pThis.scrollGallery(false,quantityThumbnails,true);}function scrollRightButton(){pThis.scrollGallery(true,quantityThumbnails,true);}function showVisible(){for(var i=0;i<objThumbnails.length;i++){objThumbnails[i].checkVisibility();}}pThis.onFocus=function(){gadgetContainer.addEventListener("keydown",addDocumentEventFocus);var activeElement=gadgetContainer.querySelector('DIV[data-indeximg="'+activeElementIndex+'"]');activeElement.style.border="3px ridge rgba(255, 255, 255, 1)";};pThis.onBlur=function(){gadgetContainer.querySelector('DIV[data-indeximg="'+(activeElementIndex)+'"]').style.border="";gadgetContainer.removeEventListener("keydown",addDocumentEventFocus);};function addDocumentEventFocus(event){if(event.key==="ArrowUp"||event.key==="Up"){if(activeElementIndex%numberOfRows!==0){setActiveThumbnail(event,activeElementIndex,(activeElementIndex-1));}}else{if(event.key==="ArrowDown"||event.key==="Down"){if(activeElementIndex%numberOfRows!==(numberOfRows-1)&&activeElementIndex<objThumbnails.length-1){setActiveThumbnail(event,activeElementIndex,(activeElementIndex+1));}}else{if((event.key==="ArrowLeft"||event.key==="Left")){if(activeElementIndex>=numberOfRows){setActiveThumbnail(event,activeElementIndex,activeElementIndex-numberOfRows,false);}}else{if((event.key==="ArrowRight"||event.key==="Right")){if(activeElementIndex<objThumbnails.length-numberOfRows){setActiveThumbnail(event,activeElementIndex,activeElementIndex+numberOfRows,true);}
1620else{setActiveThumbnail(event,activeElementIndex,objThumbnails.length-1,true);}}else{if(event.key==="Enter"){gadgetContainer.querySelector('DIV[data-indeximg="'+Number(activeElementIndex)+'"]').click();}}}}}}function setActiveThumbnail(event,currentIndex,newIndex,isRightDirection){objThumbnails[currentIndex].setViewState(false);objThumbnails[newIndex].setViewState(true,isRightDirection);activeElementIndex=newIndex;event.preventDefault();event.stopPropagation();}init();}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.ScrollBar=ScrollBar;function ScrollBar(renderGallery,gadgetContainer,rows,numberOfColumns,lengthThumbnails,buttonLeft,buttonRight){var slider=gadgetContainer.querySelector('DIV[class="photoGalleryGadgetSlider"]'),scrollBar=gadgetContainer.querySelector('DIV[class="photoGalleryGadgetScrollBar"]'),scrollElement=gadgetContainer.querySelector('DIV[class="photoGalleryGadgetScrollElement"]');var scrollBarWidth,quantityCell,lengthCell;var numberCell=0,previousCell=0;var shiftX,realPosition;var pThis=this;function init(){slider.addEventListener("mousedown",mouseDown);scrollBar.addEventListener("mousedown",scrollBarMouseDown);styleScrollBar();}pThis.resizeStyleScroll=function(){renderGallery.resizeScrollGallery(numberCell);};pThis.resizeStyleScrollBar=function(resizeColumns){styleScrollBar(resizeColumns);realPositionSlider();renderGallery.resizeScrollGallery(numberCell);};function scrollBarMouseDown(event){if(event.button===2){return;}numberCell=Math.floor((event.clientX-scrollBar.getBoundingClientRect().left)/lengthCell);realPositionSlider();quantityCellScroll(numberCell);}function quantityCellScroll(scrollCel){var rate=scrollCel-previousCell;previousCell=scrollCel;if(rate>0){renderGallery.scrollGallery(true,rate,false);}else{if(rate<0){renderGallery.scrollGallery(false,-rate,false);}}}function mouseDown(event){event.stopPropagation();if(event.button===2){return;}document.addEventListener("mousemove",onMouseMove);document.addEventListener("mouseup",onMouseUp);document.addEventListener("dragstart",dragDropStop);shiftX=event.clientX-slider.getBoundingClientRect().left;}function onMouseMove(event){var limit=scrollBarWidth-slider.getBoundingClientRect().width;realPosition=event.clientX-shiftX-scrollBar.getBoundingClientRect().left;if(realPosition>=limit){realPosition=limit;}else{if(realPosition<=0){realPosition=0;}}numberCell=Math.floor((realPosition+lengthCell/2)/lengthCell);quantityCellScroll(numberCell);slider.style.left=realPosition+"px";slider.setAttribute("class","photoGalleryGadgetSliderPress");}function styleScrollBar(columns){if(columns){numberOfColumns=columns;}if(lengthThumbnails<=rows*numberOfColumns){buttonLeft.displayHide();buttonRight.displayHide();scrollElement.style.position="absolute";scrollElement.style.left="-4000px";scrollElement.style.top="-4000px";}else{buttonLeft.displayShow();buttonRight.displayShow();scrollElement.style.position="";scrollElement.style.left="";scrollElement.style.top="";}scrollBarWidth=scrollBar.getBoundingClientRect().width;quantityCell=Math.ceil(lengthThumbnails/rows)-numberOfColumns+1;lengthCell=scrollBarWidth/quantityCell;slider.style.width=lengthCell+"px";}function realPositionSlider(){realPosition=Math.ceil(lengthCell*numberCell);slider.style.left=realPosition+"px";if(numberCell===0){if(lengthThumbnails<=rows*numberOfColumns){buttonLeft.disable();buttonRight.disable();}else{buttonLeft.disable();buttonRight.enable();}}else{if(numberCell===(quantityCell-1)){buttonRight.disable();buttonLeft.enable();}else{buttonLeft.enable();buttonRight.enable();}}if(realPosition>=scrollBar.getBoundingClientRect().width){realPosition=Math.ceil(lengthCell*(quantityCell-1));slider.style.left=realPosition+"px";}}pThis.positionSlider=function(shiftScroll,direction){if(direction){if(numberCell<quantityCell-1){shiftScroll>=quantityCell-numberCell?numberCell=quantityCell-1:numberCell=numberCell+shiftScroll;}}else{if(numberCell>0){numberCell-shiftScroll<=0?numberCell=0:numberCell=numberCell-shiftScroll;}}previousCell=numberCell;realPositionSlider();};function onMouseUp(){realPositionSlider();slider.setAttribute("class","photoGalleryGadgetSlider");document.removeEventListener("mousemove",onMouseMove);document.removeEventListener("mouseup",onMouseUp);document.removeEventListener("dragstart",dragDropStop);}function dragDropStop(e){e.stopPropagation();e.preventDefault();}init();}})();(function(){if(!window.PhotoGalleryGadget){window.PhotoGalleryGadget={};}PhotoGalleryGadget.Thumbnail=Thumbnail;function Thumbnail(renderGallery,parentContainer,item,ind){var pThis=this;var container,image,isVisible=false;
1620pThis.render=function(thumbnailsSizes,marginHorizontal,marginVertical){return'<div class="img_invisible"  style="height: '+thumbnailsSizes+"px; width: "+thumbnailsSizes+"px; margin: 0 "+marginHorizontal+"px "+marginVertical+'px 0;" data-indeximg="'+ind+'"><img src="" data-src="'+item.thumbnail+'" data-indeximg="'+ind+'" alt=""></div>';};pThis.renderFullPhoto=function(){return item.origin;};pThis.resizeThumbnail=function(resize,marginHorizontal,marginVertical){container.style.width=resize+"px";container.style.height=resize+"px";container.style.margin=0+"px "+marginHorizontal+"px "+marginVertical+"px "+0+"px";};pThis.init=function(parentContainer){container=parentContainer.querySelector('DIV[data-indeximg="'+ind+'"]');image=parentContainer.querySelector('IMG[data-indeximg="'+ind+'"]');};pThis.checkVisibility=function(){if(!isVisible&&getIsVisible(false)){isVisible=true;image.setAttribute("src",image.getAttribute("data-src"));image.setAttribute("data-src","");setClasses();}};function getIsVisible(isRightCorner){var parentContainerCoords=parentContainer.getBoundingClientRect();var coords=container.getBoundingClientRect();return(isRightCorner?coords.right:coords.left)<(parentContainerCoords.left+parentContainerCoords.width)&&(isRightCorner?coords.right:coords.left-parentContainerCoords.left)-container.scrollLeft>=0;}function setClasses(){if(image.naturalWidth&&image.naturalHeight){container.setAttribute("class",((image.naturalHeight>image.naturalWidth)?"img_vertical":"img_horizontal"));}else{setTimeout(setClasses,100);}}pThis.setViewState=function(isActive,isRightDirection){container.style.border=(isActive?"3px ridge rgba(255, 255, 255, 1)":"");if(isActive&&!getIsVisible(isRightDirection)){if(isRightDirection){renderGallery.scrollGallery(true,1,true);}else{renderGallery.scrollGallery(false,1,true);}}};}})();
1621
1622/*compiled*/
1623
1624(function()
1625{
1626  if (!window.WASiteSearchGadget)
1627  {
1628    window.WASiteSearchGadget = WASiteSearchGadget;
1629  }
1630  
1631  function WASiteSearchGadget(args)
1632  {
1633	var pThis = this;
1634    
1635	pThis.init = init;
1636	pThis.doSearch = doSearch;
1637  
1638	var model, searchBox, resultDiv, selectedTypes, timer, delay = 600,
1639	items, searchInProgress, thereWasAnotherRequest,
1640	selectedSugestion = -1; 
1641	
1642	
1643	model = args || {};
1644  
1645	function init()
1646	{
1647	    if (!document.getElementById(model.searchBoxId))
1648		{
1649		  throw new Error("couldn't find searchBoxId");
1650		}
1651		
1652		searchInProgress = false;
1653		thereWasAnotherRequest = false;
1654		
1655	    searchBox = jq$('#' + model.searchBoxId);
1656		searchBox.bind('keypress', moveToSearchPage)
1657		selectedTypes = model.selectedTypes;
1658		
1659		if (model.autoSuggest)
1660		{
1661		    resultDiv = jq$('#' + model.resultDivId);
1662
1663			searchBox.bind('input', search)
1664			searchBox.bind('keydown', handleKey)
1665		}
1666	}
1667
1668	function moveToSearchPage(e)
1669	{
1670		if (e.keyCode == 13) // enter
1671		{
1672			var url;
1673
1674			if (selectedSugestion >= 0 && selectedSugestion < items.length)
1675			{
1676				url = items[selectedSugestion].url;
1677			}
1678			else
1679			{
1680				url = WA.String.format(model.searchTemplate, 
1681					encodeURIComponent(searchBox.val()),
1682					selectedTypes, 1);
1683			}
1684			
1685			window.location = url;
1686			return false;
1687		}
1688	}
1689	function handleKey(e)
1690	{
1691		if (e.keyCode == 40)  // down
1692		{
1693			setSelectedDown();
1694			return false;
1695		}
1696		if (e.keyCode == 38)  // up
1697		{
1698			setSelectedUp();
1699			return false;
1700		}
1701	}
1702	  
1703	function search() 
1704	{
1705		if (timer)
1706		{
1707		  clearTimeout(timer);
1708		}
1709
1710		timer = setTimeout(doSearch, delay);
1711	}
1712
1713	function doSearch()
1714	{
1715        thereWasAnotherRequest = false;
1716		
1717		selectedSugestion = -1;
1718		if (searchBox.val().length == 0) 
1719		{
1720		  setEmptyResult();
1721		  return;
1722		} 
1723
1724		var filter = selectedTypes;
1725		if (filter == 0)
1726		{
1727		  setEmptyResult();
1728		  return;
1729		}
1730
1731		if (searchInProgress)
1732		{
1733			thereWasAnotherRequest = true;
1734			return;
1735		}
1736
1737		searchInProgress = true;
1738		jq$.ajax({
1739		  type: 'POST',
1740		  url: model.searchActionUrl,
1741		  data: JSON.stringify({ 'q' : searchBox.val(), 'types': filter, 'pageNumber' : 1, 'noPaging' : 0 , 'pageSize' : 10, titlesOnly: 1}),
1742		  contentType: 'application/json; charset=utf-8',
1743		  dataType: 'text'
1744		}).done(function(data)
1745		{
1746			searchInProgress = false;
1747			if (thereWasAnotherRequest) { doSearch(); }
1748			else
1749			{
1750				selectedSugestion = -1;
1751				var jsonData = JSON.parse( data.replace("while(1); ","","i").trim() );		  
1752				renderResult(jsonData);
1753		    }
1754		})
1755		.fail(function()
1756		{
1757			searchInProgress = false;
1758			if (thereWasAnotherRequest) { doSearch(); }
1759		});
1760	}
1761
1762	function setEmptyResult()
1763	{
1764		resultDiv.html('');
1765		resultDiv.hide();
1766	}
1767
1768	function renderResult(data)
1769	{
1770		resultDiv.show();
1771		items = data.entities;
1772		var a = [];
1773
1774		for (var i = 0; i < items.length; i++)
1775		{
1776		  var o = items[i];
1777		  a.push('<div id="' + getSuggestionDivId(i) + '" class="item">');
1778		  a.push('<a class="' + o.className + '" title="' + o.tooltip + '" href="' + o.url + '"><span>' + o.title + '</span></a>');
1779		  a.push('</div>');
1780		}
1781
1782		  a.push('<div id="' + getSuggestionDivId(i) + '" class="item last">');
1783		  a.push('<a href="' + WA.String.format(model.searchTemplate, encodeURIComponent(searchBox.val()), selectedTypes, 1) +
1784			'"><span>' + WA.String.format(model.GoToSearchPageTextTemplate, $('<div/>').text(searchBox.val()).html()) + '</span></a>');
1785		  a.push('</div>');
1786		resultDiv.html(a.join(''));
1787	}
1788	
1789	function getSuggestionDivId(i)
1790	{
1791		return model.gadgetId + '_' + i + 'Suggestion';
1792	}
1793	
1794	function setSelectedDown()
1795	{
1796	   if (!items || selectedSugestion >= items.length)
1797	   {
1798		return;
1799	   }
1800	   
1801		clearCurrentSuggestion();
1802		selectedSugestion++;
1803		setCurrentSuggestion();
1804	}
1805	
1806	function setSelectedUp()
1807	{
1808	   if (!items || (selectedSugestion <= 0))
1809	   {
1810		return;
1811	   }
1812	   
1813		clearCurrentSuggestion();
1814		selectedSugestion--;
1815		setCurrentSuggestion();
1816	}
1817
1818	function clearCurrentSuggestion()
1819	{
1820	   if (selectedSugestion < 0)
1821	   {
1822		return;
1823	   }
1824	   
1825	   var div  = jq$('#' + getSuggestionDivId(selectedSugestion)); 
1826	   div.removeClass('selectedSuggestions');
1827	}
1828	
1829	function setCurrentSuggestion()
1830	{
1831	   if (selectedSugestion < 0)
1832	   {
1833		return;
1834	   }
1835	   
1836	   var div  = jq$('#' +  getSuggestionDivId(selectedSugestion)); 
1837	   div.addClass('selectedSuggestions');
1838	}
1839
1840	init();
1841	}
1842}) ();
1843
1844/*compiled*/
1845// Camera slideshow v1.3.3 - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.4+
1846// Copyright (c) 2012 by Manuel Masia - www.pixedelic.com
1847// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
1848;(function($){$.fn.camera = function(opts, callback) {
1849	
1850	var defaults = {
1851		alignment			: 'center', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
1852		
1853		autoAdvance			: true,	//true, false
1854		
1855		mobileAutoAdvance	: true, //true, false. Auto-advancing for mobile devices
1856		
1857		barDirection		: 'leftToRight',	//'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop'
1858		
1859		barPosition			: 'bottom',	//'bottom', 'left', 'top', 'right'
1860		
1861		cols				: 6,
1862		
1863		easing				: 'easeInOutExpo',	//for the complete list http://jqueryui.com/demos/effect/easing.html
1864		
1865		mobileEasing		: '',	//leave empty if you want to display the same easing on mobile devices and on desktop etc.
1866		
1867		fx					: 'random',	//'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight'
1868										//you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom'
1869
1870		mobileFx			: '',	//leave empty if you want to display the same effect on mobile devices and on desktop etc.
1871
1872		gridDifference		: 250,	//to make the grid blocks slower than the slices, this value must be smaller than transPeriod
1873		
1874		height				: '50%',	//here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
1875		
1876		imagePath			: 'images/',	//he path to the image folder (it serves for the blank.gif, when you want to display videos)
1877		
1878		hover				: true,	//true, false. Puase on state hover. Not available for mobile devices
1879				
1880		loader				: 'pie',	//pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar)
1881		
1882		loaderColor			: '#eeeeee', 
1883		
1884		loaderBgColor		: '#222222', 
1885		
1886		loaderOpacity		: .8,	//0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
1887		
1888		loaderPadding		: 2,	//how many empty pixels you want to display between the loader and its background
1889		
1890		loaderStroke		: 7,	//the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter
1891				
1892		minHeight			: '200px',	//you can also leave it blank
1893		
1894		navigation			: true,	//true or false, to display or not the navigation buttons
1895		
1896		navigationHover		: true,	//if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
1897		
1898		mobileNavHover		: true,	//same as above, but only for mobile devices
1899		
1900		opacityOnGrid		: false,	//true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect 
1901		
1902		overlayer			: true,	//a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
1903		
1904		pagination			: true,
1905		
1906		playPause			: true,	//true or false, to display or not the play/pause buttons
1907		
1908		pauseOnClick		: true,	//true, false. It stops the slideshow when you click the sliders.
1909		
1910		pieDiameter			: 38,
1911		
1912		piePosition			: 'rightTop',	//'rightTop', 'leftTop', 'leftBottom', 'rightBottom'
1913		
1914		portrait			: false, //true, false. Select true if you don't want that your images are cropped
1915		
1916		rows				: 4,
1917		
1918		slicedCols			: 12,	//if 0 the same value of cols
1919		
1920		slicedRows			: 8,	//if 0 the same value of rows
1921		
1922		slideOn				: 'random',	//next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
1923		
1924		thumbnails			: false,
1925		
1926		time				: 7000,	//milliseconds between the end of the sliding effect and the start of the nex one
1927		
1928		transPeriod			: 1500,	//lenght of the sliding effect in milliseconds
1929    
1930    randomSlide : false,
1931		
1932////////callbacks
1933
1934		onEndTransition		: function() {  },	//this callback is invoked when the transition effect ends
1935
1936		onLoaded			: function() {  },	//this callback is invoked when the image on a slide has completely loaded
1937		
1938		onStartLoading		: function() {  },	//this callback is invoked when the image on a slide start loading
1939		
1940		onStartTransition	: function() {  }	//this callback is invoked when the transition effect starts
1941
1942    };
1943	
1944	
1945	function isMobile() {
1946		if( navigator.userAgent.match(/Android/i) ||
1947			navigator.userAgent.match(/webOS/i) ||
1948			navigator.userAgent.match(/iPad/i) ||
1949			navigator.userAgent.match(/iPhone/i) ||
1950			navigator.userAgent.match(/iPod/i)
1951			){
1952				return true;
1953		}
1954	}
1955
1956	var opts = $.extend({}, defaults, opts);
1957	
1958	var wrap = $(this).addClass('camera_wrap');
1959	
1960	wrap.wrapInner(
1961        '<div class="camera_src" />'
1962		).wrapInner(
1963	    '<div class="camera_fakehover" />'
1964		);
1965		
1966	var fakeHover = $('.camera_fakehover',wrap);
1967	
1968	fakeHover.append(
1969		'<div class="camera_target"></div>'
1970		);
1971	if(opts.overlayer == true){
1972		fakeHover.append(
1973			'<div class="camera_overlayer"></div>'
1974			)
1975	}
1976		fakeHover.append(
1977        '<div class="camera_target_content"></div>'
1978		);
1979		
1980	var loader;
1981	
1982	if(opts.loader=='pie' && $.browser.msie && $.browser.version < 9){
1983		loader = 'bar';
1984	} else {
1985		loader = opts.loader;
1986	}
1987	
1988	if(loader == 'pie'){
1989		fakeHover.append(
1990			'<div class="camera_pie"></div>'
1991			)
1992	} else if (loader == 'bar') {
1993		fakeHover.append(
1994			'<div class="camera_bar"></div>'
1995			)
1996	} else {
1997		fakeHover.append(
1998			'<div class="camera_bar" style="display:none"></div>'
1999			)
2000	}
2001	
2002	if(opts.playPause==true){
2003		fakeHover.append(
2004        '<div class="camera_commands"></div>'
2005		)
2006	}
2007		
2008	if(opts.navigation==true){
2009		fakeHover.append(
2010			'<div class="camera_prev"><span></span></div>'
2011			).append(
2012			'<div class="camera_next"><span></span></div>'
2013			);
2014	}
2015		
2016	if(opts.thumbnails==true){
2017		wrap.append(
2018			'<div class="camera_thumbs_cont" />'
2019			);
2020	}
2021	
2022	if(opts.thumbnails==true && opts.pagination!=true){
2023		$('.camera_thumbs_cont',wrap).wrap(
2024			'<div />'
2025			).wrap(
2026				'<div class="camera_thumbs" />'
2027			).wrap(
2028				'<div />'
2029			).wrap(
2030				'<div class="camera_command_wrap" />'
2031			);
2032	}
2033		
2034	if(opts.pagination==true){
2035		wrap.append(
2036			'<div class="camera_pag"></div>'
2037			);
2038	}
2039		
2040	wrap.append(
2041		'<div class="camera_loader"></div>'
2042		);
2043		
2044	$('.camera_caption',wrap).each(function(){
2045		$(this).wrapInner('<div />');
2046	});
2047		
2048                
2049	var pieID = 'pie_'+wrap.index('.camera_wrap'),
2050		elem = $('.camera_src',wrap),
2051		target = $('.camera_target',wrap),
2052		content = $('.camera_target_content',wrap),
2053		pieContainer = $('.camera_pie',wrap),
2054		barContainer = $('.camera_bar',wrap),
2055		prevNav = $('.camera_prev',wrap),
2056		nextNav = $('.camera_next',wrap),
2057		commands = $('.camera_commands',wrap),
2058		pagination = $('.camera_pag',wrap),
2059		thumbs = $('.camera_thumbs_cont',wrap);	
2060
2061	
2062	var w,
2063		h;
2064
2065
2066	var allImg = new Array();
2067	$('> div', elem).each( function() { 
2068		allImg.push($(this).attr('data-src'));
2069	});
2070	
2071	var allLinks = new Array();
2072	$('> div', elem).each( function() {
2073		if($(this).attr('data-link')){
2074			allLinks.push($(this).attr('data-link'));
2075		} else {
2076			allLinks.push('');
2077		}
2078	});
2079	
2080	var allTargets = new Array();
2081	$('> div', elem).each( function() {
2082		if($(this).attr('data-target')){
2083			allTargets.push($(this).attr('data-target'));
2084		} else {
2085			allTargets.push('');
2086		}
2087	});
2088	
2089  var allTitles = new Array();
2090	$('> div', elem).each( function() {
2091		if($(this).attr('data-title')){
2092			allTitles.push($(this).attr('data-title'));
2093		} else {
2094			allTitles.push('');
2095		}
2096	});
2097	
2098	var allPor = new Array();
2099	$('> div', elem).each( function() {
2100		if($(this).attr('data-portrait')){
2101			allPor.push($(this).attr('data-portrait'));
2102		} else {
2103			allPor.push('');
2104		}
2105	});
2106	
2107	var allAlign= new Array();
2108	$('> div', elem).each( function() { 
2109		if($(this).attr('data-alignment')){
2110			allAlign.push($(this).attr('data-alignment'));
2111		} else {
2112			allAlign.push('');
2113		}
2114	});
2115	
2116		
2117	var allThumbs = new Array();
2118	$('> div', elem).each( function() { 
2119		if($(this).attr('data-thumb')){
2120			allThumbs.push($(this).attr('data-thumb'));
2121		} else {
2122			allThumbs.push('');
2123		}
2124	});
2125	
2126	var amountSlide = allImg.length;
2127
2128	$(content).append('<div class="cameraContents" />');
2129	var loopMove;
2130	for (loopMove=0;loopMove<amountSlide;loopMove++)
2131	{
2132		$('.cameraContents',content).append('<div class="cameraContent" />');
2133		if(allLinks[loopMove]!=''){
2134			//only for Wordpress plugin
2135			var dataBox = $('> div ',elem).eq(loopMove).attr('data-box');
2136			if(typeof dataBox !== 'undefined' && dataBox !== false && dataBox != '') {
2137				dataBox = 'data-box="'+$('> div ',elem).eq(loopMove).attr('data-box')+'"';
2138			} else {
2139				dataBox = '';
2140			}
2141			//
2142			$('.camera_target_content .cameraContent:eq('+loopMove+')',wrap).append('<a class="camera_link" href="'+allLinks[loopMove]+'" '+dataBox+' target="'+allTargets[loopMove]+'" title="'+allTitles[loopMove]+'"></a>');
2143		}
2144
2145	}
2146	$('.camera_caption',wrap).each(function(){
2147		var ind = $(this).parent().index(),
2148			cont = wrap.find('.cameraContent').eq(ind);
2149		$(this).appendTo(cont);
2150	});
2151	
2152	target.append('<div class="cameraCont" />');
2153	var cameraCont = $('.cameraCont',wrap);
2154	
2155
2156	
2157	var loop;
2158	for (loop=0;loop<amountSlide;loop++)
2159	{
2160		cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />');
2161		var div = $('> div:eq('+loop+')',elem);
2162		target.find('.cameraSlide_'+loop).clone(div);
2163	}
2164	
2165	
2166	function thumbnailVisible() {
2167		var wTh = $(thumbs).width();
2168		$('li', thumbs).removeClass('camera_visThumb');
2169		$('li', thumbs).each(function(){
2170			var pos = $(this).position(),
2171				ulW = $('ul', thumbs).outerWidth(),
2172				offUl = $('ul', thumbs).offset().left,
2173				offDiv = $('> div',thumbs).offset().left,
2174				ulLeft = offDiv-offUl;
2175				if(ulLeft>0){
2176					$('.camera_prevThumbs',camera_thumbs_wrap).removeClass('hideNav');
2177				} else {
2178					$('.camera_prevThumbs',camera_thumbs_wrap).addClass('hideNav');
2179				}
2180				if((ulW-ulLeft)>wTh){
2181					$('.camera_nextThumbs',camera_thumbs_wrap).removeClass('hideNav');
2182				} else {
2183					$('.camera_nextThumbs',camera_thumbs_wrap).addClass('hideNav');
2184				}
2185				var left = pos.left,
2186					right = pos.left+($(this).width());
2187				if(right-ulLeft<=wTh && left-ulLeft>=0){
2188					$(this).addClass('camera_visThumb');
2189				}
2190		});
2191	}
2192
2193  function placeThumbsOnWindowResize()
2194  {
2195    thumbnailPos();
2196    thumbnailVisible();
2197  }
2198
2199  $(window).on('load resize pageshow',placeThumbsOnWindowResize);
2200
2201	cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />');
2202	
2203	
2204	var started;
2205	
2206	wrap.show();
2207	var w = target.width();
2208	var h = target.height();
2209	
2210	var setPause;
2211
2212  function onWindowResize()
2213  {
2214    if(started == true) {
2215      resizeImage();
2216    }
2217    $('ul', thumbs).animate({'margin-top':0},0,thumbnailPos);
2218    if(!elem.hasClass('paused')){
2219      elem.addClass('paused');
2220      if($('.camera_stop',camera_thumbs_wrap).length){
2221        $('.camera_stop',camera_thumbs_wrap).hide()
2222        $('.camera_play',camera_thumbs_wrap).show();
2223        if(loader!='none'){
2224          $('#'+pieID).hide();
2225        }
2226      } else {
2227        if(loader!='none'){
2228          $('#'+pieID).hide();
2229        }
2230      }
2231      clearTimeout(setPause);
2232      setPause = setTimeout(function(){
2233        elem.removeClass('paused');
2234        if($('.camera_play',camera_thumbs_wrap).length){
2235          $('.camera_play',camera_thumbs_wrap).hide();
2236          $('.camera_stop',camera_thumbs_wrap).show();
2237          if(loader!='none'){
2238            $('#'+pieID).fadeIn();
2239          }
2240        } else {
2241          if(loader!='none'){
2242            $('#'+pieID).fadeIn();
2243          }
2244        }
2245      },1500);
2246    }
2247  }
2248		
2249	$(window).on('resize pageshow', onWindowResize);
2250	
2251	function resizeImage(){	
2252		var res;
2253		function resizeImageWork(){
2254
2255      if (!wrap)
2256      {
2257        if (res) clearTimeout(res);
2258
2259        return;
2260      }
2261
2262      var prevW = w,
2263          prevH = h;
2264
2265			w = wrap.width();
2266			if(opts.height.indexOf('%')!=-1) {
2267				var startH = Math.round(w / (100/parseFloat(opts.height)));
2268				if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
2269					h = parseFloat(opts.minHeight);
2270				} else {
2271					h = startH;
2272				}
2273				wrap.css({height:h});
2274			} else if (opts.height=='auto') {
2275				h = wrap.height();
2276			} else {
2277				h = parseFloat(opts.height);
2278				wrap.css({height:h});
2279			}
2280
2281			$('.camerarelative',target).css({'width':w,'height':h});
2282
2283      if (w != prevW || h != prevH)
2284      {
2285        WA.Gadgets.notifyGadgetChanged();
2286      }
2287
2288			$('.imgLoaded',target).each(function(){
2289				var t = $(this),
2290					wT = t.attr('width'),
2291					hT = t.attr('height'),
2292					imgLoadIn = t.index(),
2293					mTop,
2294					mLeft,
2295					alignment = t.attr('data-alignment'),
2296					portrait =  t.attr('data-portrait');
2297					
2298					if(typeof alignment === 'undefined' || alignment === false || alignment === ''){
2299						alignment = opts.alignment;
2300					}
2301					
2302					if(typeof portrait === 'undefined' || portrait === false || portrait === ''){
2303						portrait = opts.portrait;
2304					}
2305										
2306					if(portrait==false||portrait=='false'){
2307						if((wT/hT)<(w/h)) {
2308							var r = w / wT;
2309							var d = (Math.abs(h - (hT*r)))*0.5;
2310							switch(alignment){
2311								case 'topLeft':
2312									mTop = 0;
2313									break;
2314								case 'topCenter':
2315									mTop = 0;
2316									break;
2317								case 'topRight':
2318									mTop = 0;
2319									break;
2320								case 'centerLeft':
2321									mTop = '-'+d+'px';
2322									break;
2323								case 'center':
2324									mTop = '-'+d+'px';
2325									break;
2326								case 'centerRight':
2327									mTop = '-'+d+'px';
2328									break;
2329								case 'bottomLeft':
2330									mTop = '-'+d*2+'px';
2331									break;
2332								case 'bottomCenter':
2333									mTop = '-'+d*2+'px';
2334									break;
2335								case 'bottomRight':
2336									mTop = '-'+d*2+'px';
2337									break;
2338							}
2339							t.css({
2340								'height' : hT*r,
2341								'margin-left' : 0,
2342								'margin-top' : mTop,
2343								'position' : 'absolute',
2344								'visibility' : 'visible',
2345								'width' : w
2346							});
2347						}
2348						else {
2349							var r = h / hT;
2350							var d = (Math.abs(w - (wT*r)))*0.5;
2351							switch(alignment){
2352								case 'topLeft':
2353									mLeft = 0;
2354									break;
2355								case 'topCenter':
2356									mLeft = '-'+d+'px';
2357									break;
2358								case 'topRight':
2359									mLeft = '-'+d*2+'px';
2360									break;
2361								case 'centerLeft':
2362									mLeft = 0;
2363									break;
2364								case 'center':
2365									mLeft = '-'+d+'px';
2366									break;
2367								case 'centerRight':
2368									mLeft = '-'+d*2+'px';
2369									break;
2370								case 'bottomLeft':
2371									mLeft = 0;
2372									break;
2373								case 'bottomCenter':
2374									mLeft = '-'+d+'px';
2375									break;
2376								case 'bottomRight':
2377									mLeft = '-'+d*2+'px';
2378									break;
2379							}
2380							t.css({
2381								'height' : h,
2382								'margin-left' : mLeft,
2383								'margin-top' : 0,
2384								'position' : 'absolute',
2385								'visibility' : 'visible',
2386								'width' : wT*r
2387							});
2388						}
2389					} else {
2390						if((wT/hT)<(w/h)) {
2391							var r = h / hT;
2392							var d = (Math.abs(w - (wT*r)))*0.5;
2393							switch(alignment){
2394								case 'topLeft':
2395									mLeft = 0;
2396									break;
2397								case 'topCenter':
2398									mLeft = d+'px';
2399									break;
2400								case 'topRight':
2401									mLeft = d*2+'px';
2402									break;
2403								case 'centerLeft':
2404									mLeft = 0;
2405									break;
2406								case 'center':
2407									mLeft = d+'px';
2408									break;
2409								case 'centerRight':
2410									mLeft = d*2+'px';
2411									break;
2412								case 'bottomLeft':
2413									mLeft = 0;
2414									break;
2415								case 'bottomCenter':
2416									mLeft = d+'px';
2417									break;
2418								case 'bottomRight':
2419									mLeft = d*2+'px';
2420									break;
2421							}
2422							t.css({
2423								'height' : h,
2424								'margin-left' : mLeft,
2425								'margin-top' : 0,
2426								'position' : 'absolute',
2427								'visibility' : 'visible',
2428								'width' : wT*r
2429							});
2430						}
2431						else {
2432							var r = w / wT;
2433							var d = (Math.abs(h - (hT*r)))*0.5;
2434							switch(alignment){
2435								case 'topLeft':
2436									mTop = 0;
2437									break;
2438								case 'topCenter':
2439									mTop = 0;
2440									break;
2441								case 'topRight':
2442									mTop = 0;
2443									break;
2444								case 'centerLeft':
2445									mTop = d+'px';
2446									break;
2447								case 'center':
2448									mTop = d+'px';
2449									break;
2450								case 'centerRight':
2451									mTop = d+'px';
2452									break;
2453								case 'bottomLeft':
2454									mTop = d*2+'px';
2455									break;
2456								case 'bottomCenter':
2457									mTop = d*2+'px';
2458									break;
2459								case 'bottomRight':
2460									mTop = d*2+'px';
2461									break;
2462							}
2463							t.css({
2464								'height' : hT*r,
2465								'margin-left' : 0,
2466								'margin-top' : mTop,
2467								'position' : 'absolute',
2468								'visibility' : 'visible',
2469								'width' : w
2470							});
2471						}
2472					}
2473			});
2474		}
2475		if (started == true) {
2476			clearTimeout(res);
2477			res = setTimeout(resizeImageWork,200);
2478		} else {
2479			resizeImageWork();
2480		}
2481		
2482		started = true;
2483	}
2484	
2485	
2486	var u,
2487		setT;
2488
2489	var clickEv,
2490		autoAdv,
2491		navHover,
2492		commands,
2493		pagination;
2494
2495	var videoHover,
2496		videoPresent;
2497		
2498	if(isMobile() && opts.mobileAutoAdvance!=''){
2499		autoAdv = opts.mobileAutoAdvance;
2500	} else {
2501		autoAdv = opts.autoAdvance;
2502	}
2503	
2504	if(autoAdv==false){
2505		elem.addClass('paused');
2506	}
2507
2508	if(isMobile() && opts.mobileNavHover!=''){
2509		navHover = opts.mobileNavHover;
2510	} else {
2511		navHover = opts.navigationHover;
2512	}
2513
2514	if(elem.length!=0){
2515			
2516		var selector = $('.cameraSlide',target);
2517		selector.wrapInner('<div class="camerarelative" />');
2518		
2519		var navSlide;
2520			
2521		var barDirection = opts.barDirection;
2522	
2523		var camera_thumbs_wrap = wrap;
2524
2525
2526		$('iframe',fakeHover).each(function(){
2527			var t = $(this);
2528			var src = t.attr('src');
2529			t.attr('data-src',src);
2530			var divInd = t.parent().index('.camera_src > div');
2531			$('.camera_target_content .cameraContent:eq('+divInd+')',wrap).append(t);
2532		});
2533		function imgFake() {
2534				$('iframe',fakeHover).each(function(){
2535					$('.camera_caption',fakeHover).show();
2536					var t = $(this);
2537					var cloneSrc = t.attr('data-src');
2538					t.attr('src',cloneSrc);
2539					var imgFakeUrl = opts.imagePath+'blank.gif';
2540					var imgFake = new Image();
2541					imgFake.src = imgFakeUrl;
2542					if(opts.height.indexOf('%')!=-1) {
2543						var startH = Math.round(w / (100/parseFloat(opts.height)));
2544						if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
2545							h = parseFloat(opts.minHeight);
2546						} else {
2547							h = startH;
2548						}
2549					} else if (opts.height=='auto') {
2550						h = wrap.height();
2551					} else {
2552						h = parseFloat(opts.height);
2553					}
2554					t.after($(imgFake).attr({'class':'imgFake','width':w,'height':h}));
2555					var clone = t.clone();
2556					t.remove();
2557					$(imgFake).on('click',function(){
2558						if($(this).css('position')=='absolute') {
2559							$(this).remove();
2560							if(cloneSrc.indexOf('vimeo') != -1 || cloneSrc.indexOf('youtube') != -1) {
2561								if(cloneSrc.indexOf('?') != -1){
2562									autoplay = '&autoplay=1';
2563								} else {
2564									autoplay = '?autoplay=1';
2565								}
2566							} else if(cloneSrc.indexOf('dailymotion') != -1) {
2567								if(cloneSrc.indexOf('?') != -1){
2568									autoplay = '&autoPlay=1';
2569								} else {
2570									autoplay = '?autoPlay=1';
2571								}
2572							}
2573							clone.attr('src',cloneSrc+autoplay);
2574							videoPresent = true;
2575						} else {
2576							$(this).css({position:'absolute',top:0,left:0,zIndex:10}).after(clone);
2577							clone.css({position:'absolute',top:0,left:0,zIndex:9});
2578						}
2579					});
2580				});
2581		}
2582		
2583		imgFake();
2584		
2585		
2586		if(opts.hover==true){
2587			if(!isMobile()){
2588				fakeHover.hover(function(){
2589					elem.addClass('hovered');
2590				},function(){
2591					elem.removeClass('hovered');
2592				});
2593			}
2594		}
2595
2596    if (navHover==true)
2597    {
2598      $(prevNav,wrap).animate({opacity:0}
2598,0);
2599      $(nextNav,wrap).animate({opacity:0},0);
2600      $(commands,wrap).animate({opacity:0},0);
2601
2602      if (isMobile())
2603      {
2604        wrap.on
2605        (
2606          'vmouseover',
2607          '.camera_fakehover',
2608          function()
2609          {
2610            $(prevNav,wrap).animate({opacity:1},200);
2611            $(nextNav,wrap).animate({opacity:1},200);
2612            $(commands,wrap).animate({opacity:1},200);
2613          }
2614        );
2615
2616        wrap.on
2617        (
2618          'vmouseout',
2619          '.camera_fakehover',
2620          function()
2621          {
2622            $(prevNav,wrap).delay(500).animate({opacity:0},200);
2623            $(nextNav,wrap).delay(500).animate({opacity:0},200);
2624            $(commands,wrap).delay(500).animate({opacity:0},200);
2625          }
2626        );
2627      }
2628      else
2629      {
2630        fakeHover.hover(function(){
2631		  $(prevNav,wrap).stop(true);
2632		  $(nextNav,wrap).stop(true);
2633		  $(commands,wrap).stop(true);
2634          $(prevNav,wrap).animate({opacity:1},200);
2635          $(nextNav,wrap).animate({opacity:1},200);
2636          $(commands,wrap).animate({opacity:1},200);
2637        },function(){
2638		  $(prevNav,wrap).stop(true);
2639		  $(nextNav,wrap).stop(true);
2640		  $(commands,wrap).stop(true);
2641          $(prevNav,wrap).animate({opacity:0}
2641,200);
2642          $(nextNav,wrap).animate({opacity:0},200);
2643          $(commands,wrap).animate({opacity:0},200);
2644        });
2645      }
2646    }
2647
2648
2649    camera_thumbs_wrap.on
2650    (
2651      'click',
2652      '.camera_stop',
2653      function()
2654      {
2655        autoAdv = false;
2656        elem.addClass('paused');
2657
2658        if ($('.camera_stop',camera_thumbs_wrap).length)
2659        {
2660          $('.camera_stop',camera_thumbs_wrap).hide();
2661          $('.camera_play',camera_thumbs_wrap).show();
2662
2663          if (loader!='none')
2664          {
2665            $('#'+pieID).hide();
2666          }
2667        }
2668        else
2669        {
2670          if (loader!='none')
2671          {
2672            $('#'+pieID).hide();
2673          }
2674        }
2675      }
2676    );
2677
2678    camera_thumbs_wrap.on
2679    (
2680      'click',
2681      '.camera_play',
2682      function()
2683      {
2684        autoAdv = true;
2685        elem.removeClass('paused');
2686
2687        if ($('.camera_play',camera_thumbs_wrap).length)
2688        {
2689          $('.camera_play',camera_thumbs_wrap).hide();
2690          $('.camera_stop',camera_thumbs_wrap).show();
2691
2692          if (loader!='none')
2693          {
2694            $('#'+pieID).show();
2695          }
2696        }
2697        else
2698        {
2699          if (loader!='none')
2700          {
2701            $('#'+pieID).show();
2702          }
2703        }
2704      }
2705    );
2706	
2707		if(opts.pauseOnClick==true){
2708			$('.camera_target_content',fakeHover).mouseup(function(){
2709				autoAdv = false;
2710				elem.addClass('paused');
2711				$('.camera_stop',camera_thumbs_wrap).hide()
2712				$('.camera_play',camera_thumbs_wrap).show();
2713				$('#'+pieID).hide();
2714			});
2715		}
2716		$('.cameraContent, .imgFake',fakeHover).hover(function(){
2717			videoHover = true;
2718		},function(){
2719			videoHover = false;
2720		});
2721		
2722		$('.cameraContent, .imgFake',fakeHover).on('click',function(){
2723			if(videoPresent == true && videoHover == true) {
2724				autoAdv = false;
2725				$('.camera_caption',fakeHover).hide();
2726				elem.addClass('paused');
2727				$('.camera_stop',camera_thumbs_wrap).hide()
2728				$('.camera_play',camera_thumbs_wrap).show();
2729				$('#'+pieID).hide();
2730			}
2731		});
2732		
2733		
2734	}
2735	
2736	
2737		function shuffle(arr) {
2738			for(
2739			  var j, x, i = arr.length; i;
2740			  j = parseInt(Math.random() * i),
2741			  x = arr[--i], arr[i] = arr[j], arr[j] = x
2742			);
2743			return arr;
2744		}
2745	
2746		function isInteger(s) {
2747			return Math.ceil(s) == Math.floor(s);
2748		}	
2749	
2750		if (loader != 'pie') {
2751			barContainer.append('<span class="camera_bar_cont" />');
2752			$('.camera_bar_cont',barContainer)
2753				.animate({opacity:opts.loaderOpacity},0)
2754				.css({'position':'absolute', 'left':0, 'right':0, 'top':0, 'bottom':0, 'background-color':opts.loaderBgColor})
2755				.append('<span id="'+pieID+'" />');
2756			$('#'+pieID).animate({opacity:0}
2756,0);
2757			var canvas = $('#'+pieID);
2758			canvas.css({'position':'absolute', 'background-color':opts.loaderColor});
2759			switch(opts.barPosition){
2760				case 'left':
2761					barContainer.css({right:'auto',width:opts.loaderStroke});
2762					break;
2763				case 'right':
2764					barContainer.css({left:'auto',width:opts.loaderStroke});
2765					break;
2766				case 'top':
2767					barContainer.css({bottom:'auto',height:opts.loaderStroke});
2768					break;
2769				case 'bottom':
2770					barContainer.css({top:'auto',height:opts.loaderStroke});
2771					break;
2772			}
2773			switch(barDirection){
2774				case 'leftToRight':
2775					canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
2776					break;
2777				case 'rightToLeft':
2778					canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
2779					break;
2780				case 'topToBottom':
2781					canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
2782					break;
2783				case 'bottomToTop':
2784					canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
2785					break;
2786			}
2787		} else {
2788			pieContainer.append('<canvas id="'+pieID+'"></canvas>');
2789			var G_vmlCanvasManager;
2790			var canvas = document.getElementById(pieID);
2791			canvas.setAttribute("width", opts.pieDiameter);
2792			canvas.setAttribute("height", opts.pieDiameter);
2793			var piePosition;
2794			switch(opts.piePosition){
2795				case 'leftTop' :
2796					piePosition = 'left:0; top:0;';
2797					break;
2798				case 'rightTop' :
2799					piePosition = 'right:0; top:0;';
2800					break;
2801				case 'leftBottom' :
2802					piePosition = 'left:0; bottom:0;';
2803					break;
2804				case 'rightBottom' :
2805					piePosition = 'right:0; bottom:0;';
2806					break;
2807			}
2808			canvas.setAttribute("style", "position:absolute; z-index:1002; "+piePosition);
2809			var rad;
2810			var radNew;
2811	
2812			if (canvas && canvas.getContext) {
2813				var ctx = canvas.getContext("2d");
2814				ctx.rotate(Math.PI*(3/2));
2815				ctx.translate(-opts.pieDiameter,0);
2816			}
2817		
2818		}
2819		if(loader=='none' || autoAdv==false) {
2820			$('#'+pieID).hide();
2821			$('.camera_canvas_wrap',camera_thumbs_wrap).hide();
2822		}
2823		
2824		if($(pagination).length) {
2825			$(pagination).append('<ul class="camera_pag_ul" />');
2826			var li;
2827			for (li = 0; li < amountSlide; li++){
2828				$('.camera_pag_ul',wrap).append('<li class="pag_nav_'+li+'" style="position:relative; z-index:1002"><span><span>'+li+'</span></span></li>');
2829			}
2830			$('.camera_pag_ul li',wrap).hover(function(){
2831				$(this).addClass('camera_hover');
2832				if($('.camera_thumb',this).length){
2833					var wTh = $('.camera_thumb',this).outerWidth(),
2834					hTh = $('.camera_thumb',this).outerHeight(),
2835					wTt = $(this).outerWidth();
2836					$('.camera_thumb',this).show().css({'top':'-'+hTh+'px','left':'-'+(wTh-wTt)/2+'px'}).animate({'opacity':1,'margin-top':'-3px'},200);
2837					$('.thumb_arrow',this).show().animate({'opacity':1,'margin-top':'-3px'},200);
2838				}
2839			},function(){
2840				$(this).removeClass('camera_hover');
2841				$('.camera_thumb',this).animate({'margin-top':'-20px','opacity':0},200,function(){
2842					$(this).css({marginTop:'5px'}).hide();
2843				});
2844				$('.thumb_arrow',this).animate({'margin-top':'-20px','opacity':0},200,function(){
2845					$(this).css({marginTop:'5px'}).hide();
2846				});
2847			});
2848		}
2849			
2850	
2851	
2852		if($(thumbs).length) {
2853			var thumbUrl;
2854			if(!$(pagination).length) {
2855				$(thumbs).append('<div />');
2856				$(thumbs).before('<div class="camera_prevThumbs hideNav"><div></div></div>').before('<div class="camera_nextThumbs hideNav"><div></div></div>');
2857				$('> div',thumbs).append('<ul />');
2858				$.each(allThumbs, function(i, val) {
2859					if($('> div', elem).eq(i).attr('data-thumb')!='') {
2860						var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
2861							newImg = new Image();
2862						newImg.src = thumbUrl;
2863						$('ul',thumbs).append('<li class="pix_thumb pix_thumb_'+i+'" />');
2864						$('li.pix_thumb_'+i,thumbs).append($(newImg).attr('class','camera_thumb'));
2865					}
2866				});
2867			} else {
2868				$.each(allThumbs, function(i, val) {
2869					if($('> div', elem).eq(i).attr('data-thumb')!='') {
2870						var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
2871							newImg = new Image();
2872						newImg.src = thumbUrl;
2873						$('li.pag_nav_'+i,pagination).append($(newImg).attr('class','camera_thumb').css({'position':'absolute'}).animate({opacity:0}
2873,0));
2874						$('li.pag_nav_'+i+' > img',pagination).after('<div class="thumb_arrow" />');
2875						$('li.pag_nav_'+i+' > .thumb_arrow',pagination).animate({opacity:0},0);
2876					}
2877				});
2878				wrap.css({marginBottom:$(pagination).outerHeight()});
2879			}
2880		} else if(!$(thumbs).length && $(pagination).length) {
2881			wrap.css({marginBottom:$(pagination).outerHeight()});
2882		}
2883
2884	
2885		var firstPos = true;
2886
2887		function thumbnailPos() {
2888			if($(thumbs).length && !$(pagination).length) {
2889				var wTh = $(thumbs).outerWidth(),
2890					owTh = $('ul > li',thumbs).outerWidth(),
2891					pos = $('li.cameracurrent', thumbs).length ? $('li.cameracurrent', thumbs).position() : '',
2892					ulW = ($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()),
2893					offUl = $('ul', thumbs).offset().left,
2894					offDiv = $('> div', thumbs).offset().left,
2895					ulLeft;
2896
2897					if(offUl<0){
2898						ulLeft = '-'+ (offDiv-offUl);
2899					} else {
2900						ulLeft = offDiv-offUl;
2901					}
2902					
2903					
2904					
2905				if(firstPos == true) {
2906					$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
2907					if($(thumbs).length && !$(pagination).lenght) {
2908						wrap.css({marginBottom:$(thumbs).outerHeight()});
2909					}
2910					thumbnailVisible();
2911					/*I repeat this two lines because of a problem with iPhones*/
2912					$('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
2913					if($(thumbs).length && !$(pagination).lenght) {
2914						wrap.css({marginBottom:$(thumbs).outerHeight()});
2915					}
2916					/*...*/
2917				}
2918				firstPos = false;
2919				
2920					var left = $('li.cameracurrent', thumbs).length ? pos.left : '',
2921						right = $('li.cameracurrent', thumbs).length ? pos.left+($('li.cameracurrent', thumbs).outerWidth()) : '';
2922					if(left<$('li.cameracurrent', thumbs).outerWidth()) {
2923						left = 0;
2924					}
2925					if(right-ulLeft>wTh){
2926						if((left+wTh)<ulW){
2927							$('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible);
2928						} else {
2929							$('ul', thumbs).animate({'margin-left':'-'+($('ul', thumbs).outerWidth()-wTh)+'px'},500,thumbnailVisible);
2930						}
2931					} else if(left-ulLeft<0) {
2932						$('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible);
2933					} else {
2934						$('ul', thumbs).css({'margin-left':'auto', 'margin-right':'auto'});
2935						setTimeout(thumbnailVisible,100);
2936					}
2937					
2938			}
2939		}
2940
2941		if($(commands).length) {
2942			$(commands).append('<div class="camera_play"></div>').append('<div class="camera_stop"></div>');
2943			if(autoAdv==true){
2944				$('.camera_play',camera_thumbs_wrap).hide();
2945				$('.camera_stop',camera_thumbs_wrap).show();
2946			} else {
2947				$('.camera_stop',camera_thumbs_wrap).hide();
2948				$('.camera_play',camera_thumbs_wrap).show();
2949			}
2950			
2951		}
2952			
2953			
2954		function canvasLoader() {
2955			rad = 0;
2956			var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
2957				barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height();
2958
2959			if (loader != 'pie') {
2960				switch(barDirection){
2961					case 'leftToRight':
2962						$('#'+pieID).css({'right':barWidth});
2963						break;
2964					case 'rightToLeft':
2965						$('#'+pieID).css({'left':barWidth});
2966						break;
2967					case 'topToBottom':
2968						$('#'+pieID).css({'bottom':barHeight});
2969						break;
2970					case 'bottomToTop':
2971						$('#'+pieID).css({'top':barHeight});
2972						break;
2973				}
2974			} else {
2975				ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter); 
2976			}
2977		}
2978		
2979		
2980		canvasLoader();
2981		
2982		
2983		$('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){
2984			$(this).css('visibility','hidden');
2985		});
2986		
2987		opts.onStartLoading.call(this);
2988		
2989	
2990	/*************************** FUNCTION nextSlide() ***************************/
2991	
2992	var isRandomSlide = opts.randomSlide,
2993      prevVis = [-1, -1, -1];
2994  
2995  function nextSlide(navSlide)
2996  { 
2997		elem.addClass('camerasliding');
2998		
2999		videoPresent = false;
3000    
3001		var vis = parseFloat($('div.cameraSlide.cameracurrent',target).index()),
3002        slideI,
3003        koRandom;
3004
3005		if(navSlide > 0)
3006    { 
3007      slideI = navSlide - 1;
3008    }
3009    else if (isRandomSlide)
3010    {
3011      do
3012      {
3013        koRandom = (new Date()).getTime() % 10 + 1;
3014        
3015        while (koRandom--)
3016        {
3017          slideI = Math.floor(Math.random() * amountSlide);
3018        }
3019      }
3020      while (slideI == null || isNaN(slideI) || slideI >= amountSlide || (amountSlide > 1 && slideI === vis) || (amountSlide > 2 && slideI === prevVis[0]) || (amountSlide > 3 && slideI === prevVis[1]) || (amountSlide > 4 && slideI === prevVis[2]))
3021    }
3022    else if (vis == amountSlide - 1)
3023    { 
3024      slideI = 0;
3025    }
3026    else
3027    {
3028      slideI = vis + 1;
3029    }
3030    
3031    prevVis.unshift(vis);
3032    prevVis.pop();
3033				
3034		var slide = $('.cameraSlide:eq('+slideI+')',target);
3035		var slideNext = $('.cameraSlide:eq('+(slideI+1)+')',target).addClass('cameranext');
3036		if( vis != slideI+1 ) {
3037			slideNext.hide();
3038		}
3039		$('.cameraContent',fakeHover).fadeOut(600);
3040		$('.camera_caption',fakeHover).show();
3041		
3042		$('.camerarelative',slide).append($('> div ',elem).eq(slideI).find('> div.camera_effected'));
3043
3044		$('.camera_target_content .cameraContent:eq('+slideI+')',wrap).append($('> div ',elem).eq(slideI).find('> div'));
3045		
3046		if(!$('.imgLoaded',slide).length){
3047			var imgUrl = allImg[slideI];
3048			var imgLoaded = new Image();
3049			imgLoaded.src = imgUrl; // +"?"+ new Date().getTime();
3050			slide.css('visibility','hidden');
3051			slide.prepend($(imgLoaded).attr('class','imgLoaded').css('visibility','hidden'));
3052			var wT, hT;
3053			if (!$(imgLoaded).get(0).complete || wT == '0' || hT == '0' || typeof wT === 'undefined' || wT === false || typeof hT === 'undefined' || hT === false) {
3054				$('.camera_loader',wrap).delay(500).fadeIn(400);
3055				imgLoaded.onload = function() {
3056					wT = imgLoaded.naturalWidth;
3057					hT = imgLoaded.naturalHeight;
3058					$(imgLoaded).attr('data-alignment',allAlign[slideI]).attr('data-portrait',allPor[slideI]);
3059					$(imgLoaded).attr('width',wT);
3060					$(imgLoaded).attr('height',hT);
3061					target.find('.cameraSlide_'+slideI).hide().css('visibility','visible');
3062					resizeImage();
3063					nextSlide(slideI+1);
3064				};
3065			}
3066		} else {
3067			if( allImg.length > (slideI+1) && !$('.imgLoaded',slideNext).length ){
3068				var imgUrl2 = allImg[(slideI+1)];
3069				var imgLoaded2 = new Image();
3070				imgLoaded2.src = imgUrl2; // +"?"+ new Date().getTime();
3071				slideNext.prepend($(imgLoaded2).attr('class','imgLoaded').css('visibility','hidden'));
3072				imgLoaded2.onload = function() {
3073					wT = imgLoaded2.naturalWidth;
3074					hT = imgLoaded2.naturalHeight;
3075					$(imgLoaded2).attr('data-alignment',allAlign[slideI+1]).attr('data-portrait',allPor[slideI+1]);
3076					$(imgLoaded2).attr('width',wT);
3077					$(imgLoaded2).attr('height',hT);
3078					resizeImage();
3079				};
3080			}
3081			opts.onLoaded.call(this);
3082			if($('.camera_loader',wrap).is(':visible')){
3083				$('.camera_loader',wrap).fadeOut(400);
3084			} else {
3085				$('.camera_loader',wrap).css({'visibility':'hidden'});
3086				$('.camera_loader',wrap).fadeOut(400,function(){
3087					$('.camera_loader',wrap).css({'visibility':'visible'});
3088				});
3089			}
3090			var rows = opts.rows,
3091				cols = opts.cols,
3092				couples = 1,
3093				difference = 0,
3094				dataSlideOn,
3095				time,
3096				transPeriod,
3097				fx,
3098				easing,
3099				randomFx = new Array('simpleFade','curtainTopLeft','curtainTopRight','curtainBottomLeft','curtainBottomRight','curtainSliceLeft','curtainSliceRight','blindCurtainTopLeft','blindCurtainTopRight','blindCurtainBottomLeft','blindCurtainBottomRight','blindCurtainSliceBottom','blindCurtainSliceTop','stampede','mosaic','mosaicReverse','mosaicRandom','mosaicSpiral','mosaicSpiralReverse','topLeftBottomRight','bottomRightTopLeft','bottomLeftTopRight','topRightBottomLeft','scrollLeft','scrollRight','scrollTop','scrollBottom','scrollHorz');
3100				marginLeft = 0,
3101				marginTop = 0,
3102				opacityOnGrid = 0;
3103				
3104				if(opts.opacityOnGrid==true){
3105					opacityOnGrid = 0;
3106				} else {
3107					opacityOnGrid = 1;
3108				}
3109 
3110			
3111			
3112			var dataFx = $(' > div',elem).eq(slideI).attr('data-fx');
3113				
3114			if(isMobile()&&opts.mobileFx!=''&&opts.mobileFx!='default'){
3115				fx = opts.mobileFx;
3116			} else {
3117				if(typeof dataFx !== 'undefined' && dataFx!== false && dataFx!== 'default'){
3118					fx = dataFx;
3119				} else {
3120					fx = opts.fx;
3121				}
3122			}
3123			
3124			if(fx=='random') {
3125				fx = shuffle(randomFx);
3126				fx = fx[0];
3127			} else {
3128				fx = fx;
3129				if(fx.indexOf(',')>0){
3130					fx = fx.replace(/ /g,'');
3131					fx = fx.split(',');
3132					fx = shuffle(fx);
3133					fx = fx[0];
3134				}
3135			}
3136			
3137			dataEasing = $(' > div',elem).eq(slideI).attr('data-easing');
3138			mobileEasing = $(' > div',elem).eq(slideI).attr('data-mobileEasing');
3139
3140			if(isMobile()&&opts.mobileEasing!=''&&opts.mobileEasing!='default'){
3141				if(typeof mobileEasing !== 'undefined' && mobileEasing!== false && mobileEasing!== 'default') {
3142					easing = mobileEasing;
3143				} else {
3144					easing = opts.mobileEasing;
3145				}
3146			} else {
3147				if(typeof dataEasing !== 'undefined' && dataEasing!== false && dataEasing!== 'default') {
3148					easing = dataEasing;
3149				} else {
3150					easing = opts.easing;
3151				}
3152			}
3153	
3154			dataSlideOn = $(' > div',elem).eq(slideI).attr('data-slideOn');
3155			if(typeof dataSlideOn !== 'undefined' && dataSlideOn!== false){
3156				slideOn = dataSlideOn;
3157			} else {
3158				if(opts.slideOn=='random'){
3159					var slideOn = new Array('next','prev');
3160					slideOn = shuffle(slideOn);
3161					slideOn = slideOn[0];
3162				} else {
3163					slideOn = opts.slideOn;
3164				}
3165			}
3166				
3167			var dataTime = $(' > div',elem).eq(slideI).attr('data-time');
3168			if(typeof dataTime !== 'undefined' && dataTime!== false && dataTime!== ''){
3169				time = parseFloat(dataTime);
3170			} else {
3171				time = opts.time;
3172			}
3173				
3174			var dataTransPeriod = $(' > div',elem).eq(slideI).attr('data-transPeriod');
3175			if(typeof dataTransPeriod !== 'undefined' && dataTransPeriod!== fal
3175se && dataTransPeriod!== ''){
3176				transPeriod = parseFloat(dataTransPeriod);
3177			} else {
3178				transPeriod = opts.transPeriod;
3179			}
3180				
3181			if(!$(elem).hasClass('camerastarted')){
3182				fx = 'simpleFade';
3183				slideOn = 'next';
3184				easing = '';
3185				transPeriod = 400;
3186				$(elem).addClass('camerastarted')
3187			}
3188	
3189			switch(fx){
3190				case 'simpleFade':
3191					cols = 1;
3192					rows = 1;
3193						break;
3194				case 'curtainTopLeft':
3195					if(opts.slicedCols == 0) {
3196						cols = opts.cols;
3197					} else {
3198						cols = opts.slicedCols;
3199					}
3200					rows = 1;
3201						break;
3202				case 'curtainTopRight':
3203					if(opts.slicedCols == 0) {
3204						cols = opts.cols;
3205					} else {
3206						cols = opts.slicedCols;
3207					}
3208					rows = 1;
3209						break;
3210				case 'curtainBottomLeft':
3211					if(opts.slicedCols == 0) {
3212						cols = opts.cols;
3213					} else {
3214						cols = opts.slicedCols;
3215					}
3216					rows = 1;
3217						break;
3218				case 'curtainBottomRight':
3219					if(opts.slicedCols == 0) {
3220						cols = opts.cols;
3221					} else {
3222						cols = opts.slicedCols;
3223					}
3224					rows = 1;
3225						break;
3226				case 'curtainSliceLeft':
3227					if(opts.slicedCols == 0) {
3228						cols = opts.cols;
3229					} else {
3230						cols = opts.slicedCols;
3231					}
3232					rows = 1;
3233						break;
3234				case 'curtainSliceRight':
3235					if(opts.slicedCols == 0) {
3236						cols = opts.cols;
3237					} else {
3238						cols = opts.slicedCols;
3239					}
3240					rows = 1;
3241						break;
3242				case 'blindCurtainTopLeft':
3243					if(opts.slicedRows == 0) {
3244						rows = opts.rows;
3245					} else {
3246						rows = opts.slicedRows;
3247					}
3248					cols = 1;
3249						break;
3250				case 'blindCurtainTopRight':
3251					if(opts.slicedRows == 0) {
3252						rows = opts.rows;
3253					} else {
3254						rows = opts.slicedRows;
3255					}
3256					cols = 1;
3257						break;
3258				case 'blindCurtainBottomLeft':
3259					if(opts.slicedRows == 0) {
3260						rows = opts.rows;
3261					} else {
3262						rows = opts.slicedRows;
3263					}
3264					cols = 1;
3265						break;
3266				case 'blindCurtainBottomRight':
3267					if(opts.slicedRows == 0) {
3268						rows = opts.rows;
3269					} else {
3270						rows = opts.slicedRows;
3271					}
3272					cols = 1;
3273						break;
3274				case 'blindCurtainSliceTop':
3275					if(opts.slicedRows == 0) {
3276						rows = opts.rows;
3277					} else {
3278						rows = opts.slicedRows;
3279					}
3280					cols = 1;
3281						break;
3282				case 'blindCurtainSliceBottom':
3283					if(opts.slicedRows == 0) {
3284						rows = opts.rows;
3285					} else {
3286						rows = opts.slicedRows;
3287					}
3288					cols = 1;
3289						break;
3290				case 'stampede':
3291					difference = '-'+transPeriod;
3292						break;
3293				case 'mosaic':
3294					difference = opts.gridDifference;
3295						break;
3296				case 'mosaicReverse':
3297					difference = opts.gridDifference;
3298						break;
3299				case 'mosaicRandom':
3300						break;
3301				case 'mosaicSpiral':
3302					difference = opts.gridDifference;
3303					couples = 1.7;
3304						break;
3305				case 'mosaicSpiralReverse':
3306					difference = opts.gridDifference;
3307					couples = 1.7;
3308						break;
3309				case 'topLeftBottomRight':
3310					difference = opts.gridDifference;
3311					couples = 6;
3312						break;
3313				case 'bottomRightTopLeft':
3314					difference = opts.gridDifference;
3315					couples = 6;
3316						break;
3317				case 'bottomLeftTopRight':
3318					difference = opts.gridDifference;
3319					couples = 6;
3320						break;
3321				case 'topRightBottomLeft':
3322					difference = opts.gridDifference;
3323					couples = 6;
3324						break;
3325				case 'scrollLeft':
3326					cols = 1;
3327					rows = 1;
3328						break;
3329				case 'scrollRight':
3330					cols = 1;
3331					rows = 1;
3332						break;
3333				case 'scrollTop':
3334					cols = 1;
3335					rows = 1;
3336						break;
3337				case 'scrollBottom':
3338					cols = 1;
3339					rows = 1;
3340						break;
3341				case 'scrollHorz':
3342					cols = 1;
3343					rows = 1;
3344						break;
3345			}
3346			
3347			var cycle = 0;
3348			var blocks = rows*cols;
3349			var leftScrap = w-(Math.floor(w/cols)*cols);
3350			var topScrap = h-(Math.floor(h/rows)*rows);
3351			var addLeft;
3352			var addTop;
3353			var tAppW = 0;	
3354			var tAppH = 0;
3355			var arr = new Array();
3356			var delay = new Array();
3357			var order = new Array();
3358			while(cycle < blocks){
3359				arr.push(cycle);
3360				delay.push(cycle);
3361				cameraCont.append('<div class="cameraappended" style="display:none; overflow:hidden; position:absolute; z-index:1000" />');
3362				var tApp = $('.cameraappended:eq('+cycle+')',target);
3363				if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){
3364					selector.eq(slideI).clone().show().appendTo(tApp);
3365				} else {
3366					if(slideOn=='next'){
3367						selector.eq(slideI).clone().show().appendTo(tApp);
3368					} else {
3369						selector.eq(vis).clone().show().appendTo(tApp);
3370					}
3371				}
3372
3373				if(cycle%cols<leftScrap){
3374					addLeft = 1;
3375				} else {
3376					addLeft = 0;
3377				}
3378				if(cycle%cols==0){
3379					tAppW = 0;
3380				}
3381				if(Math.floor(cycle/cols)<topScrap){
3382					addTop = 1;
3383				} else {
3384					addTop = 0;
3385				}
3386				tApp.css({
3387					'height': Math.floor((h/rows)+addTop+1),
3388					'left': tAppW,
3389					'top': tAppH,
3390					'width': Math.floor((w/cols)+addLeft+1)
3391				});
3392				$('> .cameraSlide', tApp).css({
3393					'height': h,
3394					'margin-left': '-'+tAppW+'px',
3395					'margin-top': '-'+tAppH+'px',
3396					'width': w
3397				});
3398				tAppW = tAppW+tApp.width()-1;
3399				if(cycle%cols==cols-1){
3400					tAppH = tAppH + tApp.height() - 1;
3401				}
3402				cycle++;
3403			}
3404			
3405
3406			
3407			switch(fx){
3408				case 'curtainTopLeft':
3409						break;
3410				case 'curtainBottomLeft':
3411						break;
3412				case 'curtainSliceLeft':
3413						break;
3414				case 'curtainTopRight':
3415					arr = arr.reverse();
3416						break;
3417				case 'curtainBottomRight':
3418					arr = arr.reverse();
3419						break;
3420				case 'curtainSliceRight':
3421					arr = arr.reverse();
3422						break;
3423				case 'blindCurtainTopLeft':
3424						break;
3425				case 'blindCurtainBottomLeft':
3426					arr = arr.reverse();
3427						break;
3428				case 'blindCurtainSliceTop':
3429						break;
3430				case 'blindCurtainTopRight':
3431						break;
3432				case 'blindCurtainBottomRight':
3433					arr = arr.reverse();
3434						break;
3435				case 'blindCurtainSliceBottom':
3436					arr = arr.reverse();
3437						break;
3438				case 'stampede':
3439					arr = shuffle(arr);
3440						break;
3441				case 'mosaic':
3442						break;
3443				case 'mosaicReverse':
3444					arr = arr.reverse();
3445						break;
3446				case 'mosaicRandom':
3447					arr = shuffle(arr);
3448						break;
3449				case 'mosaicSpiral':
3450					var rows2 = rows/2, x, y, z, n=0;
3451						for (z = 0; z < rows2; z++){
3452							y = z;
3453							for (x = z; x < cols - z - 1; x++) {
3454								order[n++] = y * cols + x;
3455							}
3456							x = cols - z - 1;
3457							for (y = z; y < rows - z - 1; y++) {
3458								order[n++] = y * cols + x;
3459							}
3460							y = rows - z - 1;
3461							for (x = cols - z - 1; x > z; x--) {
3462								order[n++] = y * cols + x;
3463							}
3464							x = z;
3465							for (y = rows - z - 1; y > z; y--) {
3466								order[n++] = y * cols + x;
3467							}
3468						}
3469						
3470						arr = order;
3471
3472						break;
3473				case 'mosaicSpiralReverse':
3474					var rows2 = rows/2, x, y, z, n=blocks-1;
3475						for (z = 0; z < rows2; z++){
3476							y = z;
3477							for (x = z; x < cols - z - 1; x++) {
3478								order[n--] = y * cols + x;
3479							}
3480							x = cols - z - 1;
3481							for (y = z; y < rows - z - 1; y++) {
3482								order[n--] = y * cols + x;
3483							}
3484							y = rows - z - 1;
3485							for (x = cols - z - 1; x > z; x--) {
3486								order[n--] = y * cols + x;
3487							}
3488							x = z;
3489							for (y = rows - z - 1; y > z; y--) {
3490								order[n--] = y * cols + x;
3491							}
3492						}
3493
3494						arr = order;
3495						
3496						break;
3497				case 'topLeftBottomRight':
3498					for (var y = 0; y < rows; y++)
3499					for (var x = 0; x < cols; x++) {
3500						order.push(x + y);
3501					}
3502						delay = order;
3503						break;
3504				case 'bottomRightTopLeft':
3505					for (var y = 0; y < rows; y++)
3506					for (var x = 0; x < cols; x++) {
3507						order.push(x + y);
3508					}
3509						delay = order.reverse();
3510						break;
3511				case 'bottomLeftTopRight':
3512					for (var y = rows; y > 0; y--)
3513					for (var x = 0; x < cols; x++) {
3514						order.push(x + y);
3515					}
3516						delay = order;
3517						break;
3518				case 'topRightBottomLeft':
3519					for (var y = 0; y < rows; y++)
3520					for (var x = cols; x > 0; x--) {
3521						order.push(x + y);
3522					}
3523						delay = order;
3524						break;
3525			}
3526			
3527			
3528						
3529			$.each(arr, function(index, value) {
3530
3531				if(value%cols<leftScrap){
3532					addLeft = 1;
3533				} else {
3534					addLeft = 0;
3535				}
3536				if(value%cols==0){
3537					tAppW = 0;
3538				}
3539				if(Math.floor(value/cols)<topScrap){
3540					addTop = 1;
3541				} else {
3542					addTop = 0;
3543				}
3544							
3545				switch(fx){
3546					case 'simpleFade':
3547						height = h;
3548						width = w;
3549						opacityOnGrid = 0;
3550							break;
3551					case 'curtainTopLeft':
3552						height = 0,
3553						width = Math.floor((w/cols)+addLeft+1),
3554						marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';
3555							break;
3556					case 'curtainTopRight':
3557						height = 0,
3558						width = Math.floor((w/cols)+addLeft+1),
3559						marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';
3560							break;
3561					case 'curtainBottomLeft':
3562						height = 0,
3563						width = Math.floor((w/cols)+addLeft+1),
3564						marginTop = Math.floor((h/rows)+addTop+1)+'px';
3565							break;
3566					case 'curtainBottomRight':
3567						height = 0,
3568						width = Math.floor((w/cols)+addLeft+1),
3569						marginTop = Math.floor((h/rows)+addTop+1)+'px';
3570							break;
3571					case 'curtainSliceLeft':
3572						height = 0,
3573						width = Math.floor((w/cols)+addLeft+1);
3574						if(value%2==0){
3575							marginTop = Math.floor((h/rows)+addTop+1)+'px';					
3576						} else {
3577							marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';					
3578						}
3579							break;
3580					case 'curtainSliceRight':
3581						height = 0,
3582						width = Math.floor((w/cols)+addLeft+1);
3583						if(value%2==0){
3584							marginTop = Math.floor((h/rows)+addTop+1)+'px';					
3585						} else {
3586							marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px';					
3587						}
3588							break;
3589					case 'blindCurtainTopLeft':
3590						height = Math.floor((h/rows)+addTop+1),
3591						width = 0,
3592						marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
3593							break;
3594					case 'blindCurtainTopRight':
3595						height = Math.floor((h/rows)+addTop+1),
3596						width = 0,
3597						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
3598							break;
3599					case 'blindCurtainBottomLeft':
3600						height = Math.floor((h/rows)+addTop+1),
3601						width = 0,
3602						marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
3603							break;
3604					case 'blindCurtainBottomRight':
3605						height = Math.floor((h/rows)+addTop+1),
3606						width = 0,
3607						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
3608							break;
3609					case 'blindCurtainSliceBottom':
3610						height = Math.floor((h/rows)+addTop+1),
3611						width = 0;
3612						if(value%2==0){
3613							marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
3614						} else {
3615							marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
3616						}
3617							break;
3618					case 'blindCurtainSliceTop':
3619						height = Math.floor((h/rows)+addTop+1),
3620						width = 0;
3621						if(value%2==0){
3622							marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px';
3623						} else {
3624							marginLeft = Math.floor((w/cols)+addLeft+1)+'px';
3625						}
3626							break;
3627					case 'stampede':
3628						height = 0;
3629						width = 0;					
3630						marginLeft = (w*0.2)*(((index)%cols)-(cols-(Math.floor(cols/2))))+'px';					
3631						marginTop = (h*0.2)*((Math.floor(index/cols)+1)-(rows-(Math.floor(rows/2))))+'px';	
3632							break;
3633					case 'mosaic':
3634						height = 0;
3635						width = 0;					
3636							break;
3637					case 'mosaicReverse':
3638						height = 0;
3639						width = 0;					
3640						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
3641						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
3642							break;
3643					case 'mosaicRandom':
3644						height = 0;
3645						width = 0;					
3646						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
3647						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
3648							break;
3649					case 'mosaicSpiral':
3650						height = 0;
3651						width = 0;
3652						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
3653						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
3654							break;
3655					case 'mosaicSpiralReverse':
3656						height = 0;
3657						width = 0;
3658						marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px';					
3659						marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px';					
3660							break;
3661					case 'topLeftBottomRight':
3662						height = 0;
3663						width = 0;					
3664							break;
3665					case 'bottomRightTopLeft':
3666						height = 0;
3667						width = 0;					
3668						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
3669						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
3670							break;
3671					case 'bottomLeftTopRight':
3672						height = 0;
3673						width = 0;					
3674						marginLeft = 0;					
3675						marginTop = Math.floor((h/rows)+addTop+1)+'px';					
3676							break;
3677					case 'topRightBottomLeft':
3678						height = 0;
3679						width = 0;					
3680						marginLeft = Math.floor((w/cols)+addLeft+1)+'px';					
3681						marginTop = 0;					
3682							break;
3683					case 'scrollRight':
3684						height = h;
3685						width = w;
3686						marginLeft = -w;					
3687							break;
3688					case 'scrollLeft':
3689						height = h;
3690						width = w;
3691						marginLeft = w;					
3692							break;
3693					case 'scrollTop':
3694						height = h;
3695						width = w;
3696						marginTop = h;					
3697							break;
3698					case 'scrollBottom':
3699						height = h;
3700						width = w;
3701						marginTop = -h;					
3702							break;
3703					case 'scrollHorz':
3704						height = h;
3705						width = w;
3706						if(vis==0 && slideI==amountSlide-1) {
3707							marginLeft = -w;	
3708						} else if(vis<slideI  || (vis==amountSlide-1 && slideI==0)) {
3709							marginLeft = w;	
3710						} else {
3711							marginLeft = -w;	
3712						}
3713							break;
3714					}
3715					
3716			
3717				var tApp = $('.cameraappended:eq('+value+')',target);
3718								
3719				if(typeof u !== 'undefined'){
3720					clearInterval(u);
3721					clearTimeout(setT);
3722					setT = setTimeout(canvasLoader,transPeriod+difference);
3723				}
3724				
3725				
3726				if($(pagination).length){
3727					$('.camera_pag li',wrap).removeClass('cameracurrent');
3728					$('.camera_pag li',wrap).eq(slideI).addClass('cameracurrent');
3729				}
3730						
3731				if($(thumbs).length){
3732					$('li', thumbs).removeClass('cameracurrent');
3733					$('li', thumbs).eq(slideI).addClass('cameracurrent');
3734					$('li', thumbs).not('.cameracurrent').find('img').animate({opacity:.5},0);
3735					$('li.cameracurrent img', thumbs).animate({opacity:1},0);
3736					$('li', thumbs).hover(function(){
3737						$('img',this).stop(true,false).animate({opacity:1},150);
3738					},function(){
3739						if(!$(this).hasClass('cameracurrent')){
3740							$('img',this).stop(true,false).animate({opacity:.5},150);
3741						}
3742					});
3743				}
3744								
3745						
3746				var easedTime = parseFloat(transPeriod)+parseFloat(difference);
3747				
3748				function cameraeased() {
3749
3750					$(this).addClass('cameraeased');
3751					if($('.cameraeased',target).length>=0){
3752						$(thumbs).css({visibility:'visible'});
3753					}
3754					if($('.cameraeased',target).length==blocks){
3755						
3756						thumbnailPos();
3757						
3758						$('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){
3759							$(this).css('visibility','hidden');
3760						});
3761		
3762						selector.eq(slideI).show().css('z-index','999').removeClass('cameranext').addClass('cameracurrent');
3763						selector.eq(vis).css('z-index','1').removeClass('cameracurrent');
3764						$('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent');
3765						if (vis >= 0) {
3766							$('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent');
3767						}
3768						
3769						opts.onEndTransition.call(this);
3770						
3771						if($('> div', elem).eq(slideI).attr('data-video')!='hide' && $('.cameraContent.cameracurrent .imgFake',fakeHover).length ){
3772							$('.cameraContent.cameracurrent .imgFake',fakeHover).click();
3773						}
3774
3775						
3776						var lMoveIn = selector.eq(slideI).find('.fadeIn').length;
3777						var lMoveInContent = $('.cameraContent',fakeHover).eq(slideI).find('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom').length;
3778						
3779						if (lMoveIn!=0){
3780							$('.cameraSlide.cameracurrent .fadeIn',fakeHover).each(function(){
3781								if($(this).attr('data-easing')!=''){
3782									var easeMove = $(this).attr('data-easing');
3783								} else {
3784									var easeMove = easing;
3785								}
3786								var t = $(this);
3787								if(typeof t.attr('data-outerWidth') === 'undefined' || t.attr('data-outerWidth') === false || t.attr('data-outerWidth') === '') {
3788									var wMoveIn = t.outerWidth();
3789									t.attr('data-outerWidth',wMoveIn);
3790								} else {
3791									var wMoveIn = t.attr('data-outerWidth');
3792								}
3793								if(typeof t.attr('data-outerHeight') === 'undefined' || t.attr('data-outerHeight') === false || t.attr('data-outerHeight') === '') {
3794									var hMoveIn = t.outerHeight();
3795									t.attr('data-outerHeight',hMoveIn);
3796								} else {
3797									var hMoveIn = t.attr('data-outerHeight');
3798								}
3799								//t.css('width',wMoveIn);
3800								var pos = t.position();
3801								var left = pos.left;
3802								var top = pos.top;
3803								var tClass = t.attr('class');
3804								var ind = t.index();
3805								var hRel = t.parents('.camerarelative').outerHeight();
3806								var wRel = t.parents('.camerarelative').outerWidth();
3807								if(tClass.indexOf("fadeIn") != -1) {
3808									t.animate({opacity:0}
3808,0).css('visibility','visible').delay((time/lMoveIn)*(0.1*(ind-1))).animate({opacity:1},(time/lMoveIn)*0.15,easeMove);
3809								} else {
3810									t.css('visibility','visible');
3811								}
3812							});
3813						}
3814
3815						$('.cameraContent.cameracurrent',fakeHover).show();
3816						if (lMoveInContent!=0){
3817							
3818							$('.cameraContent.cameracurrent .moveFromLeft, .cameraContent.cameracurrent .moveFromRight, .cameraContent.cameracurrent .moveFromTop, .cameraContent.cameracurrent .moveFromBottom, .cameraContent.cameracurrent .fadeIn, .cameraContent.cameracurrent .fadeFromLeft, .cameraContent.cameracurrent .fadeFromRight, .cameraContent.cameracurrent .fadeFromTop, .cameraContent.cameracurrent .fadeFromBottom',fakeHover).each(function(){
3819								if($(this).attr('data-easing')!=''){
3820									var easeMove = $(this).attr('data-easing');
3821								} else {
3822									var easeMove = easing;
3823								}
3824								var t = $(this);
3825								var pos = t.position();
3826								var left = pos.left;
3827								var top = pos.top;
3828								var tClass = t.attr('class');
3829								var ind = t.index();
3830								var thisH = t.outerHeight();
3831								if(tClass.indexOf("moveFromLeft") != -1) {
3832									t.css({'left':'-'+(w)+'px','right':'auto'});
3833									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lMoveInContent)*0.15,easeMove);
3834								} else if(tClass.indexOf("moveFromRight") != -1) {
3835									t.css({'left':w+'px','right':'auto'});
3836									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},(time/lMoveInContent)*0.15,easeMove);
3837								} else if(tClass.indexOf("moveFromTop") != -1) {
3838									t.css({'top':'-'+h+'px','bottom':'auto'});
3839									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lMoveInContent)*0.15,easeMove,function(){
3840										t.css({top:'auto',bottom:0});
3841									});
3842								} else if(tClass.indexOf("moveFromBottom") != -1) {
3843									t.css({'top':h+'px','bottom':'auto'});
3844									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top},(time/lMoveInContent)*0.15,easeMove);
3845								} else if(tClass.indexOf("fadeFromLeft") != -1) {
3846									t.animate({opacity:0}
3846,0).css({'left':'-'+(w)+'px','right':'auto'});
3847									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lMoveInContent)*0.15,easeMove);
3848								} else if(tClass.indexOf("fadeFromRight") != -1) {
3849									t.animate({opacity:0},0).css({'left':(w)+'px','right':'auto'});
3850									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},(time/lMoveInContent)*0.15,easeMove);
3851								} else if(tClass.indexOf("fadeFromTop") != -1) {
3852									t.animate({opacity:0},0).css({'top':'-'+(h)+'px','bottom':'auto'});
3853									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top,opacity:1},(time/lMoveInContent)*0.15,easeMove,function(){
3854										t.css({top:'auto',bottom:0});
3855									});
3856								} else if(tClass.indexOf("fadeFromBottom") != -1) {
3857									t.animate({opacity:0},0).css({'bottom':'-'+thisH+'px'});
3858									t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'bottom':'0',opacity:1},(time/lMoveInContent)*0.15,easeMove);
3859								} else if(tClass.indexOf("fadeIn") != -1) {
3860									t.animate({opacity:0}
3860,0).css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({opacity:1},(time/lMoveInContent)*0.15,easeMove);
3861								} else {
3862									t.css('visibility','visible');
3863								}
3864							});
3865						}
3866
3867						
3868						$('.cameraappended',target).remove();
3869						elem.removeClass('camerasliding');	
3870							selector.eq(vis).hide();
3871							var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(),
3872								barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height(),
3873								radSum;
3874							if (loader != 'pie') {
3875								radSum = 0.05;
3876							} else {
3877								radSum = 0.005;
3878							}
3879							$('#'+pieID).animate({opacity:opts.loaderOpacity},200);
3880							u = setInterval(
3881								function(){
3882									if(elem.hasClass('stopped')){
3883										clearInterval(u);
3884									}
3885									
3886									if(rad <= 1 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')){
3887										rad = +(rad+radSum).toFixed(5);
3888									}
3889									if(rad > 1) {
3890										if(!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
3891											clearInterval(u);
3892											imgFake();
3893
3894
3895											$('#'+pieID).animate({opacity:0}
3895,200,function(){
3896												clearTimeout(setT);
3897												//setT = setTimeout(canvasLoader, easedTime);
3898                                                canvasLoader();
3899												nextSlide();
3900												opts.onStartLoading.call(this);
3901											});
3902
3903										}
3904									}
3905
3906                                    progressBarUpdater(radSum, time, barWidth, barHeight);
3907
3908								},time*radSum
3909							);
3910						}
3911
3912				}
3913
3914
3915				
3916				if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){
3917					opts.onStartTransition.call(this);
3918					easedTime = 0;
3919					tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
3920							'display' : 'block',
3921							'height': height,
3922							'margin-left': marginLeft,
3923							'margin-top': marginTop,
3924							'width': width
3925						}).animate({
3926							'height': Math.floor((h/rows)+addTop+1),
3927							'margin-top' : 0,
3928							'margin-left' : 0,
3929							'width' : Math.floor((w/cols)+addLeft+1)
3930						},(transPeriod-difference),easing,cameraeased);
3931					selector.eq(vis).delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).animate({
3932							'margin-left': marginLeft*(-1),
3933							'margin-top': marginTop*(-1)
3934						},(transPeriod-difference),easing,function(){
3935							$(this).css({'margin-top' : 0,'margin-left' : 0});
3936						});
3937				} else {
3938					opts.onStartTransition.call(this);
3939					easedTime = parseFloat(transPeriod)+parseFloat(difference);
3940					if(slideOn=='next'){
3941						tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
3942								'display' : 'block',
3943								'height': height,
3944								'margin-left': marginLeft,
3945								'margin-top': marginTop,
3946								'width': width,
3947								'opacity' : opacityOnGrid
3948							}).animate({
3949								'height': Math.floor((h/rows)+addTop+1),
3950								'margin-top' : 0,
3951								'margin-left' : 0,
3952								'opacity' : 1,
3953								'width' : Math.floor((w/cols)+addLeft+1)
3954							},(transPeriod-difference),easing,cameraeased);
3955					} else {
3956						selector.eq(slideI).show().css('z-index','999').addClass('cameracurrent');
3957						selector.eq(vis).css('z-index','1').removeClass('cameracurrent');
3958						$('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent');
3959						$('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent');
3960						tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({
3961								'display' : 'block',
3962								'height': Math.floor((h/rows)+addTop+1),
3963								'margin-top' : 0,
3964								'margin-left' : 0,
3965								'opacity' : 1,
3966								'width' : Math.floor((w/cols)+addLeft+1)
3967							}).animate({
3968								'height': height,
3969								'margin-left': marginLeft,
3970								'margin-top': marginTop,
3971								'width': width,
3972								'opacity' : opacityOnGrid
3973							},(transPeriod-difference),easing,cameraeased);
3974					}
3975				}
3976			});
3977		}
3978	}
3979  
3980  nextSlide();
3981
3982
3983				if($(prevNav).length){
3984					$(prevNav).click(function(){
3985						if(!elem.hasClass('camerasliding')){
3986							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
3987							clearInterval(u);
3988							imgFake();
3989							$('#'+pieID+', .camera_canvas_wrap',wrap).animate({opacity:0}
3989,0);
3990							canvasLoader();
3991							if(idNum!=0){
3992								nextSlide(idNum);
3993							} else {
3994								nextSlide(amountSlide);
3995						   }
3996						   opts.onStartLoading.call(this);
3997						}
3998					});
3999				}
4000			
4001				if($(nextNav).length){
4002					$(nextNav).click(function(){
4003						if(!elem.hasClass('camerasliding')){
4004							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 
4005							clearInterval(u);
4006							imgFake();
4007							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
4008							canvasLoader();
4009							if(idNum==amountSlide-1){
4010								nextSlide(1);
4011							} else {
4012								nextSlide(idNum+2);
4013						   }
4014						   opts.onStartLoading.call(this);
4015						}
4016					});
4017				}
4018
4019
4020				if(isMobile()){
4021					fakeHover.on('swipeleft',function(event){
4022						if(!elem.hasClass('camerasliding')){
4023							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 
4024							clearInterval(u);
4025							imgFake();
4026							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
4027							canvasLoader();
4028							if(idNum==amountSlide-1){
4029								nextSlide(1);
4030							} else {
4031								nextSlide(idNum+2);
4032						   }
4033						   opts.onStartLoading.call(this);
4034						}
4035					});
4036					fakeHover.on('swiperight',function(event){
4037						if(!elem.hasClass('camerasliding')){
4038							var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
4039							clearInterval(u);
4040							imgFake();
4041							$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
4041,0);
4042							canvasLoader();
4043							if(idNum!=0){
4044								nextSlide(idNum);
4045							} else {
4046								nextSlide(amountSlide);
4047						   }
4048						   opts.onStartLoading.call(this);
4049						}
4050					});
4051				}
4052
4053				if($(pagination).length){
4054					$('.camera_pag li',wrap).click(function(){
4055						if(!elem.hasClass('camerasliding')){
4056							var idNum = parseFloat($(this).index());
4057							var curNum = parseFloat($('.cameraSlide.cameracurrent',target).index());
4058							if(idNum!=curNum) {
4059								clearInterval(u);
4060								imgFake();
4061								$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0);
4062								canvasLoader();
4063								nextSlide(idNum+1);
4064								opts.onStartLoading.call(this);
4065							}
4066						}
4067					});
4068				}
4069
4070				if($(thumbs).length) {
4071
4072					$('.pix_thumb img',thumbs).click(function(){
4073						if(!elem.hasClass('camerasliding')){
4074							var idNum = parseFloat($(this).parents('li').index());
4075							var curNum = parseFloat($('.cameracurrent',target).index());
4076							if(idNum!=curNum) {
4077								clearInterval(u);
4078								imgFake();
4079								$('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
4079,0);
4080								$('.pix_thumb',thumbs).removeClass('cameracurrent');
4081								$(this).parents('li').addClass('cameracurrent');
4082								canvasLoader();
4083								nextSlide(idNum+1);
4084								thumbnailPos();
4085								opts.onStartLoading.call(this);
4086							}
4087						}
4088					});
4089
4090					$('.camera_thumbs_cont .camera_prevThumbs',camera_thumbs_wrap).hover(function(){
4091						$(this).stop(true,false).animate({opacity:1},250);
4092					},function(){
4093						$(this).stop(true,false).animate({opacity:.7},250);
4094					});
4095					$('.camera_prevThumbs',camera_thumbs_wrap).click(function(){
4096						var sum = 0,
4097							wTh = $(thumbs).outerWidth(),
4098							offUl = $('ul', thumbs).offset().left,
4099							offDiv = $('> div', thumbs).offset().left,
4100							ulLeft = offDiv-offUl;
4101							$('.camera_visThumb',thumbs).each(function(){
4102								var tW = $(this).outerWidth();
4103								sum = sum+tW;
4104							});
4105							if(ulLeft-sum>0){
4106								$('ul', thumbs).animate({'margin-left':'-'+(ulLeft-sum)+'px'},500,thumbnailVisible);
4107							} else {
4108								$('ul', thumbs).animate({'margin-left':0},500,thumbnailVisible);
4109							}
4110					});
4111
4112					$('.camera_thumbs_cont .camera_nextThumbs',camera_thumbs_wrap).hover(function(){
4113						$(this).stop(true,false).animate({opacity:1},250);
4114					},function(){
4115						$(this).stop(true,false).animate({opacity:.7},250);
4116					});
4117					$('.camera_nextThumbs',camera_thumbs_wrap).click(function(){
4118						var sum = 0,
4119							wTh = $(thumbs).outerWidth(),
4120							ulW = $('ul', thumbs).outerWidth(),
4121							offUl = $('ul', thumbs).offset().left,
4122							offDiv = $('> div', thumbs).offset().left,
4123							ulLeft = offDiv-offUl;
4124							$('.camera_visThumb',thumbs).each(function(){
4125								var tW = $(this).outerWidth();
4126								sum = sum+tW;
4127							});
4128							if(ulLeft+sum+sum<ulW){
4129								$('ul', thumbs).animate({'margin-left':'-'+(ulLeft+sum)+'px'},500,thumbnailVisible);
4130							} else {
4131								$('ul', thumbs).animate({'margin-left':'-'+(ulW-wTh)+'px'},500,thumbnailVisible);
4132							}
4133					});
4134
4135				}
4136
4137	function progressBarUpdater(radSum, time, barWidth, barHeight)
4138	{
4139        if (loader != 'pie') {
4140
4141        	var cssStyle;
4142
4143            switch(barDirection){
4144                case 'leftToRight':
4145                    cssStyle = {'right':barWidth-(barWidth*rad)}; break;
4146                case 'rightToLeft':
4147                    cssStyle = {'left':barWidth-(barWidth*rad)}; break;
4148                case 'topToBottom':
4149                    cssStyle = {'bottom':barHeight-(barHeight*rad)}; break;
4150                case 'bottomToTop':
4151                    cssStyle = {'bottom':barHeight-(barHeight*rad)}; break;
4152            }
4153			if(rad > 1) {
4154                $('#'+pieID).css(cssStyle);
4155			} else {
4156                $('#'+pieID).animate(cssStyle,(time*radSum),'linear');
4157			}
4158
4159        } else {
4160            radNew = rad;
4161            ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter);
4162            ctx.globalCompositeOperation = 'destination-over';
4163            ctx.beginPath();
4164            ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2,false);
4165            ctx.lineWidth = opts.loaderStroke;
4166            ctx.strokeStyle = opts.loaderBgColor;
4167            ctx.stroke();
4168            ctx.closePath();
4169            ctx.globalCompositeOperation = 'source-over';
4170            ctx.beginPath();
4171            ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2*radNew,false);
4172            ctx.lineWidth = opts.loaderStroke-(opts.loaderPadding*2);
4173            ctx.strokeStyle = opts.loaderColor;
4174            ctx.stroke();
4175            ctx.closePath();
4176        }
4177	}
4178				
4179  function dispose()
4180  {
4181    if (setPause) clearTimeout(setPause);
4182    if (setT) clearTimeout(setT);
4183    if (u) clearInterval(u);
4184
4185    $(window).off('load resize pageshow',placeThumbsOnWindowResize);
4186    $(window).off('resize pageshow', onWindowResize);
4187
4188    wrap.stop(true, false);
4189    wrap.find('*').filter(':animated').stop(true, false);
4190    wrap.empty();
4191
4192    wrap = null;
4193    opts = null;
4194
4195    WA.Gadgets.GadgetDeleted.removeHandler(onGadgetDeleted);
4196  }
4197
4198  function onGadgetDeleted(sender, args)
4199  {
4200    if (args && args.componentId == opts.componentId)
4201    {
4202      dispose();
4203    }
4204  }
4205
4206  WA.Gadgets.GadgetDeleted.addHandler(onGadgetDeleted);
4207}
4208
4209})(jQuery);
4210
4211;(function($){$.fn.cameraStop = function() {
4212	var wrap = $(this),
4213		elem = $('.camera_src',wrap),
4214		pieID = 'pie_'+wrap.index();
4215	elem.addClass('stopped');
4216	if($('.camera_showcommands').length) {
4217		var camera_thumbs_wrap = $('.camera_thumbs_wrap',wrap);
4218	} else {
4219		var camera_thumbs_wrap = wrap;
4220	}
4221}
4222})(jQuery);
4223
4224;(function($){$.fn.cameraPause = function() {
4225	var wrap = $(this);
4226	var elem = $('.camera_src',wrap);
4227	elem.addClass('paused');
4228}
4229}
4229)(jQuery);
4230
4231;(function($){$.fn.cameraResume = function() {
4232	var wrap = $(this);
4233	var elem = $('.camera_src',wrap);
4234	if(typeof autoAdv === 'undefined' || autoAdv!==true){
4235		elem.removeClass('paused');
4236	}
4237}
4238})(jQuery);
4239
4240/*compiled*/
4241/*!
4242	Colorbox v1.4.29 - 2013-09-10
4243	jQuery lightbox and modal window plugin
4244	(c) 2013 Jack Moore - http://www.jacklmoore.com/colorbox
4245	license: http://www.opensource.org/licenses/mit-license.php
4246*/
4247(function ($, document, window) {
4248	var
4249	// Default settings object.
4250	// See http://jacklmoore.com/colorbox for details.
4251	defaults = {
4252		transition: "elastic",
4253		speed: 300,
4254		fadeOut: 300,
4255		width: false,
4256		initialWidth: "600",
4257		innerWidth: false,
4258		maxWidth: false,
4259		height: false,
4260		initialHeight: "450",
4261		innerHeight: false,
4262		maxHeight: false,
4263		scalePhotos: true,
4264		scrolling: true,
4265		inline: false,
4266		html: false,
4267		iframe: false,
4268		fastIframe: true,
4269		photo: false,
4270		href: false,
4271		title: false,
4272		rel: false,
4273		opacity: 0.9,
4274		preloading: true,
4275		className: false,
4276
4277		// alternate image paths for high-res displays
4278		retinaImage: false,
4279		retinaUrl: false,
4280		retinaSuffix: '@2x.$1',
4281
4282		// internationalization
4283		current: "image {current} of {total}",
4284		previous: "previous",
4285		next: "next",
4286		close: "close",
4287		xhrError: "This content failed to load.",
4288		imgError: "This image failed to load.",
4289
4290		open: false,
4291		returnFocus: true,
4292		trapFocus: true,
4293		reposition: true,
4294		loop: true,
4295		slideshow: false,
4296		slideshowAuto: true,
4297		slideshowSpeed: 2500,
4298		slideshowStart: "start slideshow",
4299		slideshowStop: "stop slideshow",
4300		photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,
4301
4302		onOpen: false,
4303		onLoad: false,
4304		onComplete: false,
4305		onCleanup: false,
4306		onClosed: false,
4307
4308		overlayClose: true,
4309		escKey: true,
4310		arrowKey: true,
4311		top: false,
4312		bottom: false,
4313		left: false,
4314		right: false,
4315		fixed: false,
4316		data: undefined,
4317		closeButton: true
4318	},
4319	
4320	// Abstracting the HTML and event identifiers for easy rebranding
4321	colorbox = 'colorbox',
4322	prefix = 'cbox',
4323	boxElement = prefix + 'Element',
4324	
4325	// Events
4326	event_open = prefix + '_open',
4327	event_load = prefix + '_load',
4328	event_complete = prefix + '_complete',
4329	event_cleanup = prefix + '_cleanup',
4330	event_closed = prefix + '_closed',
4331	event_purge = prefix + '_purge',
4332
4333	// Cached jQuery Object Variables
4334	$overlay,
4335	$box,
4336	$wrap,
4337	$content,
4338	$topBorder,
4339	$leftBorder,
4340	$rightBorder,
4341	$bottomBorder,
4342	$related,
4343	$window,
4344	$loaded,
4345	$loadingBay,
4346	$loadingOverlay,
4347	$title,
4348	$current,
4349	$slideshow,
4350	$next,
4351	$prev,
4352	$close,
4353	$groupControls,
4354	$events = $('<a/>'),
4355	
4356	// Variables for cached values or use across multiple functions
4357	settings,
4358	interfaceHeight,
4359	interfaceWidth,
4360	loadedHeight,
4361	loadedWidth,
4362	element,
4363	index,
4364	photo,
4365	open,
4366	active,
4367	closing,
4368	loadingTimer,
4369	publicMethod,
4370	div = "div",
4371	className,
4372	requests = 0,
4373	previousCSS = {},
4374	init;
4375
4376	// ****************
4377	// HELPER FUNCTIONS
4378	// ****************
4379	
4380	// Convenience function for creating new jQuery objects
4381	function $tag(tag, id, css) {
4382		var element = document.createElement(tag);
4383
4384		if (id) {
4385			element.id = prefix + id;
4386		}
4387
4388		if (css) {
4389			element.style.cssText = css;
4390		}
4391
4392		return $(element);
4393	}
4394	
4395	// Get the window height using innerHeight when available to avoid an issue with iOS
4396	// http://bugs.jquery.com/ticket/6724
4397	function winheight() {
4398		return window.innerHeight ? window.innerHeight : $(window).height();
4399	}
4400
4401	// Determine the next and previous members in a group.
4402	function getIndex(increment) {
4403		var
4404		max = $related.length,
4405		newIndex = (index + increment) % max;
4406		
4407		return (newIndex < 0) ? max + newIndex : newIndex;
4408	}
4409
4410	// Convert '%' and 'px' values to integers
4411	function setSize(size, dimension) {
4412		return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
4413	}
4414	
4415	// Checks an href to see if it is a photo.
4416	// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
4417	function isImage(settings, url) {
4418		return settings.photo || settings.photoRegex.test(url);
4419	}
4420
4421	function retinaUrl(settings, url) {
4422		return settings.retinaUrl && window.devicePixelRatio > 1 ? url.replace(settings.photoRegex, settings.retinaSuffix) : url;
4423	}
4424
4425	function trapFocus(e) {
4426		if ('contains' in $box[0] && !$box[0].contains(e.target)) {
4427			e.stopPropagation();
4428			$box.focus();
4429		}
4430	}
4431
4432	// Assigns function results to their respective properties
4433	function makeSettings() {
4434		var i,
4435			data = $.data(element, colorbox);
4436		
4437		if (data == null) {
4438			settings = $.extend({}, defaults);
4439			if (console && console.log) {
4440				console.log('Error: cboxElement missing settings object');
4441			}
4442		} else {
4443			settings = $.extend({}, data);
4444		}
4445		
4446		for (i in settings) {
4447			if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
4448				settings[i] = settings[i].call(element);
4449			}
4450		}
4451		
4452		settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
4453		settings.href = settings.href || $(element).attr('href');
4454		settings.title = settings.title || element.title;
4455		
4456		if (typeof settings.href === "string") {
4457			settings.href = $.trim(settings.href);
4458		}
4459	}
4460
4461	function trigger(event, callback) {
4462		// for external use
4463		$(document).trigger(event);
4464
4465		// for internal use
4466		$events.trigger(event);
4467
4468		if ($.isFunction(callback)) {
4469			callback.call(element);
4470		}
4471	}
4472
4473
4474	var slideshow = (function(){
4475		var active,
4476			className = prefix + "Slideshow_",
4477			click = "click." + prefix,
4478			timeOut;
4479
4480		function clear () {
4481			clearTimeout(timeOut);
4482		}
4483
4484		function set() {
4485			if (settings.loop || $related[index + 1]) {
4486				clear();
4487				timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
4488			}
4489		}
4490
4491		function start() {
4492			$slideshow
4493				.html(settings.slideshowStop)
4494				.unbind(click)
4495				.one(click, stop);
4496
4497			$events
4498				.bind(event_complete, set)
4499				.bind(event_load, clear);
4500
4501			$box.removeClass(className + "off").addClass(className + "on");
4502		}
4503
4504		function stop() {
4505			clear();
4506			
4507			$events
4508				.unbind(event_complete, set)
4509				.unbind(event_load, clear);
4510
4511			$slideshow
4512				.html(settings.slideshowStart)
4513				.unbind(click)
4514				.one(click, function () {
4515					publicMethod.next();
4516					start();
4517				});
4518
4519			$box.removeClass(className + "on").addClass(className + "off");
4520		}
4521
4522		function reset() {
4523			active = false;
4524			$slideshow.hide();
4525			clear();
4526			$events
4527				.unbind(event_complete, set)
4528				.unbind(event_load, clear);
4529			$box.removeClass(className + "off " + className + "on");
4530		}
4531
4532		return function(){
4533			if (active) {
4534				if (!settings.slideshow) {
4535					$events.unbind(event_cleanup, reset);
4536					reset();
4537				}
4538			} else {
4539				if (settings.slideshow && $related[1]) {
4540					active = true;
4541					$events.one(event_cleanup, reset);
4542					if (settings.slideshowAuto) {
4543						start();
4544					} else {
4545						stop();
4546					}
4547					$slideshow.show();
4548				}
4549			}
4550		};
4551
4552	}());
4553
4554
4555	function launch(target) {
4556		if (!closing) {
4557			
4558			element = target;
4559			
4560			makeSettings();
4561			
4562			$related = $(element);
4563			
4564			index = 0;
4565			
4566			if (settings.rel !== 'nofollow') {
4567				$related = $('.' + boxElement).filter(function () {
4568					var data = $.data(this, colorbox),
4569						relRelated;
4570
4571					if (data) {
4572						relRelated =  $(this).data('rel') || data.rel || this.rel;
4573					}
4574					
4575					return (relRelated === settings.rel);
4576				});
4577				index = $related.index(element);
4578				
4579				// Check direct calls to Colorbox.
4580				if (index === -1) {
4581					$related = $related.add(element);
4582					index = $related.length - 1;
4583				}
4584			}
4585			
4586			$overlay.css({
4587				opacity: parseFloat(settings.opacity),
4588				cursor: settings.overlayClose ? "pointer" : "auto",
4589				visibility: 'visible'
4590			}).show();
4591			
4592
4593			if (className) {
4594				$box.add($overlay).removeClass(className);
4595			}
4596			if (settings.className) {
4597				$box.add($overlay).addClass(settings.className);
4598			}
4599			className = settings.className;
4600
4601			if (settings.closeButton) {
4602				$close.html(settings.close).appendTo($content);
4603			} else {
4604				$close.appendTo('<div/>');
4605			}
4606
4607			if (!open) {
4608				open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
4609				
4610				// Show colorbox so the sizes can be calculated in older versions of jQuery
4611				$box.css({visibility:'hidden', display:'block'});
4612				
4613				$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden');
4614				$content.css({width:'', height:''}).append($loaded);
4615
4616				// Cache values needed for size calculations
4617				interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
4618				interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
4619				loadedHeight = $loaded.outerHeight(true);
4620				loadedWidth = $loaded.outerWidth(true);
4621
4622				// Opens inital empty Colorbox prior to content being loaded.
4623				settings.w = setSize(settings.initialWidth, 'x');
4624				settings.h = setSize(settings.initialHeight, 'y');
4625				$loaded.css({width:'', height:settings.h});
4626				publicMethod.position();
4627
4628				trigger(event_open, settings.onOpen);
4629				
4630				$groupControls.add($title).hide();
4631
4632				$box.focus();
4633				
4634				if (settings.trapFocus) {
4635					// Confine focus to the modal
4636					// Uses event capturing that is not supported in IE8-
4637					if (document.addEventListener) {
4638
4639						document.addEventListener('focus', trapFocus, true);
4640						
4641						$events.one(event_closed, function () {
4642							document.removeEventListener('focus', trapFocus, true);
4643						});
4644					}
4645				}
4646
4647				// Return focus on closing
4648				if (settings.returnFocus) {
4649					$events.one(event_closed, function () {
4650						$(element).focus();
4651					});
4652				}
4653			}
4654			load();
4655		}
4656	}
4657
4658	// Colorbox's markup needs to be added to the DOM prior to being called
4659	// so that the browser will go ahead and load the CSS background images.
4660	function appendHTML() {
4661		if (!$box && document.body) {
4662			init = false;
4663			$window = $(window);
4664			$box = $tag(div).attr({
4665				id: colorbox,
4666				'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
4667				role: 'dialog',
4668				tabindex: '-1'
4669			}).hide();
4670			$overlay = $tag(div, "Overlay").hide();
4671			$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
4672			$wrap = $tag(div, "Wrapper");
4673			$content = $tag(div, "Content").append(
4674				$title = $tag(div, "Title"),
4675				$current = $tag(div, "Current"),
4676				$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
4677				$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
4678				$slideshow = $tag('button', "Slideshow"),
4679				$loadingOverlay
4680			);
4681
4682			$close = $('<button type="button"/>').attr({id:prefix+'Close'});
4683			
4684			$wrap.append( // The 3x3 Grid that makes up Colorbox
4685				$tag(div).append(
4686					$tag(div, "TopLeft"),
4687					$topBorder = $tag(div, "TopCenter"),
4688					$tag(div, "TopRight")
4689				),
4690				$tag(div, false, 'clear:left').append(
4691					$leftBorder = $tag(div, "MiddleLeft"),
4692					$content,
4693					$rightBorder = $tag(div, "MiddleRight")
4694				),
4695				$tag(div, false, 'clear:left').append(
4696					$tag(div, "BottomLeft"),
4697					$bottomBorder = $tag(div, "BottomCenter"),
4698					$tag(div, "BottomRight")
4699				)
4700			).find('div div').css({'float': 'left'});
4701			
4702			$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
4703			
4704			$groupControls = $next.add($prev).add($current).add($slideshow);
4705
4706			$(document.body).append($overlay, $box.append($wrap, $loadingBay));
4707		}
4708	}
4709
4710	// Add Colorbox's event bindings
4711	function addBindings() {
4712		function clickHandler(e) {
4713			// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
4714			// See: http://jacklmoore.com/notes/click-events/
4715			if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
4716				e.preventDefault();
4717				launch(this);
4718			}
4719		}
4720
4721		if ($box) {
4722			if (!init) {
4723				init = true;
4724
4725				// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
4726				$next.click(function () {
4727					publicMethod.next();
4728				});
4729				$prev.click(function () {
4730					publicMethod.prev();
4731				});
4732				$close.click(function () {
4733					publicMethod.close();
4734				});
4735				$overlay.click(function () {
4736					if (settings.overlayClose) {
4737						publicMethod.close();
4738					}
4739				});
4740				
4741				// Key Bindings
4742				$(document).bind('keydown.' + prefix, function (e) {
4743					var key = e.keyCode;
4744					if (open && settings.escKey && key === 27) {
4745						e.preventDefault();
4746						publicMethod.close();
4747					}
4748					if (open && settings.arrowKey && $related[1] && !e.altKey) {
4749						if (key === 37) {
4750							e.preventDefault();
4751							$prev.click();
4752						} else if (key === 39) {
4753							e.preventDefault();
4754							$next.click();
4755						}
4756					}
4757				});
4758
4759				if ($.isFunction($.fn.on)) {
4760					// For jQuery 1.7+
4761					$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
4762				} else {
4763					// For jQuery 1.3.x -> 1.6.x
4764					// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
4765					// This is not here for jQuery 1.9, it's here for legacy users.
4766					$('.'+boxElement).live('click.'+prefix, clickHandler);
4767				}
4768			}
4769			return true;
4770		}
4771		return false;
4772	}
4773
4774	// Don't do anything if Colorbox already exists.
4775	if ($.colorbox) {
4776		return;
4777	}
4778
4779	// Append the HTML when the DOM loads
4780	$(appendHTML);
4781
4782
4783	// ****************
4784	// PUBLIC FUNCTIONS
4785	// Usage format: $.colorbox.close();
4786	// Usage from within an iframe: parent.jQuery.colorbox.close();
4787	// ****************
4788	
4789	publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
4790		var $this = this;
4791		
4792		options = options || {};
4793		
4794		appendHTML();
4795
4796		if (addBindings()) {
4797			if ($.isFunction($this)) { // assume a call to $.colorbox
4798				$this = $('<a/>');
4799				options.open = true;
4800			} else if (!$this[0]) { // colorbox being applied to empty collection
4801				return $this;
4802			}
4803			
4804			if (callback) {
4805				options.onComplete = callback;
4806			}
4807			
4808			$this.each(function () {
4809				$.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
4810			}).addClass(boxElement);
4811			
4812			if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
4813				launch($this[0]);
4814			}
4815		}
4816		
4817		return $this;
4818	};
4819
4820	publicMethod.position = function (speed, loadedCallback) {
4821		var
4822		css,
4823		top = 0,
4824		left = 0,
4825		offset = $box.offset(),
4826		scrollTop,
4827		scrollLeft;
4828		
4829		$window.unbind('resize.' + prefix);
4830
4831		// remove the modal so that it doesn't influence the document width/height
4832		$box.css({top: -9e4, left: -9e4});
4833
4834		scrollTop = $window.scrollTop();
4835		scrollLeft = $window.scrollLeft();
4836
4837		if (settings.fixed) {
4838			offset.top -= scrollTop;
4839			offset.left -= scrollLeft;
4840			$box.css({position: 'fixed'});
4841		} else {
4842			top = scrollTop;
4843			left = scrollLeft;
4844			$box.css({position: 'absolute'});
4845		}
4846
4847		// keeps the top and left positions within the browser's viewport.
4848		if (settings.right !== false) {
4849			left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(sett
vendor: 4,326 bytes, lines 4849-4986
4849ings.right, 'x'), 0);
4850		} else if (settings.left !== false) {
4851			left += setSize(settings.left, 'x');
4852		} else {
4853			left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
4854		}
4855		
4856		if (settings.bottom !== false) {
4857			top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
4858		} else if (settings.top !== false) {
4859			top += setSize(settings.top, 'y');
4860		} else {
4861			top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
4862		}
4863
4864		$box.css({top: offset.top, left: offset.left, visibility:'visible'});
4865		
4866		// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
4867		// but it has to be shrank down around the size of div#colorbox when it's done.  If not,
4868		// it can invoke an obscure IE bug when using iframes.
4869		$wrap[0].style.width = $wrap[0].style.height = "9999px";
4870		
4871		function modalDimensions() {
4872			$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
4873			$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
4874		}
4875
4876		css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
4877
4878		// setting the speed to 0 if the content hasn't changed size or position
4879		if (speed) {
4880			var tempSpeed = 0;
4881			$.each(css, function(i){
4882				if (css[i] !== previousCSS[i]) {
4883					tempSpeed = speed;
4884					return;
4885				}
4886			});
4887			speed = tempSpeed;
4888		}
4889
4890		previousCSS = css;
4891
4892		if (!speed) {
4893			$box.css(css);
4894		}
4895
4896		$box.dequeue().animate(css, {
4897			duration: speed || 0,
4898			complete: function () {
4899				modalDimensions();
4900				
4901				active = false;
4902				
4903				// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
4904				$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
4905				$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
4906				
4907				if (settings.reposition) {
4908					setTimeout(function () {  // small delay before binding onresize due to an IE8 bug.
4909						$window.bind('resize.' + prefix, publicMethod.position);
4910					}, 1);
4911				}
4912
4913				if (loadedCallback) {
4914					loadedCallback();
4915				}
4916			},
4917			step: modalDimensions
4918		});
4919	};
4920
4921	publicMethod.resize = function (options) {
4922		var scrolltop;
4923		
4924		if (open) {
4925			options = options || {};
4926			
4927			if (options.width) {
4928				settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
4929			}
4930
4931			if (options.innerWidth) {
4932				settings.w = setSize(options.innerWidth, 'x');
4933			}
4934
4935			$loaded.css({width: settings.w});
4936			
4937			if (options.height) {
4938				settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
4939			}
4940
4941			if (options.innerHeight) {
4942				settings.h = setSize(options.innerHeight, 'y');
4943			}
4944
4945			if (!options.innerHeight && !options.height) {
4946				scrolltop = $loaded.scrollTop();
4947				$loaded.css({height: "auto"});
4948				settings.h = $loaded.height();
4949			}
4950
4951			$loaded.css({height: settings.h});
4952
4953			if(scrolltop) {
4954				$loaded.scrollTop(scrolltop);
4955			}
4956			
4957			publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
4958		}
4959	};
4960
4961	publicMethod.prep = function (object) {
4962		if (!open) {
4963			return;
4964		}
4965		
4966		var callback, speed = settings.transition === "none" ? 0 : settings.speed;
4967
4968		$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
4969
4970		$loaded = $tag(div, 'LoadedContent').append(object);
4971		
4972		function getWidth() {
4973			settings.w = settings.w || $loaded.width();
4974			settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
4975			return settings.w;
4976		}
4977		function getHeight() {
4978			settings.h = settings.h || $loaded.height();
4979			settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
4980			return settings.h;
4981		}
4982		
4983		$loaded.hide()
4984		.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
4985		.css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
4986		.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
4987		.prependTo($content);
4988		
4989		$loadingBay.hide();
4990		
4991		// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
4992		
4993		$(photo).css({'float': 'none'});
4994
4995		callback = function () {
4996			var total = $related.length,
4997				iframe,
4998				frameBorder = 'frameBorder',
4999				allowTransparency = 'allowTransparency',
5000				complete;
5001			
5002			if (!open) {
5003				return;
5004			}
5005			
5006			function removeFilter() { // Needed for IE7 & IE8 in versions of jQuery prior to 1.7.2
5007				if ($.support.opacity === false) {
5008					$box[0].style.removeAttribute('filter');
5009				}
5010			}
5011			
5012			complete = function () {
5013				clearTimeout(loadingTimer);
5014				$loadingOverlay.hide();
5015				trigger(event_complete, settings.onComplete);
5016			};
5017
5018			
5019			$title.html(settings.title).add($loaded).show();
5020			
5021			if (total > 1) { // handle grouping
5022				if (typeof settings.current === "string") {
5023					$current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
5024				}
5025				
5026				$next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(sett
5026ings.next);
5027				$prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
5028				
5029				slideshow();
5030				
5031				// Preloads images within a rel group
5032				if (settings.preloading) {
5033					$.each([getIndex(-1), getIndex(1)], function(){
5034						var src,
5035							img,
5036							i = $related[this],
5037							data = $.data(i, colorbox);
5038
5039						if (data && data.href) {
5040							src = data.href;
5041							if ($.isFunction(src)) {
5042								src = src.call(i);
5043							}
5044						} else {
5045							src = $(i).attr('href');
5046						}
5047
5048						if (src && isImage(data, src)) {
5049							src = retinaUrl(data, src);
5050							img = document.createElement('img');
5051							img.src = src;
5052						}
5053					});
5054				}
5055			} else {
5056				$groupControls.hide();
5057			}
5058			
5059			if (settings.iframe) {
5060				iframe = $tag('iframe')[0];
5061				
5062				if (frameBorder in iframe) {
5063					iframe[frameBorder] = 0;
5064				}
5065				
5066				if (allowTransparency in iframe) {
5067					iframe[allowTransparency] = "true";
5068				}
5069
5070				if (!settings.scrolling) {
5071					iframe.scrolling = "no";
5072				}
5073				
5074				$(iframe)
5075					.attr({
5076						src: settings.href,
5077						name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
5078						'class': prefix + 'Iframe',
5079						allowFullScreen : true, // allow HTML5 video to go fullscreen
5080						webkitAllowFullScreen : true,
5081						mozallowfullscreen : true
5082					})
5083					.one('load', complete)
5084					.appendTo($loaded);
5085				
5086				$events.one(event_purge, function () {
5087					iframe.src = "//about:blank";
5088				});
5089
5090				if (settings.fastIframe) {
5091					$(iframe).trigger('load');
5092				}
5093			} else {
5094				complete();
5095			}
5096			
5097			if (settings.transition === 'fade') {
5098				$box.fadeTo(speed, 1, removeFilter);
5099			} else {
5100				removeFilter();
5101			}
5102		};
5103		
5104		if (settings.transition === 'fade') {
5105			$box.fadeTo(speed, 0, function () {
5106				publicMethod.position(0, callback);
5107			});
5108		} else {
5109			publicMethod.position(speed, callback);
5110		}
5111	};
5112
5113	function load () {
5114		var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
5115		
5116		active = true;
5117		
5118		photo = false;
5119		
5120		element = $related[index];
5121		
5122		makeSettings();
5123		
5124		trigger(event_purge);
5125		
5126		trigger(event_load, settings.onLoad);
5127		
5128		settings.h = settings.height ?
5129				setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
5130				settings.innerHeight && setSize(settings.innerHeight, 'y');
5131		
5132		settings.w = settings.width ?
5133				setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
5134				settings.innerWidth && setSize(settings.innerWidth, 'x');
5135		
5136		// Sets the minimum dimensions for use in image scaling
5137		settings.mw = settings.w;
5138		settings.mh = settings.h;
5139		
5140		// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
5141		// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
5142		if (settings.maxWidth) {
5143			settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
5144			settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
5145		}
5146		if (settings.maxHeight) {
5147			settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
5148			settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
5149		}
5150		
5151		href = settings.href;
5152		
5153		loadingTimer = setTimeout(function () {
5154			$loadingOverlay.show();
5155		}, 100);
5156		
5157		if (settings.inline) {
5158			// Inserts an empty placeholder where inline content is being pulled from.
5159			// An event is bound to put inline content back when Colorbox closes or loads new content.
5160			$inline = $tag(div).hide().insertBefore($(href)[0]);
5161
5162			$events.one(event_purge, function () {
5163				$inline.replaceWith($loaded.children());
5164			});
5165
5166			prep($(href));
5167		} else if (settings.iframe) {
5168			// IFrame element won't be added to the DOM until it is ready to be displayed,
5169			// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
5170			prep(" ");
5171		} else if (settings.html) {
5172			prep(settings.html);
5173		} else if (isImage(settings, href)) {
5174
5175			href = retinaUrl(settings, href);
5176
5177			photo = document.createElement('img');
5178
5179			$(photo)
5180			.addClass(prefix + 'Photo')
5181			.bind('error',function () {
5182				settings.title = false;
5183				prep($tag(div, 'Error').html(settings.imgError));
5184			})
5185			.one('load', function () {
5186				var percent;
5187
5188				if (request !== requests) {
5189					return;
5190				}
5191
5192				photo.alt = $(element).attr('alt') || $(element).attr('data-alt') || '';
5193
5194				if (settings.retinaImage && window.devicePixelRatio > 1) {
5195					photo.height = photo.height / window.devicePixelRatio;
5196					photo.width = photo.width / window.devicePixelRatio;
5197				}
5198
5199				if (settings.scalePhotos) {
5200					setResize = function () {
5201						photo.height -= photo.height * percent;
5202						photo.width -= photo.width * percent;
5203					};
5204					if (settings.mw && photo.width > settings.mw) {
5205						percent = (photo.width - settings.mw) / photo.width;
5206						setResize();
5207					}
5208					if (settings.mh && photo.height > settings.mh) {
5209						percent = (photo.height - settings.mh) / photo.height;
5210						setResize();
5211					}
5212				}
5213				
5214				if (settings.h) {
5215					photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
5216				}
5217				
5218				if ($related[1] && (settings.loop || $related[index + 1])) {
5219					photo.style.cursor = 'pointer';
5220					photo.onclick = function () {
5221						publicMethod.next();
5222					};
5223				}
5224
5225				photo.style.width = photo.width + 'px';
5226				photo.style.height = photo.height + 'px';
5227
5228				setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
5229					prep(photo);
5230				}, 1);
5231			});
5232			
5233			setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
5234				photo.src = href;
5235			}, 1);
5236		} else if (href) {
5237			$loadingBay.load(href, settings.data, function (data, status) {
5238				if (request === requests) {
5239					prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
5240				}
5241			});
5242		}
5243	}
5244		
5245	// Navigates to the next page/image in a set.
5246	publicMethod.next = function () {
5247		if (!active && $related[1] && (settings.loop || $related[index + 1])) {
5248			index = getIndex(1);
5249			launch($related[index]);
5250		}
5251	};
5252	
5253	publicMethod.prev = function () {
5254		if (!active && $related[1] && (settings.loop || index)) {
5255			index = getIndex(-1);
5256			launch($related[index]);
5257		}
5258	};
5259
5260	// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
5261	publicMethod.close = function () {
5262		if (open && !closing) {
5263			
5264			closing = true;
5265			
5266			open = false;
5267			
5268			trigger(event_cleanup, settings.onCleanup);
5269			
5270			$window.unbind('.' + prefix);
5271			
5272			$overlay.fadeTo(settings.fadeOut || 0, 0);
5273			
5274			$box.stop().fadeTo(settings.fadeOut || 0, 0, function () {
5275			
5276				$box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
5277				
5278				trigger(event_purge);
5279				
5280				$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
5281				
5282				setTimeout(function () {
5283					closing = false;
vendor: 4,185 bytes, lines 5284-5412
5284					trigger(event_closed, settings.onClosed);
5285				}, 1);
5286			});
5287		}
5288	};
5289
5290	// Removes changes Colorbox made to the document, but does not remove the plugin.
5291	publicMethod.remove = function () {
5292		if (!$box) { return; }
5293
5294		$box.stop();
5295		$.colorbox.close();
5296		$box.stop().remove();
5297		$overlay.remove();
5298		closing = false;
5299		$box = null;
5300		$('.' + boxElement)
5301			.removeData(colorbox)
5302			.removeClass(boxElement);
5303
5304		$(document).unbind('click.'+prefix);
5305	};
5306
5307	// A method for fetching the current element Colorbox is referencing.
5308	// returns a jQuery object.
5309	publicMethod.element = function () {
5310		return $(element);
5311	};
5312
5313	publicMethod.settings = defaults;
5314
5315}(jQuery, document, window));
5316
5317
5318/*compiled*/
5319/*
5320 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
5321 *
5322 * Uses the built in easing capabilities added In jQuery 1.1
5323 * to offer multiple easing options
5324 *
5325 * TERMS OF USE - jQuery Easing
5326 * 
5327 * Open source under the BSD License. 
5328 * 
5329 * Copyright © 2008 George McGinley Smith
5330 * All rights reserved.
5331 * 
5332 * Redistribution and use in source and binary forms, with or without modification, 
5333 * are permitted provided that the following conditions are met:
5334 * 
5335 * Redistributions of source code must retain the above copyright notice, this list of 
5336 * conditions and the following disclaimer.
5337 * Redistributions in binary form must reproduce the above copyright notice, this list 
5338 * of conditions and the following disclaimer in the documentation and/or other materials 
5339 * provided with the distribution.
5340 * 
5341 * Neither the name of the author nor the names of contributors may be used to endorse 
5342 * or promote products derived from this software without specific prior written permission.
5343 * 
5344 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
5345 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
5346 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
5347 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
5348 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
5349 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
5350 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5351 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
5352 * OF THE POSSIBILITY OF SUCH DAMAGE. 
5353 *
5354*/
5355
5356// t: current time, b: begInnIng value, c: change In value, d: duration
5357jQuery.easing['jswing'] = jQuery.easing['swing'];
5358
5359jQuery.extend( jQuery.easing,
5360{
5361	def: 'easeOutQuad',
5362	swing: function (x, t, b, c, d) {
5363		//alert(jQuery.easing.default);
5364		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
5365	},
5366	easeInQuad: function (x, t, b, c, d) {
5367		return c*(t/=d)*t + b;
5368	},
5369	easeOutQuad: function (x, t, b, c, d) {
5370		return -c *(t/=d)*(t-2) + b;
5371	},
5372	easeInOutQuad: function (x, t, b, c, d) {
5373		if ((t/=d/2) < 1) return c/2*t*t + b;
5374		return -c/2 * ((--t)*(t-2) - 1) + b;
5375	},
5376	easeInCubic: function (x, t, b, c, d) {
5377		return c*(t/=d)*t*t + b;
5378	},
5379	easeOutCubic: function (x, t, b, c, d) {
5380		return c*((t=t/d-1)*t*t + 1) + b;
5381	},
5382	easeInOutCubic: function (x, t, b, c, d) {
5383		if ((t/=d/2) < 1) return c/2*t*t*t + b;
5384		return c/2*((t-=2)*t*t + 2) + b;
5385	},
5386	easeInQuart: function (x, t, b, c, d) {
5387		return c*(t/=d)*t*t*t + b;
5388	},
5389	easeOutQuart: function (x, t, b, c, d) {
5390		return -c * ((t=t/d-1)*t*t*t - 1) + b;
5391	},
5392	easeInOutQuart: function (x, t, b, c, d) {
5393		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
5394		return -c/2 * ((t-=2)*t*t*t - 2) + b;
5395	},
5396	easeInQuint: function (x, t, b, c, d) {
5397		return c*(t/=d)*t*t*t*t + b;
5398	},
5399	easeOutQuint: function (x, t, b, c, d) {
5400		return c*((t=t/d-1)*t*t*t*t + 1) + b;
5401	},
5402	easeInOutQuint: function (x, t, b, c, d) {
5403		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
5404		return c/2*((t-=2)*t*t*t*t + 2) + b;
5405	},
5406	easeInSine: function (x, t, b, c, d) {
5407		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
5408	},
5409	easeOutSine: function (x, t, b, c, d) {
5410		return c * Math.sin(t/d * (Math.PI/2)) + b;
5411	},
5412	easeInOutSine: function (x, t, b, c, d) {
vendor: 4,186 bytes, lines 5413-5516
5413		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
5414	},
5415	easeInExpo: function (x, t, b, c, d) {
5416		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
5417	},
5418	easeOutExpo: function (x, t, b, c, d) {
5419		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
5420	},
5421	easeInOutExpo: function (x, t, b, c, d) {
5422		if (t==0) return b;
5423		if (t==d) return b+c;
5424		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
5425		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
5426	},
5427	easeInCirc: function (x, t, b, c, d) {
5428		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
5429	},
5430	easeOutCirc: function (x, t, b, c, d) {
5431		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
5432	},
5433	easeInOutCirc: function (x, t, b, c, d) {
5434		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
5435		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
5436	},
5437	easeInElastic: function (x, t, b, c, d) {
5438		var s=1.70158;var p=0;var a=c;
5439		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
5440		if (a < Math.abs(c)) { a=c; var s=p/4; }
5441		else var s = p/(2*Math.PI) * Math.asin (c/a);
5442		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
5443	},
5444	easeOutElastic: function (x, t, b, c, d) {
5445		var s=1.70158;var p=0;var a=c;
5446		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
5447		if (a < Math.abs(c)) { a=c; var s=p/4; }
5448		else var s = p/(2*Math.PI) * Math.asin (c/a);
5449		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
5450	},
5451	easeInOutElastic: function (x, t, b, c, d) {
5452		var s=1.70158;var p=0;var a=c;
5453		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
5454		if (a < Math.abs(c)) { a=c; var s=p/4; }
5455		else var s = p/(2*Math.PI) * Math.asin (c/a);
5456		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
5457		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
5458	},
5459	easeInBack: function (x, t, b, c, d, s) {
5460		if (s == undefined) s = 1.70158;
5461		return c*(t/=d)*t*((s+1)*t - s) + b;
5462	},
5463	easeOutBack: function (x, t, b, c, d, s) {
5464		if (s == undefined) s = 1.70158;
5465		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
5466	},
5467	easeInOutBack: function (x, t, b, c, d, s) {
5468		if (s == undefined) s = 1.70158; 
5469		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
5470		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
5471	},
5472	easeInBounce: function (x, t, b, c, d) {
5473		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
5474	},
5475	easeOutBounce: function (x, t, b, c, d) {
5476		if ((t/=d) < (1/2.75)) {
5477			return c*(7.5625*t*t) + b;
5478		} else if (t < (2/2.75)) {
5479			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
5480		} else if (t < (2.5/2.75)) {
5481			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
5482		} else {
5483			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
5484		}
5485	},
5486	easeInOutBounce: function (x, t, b, c, d) {
5487		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
5488		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
5489	}
5490});
5491
5492/*
5493 *
5494 * TERMS OF USE - EASING EQUATIONS
5495 * 
5496 * Open source under the BSD License. 
5497 * 
5498 * Copyright © 2001 Robert Penner
5499 * All rights reserved.
5500 * 
5501 * Redistribution and use in source and binary forms, with or without modification, 
5502 * are permitted provided that the following conditions are met:
5503 * 
5504 * Redistributions of source code must retain the above copyright notice, this list of 
5505 * conditions and the following disclaimer.
5506 * Redistributions in binary form must reproduce the above copyright notice, this list 
5507 * of conditions and the following disclaimer in the documentation and/or other materials 
5508 * provided with the distribution.
5509 * 
5510 * Neither the name of the author nor the names of contributors may be used to endorse 
5511 * or promote products derived from this software without specific prior written permission.
5512 * 
5513 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
5514 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
5515 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
5516 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
5517 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
5518 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
5519 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5520 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
5521 * OF THE POSSIBILITY OF SUCH DAMAGE. 
5522 *
5523 */
5524 
5525 var memberProfileHelper;(function(){if(window.memberProfileHelper==null){window.memberProfileHelper=new Object();}memberProfileHelper.setFilter=function(){var shadingFieldset=document.getElementById("shadingFieldset");if(shadingFieldset==null){return;}if(document.all){shadingFieldset.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=40)";}else{shadingFieldset.style.MozOpacity=0.4;}};memberProfileHelper.disableAllInputs=function(){var shadingFieldset=document.getElementById("shadingFieldset");var i;if(shadingFieldset==null){return;}var inputs=shadingFieldset.getElementsByTagName("INPUT");if(inputs.length>0){for(i=0;i<inputs.length;i++){inputs[i].disabled="true";}}inputs=shadingFieldset.getElementsByTagName("TEXTAREA");if(inputs.length>0){for(i=0;i<inputs.length;i++){inputs[i].disabled="true";}}inputs=shadingFieldset.getElementsByTagName("SELECT");if(inputs.length>0){for(i=0;i<inputs.length;i++){inputs[i].disabled="true";}}};memberProfileHelper.checkMemberReceiveRemindersFieldChanged=function(sender,args){var receiveRemindersCheckbox=document.getElementById(receiveRemindersCheckBoxId);var state=receiveRemindersCheckbox.checked?"checked":"nonChecked";DataChangeWatcher.changeValidatorCustom("ReceiveRemindersEnabledDisabled",state,args);};memberProfileHelper.checkMemberReceiveNewsLettersFieldChanged=function(sender,args){var receiveNewslettersCheckbox=document.getElementById(receiveNewsLettersCheckBoxId);var state=receiveNewslettersCheckbox.checked?"checked":"nonChecked";DataChangeWatcher.changeValidatorCustom("ReceiveNewsLettersEnabledDisabled",state,args);};memberProfileHelper.stopWatchDataChanging=function(){if(typeof(DataChangeWatcher)=="undefined"){return;}DataChangeWatcher.setNotChanged();DataChangeWatcher.pauseWatching();};memberProfileHelper.makeButtonWatchDataChanging=function(btnId,sourceAction,causesValidation,checkIfDataChanged,awayMessage){var btn=document.getElementById(btnId);if(!btn){return;}btn.onclick=function(){var dcw=DataChangeWatcher;if(!causesValidation){if(dcw){dcw.resumeWatching();if(checkIfDataChanged){if(!dcw.confirmIfDataChanged()){return;}}}Page_ValidationActive=false;}else{if(!checkIfDataChanged){if(dcw){dcw.pauseWatching();}}}var actionResult=sourceAction();if(causesValidation){if(Page_IsValid&&!Page_BlockSubmit){if(checkIfDataChanged){if(dcw&&!dcw.confirmIfDataChanged()){Page_BlockSubmit=true;return;}}}else{if(!checkIfDataChanged){if(dcw){dcw.resumeWatching();}}}}};memberProfileHelper.TransferToPaymentSystem=function(paymentUrl){if(paymentUrl==null||paymentUrl==""){return false;}DataChangeWatcher.pauseWatching();location.href=paymentUrl;};};memberProfileHelper.EmailChangedNotfication=function(){var hiddenEmail=document.getElementById(hiddenEmailId);var textboxEmail=document.getElementById(textboxEmailId);if(memberProfileHelper.trim(hiddenEmail.value)!=memberProfileHelper.trim(textboxEmail.value)){return confirm(this.changingEmailMessageText);}else{return true;}};memberProfileHelper.trim=function(str){return str.replace(/^\s*(.*)\s*$/,"$1");};function $(id){return document.getElementById(id);}memberProfileHelper.setTabHidden=function setTabHidden(tabModeName){var tabModeHidden=$(this.tabModeHiddenID);tabModeHidden.value=tabModeName;};memberProfileHelper.showProfile=function showProfile(){var mandatoryLink=$(this.editMandatoryFieldTopMessageID);if(mandatoryLink){mandatoryLink.style.display="block";}var profileLink=$(this.profileTabLinkID);var profileLabel=$(this.profileTabLabelID);var fieldsLink=$(this.accessTabLinkID);var fieldsLabel=$(this.accessTabLabelID);var subscriptionsLink=$(this.subscriptionsTabLinkID);var subscriptionsLabel=$(this.subscriptionsTabLabelID);profileLink.style.display="none";profileLabel.style.display="inline";subscriptionsLink.style.display="inline";subscriptionsLabel.style.display="none";if(fieldsLink){fieldsLink.style.display="inline";fieldsLabel.style.display="none";}var profileContainer=$(this.mainProfileTrID);var includeMemberDirectoryContainer=$(this.trIncludeInMemberDirectoryID);var fieldsContainer=$(this.trDetailsToShowID);var subscriptionsContainer=$(this.divEnableNotificationsID);if(profileContainer){profileContainer.style.display="block";}if(includeMemberDirectoryContainer){includeMemberDirectoryContainer.style.display="none";}if(fieldsContainer){fieldsContainer.style.display="none";}if(subscriptionsContainer){subscriptionsContainer.style.display="none";}this.setTabHidden(this.tabModeNameProfile);return false;};memberProfileHelper.showFieldSettings=function showFieldSettings(){var mandatoryLink=$(this.editMandatoryFieldTopMessageID);if(mandatoryLink){mandatoryLink.style.display="none";}var profileLink=$(this.profileTabLinkID);var profileLabel=$(this.profileTabLabelID);var fieldsLink=$(this.accessTabLinkID);var fieldsLabel=$(this.accessTabLabelID);var subscriptionsLink=$(this.subscriptionsTabLinkID);var subscriptionsLabel=$(this.subscriptionsTabLabelID);profileLink.style.display="inline";profileLabel.style.display="none";subscriptionsLink.style.display="inline";subscriptionsLabel.style.display="none";if(fieldsLink){fieldsLink.style.display="none";fieldsLabel.style.display="inline";}var profileContainer=$(this.mainProfileTrID);var includeMemberDirectoryContainer=$(this.trIncludeInMemberDirectoryID);var fieldsContainer=$(this.trDetailsToShowID);var subscriptionsContainer=$(this.divEnableNotificationsID);if(profileContainer){profileContainer.style.display="none";}if(includeMemberDirectoryContainer){includeMemberDirectoryContainer.style.display="block";}if(fieldsContainer){fieldsContainer.style.display="block";}if(subscriptionsContainer){subscriptionsContainer.style.display="none";}this.setTabHidden(this.tabModeNameAccess);return false;};memberProfileHelper.showSubscriptions=function showSubscriptions(){var mandatoryLink=$(this.editMandatoryFieldTopMessageID);if(mandatoryLink){mandatoryLink.style.display="none";}var profileLink=$(this.profileTabLinkID);var profileLabel=$(this.profileTabLabelID);var fieldsLink=$(this.accessTabLinkID);var fieldsLabel=$(this.accessTabLabelID);var subscriptionsLink=$(this.subscriptionsTabLinkID);var subscriptionsLabel=$(this.subscriptionsTabLabelID);profileLink.style.display="inline";profileLabel.style.display="none";subscriptionsLink.style.display="none";subscriptionsLabel.style.display="inline";if(fieldsLink){fieldsLink.style.display="inline";fieldsLabel.style.display="none";}var profileContainer=$(this.mainProfileTrID);var includeMemberDirectoryContainer=$(this.trIncludeInMemberDirectoryID);var fieldsContainer=$(this.trDetailsToShowID);var subscriptionsContainer=$(this.divEnableNotificationsID);if(profileContainer){profileContainer.style.display="none";}if(includeMemberDirectoryContainer){includeMemberDirectoryContainer.style.display="none";}if(fieldsContainer){fieldsContainer.style.display="none";}if(subscriptionsContainer){subscriptionsContainer.style.display="block";}this.setTabHidden(this.tabModeNameSubscriptions);return false;};
5525memberProfileHelper.displayMemberAllDataTable=function(){var memberAllDataTable=$("memberAllDataTable");memberAllDataTable.style.display="block";};})();var memberDirectoryDetailsToShowHelper;(function(){if(memberDirectoryDetailsToShowHelper==null){memberDirectoryDetailsToShowHelper={};}function $(id){return document.getElementById(id);}memberDirectoryDetailsToShowHelper.editIncludeMeInMemberDirectoryClick=function(){memberDirectoryDetailsToShowHelper.checkAllowDisplayCheckBox();};memberDirectoryDetailsToShowHelper.checkAllowDisplayCheckBox=function(){var allowDisplayCheckBox=$(memberDirectoryDetailsToShowHelper.AllowDisplayCheckBoxId);if(allowDisplayCheckBox){memberDirectoryDetailsToShowHelper.setMemberFieldTableMode(!allowDisplayCheckBox.checked);}};memberDirectoryDetailsToShowHelper.setMemberFieldTableMode=function(disabled){var fieldsControl=$(memberDirectoryDetailsToShowHelper.FieldsControlId);var inputs=memberDirectoryDetailsToShowHelper.getInputs(fieldsControl);for(var i=0;i<inputs.length;i++){if(inputs[i]&&!inputs[i].getAttribute(memberDirectoryDetailsToShowHelper.LockedFieldHtmlAttr)){inputs[i].disabled=disabled;}}};memberDirectoryDetailsToShowHelper.getInputs=function(node){var inputs=[];memberDirectoryDetailsToShowHelper.populateInputs(inputs,node);return inputs;};memberDirectoryDetailsToShowHelper.populateInputs=function(inputs,node){if(!node){return;}if(node.tagName&&node.tagName.toLowerCase()=="input"){inputs[inputs.length]=node;}if(!node.childNodes||node.childNodes.length==0){return;}for(var i=0;i<node.childNodes.length;i++){var subNode=node.childNodes[i];memberDirectoryDetailsToShowHelper.populateInputs(inputs,subNode);}};})();(function(){if(!window.memberSubscriptionsHelper){window.memberSubscriptionsHelper={};}memberSubscriptionsHelper.editEnableEmailsClick=function(){this.setSubscriptionsEnabling();};memberSubscriptionsHelper.setSubscriptionsEnabling=function(){var allowDisplayCheckBox=WA.$(this.AllowDisplayCheckBoxId,window);var contentControl=WA.$(this.ContentControlId,window);if(!contentControl||!allowDisplayCheckBox){return;}contentControl.style.display=allowDisplayCheckBox.checked?"block":"none";};memberSubscriptionsHelper.enableSubscription=function(checkBoxID,dropDownID){var enableCheckBox=WA.$(checkBoxID,window);var typeDropDown=WA.$(dropDownID,window);if(!enableCheckBox||!typeDropDown){return;}typeDropDown.disabled=!enableCheckBox.checked;};})();(function(){if(!window.PhotoGallery){window.PhotoGallery={};}var albumParam="";var processingText="Please wait...";var deleteConfirmation="Are you sure you want to delete?";var deletePhotoConfirmation="Are you sure you want to delete this photo?";var saveAction=false;var photosHolder=false;var photosHolderHeight=false;var titleTextBox=false;var descriptionTextBox=false;var saveButton=false;var altSaveButton=false;var saveLinkButton=false;var deleteButton=false;var cancelButton=false;var uploadButton=false;var uploadAction=false;var viewModeRadioContainer=false;var uploadButtonContainer=false;var descriptionContainer=false;var descriptionHeightUrlKey=false;var countPhotosPerRowUrlKey=false;var pagingKey=false;var saveAlbumDialogInited=false;var uploadPhotosDialogInited=false;var photoItemId=false;var photoItemTimeout=false;var actionIsRunning=false;var pendingSender=false;var pendingImageDivId=false;var pendingFullDescriptionDivId=false;var pendingSmallDescriptionDivId=false;PhotoGallery.InitPhotoGallery=initPhotoGallery;PhotoGallery.InitJsFunctions=initJsFunctions;PhotoGallery.Page_Parsed=pageParsed;PhotoGallery.Page_Unloading=pageUnloading;PhotoGallery.CloseSaveAlbumDialog=closeSaveAlbumDialog;PhotoGallery.CloseUploadPhotosDialog=closeUploadPhotosDialog;PhotoGallery.Get_SaveAction=getSaveAction;PhotoGallery.Get_SaveTitle=getSaveTitle;PhotoGallery.Get_SaveDescription=getSaveDescription;PhotoGallery.Get_SaveButton=getSaveButton;PhotoGallery.Get_DeleteButton=getDeleteButton;PhotoGallery.Get_UploadButton=getUploadButton;PhotoGallery.Get_UploadAction=getUploadAction;PhotoGallery.ProcessingButton_OnClick=processingButtonClick;PhotoGallery.DeleteButton_OnClick=deleteButtonClick;PhotoGallery.UploadButton_OnClick=uploadButtonClick;PhotoGallery.SaveButton_OnClick=saveButtonClick;PhotoGallery.ImageMenu_OnMouseOver=imageMenuMouseOver;PhotoGallery.ImageMenu_OnMouseOut=imageMenuMouseOut;PhotoGallery.MenuButton_OnMouseOver=menuButtonMouseOver;PhotoGallery.MenuButton_OnMouseOut=menuButtonMouseOut;PhotoGallery.MenuButton_OnClick=menuButtonClick;PhotoGallery.NavigateToList=navigateToList;PhotoGallery.CheckLength=checkLength;function initPhotoGallery(p){if(p.albumParam){albumParam=p.albumParam;}if(p.processingText){processingText=p.processingText;}if(p.deleteConfirmation){deleteConfirmation=p.deleteConfirmation;}if(p.deletePhotoConfirmation){deletePhotoConfirmation=p.deletePhotoConfirmation;}if(p.photosHolderId){photosHolder=WA.$(p.photosHolderId,window);}if(p.saveActionId){saveAction=WA.$(p.saveActionId,window);}if(p.titleTextBoxId){titleTextBox=WA.$(p.titleTextBoxId,window);}if(p.descriptionTextBoxId){descriptionTextBox=WA.$(p.descriptionTextBoxId,window);}if(p.saveButtonId){saveButton=WA.$(p.saveButtonId,window);}if(p.altSaveButtonId){altSaveButton=WA.$(p.altSaveButtonId,window);}if(p.saveLinkButtonId){saveLinkButton=WA.$(p.saveLinkButtonId,window);}if(p.deleteButtonId){deleteButton=WA.$(p.deleteButtonId,window);}if(p.cancelButtonId){cancelButton=WA.$(p.cancelButtonId,window);}if(p.uploadButtonId){uploadButton=WA.$(p.uploadButtonId,window);}if(p.uploadActionId){uploadAction=WA.$(p.uploadActionId,window);}if(p.viewModeRadioContainerId){viewModeRadioContainer=WA.$(p.viewModeRadioContainerId,window);}if(p.uploadButtonContainerId){uploadButtonContainer=WA.$(p.uploadButtonContainerId,window);}if(p.descriptionContainerId){descriptionContainer=WA.$(p.descriptionContainerId,window);}if(p.descriptionHeightUrlKey){descriptionHeightUrlKey=p.descriptionHeightUrlKey;}if(p.countPhotosPerRowUrlKey){countPhotosPerRowUrlKey=p.countPhotosPerRowUrlKey;}if(p.pagingUrlKey){pagingKey=p.pagingUrlKey;}}function initJsFunctions(){setDisplayInline(saveLinkButton);setDisplayInline(uploadButton);setDisplay(viewModeRadioContainer);setDisplay(uploadButtonContainer);}function pageParsed(){initJsFunctions();}function pageUnloading(){setDisabled(saveButton);setDisabled(uploadButton);setDisabled(deleteButton);if(saveLinkButton){setDisabled(saveLinkButton);setDisabled(altSaveButton);setDisabled(cancelButton);}}function setDisplay(element){if(element){element.style.display="";}}function setDisplayInline(element){if(element){element.style.display="inline";}}function setDisplayBlock(element){if(element){element.style.display="block";}}function setDisplayNone(element){if(element){element.style.display="none";}}function setDisabled(element){if(element){element.disabled=true;}}function closeSaveAlbumDialog(){PhotoAlbumsDialog.saveAlbumDialog.close();}function closeUploadPhotosDialog(){PhotoAlbumsDialog.uploadPhotosDialog.close();}function getSaveAction(){return saveAction;}function getSaveTitle(){return titleTextBox;}function getSaveDescription(){return descriptionTextBox;}function getSaveButton(){return saveButton;}function getDeleteButton(){return deleteButton;}function getUploadButton(){return uploadButton;}function getUploadAction(){return uploadAction;}function processingButtonClick(sender,otherIds){if(sender){sender.value=processingText;}
5525if(otherIds&&otherIds.length){for(var i=0;i<otherIds.length;i++){var btn=WA.$(otherIds[i],window);if(btn&&btn.id!=sender.id){btn.disabled=true;}}}return true;}function deleteButtonClick(sender,otherIds){if(confirm(deleteConfirmation)){return processingButtonClick(sender,otherIds);}return false;}function uploadButtonClick(){if(!uploadPhotosDialogInited){PhotoAlbumsDialog.uploadPhotosDialog.initialize({albumParam:albumParam});uploadPhotosDialogInited=true;}if(uploadAction.value=="1"){uploadAction.value="";if(uploadButton){uploadButton.value=processingText;}WA.reloadCurrentPage(pagingKey,window);return;}PhotoAlbumsDialog.uploadPhotosDialog.open(null,{"PhotoGallery":PhotoGallery});}function saveButtonClick(){if(!saveAlbumDialogInited){PhotoAlbumsDialog.saveAlbumDialog.initialize({albumParam:albumParam});saveAlbumDialogInited=true;}if(saveAction.value=="1"){saveAction.value="";if(saveButton){saveButton.value=processingText;}return true;}PhotoAlbumsDialog.saveAlbumDialog.open(null,{"PhotoGallery":PhotoGallery});return false;}function imageMenuMouseOver(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(photoItemTimeout&&photoItemId==imageDivId){clearTimeout(photoItemTimeout);photoItemTimeout=false;return;}if(actionIsRunning){return;}sender.parentNode.style.height=sender.offsetHeight+"px";WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhotoHover";sender.className="photoInnerContainerOver";sender.style.zIndex=sender.style.zIndex+1;var fullDescriptionDiv=WA.$(fullDescriptionDivId,window);setDisplayBlock(fullDescriptionDiv);setDisplayNone(WA.$(smallDescriptionDivId,window));if(photosHolder){photosHolderHeight=photosHolder.offsetHeight;if(!photosHolder.Y){WA.Dimensions.getXY(photosHolder);}if(!fullDescriptionDiv.Y){WA.Dimensions.getXY(fullDescriptionDiv);}var outHeigth=fullDescriptionDiv.Y+fullDescriptionDiv.offsetHeight-photosHolder.Y-photosHolderHeight;if(outHeigth>0){photosHolder.style.height=(photosHolderHeight+outHeigth+10)+"px";}}}function doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhoto";sender.className="photoInnerContainer";sender.style.zIndex=sender.style.zIndex-1;setDisplayNone(WA.$(fullDescriptionDivId,window));setDisplayBlock(WA.$(smallDescriptionDivId,window));if(photosHolderHeight&&photosHolder.offsetHeight>photosHolderHeight){photosHolder.style.height=photosHolderHeight+"px";}photoItemId=false;photoItemTimeout=false;}function imageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(actionIsRunning){if(!pendingSender){pendingSender=sender;pendingImageDivId=imageDivId;pendingFullDescriptionDivId=fullDescriptionDivId;pendingSmallDescriptionDivId=smallDescriptionDivId;}return;}if(photoItemTimeout&&photoItemId==imageDivId){return;}photoItemId=imageDivId;photoItemTimeout=setTimeout(function(){doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId);},10);}function menuButtonMouseOver(sender){sender.className="overButton";}function menuButtonMouseOut(sender){sender.className="outButton";}function menuButtonClick(linkId,secondButtonId,processingContainerId,confirmVariableName){var linkobj=WA.$(linkId,window);if(linkobj){setDisplayNone(linkobj);var secondButton=WA.$(secondButtonId,window);var processingContainer=WA.$(processingContainerId,window);setDisplayNone(secondButton);setDisplayBlock(processingContainer);if(confirmVariableName){actionIsRunning=true;if(!confirm(eval(confirmVariableName))){actionIsRunning=false;setDisplayNone(processingContainer);setDisplay(secondButton);setDisplay(linkobj);if(pendingSender){imageMenuMouseOut(pendingSender,pendingImageDivId,pendingFullDescriptionDivId,pendingSmallDescriptionDivId);pendingSender=false;}return;}}actionIsRunning=false;eval(linkobj.href.substr(11).replace(/\%20/g," ").replace(/\%22/g,'"'));}}function navigateToList(url){var descriptionHeight=(descriptionContainer)?descriptionContainer.offsetHeight:0;var countPhotosPerRow=0;if(photosHolder){var y=0;var bulets=photosHolder.getElementsByTagName("LI");for(var i=0;i<bulets.length;i++){WA.Dimensions.getXY(bulets[i]);if(i==0){y=bulets[i].Y;}else{if(y<bulets[i].Y){countPhotosPerRow=i;break;}}}}if(descriptionHeightUrlKey&&countPhotosPerRowUrlKey){var index=url.indexOf("?",0);url=index==-1?url+"?":url+"&";url+=descriptionHeightUrlKey+"="+descriptionHeight+"&"+countPhotosPerRowUrlKey+"="+countPhotosPerRow;}window.location=url;}function checkLength(e,oObject,maxLength){if(oObject.value.length<maxLength){return true;}else{var keyID=(window.event)?event.keyCode:e.keyCode;if((keyID>=37&&keyID<=40)||(keyID==8)||(keyID==46)){if(window.event){e.returnValue=true;}}else{if(window.event){e.returnValue=false;}else{e.preventDefault();}}}}})();(function(window,WA){if(!WA){return;}if(!window.PhotoAlbumsDialog){window.PhotoAlbumsDialog={};}window.PhotoAlbumsDialog.saveAlbumDialog=new WA.topWindow.BonaDialogHandler({name:"PhotoAlbumsDialog_SaveAlbumDialog",dialogParameters:{clipContainerId:"idPrimaryContentContainer",mainContainerId:"idMainContainer",directURLTemplate:"/Content/Members/PhotoGallery/CreateAlbumDialog.aspx?frameMode=0{albumParam}&version="+WA.version,reloadURLTemplate:"/Content/Members/PhotoGallery/CreateAlbumDialog.aspx?frameMode=1{albumParam}&version="+WA.version,top:null,left:null,width:500,height:290,minWidth:500,minHeight:290,isMoveable:true,isResizeable:false,isModal:true,isScrollable:true,callBackParameters:{}}});})(window,window.WA);(function(window,WA){if(!WA){return;}if(!window.PhotoAlbumsDialog){window.PhotoAlbumsDialog={};}PhotoAlbumsDialog.uploadPhotosDialog=new WA.topWindow.BonaDialogHandler({name:"PhotoAlbumsDialog_UploadPhotosDialog",dialogParameters:{clipContainerId:"idClipMainContainer",mainContainerId:"contentDiv",directURLTemplate:"/Content/Members/PhotoGallery/UploadPhotosDialog.aspx?frameMode=0{albumParam}&version="+WA.version,reloadURLTemplate:"/Content/Pictures/PhotoGallery/UploadPhotosInnerDialog.aspx?version="+WA.version+"{albumParam}",top:null,left:null,width:430,height:355,minWidth:430,minHeight:355,isMoveable:true,isResizeable:false,isModal:true,isScrollable:false,callBackParameters:{}},onDialogClose:function(){if(PhotoGallery.Get_UploadAction().value=="1"){PhotoGallery.Get_UploadButton().click();}}});})(window,window.WA);jq$(function(){if(jq$(".WaGadgetContactProfileStatePhotoGallery .editCaptionTextBox").size()){$("body").animate({scrollTop:$(".WaGadgetContactProfileStatePhotoGallery .editCaptionTextBox").offset().top},0);}});(function(){if(window.Wizard==null){window.Wizard=new Object();}Wizard.SetRadioChosen=SetRadioChosen;Wizard.SetMethosRadioChosen=SetMethosRadioChosen;Wizard.SetMethodValidate=SetMethodValidate;Wizard.SetCreditCardIsChosen=SetCreditCardIsChosen;
5525Wizard.GetCreditCardIsChosen=GetCreditCardIsChosen;Wizard.ValidateIsRadioChosen=ValidateIsRadioChosen;Wizard.ValidateIsMethodRadioChosen=ValidateIsMethodRadioChosen;Wizard.SetRadioValidatorsIds=SetRadioValidatorsIds;Wizard.DisableButtons=DisableButtonsWithTimeout;Wizard.NavigateToCreditCard=NavigateToCreditCard;Wizard.SetContainerVisibility=SetContainerVisibility;Wizard.StopWatching=StopWatching;Wizard.ShowAdminCancelDialog=ShowAdminCancelDialog;Wizard.SubstituteFormTargetIfReq=SubstituteFormTargetIfReq;var isRadioChosen=false;var isMethodRadioChosen=false;var isMethodValidate=false;var isCreditCardChosen=false;var radioValidatorId=false;var radioMethodValidatorId=false;function SetRadioChosen(){isRadioChosen=true;if(radioValidatorId){ValidatorValidate(document.getElementById(radioValidatorId));}else{Page_ClientValidate("WizardValidationGroup");}if(radioMethodValidatorId){ValidatorValidate(document.getElementById(radioMethodValidatorId));}}function SetMethosRadioChosen(){isMethodRadioChosen=true;if(radioValidatorId){ValidatorValidate(document.getElementById(radioValidatorId));}if(radioMethodValidatorId){ValidatorValidate(document.getElementById(radioMethodValidatorId));}}function validateRados(){}function SetMethodValidate(isValidate){isMethodValidate=isValidate;}function SetCreditCardIsChosen(isChosen){isCreditCardChosen=isChosen;}function GetCreditCardIsChosen(){return isCreditCardChosen;}function ValidateIsRadioChosen(sender,args){args.IsValid=isRadioChosen;}function ValidateIsMethodRadioChosen(sender,args){args.IsValid=!isMethodValidate||isMethodRadioChosen;}function SetRadioValidatorsIds(radioValidatorClientId,radioMethodValidatorClientId){radioValidatorId=radioValidatorClientId;radioMethodValidatorId=radioMethodValidatorClientId;}function DisableButtonsWithTimeout(){if(typeof(Page_ValidationActive)!="undefined"&&Page_ValidationActive&&Page_IsValid==false){return;}var ids=arguments;setTimeout(function(){DisableButtons(ids);},50);}function NavigateToCreditCard(url){document.body.style.display="none";WA.topWindow.location=url;}function DisableButtons(ids){if(!ids){return;}for(i=0;i<ids.length;i++){var elemToDisable=document.getElementById(ids[i]);if(elemToDisable){elemToDisable.disabled=true;}}}function SetContainerVisibility(containerId,visible){var container=document.getElementById(containerId);if(!container){return;}container.style.display=visible?"block":"none";}function StopWatching(){if(window.DataChangeWatcher){DataChangeWatcher.pauseWatching();}if(window.Page_ClientValidate){Page_ClientValidate("WizardValidationGroup");}var resumeWatching=false;if(window.Page_IsValid){resumeWatching=!Page_IsValid;}if(window.DataChangeWatcher&&resumeWatching){DataChangeWatcher.resumeWatching();}}function ShowAdminCancelDialog(text){if(!confirm(text)){return false;}return true;}function SubstituteFormTargetIfReq(){var planRadiosContainer=document.getElementById("idPlansContainer");var selectedPlanId=getSelectedRadioAttrVal(planRadiosContainer.getElementsByTagName("INPUT"),"planId");var selectedSubscriptionPeriod=getSelectedSubscriptionPeriod();if(selectedPlanId==0||selectedPlanId==null){return;}var shouldSubstituteTarget=false;var wasFreePlanChoosen=selectedPlanId==freePlanId;var payOutstandingBalanceNowRadio=document.getElementById(payOutstandingBalanceNowId);var newCreditCardRadio=document.getElementById(newCreditCardRadioId);var shouldPayOutstandingAmountNow=wasFreePlanChoosen&&isAccountOverdue&&payOutstandingBalanceNowRadio&&payOutstandingBalanceNowRadio.checked;var isSelectedPeriodAnnualInvoice=selectedSubscriptionPeriod==3;if(isSelectedPeriodAnnualInvoice){shouldSubstituteTarget=false;}else{if(!isCurrentPlanChargeable){shouldSubstituteTarget=true;}else{var shouldEnterNewCard=wasFreePlanChoosen?shouldPayOutstandingAmountNow:(newCreditCardRadio&&newCreditCardRadio.checked)||isBillingInfoEmpty;shouldSubstituteTarget=shouldEnterNewCard;}}if(shouldSubstituteTarget){document.getElementById(formClientId).target="_top";}}function getSelectedSubscriptionPeriod(){var selectedMethodId=0;var paymentMethodRadiosContainer=document.getElementById("idPaymentMethodsContainer");if(paymentMethodRadiosContainer){var paymentMethodRadios=paymentMethodRadiosContainer.getElementsByTagName("INPUT");selectedMethodId=getSelectedRadioAttrVal(paymentMethodRadiosContainer.getElementsByTagName("INPUT"),"methodId");}return selectedMethodId;}function getSelectedRadioAttrVal(radios,attrName){for(var i=0;i<radios.length;i++){if(radios[i].checked){return radios[i].getAttribute(attrName);}}}})();(function(){if(!window.MemberPublicProfilePhotoGallery){window.MemberPublicProfilePhotoGallery={};}var albumParam="";var processingText="Please wait...";var deleteConfirmation="Are you sure you want to delete?";var deletePhotoConfirmation="Are you sure you want to delete this photo?";var saveAction=false;var photosHolder=false;
5525var photosHolderHeight=false;var titleTextBox=false;var descriptionTextBox=false;var saveButton=false;var altSaveButton=false;var saveLinkButton=false;var deleteButton=false;var cancelButton=false;var uploadButton=false;var uploadAction=false;var viewModeRadioContainer=false;var uploadButtonContainer=false;var descriptionContainer=false;var descriptionHeightUrlKey=false;var countPhotosPerRowUrlKey=false;var pagingKey=false;var saveAlbumDialogInited=false;var uploadPhotosDialogInited=false;var photoItemId=false;var photoItemTimeout=false;var actionIsRunning=false;var pendingSender=false;var pendingImageDivId=false;var pendingFullDescriptionDivId=false;var pendingSmallDescriptionDivId=false;MemberPublicProfilePhotoGallery.InitPhotoGallery=initPhotoGallery;MemberPublicProfilePhotoGallery.ImageMenu_OnMouseOver=imageMenuMouseOver;MemberPublicProfilePhotoGallery.ImageMenu_OnMouseOut=imageMenuMouseOut;MemberPublicProfilePhotoGallery.NavigateToList=navigateToList;MemberPublicProfilePhotoGallery.CheckLength=checkLength;function initPhotoGallery(p){if(p.albumParam){albumParam=p.albumParam;}if(p.processingText){processingText=p.processingText;}if(p.deleteConfirmation){deleteConfirmation=p.deleteConfirmation;}if(p.deletePhotoConfirmation){deletePhotoConfirmation=p.deletePhotoConfirmation;}if(p.photosHolderId){photosHolder=WA.$(p.photosHolderId,window);}if(p.saveActionId){saveAction=WA.$(p.saveActionId,window);}if(p.titleTextBoxId){titleTextBox=WA.$(p.titleTextBoxId,window);}if(p.descriptionTextBoxId){descriptionTextBox=WA.$(p.descriptionTextBoxId,window);}if(p.saveButtonId){saveButton=WA.$(p.saveButtonId,window);}if(p.altSaveButtonId){altSaveButton=WA.$(p.altSaveButtonId,window);}if(p.saveLinkButtonId){saveLinkButton=WA.$(p.saveLinkButtonId,window);}if(p.deleteButtonId){deleteButton=WA.$(p.deleteButtonId,window);}if(p.cancelButtonId){cancelButton=WA.$(p.cancelButtonId,window);}if(p.uploadButtonId){uploadButton=WA.$(p.uploadButtonId,window);}if(p.uploadActionId){uploadAction=WA.$(p.uploadActionId,window);}if(p.viewModeRadioContainerId){viewModeRadioContainer=WA.$(p.viewModeRadioContainerId,window);}if(p.uploadButtonContainerId){uploadButtonContainer=WA.$(p.uploadButtonContainerId,window);}if(p.descriptionContainerId){descriptionContainer=WA.$(p.descriptionContainerId,window);}if(p.descriptionHeightUrlKey){descriptionHeightUrlKey=p.descriptionHeightUrlKey;}if(p.countPhotosPerRowUrlKey){countPhotosPerRowUrlKey=p.countPhotosPerRowUrlKey;}if(p.pagingUrlKey){pagingKey=p.pagingUrlKey;}}function setDisplay(element){if(element){element.style.display="";}}function setDisplayInline(element){if(element){element.style.display="inline";}}function setDisplayBlock(element){if(element){element.style.display="block";}}function setDisplayNone(element){if(element){element.style.display="none";}}function setDisabled(element){if(element){element.disabled=true;}}function imageMenuMouseOver(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(photoItemTimeout&&photoItemId==imageDivId){clearTimeout(photoItemTimeout);photoItemTimeout=false;return;}if(actionIsRunning){return;}sender.parentNode.style.height=sender.offsetHeight+"px";WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhotoHover";sender.className="photoInnerContainerOver";sender.style.zIndex=sender.style.zIndex+1;var fullDescriptionDiv=WA.$(fullDescriptionDivId,window);setDisplayBlock(fullDescriptionDiv);setDisplayNone(WA.$(smallDescriptionDivId,window));if(photosHolder){photosHolderHeight=photosHolder.offsetHeight;if(!photosHolder.Y){WA.Dimensions.getXY(photosHolder);}if(!fullDescriptionDiv.Y){WA.Dimensions.getXY(fullDescriptionDiv);}var outHeigth=fullDescriptionDiv.Y+fullDescriptionDiv.offsetHeight-photosHolder.Y-photosHolderHeight;if(outHeigth>0){photosHolder.style.height=(photosHolderHeight+outHeigth+10)+"px";}}}function doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){WA.$(imageDivId,window).className="photoAlbumItemThumbnailPhoto";sender.className="photoInnerContainer";sender.style.zIndex=sender.style.zIndex-1;setDisplayNone(WA.$(fullDescriptionDivId,window));setDisplayBlock(WA.$(smallDescriptionDivId,window));
5525if(photosHolderHeight&&photosHolder.offsetHeight>photosHolderHeight){photosHolder.style.height=photosHolderHeight+"px";}photoItemId=false;photoItemTimeout=false;}function imageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId){if(actionIsRunning){if(!pendingSender){pendingSender=sender;pendingImageDivId=imageDivId;pendingFullDescriptionDivId=fullDescriptionDivId;pendingSmallDescriptionDivId=smallDescriptionDivId;}return;}if(photoItemTimeout&&photoItemId==imageDivId){return;}photoItemId=imageDivId;photoItemTimeout=setTimeout(function(){doImageMenuMouseOut(sender,imageDivId,fullDescriptionDivId,smallDescriptionDivId);},10);}function navigateToList(url){var descriptionHeight=(descriptionContainer)?descriptionContainer.offsetHeight:0;var countPhotosPerRow=0;if(photosHolder){var y=0;var bulets=photosHolder.getElementsByTagName("LI");for(var i=0;i<bulets.length;i++){WA.Dimensions.getXY(bulets[i]);if(i==0){y=bulets[i].Y;}else{if(y<bulets[i].Y){countPhotosPerRow=i;break;}}}}if(descriptionHeightUrlKey&&countPhotosPerRowUrlKey){var index=url.indexOf("?",0);url=index==-1?url+"?":url+"&";url+=descriptionHeightUrlKey+"="+descriptionHeight+"&"+countPhotosPerRowUrlKey+"="+countPhotosPerRow;}window.location=url;}function checkLength(e,oObject,maxLength){if(oObject.value.length<maxLength){return true;}else{var keyID=(window.event)?event.keyCode:e.keyCode;if((keyID>=37&&keyID<=40)||(keyID==8)||(keyID==46)){if(window.event){e.returnValue=true;}}else{if(window.event){e.returnValue=false;}else{e.preventDefault();}}}}})();(function(window,WA,undefined){if(!window.WaOnlineStoreCart){window.WaOnlineStoreCart=OnlineStoreCart;}function OnlineStoreCart(){var service=new WaOnlineStoreCartService(),self=this;self.add=add;self.get=get;self.load=load;self.remove=remove;self.setQuantity=setQuantity;self.getService=getService;function add(productId,variantId,quantity){return service.addProduct(productId,variantId,quantity);}function getService(){return service;}function get(productId,variantId){return service.getProduct(productId,variantId);}function load(){return service.loadCurrent();}function remove(productId,variantId){return service.removeProduct(productId,variantId);}function setQuantity(productId,variantId,quantity){return service.setQuantity(productId,variantId,quantity);}}var instance;OnlineStoreCart.getInstance=function(){return instance||(instance=new OnlineStoreCart());};OnlineStoreCart.load=function(initModel){var cart=this.getInstance(initModel);return cart.load();};})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCartGateway){window.WaOnlineStoreCartGateway=OnlineStoreCartGateway;}function OnlineStoreCartGateway(){var self=this;self.addProduct=addProduct;self.loadCurrent=loadCurrent;self.recalculateCurrent=recalculateCurrent;function addProduct(model){return WA.Ajax({contentType:"application/json; charset=utf-8",data:JSON.stringify(model),dataType:"json",processData:false,type:"POST",url:"/Sys/Store/Cart/Add"});}function loadCurrent(){return WA.Ajax({dataType:"json",type:"GET",url:"/Sys/Store/Cart/Current"});}function transformCartModel(oldCartModel){var newCart=jq$.extend(true,{},oldCartModel);jq$.each(newCart.items,function(i,item){delete item.price;delete item.title;delete item.total;delete item.pictureUrl;});delete newCart.total;return newCart;}function recalculateCurrent(model,deliveryOptionId){var url="/Sys/Store/Cart/RecalculateCart";if(deliveryOptionId){url=url+"?deliveryOptionId="+deliveryOptionId;}return WA.Ajax({contentType:"application/json; charset=utf-8",data:JSON.stringify(transformCartModel(model)),dataType:"json",processData:false,type:"POST",url:url});}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCartLayout){window.WaOnlineStoreCartLayout=OnlineStoreCartLayout;}function OnlineStoreCartLayout(service,initModel){var container=document.getElementById("cartLayout"),self=this;var productDetailsUrl="/Sys/ProductDetails",currencySymbol="$",currency="USD";self.render=render;self.onError=onError;var isSaveFailed=null;var isDisabled=null;var checkoutURL="/Sys/Store/Checkout";init();resetViewStates();
5525function init(){jq$(container).on("input",".storeCartTable_tdQuantity input",onProductQuantityInput);jq$(container).on("click",".storeCartTable_deleteButton",onProductDelete);jq$(container).on("click",".quantitySnippet .quantity-button",onProductQuantityUpDown);jq$(container).on("click",".storeCartControlNav__back",onBackToShopping);jq$(container).on("click",".toCheckout",onCheckout);service.savingStart=onSavingStart;}function onBackToShopping(){window.history.go(-1);return false;}function onCheckout(){window.location.href=checkoutURL;}function resetViewStates(){isSaveFailed=false;isDisabled=false;}function render(model){container.innerHTML=model.items&&model.items.length>0?renderTable(model):renderEmpty();}function renderEmpty(){var html=[];if(isSaveFailed){html.push(renderGeneralError());}html.push('<div class="emptyCartContainer">');html.push('<div class="emptyCartIcon2"></div>');html.push('<p class="emptyCartMessage">Your cart is empty.</p>');html.push("</div>");return html.join("");}function renderTable(model){var html=[];if(isSaveFailed){html.push(renderGeneralError());}html.push('<table class="storeCartTable">');html.push(renderItems(model.items));html.push(renderTotal(model));html.push("</table>");html.push(renderControlNav());return html.join("");}function renderItems(items){var html=[],i,length=items.length;for(i=0;i<length;i++){html.push(renderItem(items[i]));}return html.join("");}function renderItem(item){var html=[];html.push('<tr class="storeCartTable_row" data-product-id="',item.productId,'" data-variant-id="',item.variantId,'">');html.push('<td class="storeCartTable_tdImage">',renderImage(item),"</td>");html.push('<td class="storeCartTable_tdTitle">');html.push('<a href="',getItemUrl(item.productId,item.variantId),'">',BonaPage.encodeHtml(item.title),"</a>");html.push(renderOptions(item));html.push("</td>");html.push('<td class="storeCartTable_tdPprice">',renderPrice(item.price),"</td>");html.push('<td class="storeCartTable_tdQuantity">');html.push('<div class="quantitySnippet">');if(item.productType==="DIGITAL"||item.productType==="ECOURSE"){html.push('<span class="typeNumber">'+item.quantity+"</span>");}else{html.push("<input ",(isDisabled&&'disabled="disabled"'),' class="typeNumber" min="1" size="2" type="number" value="',item.quantity,'">');html.push('<div class="quantity-button quantity-down">&nbsp;</div><div class="quantity-button quantity-up">&nbsp;</div>');}html.push("</div>");html.push("</td>");html.push('<td class="storeCartTable_tdAmount">',renderPrice(item.total),"</td>");html.push('<td class="storeCartTable_tdDelete">');html.push('<button title="Remove item" class="storeCartTable_deleteButton"></button>');html.push("</td>");html.push("</tr>");return html.join("");}function renderOption(option){return'<div class="storeCartTable_itemOption">'+BonaPage.encodeHtml(option.title)+": "+BonaPage.encodeHtml(option.value)+"</div>";}function renderOptions(item){if(!item.options){return"";}return jq$.map(item.options,function(option,i){return renderOption(option);}).join("");}function renderImage(item){var html=[];if(item.pictureUrl){html.push('<a class="storeCartTable_img" href="',getItemUrl(item.productId,item.variantId),'">');html.push('<img src="',item.pictureUrl,'" width="100"/></a>');}else{html.push('<div class="storeCartTable_img storeCartTable_no_img" title="No photo"></div>');}return html.join("");}function getItemUrl(productId,variantId){return initModel.productDetailsUrl+"/"+productId;}function renderPrice(price){if(initModel.currencySymbol){return'<span class="priceContainer">'+initModel.currencySymbol+price.toFixed(2)+"</span>";}else{return'<span class="priceContainer">'+price.toFixed(2)+" "+initModel.currency+"</span>";}}function renderTotal(model){var html=[];var total=model.total;var subTotal=model.subTotal;var isTaxesApplied=model.isTaxesApplied||false;var isTaxesIncludedTotal=model.isTaxesIncludedTotal||false;var taxes=model.taxes||[];if(initModel.taxesEnable&&isTaxesApplied&&!isTaxesIncludedTotal){html.push('<tr class="storeCartSubTotalInfoRowFirst">');html.push('<td colspan="4" class="storeCartTable_totalLabel">Subtotal:</td>');if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,subTotal.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',subTotal.toFixed(2)," ",initModel.currency,"</td>");}html.push('<td class="storeCartTable_totalValue"></td>');html.push("</tr>");html.push(renderTaxes(taxes,isTaxesIncludedTotal));}if(total||total===0){if(!isTaxesIncludedTotal){html.push('<tr class="storeCartTotal storeCartTotalInfoRow">');}else{html.push('<tr class="storeCartTotal storeCartTotalInfoRowFirst">');}html.push('<td colspan="4" class="storeCartTable_totalLabel">Total:</td>');if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,total.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',total.toFixed(2)," ",initModel.currency,"</td>");}html.push('<td class="storeCartTable_totalValue"></td>');html.push("</tr>");}if(initModel.taxesEnable&&isTaxesApplied&&isTaxesIncludedTotal){html.push(renderTaxes(taxes,isTaxesIncludedTotal));}return html.join("");}function renderTaxes(taxes,isTaxesIncludedTotal){var html=[];for(var taxIndex in taxes){var tax=taxes[taxIndex];var taxLabel=tax.title+":";if(isTaxesIncludedTotal){taxLabel="Incl."+tax.title+":";}html.push('<tr class="storeCartTotalInfoRow">');html.push('<td colspan="4" class="storeCartTable_totalLabel">',taxLabel,"</td>");if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,tax.amount.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',tax.amount.toFixed(2)," ",initModel.currency,"</td>");}html.push('<td class="storeCartTable_totalValue"></td>');html.push("</tr>");}return html.join("");}function renderControlNav(){var html=[];html.push('<div class="storeCartControlNav">');html.push('<div class="storeCartControlNav_left">');html.push('<a href="#" class="storeCartControlNav__back">Continue shopping</a>');html.push("</div>");html.push('<div class="storeCartControlNav_right">');html.push("<input ",(isDisabled&&'disabled="disabled"'),' type="button" name="continue" value="Proceed to checkout" class="functionalButton toCheckout">');html.push("</div>");html.push("</div>");return html.join("");}function renderGeneralError(){var html=[];html.push('<div class="noticeBox boxTypeError">');html.push('<div class="text">');html.push("Cannot complete operation. Please try again later or contact administrator");html.push("</div>");html.push("</div>");return html.join("");}function onError(cart){isSaveFailed=true;render(cart);resetViewStates();}function onSaved(cart){render(cart);resetViewStates();}function onSavingStart(cart){isDisabled=true;render(cart);resetViewStates();}function onProductDelete(){if(isDisabled){return;}var sender=jq$(this),productId=sender.closest(".storeCartTable_row").data("productId"),variantId=sender.closest(".storeCartTable_row").data("variantId");service.removeProduct(productId,variantId).done(onSaved).fail(onError);}function onProductQuantityInput(){var sender=jq$(this),productId=sender.closest(".storeCartTable_row").data("productId"),variantId=sender.closest(".storeCartTable_row").data("variantId"),quantity=+sender.val(),min=+sender.attr("min");
5525if(quantity<=min){quantity=min;}service.setQuantity(productId,variantId,quantity).done(onSaved).fail(onError);}function onProductQuantityUpDown(){var sender=jq$(this),input=sender.closest(".quantitySnippet").find("input"),value=+input.val();value+=sender.hasClass("quantity-up")?1:-1;input.val(value).trigger("input");}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCartService){window.WaOnlineStoreCartService=OnlineStoreCartService;}function OnlineStoreCartService(){var cache={},cacheKey={cart:"OnlineStoreCart"},defaultSaveDelay=400,delayedSave,delayedSaveTimerId,gateway=new WaOnlineStoreCartGateway(),self=this;self.addProduct=addProduct;self.getProduct=getProduct;self.loadCurrent=loadCurrent;self.removeProduct=removeProduct;self.setQuantity=setQuantity;self.savingStart=null;self.savingCompleted=null;self.resetCart=resetCart;self.localLoad=localLoad;self.saveWithDelay=saveWithDelay;self.saveInCache=saveInCache;cache.get=function(key){var serialized=WA.Storage.read(key);if(typeof serialized!=="string"){return undefined;}try{return JSON.parse(serialized);}catch(e){console.log(e);return serialized||undefined;}};cache.remove=function(key){WA.Storage.del(key);};cache.set=function(key,value){var serialized=JSON.stringify(value);try{WA.Storage.write(key,serialized);}catch(e){console.log(e);}};function onSavingStart(cart){if(typeof self.savingStart==="function"){self.savingStart(cart);}}function onSavingCompleted(cart){if(typeof self.savingCompleted==="function"){self.savingCompleted(cart);}}function resetCart(){cache.remove(cacheKey.cart);}function addProduct(productId,variantId,quantity){var cart=cache.get(cacheKey.cart),cartItems,i,productNotFound=true;variantId=variantId||undefined;quantity=validateQuantity(quantity,1);if(cart){cartItems=cart.items;for(i=0,productNotFound=true;i<cartItems.length;i++){if(cartItems[i].productId===productId&&cartItems[i].variantId==variantId){cartItems[i].quantity+=quantity;productNotFound=false;break;}}if(productNotFound){cartItems.push({productId:productId,variantId:variantId,quantity:quantity});}return gateway.recalculateCurrent(cart).done(saveInCache);}return gateway.addProduct({productId:productId,variantId:variantId,quantity:quantity}).done(saveInCache);}function getProduct(productId,variantId){var cart=cache.get(cacheKey.cart),cartItems,i;variantId=variantId||undefined;if(cart){cartItems=cart.items;for(i=0;i<cartItems.length;i++){if(cartItems[i].productId===productId&&cartItems[i].variantId==variantId){return cartItems[i];}}}return null;}function localLoad(){var cart=cache.get(cacheKey.cart);return cart;}function loadCurrent(deliveryOptionId){var cart=cache.get(cacheKey.cart);if(cart){return gateway.recalculateCurrent(cart,deliveryOptionId).done(saveInCache);}return gateway.loadCurrent().done(saveInCache);}function removeProduct(productId,variantId){var cart=cache.get(cacheKey.cart),cartItems,i;variantId=variantId||undefined;cartItems=cart.items;for(i=cartItems.length-1;i>=0;i--){if(cartItems[i].productId===productId&&cartItems[i].variantId==variantId){cartItems.splice(i,1);break;}}return saveWithDelay(cart);}function setQuantity(productId,variantId,quantity){var cart=cache.get(cacheKey.cart),cartItems,i;variantId=variantId||undefined;cartItems=cart.items;quantity=validateQuantity(quantity,0);for(i=0;i<cartItems.length;i++){if(cartItems[i].productId===productId&&cartItems[i].variantId==variantId){cartItems[i].quantity=quantity;break;}}return saveWithDelay(cart);}function save(cart){return gateway.recalculateCurrent(cart);}function saveInCache(cart){onSavingCompleted(cart);cache.set(cacheKey.cart,cart);}function saveWithDelay(cart,delay){var deferred;if(delayedSave&&delayedSave.state()==="pending"){deferred=jq$.Deferred();}else{deferred=delayedSave=jq$.Deferred().done(saveInCache);}clearTimeout(delayedSaveTimerId);delayedSaveTimerId=setTimeout(function(){onSavingStart(cart);save(cart).done(function(cart){delayedSave.resolve(cart);}).fail(function(error){delayedSave.reject(cache.get(cacheKey.cart),error);});},delay||defaultSaveDelay);return deferred;}function validateQuantity(quantity,quantityMinimum){quantity=+quantity;return quantity<quantityMinimum||isNaN(quantity)?quantityMinimum:quantity;}}})(window,window.WA);(function(window,WA,undefined){if(!window.InventoryIssuesHelper){window.InventoryIssuesHelper=new InventoryIssuesHelper();}function InventoryIssuesHelper(){this.hasInventoryIssues=hasInventoryIssues;this.getInventoryIssue=getInventoryIssue;function hasInventoryIssues(item,issues){return getInventoryIssue(item,issues)!=null;}function getInventoryIssue(item,issues){var _issues=$.grep(issues,function(obj){return(obj.productId===item.productId&&obj.variantId===item.variantId);});return _issues.length>0?_issues[0]:null;}}})(window,window.WA);(function(window,WA,undefined){if(!window.InventoryIssuesStepTableRenderer){window.InventoryIssuesStepTableRenderer=InventoryIssuesStepTableRenderer;}function InventoryIssuesStepTableRenderer(){this.render=render;function render(model){return confirmationRenderTable(model);}function confirmationRenderTable(model){var html=[];html.push('<table class="storeCartTable">');html.push(confirmationRenderItems(model.items,model.issues));html.push("</table>");return html.join("");}function confirmationRenderItems(items,issues){var html=[],i,length=items.length;for(i=0;i<length;i++){if(InventoryIssuesHelper.hasInventoryIssues(items[i],issues)){html.push(confirmationRenderItem(items[i],issues));}}return html.join("");}function confirmationRenderItem(item,issues){var html=[];html.push('<tr class="storeCartTable_row',item.isDeleted?" storeCartTable_rowDeleted":"",'">');html.push('<td class="storeCartTable_tdImage">',renderImage(item),"</td>");html.push('<td class="storeCartTable_tdTitle">');html.push('<div class="storeCartTable_itemTitle">',item.title,"</div>");html.push(renderOptions(item));html.push("</td>");html.push('<td class="storeCartTable_tdInventoryIssue" align="right">',renderInventoryIssues(item,issues),"</td>");html.push('<td class="storeCartTable_tdDelete">');if(!item.isDeleted){html.push('<button title="Remove item" class="storeCartTable_deleteButton" item-productId="',item.productId,'" item-variantId="',item.variantId,'"></button>');}html.push("</td>");html.push("</tr>");return html.join("");}function renderOptions(item){if(!item.options){return"";}return jq$.map(item.options,function(option,i){return renderOption(option);}).join("");}function renderOption(option){return'<div class="storeCartTable_itemOption">'+BonaPage.encodeHtml(option.title)+": "+BonaPage.encodeHtml(option.value)+"</div>";}function renderImage(item){var html=[];
5525if(item.pictureUrl){html.push('<img src="',item.pictureUrl,'" width="100"/>');}else{html.push('<div class="storeCartTable_img storeCartTable_no_img" title="No photo"></div>');}return html.join("");}function renderInventoryIssues(item,issues){if(item.isDeleted){return"<div>Deleted</div>";}var html=[];var issue=$.grep(issues,function(obj){return(obj.productId===item.productId&&obj.variantId===item.variantId);})[0];switch(issue.type){case"NOTENOUGH":html.push('<div class="storeCartTable_itemInventoryIssue_notEnough">'+issue.quantity+" -> only "+issue.stock+" left</div>");break;case"OUTOFSTOCK":html.push('<div class="storeCartTable_itemInventoryIssue_outOfStock">Out of stock</div>');break;default:throw ({"message":"Invalid issue type","productId":item.productId,"variantId":item.variantId});}return html.join("");}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckout){window.WaOnlineStoreCheckout=OnlineStoreCheckout;}var SHIPPING="SHIPPING",PICKUP="PICKUP";var DELIVERY_OPTION_TYPES={};DELIVERY_OPTION_TYPES[SHIPPING]=SHIPPING;DELIVERY_OPTION_TYPES[PICKUP]=PICKUP;window.WaOnlineStoreCheckout.SHIPPING=SHIPPING;window.WaOnlineStoreCheckout.PICKUP=PICKUP;window.WaOnlineStoreCheckout.DELIVERY_OPTION_TYPES=DELIVERY_OPTION_TYPES;function OnlineStoreCheckout(){var serviceCart=WaOnlineStoreCart.getInstance().getService(),serviceCheckout=new WaOnlineStoreCheckoutService(serviceCart),self=this;self.getService=getService;function getService(){return serviceCheckout;}}var instance;OnlineStoreCheckout.getInstance=function(){return instance||(instance=new OnlineStoreCheckout());};OnlineStoreCheckout.load=function(){return WaOnlineStoreCart.getInstance().load();};})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutGateway){window.WaOnlineStoreCheckoutGateway=OnlineStoreCheckoutGateway;}function OnlineStoreCheckoutGateway(){var self=this;self.invoiceMe=invoiceMe;self.payOnline=payOnline;self.bankTransfer=bankTransfer;self.freeOrder=freeOrder;self.checkEmail=checkEmail;function payRequest(url,model){return WA.Ajax({contentType:"application/json; charset=utf-8",data:JSON.stringify(model),dataType:"json",processData:false,type:"POST",url:url});}function invoiceMe(model){return payRequest("/Sys/Store/Checkout/InvoiceMe",model);}function payOnline(model){return payRequest("/Sys/Store/Checkout/PayOnline",model);}function bankTransfer(model){return payRequest("/Sys/Store/Checkout/BankTransfer",model);}function freeOrder(model){return payRequest("/Sys/Store/Checkout/FreeOrder",model);}function checkEmail(model){return WA.Ajax({contentType:"application/json; charset=utf-8",data:JSON.stringify(model),dataType:"json",processData:false,type:"POST",url:"/Sys/Store/Checkout/CheckEmail"});}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutLayout){window.WaOnlineStoreCheckoutLayout=OnlineStoreCheckoutLayout;}function OnlineStoreCheckoutLayout(serviceCheckout,serviceCart,opts){var self=this,isAuthorized=opts.isAuthorized,initModel=opts.initModel,checkEmptyCart=opts.checkEmptyCart,checkCartIssues=opts.checkCartIssues,step1,step2,step3,inventoryIssuesStep,wizard,checkoutContentContainer=jq$("#OnlineStoreCheckout_content_container"),wizardContainer=document.getElementById("idCheckoutWizardContainer"),deliveryEnable=initModel.deliveryEnable,deliveryOptions=initModel.deliveryOptions;if(!initModel){throw (new Error("Not define initModel in layout opts"));}if(!checkEmptyCart){throw (new Error("Not define checkEmptyCart in layout opts"));}if(!wizardContainer){return;}self.render=render;self.showContainer=showContainer;init();function init(){jq$(wizardContainer).on("click",".wizardBackButton",onPressWizardBackButton);jq$(wizardContainer).on("click",".wizardNextButton",onPressWizardNextButton);jq$(wizardContainer).on("showStep",onShowWizardStep);step1=new WaOnlineStoreCheckoutLayoutStep1(serviceCheckout,isAuthorized);step2=new WaOnlineStoreCheckoutLayoutStep2(serviceCheckout,initModel);step3=new WaOnlineStoreCheckoutLayoutStep3(serviceCheckout,initModel);step3.onOrderCreateFailed(onOrderCreateFailed);inventoryIssuesStep=new OnlineStoreCheckoutLayoutInventoryIssuesStep(serviceCheckout,serviceCart);inventoryIssuesStep.onUpdateAndContinueClick(onUpdateAndContinueClick);wizard=new WaBasicWizard({element:wizardContainer,stepsBarContainer:"h1.stepsContainer",selected:0,showStepURLhash:true});if(isDisableDelivery()){jq$(".stepsContainer").addClass("stepsContainer_withoutDelivery");}}function showContainer(){checkoutContentContainer.show();}function render(){step1.render();step2.render();step3.render();inventoryIssuesStep.render();checkCartHasIssues();}function onSuccessCheckEmail(model){if(model.IsEmailExists===null||!model.IsEmailExists){step1.saveContactModel().done(function(){step1.deactivatePreload();if(isSkipDeliveryStep()){wizard.next();}wizard.next();}).fail(function(){step1.deactivatePreload();step1.checkEmailFailedRender();});}else{step1.deactivatePreload();step1.emailExistErrorRender();return;}}function onFailureCheckEmail(error){console.log(error.message||"check email: Fail");step1.deactivatePreload();step1.checkEmailFailedRender();wizard.next();}function isDisableDelivery(){var card=serviceCart.localLoad()||{};var items=card.items||[];var isAllProductsDigital=items.length>0&&items.filter(function(item){return item.productType==="DIGITAL";}).length===items.length;return(deliveryOptions.length===0&&deliveryEnable)||isAllProductsDigital;}function isSkipDeliveryStep(){var isDisableDeliveryStep=(wizard.getStep()===2||wizard.getStep()===0);return(isDisableDelivery()&&isDisableDeliveryStep);}function onPressWizardBackButton(e){e.preventDefault();if(checkEmptyCart()){return;}if(wizard.getStep()===2&&checkCartHasIssues()){return false;}if(isSkipDeliveryStep()){wizard.prev();}wizard.prev();if(wizard.getStep()===0){step1.render();}if(wizard.getStep()===1){step2.render();}return false;}function onPressWizardNextButton(e){e.preventDefault();if(checkEmptyCart()){return false;}var inventoryIssuesStep=1;if(isDisableDelivery()){inventoryIssuesStep=0;}if(wizard.getStep()===inventoryIssuesStep&&checkCartHasIssues()){return false;}if(wizard.getStep()===0){step1.activatePreload();step1.checkEmail().done(onSuccessCheckEmail).fail(onFailureCheckEmail);}if(wizard.getStep()===1){step2.saveForm().done(function(){wizard.next();}).fail(function(){renderGeneralError();});return false;}return false;}function renderGeneralError(){}function onShowWizardStep(e,anchorObject,stepNumber,stepDirection,stepPosition){if(stepNumber===2){step3.render();}}function onOrderCreateFailed(data){window.location.reload();}function onUpdateAndContinueClick(e){checkCartHasIssues();}function checkCartHasIssues(){var cart=serviceCart.localLoad()||{};if(cart.isValid){inventoryIssuesStep.hide();wizardContainer.style.display="block";if(wizard.getStep()===2){step3.render();}}else{inventoryIssuesStep.render();inventoryIssuesStep.show();wizardContainer.style.display="none";}return !cart.isValid;}}})(window,window.WA);(function(window,WA,undefined){if(!window.OnlineStoreCheckoutLayoutInventoryIssuesStep){window.OnlineStoreCheckoutLayoutInventoryIssuesStep=OnlineStoreCheckoutLayoutInventoryIssuesStep;}function OnlineStoreCheckoutLayoutInventoryIssuesStep(service,serviceCart){var formName="form_invetory_issues",container=document.getElementById("step-inventoryIssues"),tableContainer=document.getElementById("step-inventoryIssues-tableContainer"),tableRenderer=new InventoryIssuesStepTableRenderer(),$container=jq$(container),form=jq$("form[name="+formName+"]"),updateAndContinueEventName="CheckoutInventoryIssueUpdateAndContinueClick",
5525self=this,validator,model;self.render=render;self.updateAndContinue=updateAndContinue;self.deleteProduct=deleteProduct;self.show=show;self.hide=hide;self.onUpdateAndContinueClick=onUpdateAndContinueClick;init();function init(){service.getConfirmModel().done(function(confirmModel){model=jq$.extend(true,{},confirmModel.cart);});}function show(){container.style.display="block";}function hide(){container.style.display="none";}function render(){service.getConfirmModel().done(function(confirmModel){model=model?model:jq$.extend(true,{},confirmModel.cart);tableContainer.innerHTML=tableRenderer.render(model);jq$("button.storeCartTable_deleteButton",tableContainer).click(deleteProduct);});jq$("#idUpdateAndContinueButton",container).click(updateAndContinue);}function deleteProduct(e){var productId=e.target.getAttribute("item-productId"),variantId=e.target.getAttribute("item-variantId");if(variantId==""){variantId=null;}var itemsToDelete=jq$.grep(model.items,function(el,idx){return el.productId==productId&&el.variantId==variantId;});for(var i=itemsToDelete.length-1;i>=0;i--){itemsToDelete[i].isDeleted=true;}render();}function updateAndContinue(){model.items=$.grep(model.items,function(obj){return obj.isDeleted;},true);for(var i=model.items.length-1;i>=0;i--){var item=model.items[i];if(InventoryIssuesHelper.hasInventoryIssues(item,model.issues)){var issue=InventoryIssuesHelper.getInventoryIssue(item,model.issues);switch(issue.type){case"NOTENOUGH":model.items[i].quantity=issue.stock;break;case"OUTOFSTOCK":model.items[i]=null;break;default:throw ({"message":"Invalid issue type","productId":item.productId,"variantId":item.variantId});}}}model.items=$.grep(model.items,function(obj){return obj;});serviceCart.saveWithDelay(model).done(function(cart){jq$.event.trigger(updateAndContinueEventName);serviceCart.saveInCache(cart);});}function onUpdateAndContinueClick(actionFunc){jq$(document).bind(updateAndContinueEventName,actionFunc);}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutLayoutStep1){window.WaOnlineStoreCheckoutLayoutStep1=OnlineStoreCheckoutLayoutStep1;}function OnlineStoreCheckoutLayoutStep1(service,isAuthorized){var container=document.getElementById("step-1"),$container=jq$(container),self=this,validator,loginURL="/Sys/Login?ReturnUrl=%2fSys%2fStore%2fCheckout",formName="contact_details",form=jq$("form[name="+formName+"]"),$terms=form.find("input.storeCheckoutTerm");self.render=render;self.checkEmail=checkEmail;self.activatePreload=activatePreload;self.deactivatePreload=deactivatePreload;self.saveContactModel=saveContactModel;self.emailExistErrorRender=emailExistErrorRender;self.checkEmailFailedRender=checkEmailFailedRender;init();function init(){validatorInit();jq$("#loginPageButton").on("click",function(){window.location.href=loginURL;});$terms.on("change",tryEnableNextButton);tryEnableNextButton();}function isCheckedTerms(){var checkedAllTerms=true;$terms.each(function(i,el){checkedAllTerms=checkedAllTerms&&el.checked;});return checkedAllTerms;}function validatorInit(){validator=new FormValidator({form:formName,autoConfig:true,validateOnBlur:true,onBlurField:onBlurValidate,onSubmit:onSubmitValidate});}function render(){service.getContactModel().done(function(model){getEmailField().val(model.Email);getFirstNameField().val(model.FirstName);getLastNameField().val(model.LastName);getPhoneField().val(model.Phone);jq$(model.RulesAndTerms).each(function(i,id){jq$("#term_"+id)[0].checked=true;});if(!isAuthorized&&!model.Email){disableNextButton();}tryEnableNextButton();});}function getNextButton(){return $container.find(".wizardNextButton");}function tryEnableNextButton(){if(isCheckedTerms()&&validator.validateForm()){enableNextButton();}else{disableNextButton();}}function tryHideNotifications(){if(validator.validateForm()){getExistEmailNotification().hide();}}function getEmailField(){return form.find("#billingDetails_email");}function getFirstNameField(){return form.find("#billingDetails_firstName");}function getLastNameField(){return form.find("#billingDetails_lastName");}function getPhoneField(){return form.find("#billingDetails_phone");}function checkEmail(){return service.checkEmail({Email:getEmailField().val()});}function getGeneralErrorNotification(){return jq$("#generalError");}function saveContactModel(){var checkedTerms=$terms.filter(function(i,el){return el.checked;}).map(function(i,el){return +$(el).val();}).get();var model={Email:getEmailField().val(),FirstName:getFirstNameField().val(),LastName:getLastNameField().val(),Phone:getPhoneField().val(),RulesAndTerms:checkedTerms};getGeneralErrorNotification().hide();getExistEmailNotification().hide();return service.saveContactModel(model);}function disableNextButton(){getNextButton().attr("disabled","disabled");}function enableNextButton(){getNextButton().removeAttr("disabled");}function activatePreload(){disableNextButton();}function deactivatePreload(){enableNextButton();}function onSubmitValidate(errors,evt){if(errors.length>0||!isCheckedTerms()){disableNextButton();}else{enableNextButton();}}function onBlurValidate(errors,evt){var sender=jq$(evt.target);putErrors(errors,sender);}function putErrors(errors,sender){if(!sender.next(".errorField").length){sender.after('<div class="errorField"></div>');}var errorField=sender.next(".errorField");if(errors.length>0){errorField.html(errors[0].message).addClass("errorField__visible");sender.parents(".formFieldContainer").addClass("error");disableNextButton();}else{errorField.removeClass("errorField__visible");sender.parents(".formFieldContainer").removeClass("error");tryEnableNextButton();tryHideNotifications();}}function getExistEmailNotification(){return jq$("#existEmail");}function emailExistErrorRender(){putErrors([{message:"Already used"}],getEmailField());getExistEmailNotification().show();}function checkEmailFailedRender(){getGeneralErrorNotification().show();captchaReset();}}
5525})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutLayoutStep2){window.WaOnlineStoreCheckoutLayoutStep2=OnlineStoreCheckoutLayoutStep2;}function OnlineStoreCheckoutLayoutStep2(service,initModel){var SHIPPING=WaOnlineStoreCheckout.SHIPPING,PICKUP=WaOnlineStoreCheckout.PICKUP;var formName="delivery_details",container=document.getElementById("step-2"),$container=jq$(container),self=this,validator,deliveryOptionId=null,deliveryEnable=initModel.deliveryEnable,deliveryOptions=initModel.deliveryOptions,$shippingAddressContainer=$container.find(".delivery.delivery__shipping-address"),$pickupContainer=$container.find(".delivery.delivery__pickup-address"),$deliveryDetailsForm=$container.find("form[name="+formName+"]"),$shippingAddressContainer=$shippingAddressContainer,$deliveryOptionsContainer=$container.find(".delivery-methods"),$pickupContainer=$container.find(".delivery.delivery__pickup-address"),$deliveryOptionsRadio=$container.find('input[type="radio"][name="delivery-options"]'),deliveryOptionType=null;self.render=render;self.saveForm=saveForm;$deliveryOptionsRadio.on("change",function(){deliveryOptionId=jq$(this).val();var isShipping=jq$(this).hasClass("delivery-method-radio-button_shipping-option");deliveryOptionType=isShipping?SHIPPING:PICKUP;showFormByType(deliveryOptionType);});deliveryOptionId=$deliveryOptionsRadio.first().val();init();function init(){$deliveryOptionsContainer.hide();$pickupContainer.hide();$shippingAddressContainer.hide();if(!deliveryEnable){$container.find(".formFieldContainer.required").removeClass("required");}validatorInit();disableNextButton();if(deliveryEnable){$deliveryOptionsContainer.show();$shippingAddressContainer.show();}else{$shippingAddressContainer.show();}if(deliveryEnable&&deliveryOptions.length>0){$deliveryOptionsRadio.first().attr("checked",true);$deliveryOptionsRadio.first().trigger("change");}}function validatorInit(){if(deliveryEnable){validator=new FormValidator({form:formName,autoConfig:true,validateOnBlur:true,onBlurField:onBlurValidate,onSubmit:onSubmitValidate});}else{validator={isValidateForm:function(){return true;},validateForm:function(){return true;}};}var onChangeField=function(){tryEnableNextButton();};$shippingAddressContainer.find("#shippingAddress_address1").on("input",onChangeField);$shippingAddressContainer.find("#shippingAddress_city").on("input",onChangeField);$shippingAddressContainer.find("#shippingAddress_region").on("input",onChangeField);$shippingAddressContainer.find("#shippingAddress_zipcode").on("input",onChangeField);$shippingAddressContainer.find("#shippingAddress_country").on("change",function(evt){var errors=[],sender=jq$(evt.target);if(deliveryEnable&&!isSelectedCountry()){errors=[{message:"The Country is required"}];}putErrors(errors,sender);tryEnableNextButton();});$deliveryOptionsRadio.on("change",onChangeField);}function onSubmitValidate(errors,evt){if(errors.length>0){disableNextButton();}else{enableNextButton();}}function onBlurValidate(errors,evt){var sender=jq$(evt.target);putErrors(errors,sender);}function putErrors(errors,sender){if(!sender.next(".errorField").length){sender.after('<div class="errorField"></div>');}var errorField=sender.next(".errorField");if(errors.length>0){errorField.html(errors[0].message).addClass("errorField__visible");sender.parents(".formFieldContainer").addClass("error");disableNextButton();}else{errorField.removeClass("errorField__visible");sender.parents(".formFieldContainer").removeClass("error");tryEnableNextButton();}}function showFormByType(optionType){if(optionType===SHIPPING){$pickupContainer.hide();$shippingAddressContainer.show();}else{$pickupContainer.show();$shippingAddressContainer.hide();}}function render(){service.getDeliveryModel().done(function(deliveryModel){var shippingAddress=deliveryModel.shippingAddress;jq$('input[name="delivery-options"][value="'+deliveryOptionId+'"]').prop("checked",true);if(shippingAddress){$shippingAddressContainer.find("#shippingAddress_address1").val(shippingAddress.addressLine1);$shippingAddressContainer.find("#shippingAddress_address2").val(shippingAddress.addressLine2);$shippingAddressContainer.find("#shippingAddress_city").val(shippingAddress.city);$shippingAddressContainer.find("#shippingAddress_country").val(shippingAddress.countryId);
5525$shippingAddressContainer.find("#shippingAddress_region").val(shippingAddress.province);$shippingAddressContainer.find("#shippingAddress_zipcode").val(shippingAddress.zip);}tryEnableNextButton();});}function disableNextButton(){getNextButton().attr("disabled","disabled");}function enableNextButton(){getNextButton().removeAttr("disabled");}function getNextButton(){return $container.find(".wizardNextButton");}function tryEnableNextButton(){if(!deliveryEnable){return enableNextButton();}if((validator.isValidateForm()&&isSelectedCountry())||(deliveryOptionType===PICKUP)){enableNextButton();}else{disableNextButton();}}function getSelectedCountry(){var $countrySelect=$shippingAddressContainer.find("#shippingAddress_country"),countryId=+$countrySelect.val(),countryName="";if(countryId===0){countryId=null;countryName="";}else{countryName=$countrySelect.find("option:selected").text();}return{countryName:countryName,countryId:countryId};}function isSelectedCountry(){var country=getSelectedCountry();return country.countryId!==null;}function saveForm(){var selectedCountry=getSelectedCountry(),countryName=selectedCountry.countryName,countryId=selectedCountry.countryId;var shippingAddress={addressLine1:$shippingAddressContainer.find("#shippingAddress_address1").val(),addressLine2:$shippingAddressContainer.find("#shippingAddress_address2").val(),city:$shippingAddressContainer.find("#shippingAddress_city").val(),countryId:countryId,countryName:countryName,province:$shippingAddressContainer.find("#shippingAddress_region").val(),zip:$shippingAddressContainer.find("#shippingAddress_zipcode").val()};var deliveryModel={shippingAddress:shippingAddress,deliveryOptionId:deliveryOptionId};return service.saveDeliveryModel(deliveryModel);}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutLayoutStep3){window.WaOnlineStoreCheckoutLayoutStep3=OnlineStoreCheckoutLayoutStep3;}function OnlineStoreCheckoutLayoutStep3(service,initModel){var SHIPPING=WaOnlineStoreCheckout.SHIPPING,PICKUP=WaOnlineStoreCheckout.PICKUP,DELIVERY_OPTION_TYPES=WaOnlineStoreCheckout.DELIVERY_OPTION_TYPES;var self=this,model,captchaVerify=false,mainContainer=document.getElementById("step-3-content"),captchaEnable=true,captchaWidgetId=undefined,deliveryEnable=initModel.deliveryEnable,isNewPaymentUIEnabled=initModel.isNewPaymentUIEnabled,recaptchaElementId="recaptchaContainer",$commentInput=jq$("#order_comments"),$paymentProcessingFeeDonationCheckBox=jq$("#paymentProcessingFeeDonationCheckBox"),orderCreateFailedEventName="OrderCreateFailedEvent";self.render=render;self.confirmationRender=confirmationRender;self.onOrderCreateFailed=onOrderCreateFailed;self.showGeneralError=showGeneralError;init();function init(){var $payInvoiceButton=getPayInvoiceButton();var $payOnlineButton=getPayOnlineButton();var $bankTransferButton=getBankTransferButton();var $freeOrderButton=getFreeOrderButton();$payInvoiceButton.on("click",function(){disablePayButtons();payInvoice(captchaVerify);});$payOnlineButton.on("click",function(){disablePayButtons();payOnline(captchaVerify);});$bankTransferButton.on("click",function(){disablePayButtons();bankTransfer(captchaVerify);});$freeOrderButton.on("click",function(){disablePayButtons();freeOrder(captchaVerify);});if(isNewPaymentUIEnabled){initAccordion();}captchaInit();}function captchaInit(){if(captchaEnable){var sitekey=getRecaptchaContainer().data("sitekey");captchaWidgetId=grecaptcha.render(recaptchaElementId,{sitekey:sitekey,callback:captchaSuccessCallback});}}function captchaSuccessCallback(responseToken){captchaVerify=responseToken;enablePayButtons();}function getRecaptchaContainer(){return jq$("#"+recaptchaElementId);}function render(){getGeneralErrorNotification().hide();disablePayButtons();captchaReset();service.getConfirmModel().done(function(confirmModel){model=confirmModel;confirmationRender(model);displayPayButtons(model);displayPaymentProcessingFeeDonationCheckBox(model);if(isNewPaymentUIEnabled){updatePayOnlineButtonLabel(model);}});}function updatePayOnlineButtonLabel(model){var button=document.getElementById("button_pay_online");if(!button||!model.cart||model.cart.total==null){return;}var total=model.cart.total;var baseLabel="Pay "+initModel.currencySymbol+total.toFixed(2);button.value=baseLabel;var checkbox=$paymentProcessingFeeDonationCheckBox[0];if(checkbox){var feeAmount=total*(initModel.paymentProcessingFeeDonationPercent||0)/100+(initModel.paymentProcessingFeeDonationIncrease||0);var donationLabel="Pay "+initModel.currencySymbol+(total+feeAmount).toFixed(2);checkbox.onchange=function(){button.value=this.checked?donationLabel:baseLabel;};}}function getFreeOrderButton(){return jq$("#button_free_order");}function getPayInvoiceButton(){return jq$("#button_pay_invoice");}function getPayOnlineButton(){return jq$("#button_pay_online");}function getBankTransferButton(){return jq$("#button_bank_transfer");}function getGeneralErrorNotification(){return jq$("#generalError");}function confirmationRender(model){mainContainer.innerHTML=confirmationRenderTable(model);}function displayPayButtons(model){if(model.cart&&model.cart.total===0){getFreeOrderButton().show();if(isNewPaymentUIEnabled){jq$("#accordionPaymentMethods").hide();}else{getPayInvoiceButton().hide();getPayOnlineButton().hide();getBankTransferButton().hide();}}else{getFreeOrderButton().hide();if(isNewPaymentUIEnabled){jq$("#accordionPaymentMethods").show();}else{getPayInvoiceButton().show();getPayOnlineButton().show();getBankTransferButton().show();}}}function initAccordion(){var cards=document.querySelectorAll("#accordionPaymentMethods .payment-method-card");var radios=document.querySelectorAll('#accordionPaymentMethods input[type="radio"]');if(cards.length>0){cards[0].classList.add("selected");}cards.forEach(function(card){card.addEventListener("click",function(e){if(e.target.closest(".payment-action-button")){return;}var radio=card.querySelector('input[type="radio"]');if(radio){radio.checked=true;updateAccordionSelection(cards);}});});radios.forEach(function(radio){radio.addEventListener("change",function(){updateAccordionSelection(cards);});});}function updateAccordionSelection(cards){cards.forEach(function(card){var radio=card.querySelector('input[type="radio"]');card.classList.toggle("selected",!!(radio&&radio.checked));});}function displayPaymentProcessingFeeDonationCheckBox(model){if(!$paymentProcessingFeeDonationCheckBox.length){return;}if(model.cart&&model.cart.total===0){jq$("#paymentProcessingFeeDonation").hide();}var amount=model.cart.total*initModel.paymentProcessingFeeDonationPercent/100+initModel.paymentProcessingFeeDonationIncrease;jq$("#paymentProcessingFeeDonationAmount").html(initModel.currencySymbol+amount.toFixed(2));}function disablePayButtons(){getPayInvoiceButton().attr("disabled","disabled");getPayOnlineButton().attr("disabled","disabled");getFreeOrderButton().attr("disabled","disabled");getBankTransferButton().attr("disabled","disabled");}function enablePayButtons(){getPayInvoiceButton().removeAttr("disabled");getPayOnlineButton().removeAttr("disabled");getFreeOrderButton().removeAttr("disabled");getBankTransferButton().removeAttr("disabled");}function captchaReset(){grecaptcha.reset(captchaWidgetId);}function captchaValidationFailureCallback(){showGeneralError();captchaReset();}function patchModel(model){model.comments=$commentInput.val();model.comments=$commentInput.val();model.paymentProcessingFeeDonationChecked=$paymentProcessingFeeDonationCheckBox.length&&$paymentProcessingFeeDonationCheckBox[0].checked;return model;}function payInvoice(captchaToken){return service.invoiceMe(patchModel(model),captchaToken).done(function(resp){if(!resp.IsReCaptchaValid){captchaValidationFailureCallback();}}).fail(function(data){var err=getErrorData(data);if(err.errorType=="NotEnoughStock"){jq$.event.trigger(orderCreateFailedEventName);}else{showGeneralError();}});}function payOnline(captchaToken){return service.payOnline(patchModel(model),captchaToken).done(function(resp){if(!resp.IsReCaptchaValid){captchaValidationFailureCallback();}}).fail(function(data){var err=getErrorData(data);if(err.errorType=="NotEnoughStock"){jq$.event.trigger(orderCreateFailedEventName);}else{showGeneralError();}});}function bankTransfer(captchaToken){return service.bankTransfer(patchModel(model),captchaToken).done(function(resp){if(!resp.IsReCaptchaValid){captchaValidationFailureCallback();}}).fail(function(data){var err=getErrorData(data);if(err.errorType=="NotEnoughStock"){jq$.event.trigger(orderCreateFailedEventName);}else{showGeneralError();}});}function freeOrder(captchaToken){return service.freeOrder(patchModel(model),captchaToken).done(function(resp){if(!resp.IsReCaptchaValid){captchaValidationFailureCallback();}}).fail(function(data){var err=getErrorData(data);if(err.errorType=="NotEnoughStock"){jq$.event.trigger(orderCreateFailedEventName);}else{showGeneralError();}});}function getErrorData(data){try{return JSON.parse(data.responseText).data;}catch(e){return data.responseText;}}function showGeneralError(){getGeneralErrorNotification().show();}function confirmationRenderTable(model){var html=[];html.push('<table class="storeCartTable">');html.push(confirmationRenderItems(model.cart.items));if(deliveryEnable&&model.deliveryModel&&model.deliveryModel.deliveryOptionId){html.push(confirmationRenderDelivery(model.deliveryModel));}html.push(confirmationRenderTotal(model.cart));html.push("</table>");html.push(deliveryInformationRender(model));return html.join("");}function confirmationRenderItems(items){var html=[],i,length=items.length;for(i=0;i<length;i++){html.push(confirmationRenderItem(items[i]));}return html.join("");}function renderImage(item){var html=[];
5525if(item.pictureUrl){html.push('<img src="',item.pictureUrl,'" width="100"/>');}else{html.push('<div class="storeCartTable_img storeCartTable_no_img" title="No photo"></div>');}return html.join("");}function getItemUrl(productId){return initModel.productDetailsUrl+"/"+productId;}function renderPrice(price){var fixedPrice=price?price.toFixed(2):"0.0";if(initModel.currencySymbol){return'<span class="priceContainer">'+initModel.currencySymbol+fixedPrice+"</span>";}else{return'<span class="priceContainer">'+fixedPrice+" "+initModel.currency+"</span>";}}function confirmationRenderItem(item){var html=[];html.push('<tr class="storeCartTable_row">');html.push('<td class="storeCartTable_tdImage">',renderImage(item),"</td>");html.push('<td class="storeCartTable_tdTitle">');html.push('<div class="storeCartTable_itemTitle">',enc(item.title),"</div>");html.push(renderOptions(item));html.push("</td>");html.push('<td class="storeCartTable_tdPprice">',renderPrice(item.price),"</td>");html.push('<td class="storeCartTable_tdQuantity qtyLabel">',item.quantity,"</td>");html.push('<td class="storeCartTable_tdAmount">',renderPrice(item.total),"</td>");html.push("</tr>");return html.join("");}function confirmationRenderDelivery(deliveryModel){var html=[];var deliveryOption=currentDeliveryOption(deliveryModel.deliveryOptionId,initModel.deliveryOptions);html.push('<tr class="storeCartTable_row">');html.push('<td class="storeCartTable_tdImage"></td>');html.push('<td class="storeCartTable_tdTitle">');html.push('<div class="storeCartTable_itemTitle">Delivery: ',enc(deliveryOption.title),"</div>");html.push("</td>");html.push('<td class="storeCartTable_tdPprice"></td>');html.push('<td class="storeCartTable_tdQuantity"></td>');html.push('<td class="storeCartTable_tdAmount">',renderPrice(deliveryOption.price),"</td>");html.push("</tr>");return html.join("");}function renderOption(option){return'<div class="storeCartTable_itemOption">'+enc(option.title)+": "+enc(option.value)+"</div>";}function renderOptions(item){if(!item.options){return"";}return jq$.map(item.options,function(option,i){return renderOption(option);}).join("");}function confirmationRenderTotal(cart){var html=[];var total=cart.total;var subTotal=cart.subTotal;var isTaxesApplied=cart.isTaxesApplied||false;var isTaxesIncludedTotal=cart.isTaxesIncludedTotal||false;var taxes=cart.taxes||[];if(initModel.taxesEnable&&isTaxesApplied&&!isTaxesIncludedTotal){html.push('<tr class="storeCartTotalInfoRowFirst">');html.push('<td colspan="4" class="storeCartTable_totalLabel">Subtotal:</td>');if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,subTotal.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',subTotal.toFixed(2)," ",initModel.currency,"</td>");}html.push("</tr>");html.push(renderTaxes(taxes,isTaxesIncludedTotal));}if(total||total===0){if(!isTaxesIncludedTotal){html.push('<tr class="storeCartTotalInfoRow">');}else{html.push('<tr class="storeCartTotalInfoRowFirst">');}html.push('<td colspan="4" class="storeCartTable_totalLabel">Total:</td>');if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,total.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',total.toFixed(2)," ",initModel.currency,"</td>");}html.push("</tr>");}if(initModel.taxesEnable&&isTaxesApplied&&isTaxesIncludedTotal){html.push(renderTaxes(taxes,isTaxesIncludedTotal));}return html.join("");}function renderTaxes(taxes,isTaxesIncludedTotal){var html=[];for(var taxIndex in taxes){var tax=taxes[taxIndex];var taxLabel=tax.title+":";if(isTaxesIncludedTotal){taxLabel="Incl."+enc(tax.title)+":";}html.push('<tr class="storeCartTotalInfoRow">');html.push('<td colspan="4" class="storeCartTable_totalLabel">',enc(taxLabel),"</td>");if(initModel.currencySymbol){html.push('<td class="storeCartTable_totalValue">',initModel.currencySymbol,tax.amount.toFixed(2),"</td>");}else{html.push('<td class="storeCartTable_totalValue">',tax.amount.toFixed(2)," ",initModel.currency,"</td>");}html.push("</tr>");}return html.join("");}function enc(val){return BonaPage.encodeHtml(val);}function onOrderCreateFailed(actionFunc){jq$(document).bind(orderCreateFailedEventName,actionFunc);}function currentDeliveryOption(deliveryOptionId,deliveryOptions){deliveryOptions=deliveryOptions.filter(function(option){return +option.id===+deliveryOptionId;})[0];return deliveryOptions||{title:null,optionId:null,type:null};}function deliveryInformationRender(model){var shippingAddress,deliveryOption,withShipping=true,html=[],owner=(model.billingDetails||{});shippingAddress=model.deliveryModel.shippingAddress||model.shippingAddress;if(deliveryEnable){deliveryOption=currentDeliveryOption(model.deliveryModel.deliveryOptionId,initModel.deliveryOptions);withShipping=DELIVERY_OPTION_TYPES[SHIPPING]===deliveryOption.type;}else{withShipping=!!shippingAddress;}html.push("<h2>Billing and shipping information</h2>");html.push("<p><strong>Billing details</strong><br />");html.push(enc(owner.FirstName)," ",enc(owner.LastName)," ",enc(owner.Email),"<br/>");if(owner.Phone){html.push(enc(owner.Phone),"<br/>");}html.push("</p>");if(withShipping){html.push("<p><strong>Shipping address</strong><br/>");if(shippingAddress.addressLine1){html.push(enc(shippingAddress.addressLine1)," ");}if(shippingAddress.addressLine2){html.push(enc(shippingAddress.addressLine2)," ");}if(shippingAddress.addressLine1||shippingAddress.addressLine2){html.push("<br/>");}var countryName=(shippingAddress.countryName!=="< Select >")?enc(shippingAddress.countryName):"";html.push(enc(shippingAddress.city)," ",enc(shippingAddress.province)," ",countryName," ",enc(shippingAddress.zip),"<br />");html.push("</p>");}html.push("<p>&nbsp;</p>");return html.join("");}}})(window,window.WA);(function(window,WA,undefined){if(!window.WaOnlineStoreCheckoutService){window.WaOnlineStoreCheckoutService=OnlineStoreCheckoutService;}function OnlineStoreCheckoutService(serviceCart){var cache={}
5525,cacheKey={billingDetails:"billingDetails",deliveryModel:"deliveryModel",rulesAndTerms:"rulesAndTerms"},gateway=new WaOnlineStoreCheckoutGateway(),self=this;var defaultShippingAddressModel={addressLine1:null,addressLine2:null,city:null,countryId:null,province:null,zip:null};var defaultDeliveryModel={shippingAddressModel:defaultShippingAddressModel,deliveryOptionId:null};self.invoiceMe=invoiceMe;self.payOnline=payOnline;self.bankTransfer=bankTransfer;self.freeOrder=freeOrder;self.checkEmail=checkEmail;self.saveContactModel=saveContactModel;self.getContactModel=getContactModel;self.getShippingAddressModel=getShippingAddressModel;self.getDeliveryModel=getDeliveryModel;self.saveDeliveryModel=saveDeliveryModel;self.getConfirmModel=getConfirmModel;cache.get=function(key){var serialized=WA.Storage.read(key);if(typeof serialized!=="string"){return undefined;}try{return JSON.parse(serialized);}catch(e){console.log(e);return serialized||undefined;}};cache.remove=function(key){WA.Storage.del(key);};cache.set=function(key,value){var serialized=JSON.stringify(value);try{WA.Storage.write(key,serialized);}catch(e){console.log(e);}};function getShippingAddressModel(){var model=cache.get(cacheKey.deliveryModel);if(model){return jq$.Deferred().resolve(model.shippingAddress||defaultShippingAddressModel);}else{return defaultShippingAddressModel;}}function getDeliveryModel(){var model=cache.get(cacheKey.deliveryModel);return jq$.Deferred().resolve(model||defaultDeliveryModel);}function saveDeliveryModel(model){cache.set(cacheKey.deliveryModel,model);return jq$.Deferred().resolve(model);}function resetAllData(){serviceCart.resetCart();cache.remove(cacheKey.deliveryModel);cache.remove(cacheKey.billingDetails);}function invoiceMe(checkoutModel,captchaToken){var data={CheckoutModel:checkoutModel,Captcha:captchaToken};return gateway.invoiceMe(data).fail(payFailed).done(paySuccess);}function payOnline(checkoutModel,captchaToken){var data={CheckoutModel:checkoutModel,Captcha:captchaToken};return gateway.payOnline(data).fail(payFailed).done(paySuccess);}function bankTransfer(checkoutModel,captchaToken){var data={CheckoutModel:checkoutModel,Captcha:captchaToken};return gateway.bankTransfer(data).fail(payFailed).done(paySuccess);}function freeOrder(checkoutModel,captchaToken){var data={CheckoutModel:checkoutModel,Captcha:captchaToken};return gateway.freeOrder(data).fail(payFailed).done(paySuccess);}function paySuccess(data){if(data.IsReCaptchaValid&&data.RedirectUrl){resetAllData();window.location=data.RedirectUrl;}}function payFailed(data,textStatus){console.log("Failed!",data,textStatus);}function checkEmail(model){return gateway.checkEmail(model);}function getContactModel(){var model=cache.get(cacheKey.billingDetails);return jq$.Deferred().resolve(model||{});}function saveContactModel(model){var contactModel=cache.get(cacheKey.billingDetails);var billingDetails=jq$.extend(contactModel,model);cache.set(cacheKey.billingDetails,billingDetails);return jq$.Deferred().resolve(billingDetails);}function getConfirmModel(){var def=jq$.Deferred();getContactModel().done(function(billingDetails){getDeliveryModel().done(function(deliveryModel){serviceCart.loadCurrent(deliveryModel.deliveryOptionId).done(function(cart){def.resolve({billingDetails:billingDetails,deliveryModel:deliveryModel,cart:cart});});});});return def;}}})(window,window.WA);jq$(function(){if(!window.currentProduct){window.currentProduct={id:0};}if(window.currentProduct.id>0){var cartService=WaOnlineStoreCart.getInstance(),cartUrl="/Sys/Store/Cart",cartKey="OnlineStoreCart",buttonAdd=document.getElementById("OnlineStoreProduct_addToCart"),outOfStockLabel=document.getElementById("idOnlineStoreCatalog_OutOfStock_container"),alreadyInCartLabel=document.getElementById("idOnlineStoreCatalog_AlreadyInCart_container"),buttonView=document.getElementById("OnlineStoreProduct_viewCart"),qtyContainer=document.getElementsByClassName("OnlineStoreProductQty")[0],inputQty=document.getElementById("idInputQuantity"),qtyLimitContainer=document.getElementById("idOnlineStoreCatalog_QuantityLimitContainer"),qtyLimit=document.getElementById("idOnlineStoreCatalog_QuantityLimit"),quantitySnippet=document.querySelector(".quantitySnippet"),options=document.querySelectorAll("SELECT.OnlineStoreProduct_optionsSelect"),optionErrorLabels={},variantsModel={};for(var i=options.length-1;i>=0;i--){var option=options[i];var errorLabel=document.getElementById("idOnlineStoreProduct_Option"+option.getAttribute("option-id")+"_ErrorLabel");optionErrorLabels[option.getAttribute("option-id")]=errorLabel;}if(!window.currentProduct.outOfStock&&quantitySnippet){quantitySnippet.onclick=function(event){var target=event.target,value;if(target.className.indexOf("quantity-button")!==-1){value=getQuantity();value+=target.className.indexOf("quantity-up")>=0?1:-1;inputQty.value=value;inputQty.oninput();}};}if(!window.currentProduct.outOfStock&&inputQty){inputQty.oninput=function(){var value=getQuantity(),min=parseInt(inputQty.getAttribute("min"));if(value<min){value=min;}inputQty.value=value;};}buttonView.onclick=function(e){document.location=cartUrl;e.preventDefault();return false;};buttonAdd.onclick=function(){if(!validate()){return false;}var variant=getVariant(),variantId=null,quantity=getQuantity();if(variant){variantId=variant.id;}if(quantity>0){cartService.add(currentProduct.id,variantId,quantity).fail(function(error){console.log(error);}).done(update);}return false;};cartService.load().fail(function(error){console.log(error);}).done(update);function getVariant(selectedOptions){if(!selectedOptions){selectedOptions=getSelectedOptions();}if(!selectedOptions||selectedOptions.length==0||!currentProduct.variants||currentProduct.variants.length==0){return null;}var variant=null;for(var i=currentProduct.variants.length-1;i>=0;i--){var optionValues=currentProduct.variants[i].options;var isMatch=true;for(var j=selectedOptions.length-1;j>=0;j--){var found=false;for(var k=optionValues.length-1;k>=0;k--){if(optionValues[k].title==selectedOptions[j].title&&optionValues[k].value==selectedOptions[j].value){found=true;break;}}if(!found){isMatch=false;break;}}if(isMatch){variant=currentProduct.variants[i];}}return variant;}function getSelectedOptions(){var selectedOptions=[];for(var i=options.length-1;i>=0;i--){var option=options[i];selectedOptions.push({title:option.getAttribute("option-title"),value:option.value});}return selectedOptions;}function getQuantity(){if(inputQty){var value=parseInt(inputQty.value);return value>0?value:1;}return 1;}function getProductsInCartQuantity(cart){if(!cart){return;}var quantity=0;
5525cart.items.forEach(function(item){quantity+=item.quantity;});return quantity;}function init(){for(var i=options.length-1;i>=0;i--){var optionSelect=options[i];optionSelect.onchange=function(event){var hasValue=event.target.value!="";optionErrorLabels[event.target.getAttribute("option-id")].style.display=hasValue?"none":"block";var variant=getVariant();setVariantData(variant);};}}function setVariantData(variant){if(!variant){outOfStockLabel.style.display="none";qtyLimitContainer.style.visibility="hidden";buttonAdd.disabled=true;return;}qtyLimitContainer.style.visibility=variant.outOfStock||!variant.stock?"hidden":"visible";qtyLimit.innerText=variant.stock;outOfStockLabel.style.display=variant.outOfStock?"block":"none";buttonAdd.disabled=variant.outOfStock;}function validate(){var isValid=false;var errors=getValidationErrors();isValid=errors.length==0;displayErrorState(errors);return isValid;}function getValidationErrors(){var errors=[];var selectedOptions=[];if(options.length==0){return errors;}for(var i=options.length-1;i>=0;i--){var option=options[i];if(option.selectedIndex==0){errors.push({type:"option",id:option.getAttribute("option-id")});}else{selectedOptions.push({title:option.getAttribute("option-title"),value:option.value});}}if(errors.length>0){return errors;}var variant=getVariant(selectedOptions);if(variant&&variant.outOfStock){return[{type:"outOfStock"}];}return errors;}function displayErrorState(errors){for(var i=optionErrorLabels.length-1;i>=0;i--){optionErrorLabels[i].style.display="none";}for(var i=errors.length-1;i>=0;i--){var error=errors[i];switch(error.type){case"option":optionErrorLabels[error.id].style.display="block";break;case"outOfStock":outOfStockLabel.style.display="block";break;}}buttonAdd.disabled=errors.length>0;}function isProductDigital(){if(!currentProduct){return false;}return currentProduct.type==="DIGITAL";}function isProductEcourse(){if(!currentProduct){return false;}return currentProduct.type==="ECOURSE";}function isProductInCart(productId){var cart=JSON.parse(WA.Storage.read(cartKey));if(!cart||!cart.items){return false;}var result=false;for(var i=0;i<cart.items.length;i++){if(cart.items[i].productId===productId){result=true;break;}}return result;}function displayAlreadyInCartState(){alreadyInCartLabel.style.visibility="visible";buttonAdd.disabled=true;}function updateLayoutForDigitalProduct(){if(isProductInCart(currentProduct.id)){displayAlreadyInCartState();}}function update(){var cart,productsInCartQuantity,currentProductQuantity,currentProductQuantityLimit;cart=JSON.parse(WA.Storage.read(cartKey));productsInCartQuantity=getProductsInCartQuantity(cart);updateViewInCartText(productsInCartQuantity);if(isProductDigital()||isProductEcourse()){updateLayoutForDigitalProduct();}}function updateViewInCartText(value){if(typeof value!=="number"){return;}buttonView.textContent=value>0?"View cart ("+value+")":"View cart";}function quantityLimitElement(options){var self=this,main=options.element,delay=options.delay||400;self.hide=hide;self.show=show;self.text=text;function hide(){if(main){main.style.display="none";}}function show(){if(main){main.style.display="block";setTimeout(hide,delay);}}function text(value){if(main){main.textContent=value;}}}var coverContainer=document.querySelector(".OnlineStoreProduct_gallery_cover_container"),coverImg=document.getElementById("OnlineStoreProduct_gallery_cover_img"),thumbs=document.getElementById("OnlineStoreProduct_gallery_thumbs");if(thumbs){thumbs.onclick=function(e){var target=e.target;while(target!=this){if(target.nodeName=="A"){showThumbnail(target.href,target.title);return false;}target=target.parentNode;}};var imgs=thumbs.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){var img=document.createElement("img");img.src=imgs[i].parentNode.href;}}function showThumbnail(href,title){coverImg.src=href;coverImg.alt=title;coverContainer.href=href;}init();}});(function(window,WA,undefined){if(!window.WaPollBallot){window.WaPollBallot=PollBallot;}function PollBallot(){var self=this,confirmDialogId="pollSubmitConfirmationDialog",pollGadgetSelector=".WaGadgetPoll",validator=new WaPollBallotValidator(".WaGadgetPoll .votingBlock");self.Dispose=WA.Tools.EventHandlers.createHandlers(self,{id:"Dispose"});var confirmDialog=new WA.UI.ConfirmationDialog({id:confirmDialogId,resources:{Title:"Confirmation",ContentHTML:"Do you want to submit your answers?",ConfirmButtonLabel:"Yes",CancelButtonLabel:"No"}},{parentComponent:self});init();
5525function init(){jq$(pollGadgetSelector).on("keydown","form input",onKeyDown);confirmDialog.CancelClick.addHandler(onCancelClick);confirmDialog.ConfirmClick.addHandler(onConfirmClick);jq$(pollGadgetSelector).on("click","form input[type=submit]",onSubmit);jq$(pollGadgetSelector).on("click","form input[type=checkbox], form input[type=radio]",onPressCheckbox);}function onSubmit(){return validator.validate();}function onPressCheckbox(e){return validator.validateOption(e.target);}function onKeyDown(e){if(e.which==13&&validator.validate()){var confirmDialogElement=jq$("#"+confirmDialogId);var top=(jq$(window).height()-confirmDialogElement.outerHeight())/2;confirmDialog.show();confirmDialogElement.css({top:top+"px"});return false;}}function onConfirmClick(){confirmDialog.hide();document.getElementById("pollBallotForm").submit();}function onCancelClick(){confirmDialog.hide();}}var instance;PollBallot.getInstance=function(){return instance||(instance=new PollBallot());};})(window,window.WA);(function(window,WA,undefined){if(!window.WaPollBallotValidator){window.WaPollBallotValidator=PollBallotValidator;}function PollBallotValidator(questionBlockSelector){var self=this;self.validate=function(){var questionNodes=[].slice.call(document.querySelectorAll(questionBlockSelector)),result=true;questionNodes.forEach(function(item,i,arr){if(checkQuestionNode(item)===false){result=false;}});return result;};self.validateOption=function(target){var questionNode=target.closest(questionBlockSelector),limit=getLimitForQuestion(questionNode),selected=getCheckedOptions(questionNode);if(selected.length>0&&(selected.length<=limit||limit==0)){hideError(questionNode);}};function checkQuestionNode(questionNode){var limit=getLimitForQuestion(questionNode),selected=getCheckedOptions(questionNode),suggestionInput=getSuggestionInput(questionNode),isRequired=getIsRequiredForQuestion(questionNode);if(isRequired&&selected.length<1&&(!suggestionInput||suggestionInput.value.trim()==="")||selected.length===1&&selected[0].value==="suggestion"&&suggestionInput.value.trim()===""){showError(questionNode,"An answer is required");return false;}if(limit>0&&selected.length>limit){showError(questionNode,"Maximum "+limit+" options");return false;}return true;}function getLimitForQuestion(questionNode){return +questionNode.getAttribute("data-limit")||0;}function getIsRequiredForQuestion(questionNode){return questionNode.getAttribute("data-isRequired").toLowerCase()!=="false";}function getCheckedOptions(questionNode){return questionNode.querySelectorAll(".optionItem input[type=checkbox]:checked, .optionItem input[type=radio]:checked");}function getSuggestionInput(questionNode){return questionNode.querySelector("input[type=text]");}function showError(questionNode,text){if(text){questionNode.querySelector(".errorMsg").innerHTML=text;}questionNode.querySelector(".errorMsg").style.display="block";}function hideError(questionNode){questionNode.querySelector(".errorMsg").style.display="none";}}})(window,window.WA);(function(ELEMENT){ELEMENT.matches=ELEMENT.matches||ELEMENT.mozMatchesSelector||ELEMENT.msMatchesSelector||ELEMENT.oMatchesSelector||ELEMENT.webkitMatchesSelector;ELEMENT.closest=ELEMENT.closest||function closest(selector){if(!this){return null;}if(this.matches(selector)){return this;}if(!this.parentElement){return null;}else{return this.parentElement.closest(selector);}};}(Element.prototype));(function(){if(!window.WASearchResultsGadget){window.WASearchResultsGadget=WASearchResultsGadget;}function WASearchResultsGadget(args){var pThis=this;pThis.init=init;pThis.doSearch=doSearch;var model,foundLabel,searchBox,resultDiv,foundRecordsSpan,recordsFoundMessage,pager,selectedTypesCaption,searchInProgress,thereWasAnotherRequest;model=args||{};function init(){if(model.searchUnavailable==true){return;}var prefix="#"+model.modelId;searchInProgress=false;thereWasAnotherRequest=false;searchBox=jq$(prefix+"_searchBox");resultDiv=jq$(prefix+"_resultDiv");foundLabel=jq$(prefix+"_foundLabel");foundRecordsSpan=jq$(prefix+"_foundRecords");recordsFoundMessage=jq$(prefix+"_recordsFoundMessage");selectedTypesCaption=jq$(prefix+"_selectedTypesCaption");pager=jq$(prefix+"_pager");$("input[name="+model.modelId+"_type]").on("click",checkedChanged);$(prefix+"_togglePanelLink").on("click",function(){jq$(prefix+"_contentTypesPanel").slideToggle(100);jq$(this).toggleClass("fa-caret-down","fa-caret-right");});var timer;var delay=600;searchBox.bind("input",function(){window.clearTimeout(timer);timer=window.setTimeout(function(){doSearch(1);},delay);});searchBox.focus();if(searchBox.val().length>0){doSearch(model.pageNumber);}}function doSearch(pageNum){if(!pageNum){return;}thereWasAnotherRequest=false;if(searchBox.val().length==0){setEmptyResult();return;}var filter=getSelectedTypes();if(filter==0){setEmptyResult();return;}if(searchInProgress){thereWasAnotherRequest=true;return;}searchInProgress=true;foundRecordsSpan.html(model.text.searchInProgress);jq$.ajax({type:"POST",url:model.searchActionUrl,data:JSON.stringify({"q":searchBox.val(),"types":filter,"pageNumber":pageNum,"noPaging":model.noPaging}),contentType:"application/json; charset=utf-8",dataType:"text"}).done(function(data){searchInProgress=false;if(thereWasAnotherRequest){doSearch(1);}else{foundLabel.show();var jsonData=JSON.parse(data.replace("while(1); ","","i").trim());if(jsonData.entities.length>0){renderResult(jsonData);}else{setEmptyResult();}var url=WA.String.format(model.getUrlTemplate,encodeURIComponent(searchBox.val()),filter,pageNum);if(model.noPaging==true){url=url+"&nopaging=true";}window.history.replaceState({},"",url);}}).fail(function(){searchInProgress=false;if(thereWasAnotherRequest){doSearch(1);}else{recordsFoundMessage.html("Search is not available now.");}});}function checkedChanged(){refreshSelectedTypesCaption();doSearch(1);}function refreshSelectedTypesCaption(){var all=true;var captions=new Array();$("input[name="+model.modelId+"_type]").each(function(){if($(this).attr("checked")=="checked"){captions.push($("label[for="+$(this).attr("id")+"]:first").text());}else{all=false;}});var text="";if(all){text="all";}else{if(captions.length==0){text="none";}else{text=captions.join(", ");}}selectedTypesCaption.html(WA.String.format(model.text.contentTypeTemplate,text));}function getSelectedTypes(){var filter=0;$("input[name="+model.modelId+"_type]:checked").each(function(){filter=filter|$(this).attr("value");});return filter;}function setEmptyResult(){setFoundRecords(0,model.text.noResultsFound);resultDiv.html("");pager.html("");}function renderResult(data){var items=data.entities;var a=new Array();for(var i=0;i<items.length;i++){var o=items[i];var text=o.text;a.push('<div class="row">');a.push('<div class="title"><a class="'+o.className+'" title="'+o.tooltip+'" href="'+o.url+'"><span>'+o.title+"</span></a></div>");a.push('<div class="text">'+o.text+"</div>");if(o.additionalInfo!=""){a.push('<div class="additionalInfo">'+o.additionalInfo+"</div>");}a.push("</div>");}resultDiv.html(a.join(""));setFoundRecords(data.recordsFound,data.recordsFoundMessage);renderPager(parseInt(data.pagesFound),parseInt(data.currentPage),9);}function setFoundRecords(recordsFound,message){foundRecordsSpan.html(""+recordsFound+"");recordsFoundMessage.html(message);}function renderPager(pagesCount,currentPage,pagesToDisplay){if(pagesCount==1){pager.html("");return;}var pagerItems=[];pagerItems.push({text:model.text.first,page:currentPage==1?null:1});pagerItems.push({text:model.text.previous,page:currentPage==1?null:currentPage-1});var firstPage,lastPage;if(pagesCount<pagesToDisplay){firstPage=1;lastPage=pagesCount;}else{firstPage=Math.min(currentPage-Math.floor(pagesToDisplay/2),pagesCount-pagesToDisplay+1);if(firstPage<1){firstPage=1;}lastPage=firstPage+pagesToDisplay-1;}for(var i=firstPage;i<=lastPage;i++){pagerItems.push({text:i,page:currentPage==i?null:i});}pagerItems.push({text:model.text.next,page:currentPage==pagesCount?null:currentPage+1});pagerItems.push({text:model.text.last,page:currentPage==pagesCount?null:pagesCount});var arr=renderPagerItems(pagerItems);}function renderPagerItems(jsonArr){var i,linkElements,a=new Array();WA.Array.foreach(jsonArr,function(item){if(item.page){a.push('<a style="cursor: pointer;" data-page="'+item.page+'">'+item.text+"</a>");}else{a.push("<span>"+item.text+"</span>");}});pager.html(a.join("&nbsp;&nbsp;"));linkElements=document.body.querySelectorAll("A[data-page]");for(i=0;i<linkElements.length;i++){WA.addHandler(linkElements[i],"click",gotoPage);}}function gotoPage(e){var targetElement;if(!e&&event){e=event;}if(e){targetElement=e.target||e.srcElement;if(targetElement){doSearch(targetElement.getAttribute("data-page"));}}}init();}})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.