window.gdSetMap = window.gdSetMap || 'auto';

window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.8.1"}};
			!function(a,b,c){function d(a){var b,c,d,e,f=String.fromCharCode;if(!k||!k.fillText)return!1;switch(k.clearRect(0,0,j.width,j.height),k.textBaseline="top",k.font="600 32px Arial",a){case"flag":return k.fillText(f(55356,56826,55356,56819),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,56826,8203,55356,56819),0,0),c=j.toDataURL(),b===c&&(k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447),0,0),c=j.toDataURL(),b!==c);case"emoji4":return k.fillText(f(55358,56794,8205,9794,65039),0,0),d=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55358,56794,8203,9794,65039),0,0),e=j.toDataURL(),d!==e}return!1}function e(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i,j=b.createElement("canvas"),k=j.getContext&&j.getContext("2d");for(i=Array("flag","emoji4"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);

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


/*! jQuery Migrate v1.4.1 | (c) jQuery Foundation and other contributors | jquery.org/license */
"undefined"==typeof jQuery.migrateMute&&(jQuery.migrateMute=!0),function(a,b,c){function d(c){var d=b.console;f[c]||(f[c]=!0,a.migrateWarnings.push(c),d&&d.warn&&!a.migrateMute&&(d.warn("JQMIGRATE: "+c),a.migrateTrace&&d.trace&&d.trace()))}function e(b,c,e,f){if(Object.defineProperty)try{return void Object.defineProperty(b,c,{configurable:!0,enumerable:!0,get:function(){return d(f),e},set:function(a){d(f),e=a}})}catch(g){}a._definePropertyBroken=!0,b[c]=e}a.migrateVersion="1.4.1";var f={};a.migrateWarnings=[],b.console&&b.console.log&&b.console.log("JQMIGRATE: Migrate is installed"+(a.migrateMute?"":" with logging active")+", version "+a.migrateVersion),a.migrateTrace===c&&(a.migrateTrace=!0),a.migrateReset=function(){f={},a.migrateWarnings.length=0},"BackCompat"===document.compatMode&&d("jQuery is not compatible with Quirks Mode");var g=a("<input/>",{size:1}).attr("size")&&a.attrFn,h=a.attr,i=a.attrHooks.value&&a.attrHooks.value.get||function(){return null},j=a.attrHooks.value&&a.attrHooks.value.set||function(){return c},k=/^(?:input|button)$/i,l=/^[238]$/,m=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,n=/^(?:checked|selected)$/i;e(a,"attrFn",g||{},"jQuery.attrFn is deprecated"),a.attr=function(b,e,f,i){var j=e.toLowerCase(),o=b&&b.nodeType;return i&&(h.length<4&&d("jQuery.fn.attr( props, pass ) is deprecated"),b&&!l.test(o)&&(g?e in g:a.isFunction(a.fn[e])))?a(b)[e](f):("type"===e&&f!==c&&k.test(b.nodeName)&&b.parentNode&&d("Can't change the 'type' of an input or button in IE 6/7/8"),!a.attrHooks[j]&&m.test(j)&&(a.attrHooks[j]={get:function(b,d){var e,f=a.prop(b,d);return f===!0||"boolean"!=typeof f&&(e=b.getAttributeNode(d))&&e.nodeValue!==!1?d.toLowerCase():c},set:function(b,c,d){var e;return c===!1?a.removeAttr(b,d):(e=a.propFix[d]||d,e in b&&(b[e]=!0),b.setAttribute(d,d.toLowerCase())),d}},n.test(j)&&d("jQuery.fn.attr('"+j+"') might use property instead of attribute")),h.call(a,b,e,f))},a.attrHooks.value={get:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?i.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value') no longer gets properties"),b in a?a.value:null)},set:function(a,b){var c=(a.nodeName||"").toLowerCase();return"button"===c?j.apply(this,arguments):("input"!==c&&"option"!==c&&d("jQuery.fn.attr('value', val) no longer sets properties"),void(a.value=b))}};var o,p,q=a.fn.init,r=a.find,s=a.parseJSON,t=/^\s*</,u=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,v=/\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,w=/^([^<]*)(<[\w\W]+>)([^>]*)$/;a.fn.init=function(b,e,f){var g,h;return b&&"string"==typeof b&&!a.isPlainObject(e)&&(g=w.exec(a.trim(b)))&&g[0]&&(t.test(b)||d("$(html) HTML strings must start with '<' character"),g[3]&&d("$(html) HTML text after last tag is ignored"),"#"===g[0].charAt(0)&&(d("HTML string cannot start with a '#' character"),a.error("JQMIGRATE: Invalid selector string (XSS)")),e&&e.context&&e.context.nodeType&&(e=e.context),a.parseHTML)?q.call(this,a.parseHTML(g[2],e&&e.ownerDocument||e||document,!0),e,f):(h=q.apply(this,arguments),b&&b.selector!==c?(h.selector=b.selector,h.context=b.context):(h.selector="string"==typeof b?b:"",b&&(h.context=b.nodeType?b:e||document)),h)},a.fn.init.prototype=a.fn,a.find=function(a){var b=Array.prototype.slice.call(arguments);if("string"==typeof a&&u.test(a))try{document.querySelector(a)}catch(c){a=a.replace(v,function(a,b,c,d){return"["+b+c+'"'+d+'"]'});try{document.querySelector(a),d("Attribute selector with '#' must be quoted: "+b[0]),b[0]=a}catch(e){d("Attribute selector with '#' was not fixed: "+b[0])}}return r.apply(this,b)};var x;for(x in r)Object.prototype.hasOwnProperty.call(r,x)&&(a.find[x]=r[x]);a.parseJSON=function(a){return a?s.apply(this,arguments):(d("jQuery.parseJSON requires a valid JSON string"),null)},a.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.browser||(o=a.uaMatch(navigator.userAgent),p={},o.browser&&(p[o.browser]=!0,p.version=o.version),p.chrome?p.webkit=!0:p.webkit&&(p.safari=!0),a.browser=p),e(a,"browser",a.browser,"jQuery.browser is deprecated"),a.boxModel=a.support.boxModel="CSS1Compat"===document.compatMode,e(a,"boxModel",a.boxModel,"jQuery.boxModel is deprecated"),e(a.support,"boxModel",a.support.boxModel,"jQuery.support.boxModel is deprecated"),a.sub=function(){function b(a,c){return new b.fn.init(a,c)}a.extend(!0,b,this),b.superclass=this,b.fn=b.prototype=this(),b.fn.constructor=b,b.sub=this.sub,b.fn.init=function(d,e){var f=a.fn.init.call(this,d,e,c);return f instanceof b?f:b(f)},b.fn.init.prototype=b.fn;var c=b(document);return d("jQuery.sub() is deprecated"),b},a.fn.size=function(){return d("jQuery.fn.size() is deprecated; use the .length property"),this.length};var y=!1;a.swap&&a.each(["height","width","reliableMarginRight"],function(b,c){var d=a.cssHooks[c]&&a.cssHooks[c].get;d&&(a.cssHooks[c].get=function(){var a;return y=!0,a=d.apply(this,arguments),y=!1,a})}),a.swap=function(a,b,c,e){var f,g,h={};y||d("jQuery.swap() is undocumented and deprecated");for(g in b)h[g]=a.style[g],a.style[g]=b[g];f=c.apply(a,e||[]);for(g in b)a.style[g]=h[g];return f},a.ajaxSetup({converters:{"text json":a.parseJSON}});var z=a.fn.data;a.fn.data=function(b){var e,f,g=this[0];return!g||"events"!==b||1!==arguments.length||(e=a.data(g,b),f=a._data(g,b),e!==c&&e!==f||f===c)?z.apply(this,arguments):(d("Use of jQuery.fn.data('events') is deprecated"),f)};var A=/\/(java|ecma)script/i;a.clean||(a.clean=function(b,c,e,f){c=c||document,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,d("jQuery.clean() is deprecated");var g,h,i,j,k=[];if(a.merge(k,a.buildFragment(b,c).childNodes),e)for(i=function(a){return!a.type||A.test(a.type)?f?f.push(a.parentNode?a.parentNode.removeChild(a):a):e.appendChild(a):void 0},g=0;null!=(h=k[g]);g++)a.nodeName(h,"script")&&i(h)||(e.appendChild(h),"undefined"!=typeof h.getElementsByTagName&&(j=a.grep(a.merge([],h.getElementsByTagName("script")),i),k.splice.apply(k,[g+1,0].concat(j)),g+=j.length));return k});var B=a.event.add,C=a.event.remove,D=a.event.trigger,E=a.fn.toggle,F=a.fn.live,G=a.fn.die,H=a.fn.load,I="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",J=new RegExp("\\b(?:"+I+")\\b"),K=/(?:^|\s)hover(\.\S+|)\b/,L=function(b){return"string"!=typeof b||a.event.special.hover?b:(K.test(b)&&d("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),b&&b.replace(K,"mouseenter$1 mouseleave$1"))};a.event.props&&"attrChange"!==a.event.props[0]&&a.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),a.event.dispatch&&e(a.event,"handle",a.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),a.event.add=function(a,b,c,e,f){a!==document&&J.test(b)&&d("AJAX events should be attached to document: "+b),B.call(this,a,L(b||""),c,e,f)},a.event.remove=function(a,b,c,d,e){C.call(this,a,L(b)||"",c,d,e)},a.each(["load","unload","error"],function(b,c){a.fn[c]=function(){var a=Array.prototype.slice.call(arguments,0);return"load"===c&&"string"==typeof a[0]?H.apply(this,a):(d("jQuery.fn."+c+"() is deprecated"),a.splice(0,0,c),arguments.length?this.bind.apply(this,a):(this.triggerHandler.apply(this,a),this))}}),a.fn.toggle=function(b,c){if(!a.isFunction(b)||!a.isFunction(c))return E.apply(this,arguments);d("jQuery.fn.toggle(handler, handler...) is deprecated");var e=arguments,f=b.guid||a.guid++,g=0,h=function(c){var d=(a._data(this,"lastToggle"+b.guid)||0)%g;return a._data(this,"lastToggle"+b.guid,d+1),c.preventDefault(),e[d].apply(this,arguments)||!1};for(h.guid=f;g<e.length;)e[g++].guid=f;return this.click(h)},a.fn.live=function(b,c,e){return d("jQuery.fn.live() is deprecated"),F?F.apply(this,arguments):(a(this.context).on(b,this.selector,c,e),this)},a.fn.die=function(b,c){return d("jQuery.fn.die() is deprecated"),G?G.apply(this,arguments):(a(this.context).off(b,this.selector||"**",c),this)},a.event.trigger=function(a,b,c,e){return c||J.test(a)||d("Global events are undocumented and deprecated"),D.call(this,a,b,c||document,e)},a.each(I.split("|"),function(b,c){a.event.special[c]={setup:function(){var b=this;return b!==document&&(a.event.add(document,c+"."+a.guid,function(){a.event.trigger(c,Array.prototype.slice.call(arguments,1),b,!0)}),a._data(this,c,a.guid++)),!1},teardown:function(){return this!==document&&a.event.remove(document,c+"."+a._data(this,c)),!1}}}),a.event.special.ready={setup:function(){this===document&&d("'ready' event is deprecated")}};var M=a.fn.andSelf||a.fn.addBack,N=a.fn.find;if(a.fn.andSelf=function(){return d("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),M.apply(this,arguments)},a.fn.find=function(a){var b=N.apply(this,arguments);return b.context=this.context,b.selector=this.selector?this.selector+" "+a:a,b},a.Callbacks){var O=a.Deferred,P=[["resolve","done",a.Callbacks("once memory"),a.Callbacks("once memory"),"resolved"],["reject","fail",a.Callbacks("once memory"),a.Callbacks("once memory"),"rejected"],["notify","progress",a.Callbacks("memory"),a.Callbacks("memory")]];a.Deferred=function(b){var c=O(),e=c.promise();return c.pipe=e.pipe=function(){var b=arguments;return d("deferred.pipe() is deprecated"),a.Deferred(function(d){a.each(P,function(f,g){var h=a.isFunction(b[f])&&b[f];c[g[1]](function(){var b=h&&h.apply(this,arguments);b&&a.isFunction(b.promise)?b.promise().done(d.resolve).fail(d.reject).progress(d.notify):d[g[0]+"With"](this===e?d.promise():this,h?[b]:arguments)})}),b=null}).promise()},c.isResolved=function(){return d("deferred.isResolved is deprecated"),"resolved"===c.state()},c.isRejected=function(){return d("deferred.isRejected is deprecated"),"rejected"===c.state()},b&&b.call(c,c),c}}}(jQuery,window);

jQuery.autocomplete_gd=function(input,options){var me=this;var $input=jQuery(input).attr("autocomplete","off");if(options.inputClass)$input.addClass(options.inputClass);var results=document.createElement("div");var $results=jQuery(results);$results.show().addClass(options.resultsClass).css("position","absolute");if(options.width>0)$results.css("width",options.width);jQuery("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;function flushCache(){cache={};cache.data={};cache.length=0}flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string")options.cacheLength=1;for(var i=0;i<options.data.length;i++){row=typeof options.data[i]=="string"?[options.data[i]]:options.data[i];if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row)}}for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k])}}$input.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault()}break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange()},options.delay);break}}).focus(function(){hasFocus=true}).blur(function(){hasFocus=false;hideResults()});hideResultsNow();function onChange(){if(lastKeyPressCode==46||lastKeyPressCode>8&&lastKeyPressCode<32)return $results.show();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v)}else{$input.removeClass(options.loadingClass);$results.show()}}function moveSelect(step){var lis=jQuery("li",results);if(!lis)return;active+=step;if(active<0){active=0}else if(active>=lis.size()){active=lis.size()-1}lis.removeClass("ac_over");jQuery(lis[active]).addClass("ac_over")}function selectCurrent(){var li=jQuery("li.ac_over",results)[0];if(!li){var $li=jQuery("li",results);if(options.selectOnly){if($li.length==1)li=$li[0]}else if(options.selectFirst){li=$li[0]}}if(li){selectItem(li);return true}else{return false}}function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue=""}var v=jQuery.trim(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val(v);hideResultsNow();if(options.onItemSelect)setTimeout(function(){options.onItemSelect(li,$input.parents("form"))},1)}function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select()}else if(field.setSelectionRange){field.setSelectionRange(start,end)}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end}}field.focus()}function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length)}}function showResults(){$results.appendTo("body");$results.css({display:"block"});var pos=findPos(input);var iWidth=options.width>0?options.width:$input.outerWidth();$results.css({width:parseInt(iWidth)+"px",top:$input.offset().top+$input.outerHeight(true),left:pos.x+"px"}).show()}function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200)}function hideResultsNow(){$results.css({display:"none"});if(timeout)clearTimeout(timeout);$input.removeClass(options.loadingClass);if($results.is(":visible")){$results.show()}if(options.mustMatch){var v=$input.val();if(v!=input.lastSelected){selectItem(null)}}}function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if(jQuery.browser.msie){$results.append(document.createElement("iframe"))}results.appendChild(dataToDom(data));if(options.autoFill&&$input.val().toLowerCase()==q.toLowerCase())autoFill(data[0][0]);showResults()}else{hideResultsNow()}}function parseData(data){if(!data)return null;var parsed=[];var rows=data.split(options.lineSeparator);for(var i=0;i<rows.length;i++){var row=jQuery.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator)}}return parsed}function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if(options.maxItemsToShow>0&&options.maxItemsToShow<num)num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0]}else{li.innerHTML=row[0];li.selectValue=row[0]}var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j]}}li.extra=extra;ul.appendChild(li);jQuery(li).hover(function(){jQuery("li",ul).removeClass("ac_over");jQuery(this).addClass("ac_over");active=jQuery("li",ul).indexOf(jQuery(this).get(0))},function(){jQuery(this).removeClass("ac_over")}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)})}return ul}function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data&&data.length){receiveData(q,data)}else if(typeof options.url=="string"&&options.url.length>0){jQuery.ajax({url:makeUrl(q),type:"GET",dataType:"html",beforeSend:function(){geodir_search_wait(1)},success:function(data,textStatus,xhr){data=parseData(data);addToCache(q,data);receiveData(q,data);geodir_search_wait(0)},error:function(xhr,textStatus,errorThrown){console.log(textStatus);geodir_search_wait(0)}})}else{$input.removeClass(options.loadingClass)}}function makeUrl(q){var sform=jQuery($input).closest("form");var url=options.url+"&q="+encodeURI(q);for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i])}if($input.attr("name")==geodir_advanced_search_js_msg.autocomplete_field_name){if(sform.find('[name="set_location_type"]').length){url+="&_ltype="+encodeURI(sform.find('[name="set_location_type"]').val())}if(sform.find('[name="set_location_val"]').length){url+="&_lval="+encodeURI(sform.find('[name="set_location_val"]').val())}if(sform.find('[name="gd_hood_s"]').length){url+="&_lhood="+encodeURI(sform.find('[name="gd_hood_s"]').val())}}return url}function loadFromCache(q){if(gdNearChanged){flushCache();gdNearChanged=false;return null}if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x}}return csub}}}return null}function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains}this.flushCache=function(){flushCache()};this.setExtraParams=function(p){options.extraParams=p};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data&&data.length){findValueCallback(q,data)}else if(typeof options.url=="string"&&options.url.length>0){jQuery.get(makeUrl(q),function(data){data=parseData(data);addToCache(q,data);findValueCallback(q,data)})}else{findValueCallback(q,null)}};function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=data?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0]}else{li.innerHTML=row[0];li.selectValue=row[0]}var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j]}}li.extra=extra}}if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1)}function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++}else if(!cache[q]){cache.length++}cache.data[q]=data}function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop}return{x:curleft,y:curtop}}};jQuery.fn.autocomplete_gd=function(url,options,data){options=options||{};options.url=url;options.data=typeof data=="object"&&data.constructor==Array?data:null;options.inputClass=options.inputClass||"ac_input";options.resultsClass=options.resultsClass||"ac_results";options.lineSeparator=options.lineSeparator||"\n";options.cellSeparator=options.cellSeparator||"|";options.minChars=options.minChars||1;options.delay=options.delay||400;options.matchCase=options.matchCase||0;options.matchSubset=options.matchSubset||1;options.matchContains=options.matchContains||0;options.cacheLength=options.cacheLength||1;options.mustMatch=options.mustMatch||0;options.extraParams=options.extraParams||{};options.loadingClass=options.loadingClass||"ac_loading";options.selectFirst=options.selectFirst||false;options.selectOnly=options.selectOnly||false;options.maxItemsToShow=options.maxItemsToShow||-1;options.autoFill=options.autoFill||false;options.width=parseInt(options.width,10)||0;this.each(function(){var input=this;new jQuery.autocomplete_gd(input,options)});return this};jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete_gd(null,options,data)};jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i}return-1};(function(){})();function geodir_search_setup_ac(){if(geodir_advanced_search_js_msg.geodir_location_manager_active==1&&geodir_advanced_search_js_msg.geodir_enable_autocompleter_near==1){jQuery(".snear").each(function(){jQuery(this).keyup(function(){jQuery(this).removeClass("near-country near-region near-city")})});jQuery("input[name=snear]").autocomplete_gd(geodir_advanced_search_js_msg.geodir_admin_ajax_url+"?action=geodir_autocompleter_near_ajax_action",{delay:500,minChars:parseInt(geodir_var.as_min_char),matchSubset:1,matchContains:1,cacheLength:1,formatItem:formatItemNear,onItemSelect:onSelectItemNear,autoFill:false})}if(jQuery(".search_by_post").val()){gd_s_post_type=jQuery(".search_by_post").val()}else if(jQuery('.geodir-search input[name="stype"]').val()){gd_s_post_type=jQuery('.geodir-search input[name="stype"]').val()}else{gd_s_post_type="gd_place"}setTimeout(function(){jQuery(".search_by_post").change(function(){gd_s_post_type=jQuery(this).val();jQuery(".ac_results").remove();jQuery.each(gdsa,function(index,item){if(this.autocompleter){this.autocompleter.setExtraParams({post_type:gd_s_post_type});this.autocompleter.flushCache()}})})},100);if(geodir_advanced_search_js_msg.geodir_enable_autocompleter==1){try{var gdsa=jQuery(".geodir_submit_search").closest("form").find("input[name="+geodir_advanced_search_js_msg.autocomplete_field_name+"]").autocomplete_gd(geodir_advanced_search_js_msg.geodir_admin_ajax_url+"?action=geodir_autocompleter_ajax_action",{delay:500,minChars:parseInt(geodir_var.as_min_char),matchSubset:1,matchContains:1,cacheLength:1,formatItem:formatItem,onItemSelect:onSelectItem,autoFill:false,extraParams:{post_type:gd_s_post_type}})}catch(e){}}if(jQuery(".gd-adv-search-labels label").length){jQuery(".gd-adv-search-labels label").live("click",function(event){var dataName=jQuery(this).attr("data-name");var dataNames=jQuery(this).attr("data-names");if(typeof dataName!="undefined"||jQuery(this).hasClass("gd-adv-search-near")){if(jQuery(this).hasClass("gd-adv-search-near")){dataName="snear"}var dataEl=jQuery("form.geodir-listing-search").find('[name="'+dataName+'"]');gd_adv_search_deselect(dataEl);if(typeof dataNames!="undefined"){dataEl=jQuery("form.geodir-listing-search").find('[name="'+dataNames+'"]');gd_adv_search_deselect(dataEl)}jQuery("form.geodir-listing-search").find(".geodir_submit_search").click()}})}jQuery(".geodir_advance_search_widget.geodir-advance-search-searched").each(function(){var $this=this;if(jQuery($this).attr("data-show-adv")=="search"){jQuery(".showFilters",$this).trigger("click")}});jQuery(".customize_filter",".geodir-filter-container").each(function(){var $cont=this;var $form=jQuery($cont).closest("form");var $adv_show=jQuery($form).closest(".geodir_advance_search_widget").attr("data-show-adv");if($adv_show=="always"&&typeof jQuery(".showFilters",$form).html()!="undefined"){jQuery(".showFilters",$form).remove();if(!jQuery(".customize_filter",$form).is(":visible")){jQuery(".customize_filter",$form).slideToggle(500)}}})}jQuery(document).ready(function($){gdsText=jQuery('input[type="button"].geodir_submit_search').val();jQuery(".geodir_submit_search").click(function(){var $form=jQuery(this).closest("form");geodir_search_wait(1);var is_near_me=false;var $snear=jQuery(".snear",$form).val();if($snear==geodir_advanced_search_js_msg.msg_Near+" "+geodir_advanced_search_js_msg.msg_Me){is_near_me=true}else if($snear==geodir_advanced_search_js_msg.msg_Near+" "+geodir_advanced_search_js_msg.msg_User_defined){is_near_me=true}else if($snear.match("^"+geodir_advanced_search_js_msg.msg_In)){is_near_me=true}if(jQuery(".sgeo_lat").val()!=""&&jQuery(".sgeo_lon").val()!=""&&!is_near_me){jQuery(".sgeo_lat").val("");jQuery(".sgeo_lon").val("")}return false});geodir_search_setup_ac();jQuery("body").on("geodir_setup_search_form",function(){geodir_search_setup_ac();gdSetupUserLoc()})});function gd_adv_search_deselect(el){var fType=jQuery(el).prop("type");switch(fType){case"checkbox":case"radio":jQuery(el).prop("checked",false);break}jQuery(el).val("")}function gdGetLocation(box){jQuery(".snear").removeClass("near-country near-region near-city");if(box&&box.prop("checked")!=true){gdClearUserLoc();return}if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){lat=position.coords.latitude;lon=position.coords.longitude;gdSetUserLocation(position.coords.latitude,position.coords.longitude,1)},gdLocationError,gdLocationOptions)}else{alert(geodir_advanced_search_js_msg.GEOLOCATION_NOT_SUPPORTED)}}function gdClearUserLoc(){lat="";lon="";my_location="";userMarkerActive=true;gdSetUserLocation(lat,lon,my_location)}function setusermarker(new_lat,new_lon,map_id){if(window.gdMaps=="osm"){setusermarker_osm(new_lat,new_lon,map_id);return}var image=new google.maps.MarkerImage(geodir_advanced_search_js_msg.geodir_advanced_search_plugin_url+"/css/map_me.png",null,null,new google.maps.Point(8,8),new google.maps.Size(17,17));if(map_id){goMap=jQuery("#"+map_id).goMap()}if(gdUmarker["visible"]){return}if(typeof goMap=="undefined"){return}var coord=new google.maps.LatLng(lat,lon);gdUmarker=jQuery.goMap.createMarker({optimized:false,flat:true,draggable:true,id:"map_me",title:"Set Location",position:coord,visible:true,clickable:true,icon:image});jQuery.goMap.createListener({type:"marker",marker:"map_me"},"dragend",function(){latLng=gdUmarker.getPosition();lat=latLng.lat();lon=latLng.lng();gdSetUserLocation(lat,lon,0)});userMarkerActive=true}function setusermarker_osm(new_lat,new_lon,map_id){if(map_id){goMap=jQuery("#"+map_id).goMap()}if(jQuery.goMap.gdUmarker){return}if(typeof goMap=="undefined"){return}gdUmarker=jQuery.goMap.createMarker({optimized:false,flat:true,draggable:true,id:"map_me",title:"Set Location",position:new L.latLng(lat,lon),visible:true,clickable:true,addToMap:true});gdUmarker.setIcon(L.divIcon({iconSize:[17,17],iconAnchor:[8.5,8.5],className:"gd-user-marker",html:'<div class="gd-user-marker-box"><div class="gd-user-marker-animate"></div><img class="gd-user-marker-img" src="'+geodir_advanced_search_js_msg.geodir_advanced_search_plugin_url+"/css/map_me.png"+'"></img></div>'}));gdUmarker.on("dragend",function(e){gdULatLng=gdUmarker.getLatLng();gdSetUserLocation(gdULatLng.lat,gdULatLng.lng,0)});jQuery.goMap.gdUmarker=gdUmarker;userMarkerActive=true}function moveUserMarker(lat,lon){if(window.gdMaps=="google"){var coord=new google.maps.LatLng(lat,lon);gdUmarker.setPosition(coord)}else if(window.gdMaps=="osm"){var coord=new L.latLng(lat,lon);gdUmarker.setLatLng(coord)}}function removeUserMarker(){if(typeof goMap!="undefined"){jQuery.goMap.removeMarker("map_me")}userMarkerActive=false}function gdLocationError(error){switch(error.code){case error.PERMISSION_DENIED:alert(geodir_advanced_search_js_msg.PERMISSION_DENINED);break;case error.POSITION_UNAVAILABLE:alert(geodir_advanced_search_js_msg.POSITION_UNAVAILABLE);break;case error.TIMEOUT:alert(geodir_advanced_search_js_msg.DEFAUTL_ERROR);break;case error.UNKNOWN_ERROR:alert(geodir_advanced_search_js_msg.UNKNOWN_ERROR);break}}function gdSetupUserLoc(){if(my_location){jQuery(".geodir-search .fa-compass").css("color",geodir_advanced_search_js_msg.compass_active_color);jQuery(".gt_near_me_s").prop("checked",true);jQuery(".snear").val(geodir_advanced_search_js_msg.msg_Near+" "+geodir_advanced_search_js_msg.msg_Me);jQuery(".sgeo_lat").val(lat);jQuery(".sgeo_lon").val(lon)}else{if(lat&&lon){jQuery(".geodir-search .fa-compass").css("color",geodir_advanced_search_js_msg.compass_active_color);jQuery(".gt_near_me_s").prop("checked",true);jQuery(".snear").val(geodir_advanced_search_js_msg.msg_Near+" "+geodir_advanced_search_js_msg.msg_User_defined);jQuery(".sgeo_lat").val(lat);jQuery(".sgeo_lon").val(lon)}else if(jQuery(".snear").length&&jQuery(".snear").val().match("^"+geodir_advanced_search_js_msg.msg_Near)){jQuery(".geodir-search .fa-compass").css("color","");jQuery(".gt_near_me_s").prop("checked",false);jQuery(".snear").val("");jQuery(".snear").blur();jQuery(".sgeo_lat").val("");jQuery(".sgeo_lon").val("")}}}function gdSetUserLocation(lat,lon,my_loc){if(my_loc){my_location=1}else{my_location=0}gdSetupUserLoc();if(userMarkerActive==false){jQuery.each(map_id_arr,function(key,value){setusermarker(lat,lon,value)})}else if(lat&&lon){moveUserMarker(lat,lon)}else{removeUserMarker()}jQuery.ajax({url:geodir_advanced_search_js_msg.geodir_admin_ajax_url,type:"POST",dataType:"html",data:{action:"gd_set_user_location",lat:lat,lon:lon,myloc:my_location},success:function(data,textStatus,xhr){},error:function(xhr,textStatus,errorThrown){console.log(errorThrown)}})}function gdasShowRange(el){jQuery(".gdas-range-value-out").html(jQuery(el).val()+" "+geodir_advanced_search_js_msg.unom_dist)}function gdasSetRange(el){range=jQuery(el).val();var ajax_url=geodir_advanced_search_js_msg.geodir_admin_ajax_url;jQuery.post(ajax_url,{action:"geodir_set_near_me_range",range:range},function(data){})}function geodir_do_geolocation_on_load(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(geodir_position_success_on_load,geodir_position_error,{timeout:1e4})}else{var error={code:"-1"};geodir_position_error(error)}}function geodir_position_error(err){var ajax_url=geodir_advanced_search_js_msg.geodir_admin_ajax_url;var msg;var default_err=false;switch(err.code){case err.UNKNOWN_ERROR:msg=geodir_advanced_search_js_msg.UNKNOWN_ERROR;break;case err.PERMISSION_DENINED:msg=geodir_advanced_search_js_msg.PERMISSION_DENINED;break;case err.POSITION_UNAVAILABLE:msg=geodir_advanced_search_js_msg.POSITION_UNAVAILABLE;break;case err.BREAK:msg=geodir_advanced_search_js_msg.BREAK;break;case 3:geodir_position_success_on_load(null);break;default:msg=geodir_advanced_search_js_msg.DEFAUTL_ERROR;default_err=true;break}jQuery.post(ajax_url,{action:"geodir_share_location",geodir_ajax:"share_location",error:true},function(data){});if(!default_err){alert(msg)}}function geodir_position_success_on_load(position){var ajax_url=geodir_advanced_search_js_msg.geodir_admin_ajax_url;var request_param=geodir_advanced_search_js_msg.request_param;var redirect=typeof redirect!=="undefined"?redirect:"";var lat;var long;if(position&&position!==null){var coords=position.coords||position.coordinate||position;lat=coords.latitude;long=coords.longitude}jQuery.post(ajax_url,{action:"geodir_share_location",geodir_ajax:"share_location",lat:lat,"long":long,request_param:request_param},function(data){if(data&&data!=="OK"){window.location=data}})}jQuery(document).ready(function(){geodir_search_onload_redirect()});function geodir_search_onload_redirect(){var onloadRedirect=geodir_advanced_search_js_msg.onload_redirect;var onloadAskRedirect=geodir_advanced_search_js_msg.onload_askRedirect;if(!onloadAskRedirect){return}if(typeof Storage!=="undefined"&&sessionStorage.getItem("gd_onload_redirect_done")!="1"){sessionStorage.setItem("gd_onload_redirect_done","1");switch(onloadRedirect){case"nearest":if(geodir_advanced_search_js_msg.geodir_autolocate_ask){if(confirm(geodir_advanced_search_js_msg.geodir_autolocate_ask_msg)){geodir_do_geolocation_on_load()}else{geodir_position_do_not_share()}}else{geodir_do_geolocation_on_load()}break;case"location":var redirectLocation=geodir_advanced_search_js_msg.onload_redirectLocation;if(redirectLocation&&redirectLocation!==""){window.location=redirectLocation}break;case"no":default:geodir_position_do_not_share();break}}}function geodir_position_do_not_share(){var ajax_url=geodir_advanced_search_js_msg.geodir_admin_ajax_url;jQuery.post(ajax_url,{action:"geodir_do_not_share_location",geodir_ajax:"share_location"},function(data){})}function formatItemNear(row){var attr;if(row.length==3){attr='attr="'+row[2]+'"'}else{attr=""}return row[0]+"<span "+attr+"></span>"}gdReplaceASC_load=true;function gdReplaceASC(stype,el){if(!stype){return}var $form=jQuery(el).closest("form");var $adv_show=jQuery($form).closest(".geodir_advance_search_widget").attr("data-show-adv");jQuery($form).addClass("geodir-adv-form-wait");if($adv_show=="always"||$adv_show=="search"){jQuery(".geodir-loc-bar-in",$form).css({opacity:".66"});jQuery(".customize_filter",$form).css({opacity:".66"});if(jQuery(".customize_filter",$form).is(":visible")){jQuery(".customize_filter",$form).slideToggle(500)}}else{jQuery(".customize_filter",$form).hide("slow");jQuery(".geodir_submit_search",$form).css("visibility","visible")}var $div=jQuery(el).closest(".geodir-search");var button="";var html="";jQuery.ajax({url:geodir_advanced_search_js_msg.geodir_admin_ajax_url,type:"POST",dataType:"html",data:{action:"geodir_advance_search_button_ajax",stype:stype,adv:$adv_show},beforeSend:function(){if(!gdReplaceASC_load){geodir_search_wait(1)}gdReplaceASC_load=false},success:function(data,textStatus,xhr){jQuery($form).removeClass("geodir-adv-form-wait");jQuery("body").removeClass("gd-multi-datepicker");if(data){gdGetCustomiseHtml(stype,data,el)}else{if($adv_show=="always"||$adv_show=="search"){jQuery(".geodir_submit_search",$form).css("visibility","visible");jQuery(".geodir-loc-bar-in",$form).css({opacity:"1"})}gdSetupAjaxAdvancedSearch("","",el);geodir_search_wait(0)}geodir_reposition_compass()},error:function(xhr,textStatus,errorThrown){console.log(textStatus);geodir_search_wait(0)},complete:function(xhr,textStatus){}})}function gdGetCustomiseHtml(stype,button,el){var $adv_show=jQuery(el).closest(".geodir_advance_search_widget").attr("data-show-adv");jQuery.ajax({url:geodir_advanced_search_js_msg.geodir_admin_ajax_url,type:"POST",dataType:"html",data:{action:"gd_advancedsearch_customise",stype:stype,adv:$adv_show},beforeSend:function(){},success:function(data,textStatus,xhr){gdSetupAjaxAdvancedSearch(button,data,el);geodir_reposition_compass();geodir_search_wait(0)},error:function(xhr,textStatus,errorThrown){console.log(textStatus);geodir_search_wait(0)}})}function gdSetupAjaxAdvancedSearch(button,html,el){var $form=jQuery(el).closest("form");var $adv_show=jQuery($form).closest(".geodir_advance_search_widget").attr("data-show-adv");if(button){if(jQuery(".showFilters",$form).length){}else{jQuery(".geodir_submit_search:visible",$form).after(button)}jQuery($form).addClass("geodir-adv-form");jQuery(".geodir-filter-container",$form).html(html);if($adv_show=="always"||$adv_show=="search"){jQuery(".geodir-loc-bar-in",$form).css({opacity:"1"});if(!jQuery(".customize_filter",$form).is(":visible")){jQuery(".customize_filter",$form).slideToggle(500)}if($adv_show=="always"){jQuery(".showFilters",$form).remove()}else{jQuery("body").addClass("geodir_advance_search")}}else{jQuery("body").addClass("geodir_advance_search")}}else{jQuery(".showFilters",$form).remove();jQuery(".geodir-filter-container",$form).html("");jQuery("body").removeClass("geodir_advance_search");jQuery($form).removeClass("geodir-adv-form")}geodir_setup_submit_search()}function onSelectItem(row,$form){if(geodir_advanced_search_js_msg.geodir_autocompleter_autosubmit==1){var link=jQuery(row).find("span").attr("link");if(typeof link!="undefined"&&link!=""){window.location.href=link;return true}if($form.find(' input[name="snear"]').val()==geodir_advanced_search_js_msg.default_Near){jQuery('input[name="snear"]').val("")}if(jQuery(".search_by_post",$form).val()!=""&&typeof gd_cpt_no_location=="function"){if(gd_cpt_no_location(jQuery(".search_by_post",$form).val())){jQuery(".snear",$form).remove();jQuery(".sgeo_lat",$form).remove();jQuery(".sgeo_lon",$form).remove();jQuery('select[name="sort_by"]',$form).remove()}}if(typeof jQuery(row).find("span").attr("attr")!="undefined"){jQuery("input.geodir_submit_search",$form).trigger("click")}else{jQuery("input.geodir_submit_search",$form).trigger("click")}}else{jQuery(row).parents("form").find('input[name="'+geodir_advanced_search_js_msg.autocomplete_field_name+'"]').focus()}}function onSelectItemNear(row,$form){nClass="";lType="";gdNearChanged=true;if(row.extra[2]==1){nClass="near-country";lType=geodir_advanced_search_js_msg.txt_in_country}else if(row.extra[2]==2){nClass="near-region";lType=geodir_advanced_search_js_msg.txt_in_region}else if(row.extra[2]==3){nClass="near-city";lType=geodir_advanced_search_js_msg.txt_in_city}else if(row.extra[2]==4){nClass="near-neighbourhood";lType=geodir_advanced_search_js_msg.txt_in_hood;if($form.find(' input[name="gd_hood_s"]').length){$form.find(' input[name="gd_hood_s"]').val(row.extra[3])}else{$form.find(' input[name="snear"]').after('<input name="gd_hood_s" type="hidden" value="'+row.extra[3]+'" />')}}if(row.extra[2]!=4){$form.find('input[name="gd_hood_s"]').remove()}fillVal=geodir_advanced_search_js_msg.msg_In+" "+row.extra[0]+" "+lType;$form.find(' input[name="snear"]').val(fillVal);if($form.find(' input[name="set_location_val"]').length){$form.find(' input[name="set_location_val"]').val(row.extra[1])}else{$form.find(' input[name="snear"]').after('<input name="set_location_val" type="hidden" value="'+row.extra[1]+'" />')}if($form.find(' input[name="set_location_type"]').length){$form.find(' input[name="set_location_type"]').val(row.extra[2])}else{$form.find(' input[name="snear"]').after('<input name="set_location_type" type="hidden" value="'+row.extra[2]+'" />')}$form.find(' input[name="snear"]').removeClass("near-country near-region near-city");if(nClass){$form.find(' input[name="snear"]').addClass(nClass)}if(geodir_advanced_search_js_msg.geodir_autocompleter_autosubmit_near==1){setTimeout(function(){$form.find(".geodir_submit_search").click()},100)}}function formatItem(row){var attr;if(row.length==3&&row[2]!=""){attr='attr="'+row[2]+'"'}else{attr=""}var link="";var icon="";var exp=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;if(typeof row[1]!="undefined"&&row[1]!=""&&exp.test(row[1])){link=' link="'+row[1]+'" class="gd-search-has-link"';icon='<i class="fa fa-angle-double-right"></i>'}return row[0]+"<span "+attr+" "+link+">"+icon+"</span>"}function geodir_insert_compass(){if(geodir_advanced_search_js_msg.search_new_style=="1"){return}jQuery(".snear").each(function(){var $this=jQuery(this);jQuery('<span class="near-compass" data-dropdown=".gd-near-me-dropdown"></span>').css({position:"absolute",left:$this.position().left+$this.outerWidth()+parseInt($this.css("margin-left"))-$this.innerHeight(),top:$this.position().top+parseInt($this.css("margin-top"))+($this.outerHeight()-$this.innerHeight())/2,fontSize:($this.innerHeight()+parseInt($this.css("margin-top")))*.95,"line-height":"0px"}).html('<i class="fa fa-compass"></i>').data("inputEQ",$this.index()).insertAfter($this)});jQuery(window).resize(function(){geodir_reposition_compass()})}function geodir_reposition_compass(){if(geodir_advanced_search_js_msg.search_new_style=="1"){return}jQuery(".snear").each(function(){var $this=jQuery(this);jQuery($this).next(".near-compass").css({position:"absolute",left:$this.position().left+$this.outerWidth()+parseInt($this.css("margin-left"))-$this.innerHeight(),top:$this.position().top+parseInt($this.css("margin-top"))+($this.outerHeight()-$this.innerHeight())/2,fontSize:($this.innerHeight()+parseInt($this.css("margin-top")))*.95,"line-height":"0px"})})}function geodir_search_expandmore(el){var moretext=jQuery.trim(jQuery(el).text());jQuery(el).closest("ul").find(".more").toggle("slow");if(moretext==geodir_advanced_search_js_msg.text_more){jQuery(el).text(geodir_advanced_search_js_msg.text_less)}else{jQuery(el).text(geodir_advanced_search_js_msg.text_more)}}if(typeof window.gdShowFilters==="undefined"){window.gdShowFilters=function(fbutton){var $form=jQuery(fbutton).closest("form");var $adv_show=jQuery($form).closest(".geodir_advance_search_widget").attr("data-show-adv");if($adv_show=="always"){}else{jQuery("button.showFilters i").addClass("fa-spin");jQuery(".customize_filter",$form).slideToggle("slow",function(){jQuery("button.showFilters i").removeClass("fa-spin")})}}}jQuery&&function(t){function o(o,d){var n=o?t(this):d,a=t(n.attr("data-dropdown")),s=n.hasClass("dropdown-open");if(o){if(t(o.target).hasClass("dropdown-ignore"))return;o.preventDefault(),o.stopPropagation()}else if(n!==d.target&&t(d.target).hasClass("dropdown-ignore"))return;r(),s||n.hasClass("dropdown-disabled")||(n.addClass("dropdown-open"),a.data("dropdown-trigger",n).show(),e(),a.trigger("show",{dropdown:a,trigger:n}))}function r(o){var r=o?t(o.target).parents().addBack():null;if(r&&r.is("div.gd-dropdown")){if(!r.is(".dropdown-menu"))return;if(!r.is("A"))return}t(document).find("div.gd-dropdown:visible").each(function(){var o=t(this);o.hide().removeData("dropdown-trigger").trigger("hide",{dropdown:o})}),t(document).find(".dropdown-open").removeClass("dropdown-open")}function e(){var o=t(".gd-dropdown:visible").eq(0),r=o.data("dropdown-trigger"),e=r?parseInt(r.attr("data-horizontal-offset")||0,10):null,d=r?parseInt(r.attr("data-vertical-offset")||0,10):null;jQuery(o).appendTo("body");0!==o.length&&r&&o.css(o.hasClass("dropdown-relative")?{left:o.hasClass("dropdown-anchor-right")?r.position().left-(o.outerWidth(!0)-r.outerWidth(!0))-parseInt(r.css("margin-right"),10)+e:r.position().left+parseInt(r.css("margin-left"),10)+e,top:r.position().top+r.outerHeight(!0)-parseInt(r.css("margin-top"),10)+d}:{left:o.hasClass("dropdown-anchor-right")?r.offset().left-(o.outerWidth()-r.outerWidth())+e:r.offset().left+e,top:r.offset().top+r.outerHeight(true)+d})}t.extend(t.fn,{dropdown:function(e,d){switch(e){case"show":return o(null,t(this)),t(this);case"hide":return r(),t(this);case"attach":return t(this).attr("data-dropdown",d);case"detach":return r(),t(this).removeAttr("data-dropdown");case"disable":return t(this).addClass("dropdown-disabled");case"enable":return r(),t(this).removeClass("dropdown-disabled")}}}),t(document).on("click.dropdown","[data-dropdown]",o),t(document).on("click.dropdown",r),t(window).on("resize",e)}(jQuery);

/* <![CDATA[ */
var geodir_var = {"siteurl":"http:\/\/www.new-brennanhealingscience.org\/directory","geodir_plugin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodirectory","geodir_lazy_load":"1","geodir_ajax_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin-ajax.php?action=geodir_ajax_action","geodir_gd_modal":"0","is_rtl":"0","as_min_char":"3"};
/* ]]> */

var gdUrlParam=function gdUrlParam(sParam){var sPageURL=decodeURIComponent(window.location.search.substring(1)),sURLVariables=sPageURL.split("&"),sParameterName,i;for(i=0;i<sURLVariables.length;i++){sParameterName=sURLVariables[i].split("=");if(sParameterName[0]===sParam){return sParameterName[1]===undefined?true:sParameterName[1]}}};jQuery.fn.gdunveil=function(threshold,callback,extra1){var $w=jQuery(window),th=threshold||0,retina=window.devicePixelRatio>1,attrib=retina?"data-src-retina":"data-src",images=this,loaded;if(extra1){var $e1=jQuery(extra1),th=threshold||0,retina=window.devicePixelRatio>1,attrib=retina?"data-src-retina":"data-src",images=this,loaded}this.one("gdunveil",function(){var source=this.getAttribute(attrib);source=source||this.getAttribute("data-src");if(source){jQuery(this).css("background-image",'url("'+source+'")');if(typeof callback==="function")callback.call(this)}});function gdunveil(){var inview=images.filter(function(){var $e=jQuery(this);if($e.is(":hidden"))return;var wt=$w.scrollTop(),wb=wt+$w.height(),et=$e.offset().top,eb=et+$e.height();return eb>=wt-th&&et<=wb+th});loaded=inview.trigger("gdunveil");images=images.not(loaded)}$w.on("scroll.gdunveil resize.gdunveil lookup.gdunveil",gdunveil);if(extra1){$e1.on("scroll.gdunveil resize.gdunveil lookup.gdunveil",gdunveil)}gdunveil();return this};function geodir_init_lazy_load(){jQuery(".geodir_thumbnail").gdunveil(100,function(){this.style.opacity=1},"#geodir_content");jQuery("#gd-tabs").click(function(){setTimeout(function(){jQuery(window).trigger("lookup")},100)});jQuery(document).ready(function(){setTimeout(function(){jQuery(window).trigger("lookup")},100)})}jQuery(function(){if(geodir_var.geodir_lazy_load==1){geodir_init_lazy_load()}});(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(D)?(t.removeAttribute(D),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(F),parseInt(n,10)>=0&&(t.setAttribute("maxLength",n),t.removeAttribute(F)),r=t.getAttribute(P),r&&(t.type=r),!0):!1}function a(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(D,"true"),t.value=n,t.className+=" "+I,r=t.getAttribute(F),r||(t.setAttribute(F,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(P),e?t.type="text":"password"===t.type&&M.changeType(t,"text")&&t.setAttribute(P,"password"),!0):!1}function u(t,e){var r,n,a,u,i,l,o;if(t&&t.getAttribute(V))e(t);else for(a=t?t.getElementsByTagName("input"):b,u=t?t.getElementsByTagName("textarea"):f,r=a?a.length:0,n=u?u.length:0,o=0,l=r+n;l>o;o++)i=r>o?a[o]:u[o-r],e(i)}function i(t){u(t,n)}function l(t){u(t,a)}function o(t){return function(){m&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)?M.moveCaret(t,0):n(t)}}function c(t){return function(){a(t)}}function s(t){return function(e){return A=t.value,"true"===t.getAttribute(D)&&A===t.getAttribute(V)&&M.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function d(t){return function(){n(t,A),""===t.value&&(t.blur(),M.moveCaret(t,0))}}function g(t){return function(){t===r()&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)&&M.moveCaret(t,0)}}function v(t){return function(){i(t)}}function p(t){t.form&&(T=t.form,"string"==typeof T&&(T=document.getElementById(T)),T.getAttribute(U)||(M.addEventListener(T,"submit",v(T)),T.setAttribute(U,"true"))),M.addEventListener(t,"focus",o(t)),M.addEventListener(t,"blur",c(t)),m&&(M.addEventListener(t,"keydown",s(t)),M.addEventListener(t,"keyup",d(t)),M.addEventListener(t,"click",g(t))),t.setAttribute(j,"true"),t.setAttribute(V,x),(m||t!==r())&&a(t)}var b,f,m,h,A,y,E,x,L,T,N,S,w,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],k="#ccc",I="placeholdersjs",R=RegExp("(?:^|\\s)"+I+"(?!\\S)"),V="data-placeholder-value",D="data-placeholder-active",P="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",q="data-placeholder-focus",z="data-placeholder-live",F="data-placeholder-maxlength",G=document.createElement("input"),H=document.getElementsByTagName("head")[0],J=document.documentElement,K=t.Placeholders,M=K.Utils;if(K.nativeSupport=void 0!==G.placeholder,!K.nativeSupport){for(b=document.getElementsByTagName("input"),f=document.getElementsByTagName("textarea"),m="false"===J.getAttribute(q),h="false"!==J.getAttribute(z),y=document.createElement("style"),y.type="text/css",E=document.createTextNode("."+I+" { color:"+k+"; }"),y.styleSheet?y.styleSheet.cssText=E.nodeValue:y.appendChild(E),H.insertBefore(y,H.firstChild),w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x&&(x=x.nodeValue,x&&M.inArray(B,N.type)&&p(N));L=setInterval(function(){for(w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x?(x=x.nodeValue,x&&M.inArray(B,N.type)&&(N.getAttribute(j)||p(N),(x!==N.getAttribute(V)||"password"===N.type&&!N.getAttribute(P))&&("password"===N.type&&!N.getAttribute(P)&&M.changeType(N,"text")&&N.setAttribute(P,"password"),N.value===N.getAttribute(V)&&(N.value=x),N.setAttribute(V,x)))):N.getAttribute(D)&&(n(N),N.removeAttribute(V));h||clearInterval(L)},100)}M.addEventListener(t,"beforeunload",function(){K.disable()}),K.disable=K.nativeSupport?e:i,K.enable=K.nativeSupport?e:l}(this);jQuery(document).ready(function($){jQuery("#geodir-tab-mobile-menu").click(function(){jQuery("#gd-tabs .geodir-tab-head").toggle()});gd_infowindow=typeof google!=="undefined"&&typeof google.maps!=="undefined"?new google.maps.InfoWindow:null;if(jQuery("select.chosen_select").length>0){jQuery("select.chosen_select").chosen({no_results_text:"Sorry, nothing found!"});jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"})}jQuery('.gd-cats-display-checkbox input[type="checkbox"]').click(function(){var isChecked=jQuery(this).is(":checked");if(!isChecked){var chkVal=jQuery(this).val();jQuery(this).closest(".gd-parent-cats-list").find(".gd-cat-row-"+chkVal+' input[type="checkbox"]').prop("checked",isChecked)}});jQuery(".geodir-delete").click(function(){var message=geodir_all_js_msg.my_place_listing_del;if(jQuery(this).closest(".geodir-gridview").hasClass("gdp-franchise-m")||jQuery(this).closest(".geodir-listview").hasClass("gdp-franchise-m")){message=geodir_all_js_msg.my_main_listing_del}if(confirm(message)){return true}else{return false}});jQuery(".gd-category-dd").hover(function(){jQuery(".gd-category-dd ul").show()});jQuery(".gd-category-dd ul li a").click(function(ele){jQuery(".gd-category-dd").find("input").val(jQuery(this).attr("data-slug"));jQuery(".gd-category-dd > a").html(jQuery(this).attr("data-name"));jQuery(".gd-category-dd ul").hide()});geodir_setup_search_form()});jQuery(window).load(function(){jQuery(".geodir-tabs-content").show();tabNoRun=false;function activateTab(tab){if(!jQuery(".geodir-tab-head").length){return}tabName=urlHash=tab.find("a").html();if(tabName&&jQuery(".geodir-mobile-active-tab").length){jQuery(".geodir-mobile-active-tab").html(tabName)}if(tabNoRun){tabNoRun=false;return}var activeTab=tab.closest("dl").find("dd.geodir-tab-active"),contentLocation=tab.find("a").attr("data-tab")+"Tab";urlHash=tab.find("a").attr("data-tab");if(jQuery(tab).hasClass("geodir-tab-active")){}else{if(typeof urlHash==="undefined"){if(window.location.hash.substring(0,8)=="#comment"){tab=jQuery('*[data-tab="#reviews"]').parent();tabNoRun=true}}else{if(history.pushState){history.replaceState(null,null,urlHash)}else{window.location.hash=urlHash}}}activeTab.removeClass("geodir-tab-active");tab.addClass("geodir-tab-active");jQuery(contentLocation).closest(".geodir-tabs-content").children("li").hide();jQuery(contentLocation).fadeIn();jQuery(contentLocation).css({display:"inline-block"});if(urlHash=="#post_map"&&window.gdMaps){window.setTimeout(function(){jQuery("#detail_page_map_canvas").goMap();var center=jQuery.goMap.map.getCenter();if(window.gdMaps=="osm"){jQuery.goMap.map.invalidateSize();jQuery.goMap.map._onResize();jQuery.goMap.map.panTo(center)}else{google.maps.event.trigger(jQuery.goMap.map,"resize");jQuery.goMap.map.setCenter(center)}},100)}if(history.pushState&&window.location.hash&&jQuery("#publish_listing").length===0){if(jQuery(window).width()<1060){jQuery("#gd-tabs .geodir-tab-head").toggle();jQuery("html, body").animate({scrollTop:jQuery("#geodir-tab-mobile-menu").offset().top},500)}}}jQuery("dl.geodir-tab-head").each(function(){var tabs=jQuery(this).children("dd");tabs.click(function(e){if(jQuery(this).find("a").attr("data-status")=="enable"){activateTab(jQuery(this))}})});if(window.location.hash){activateTab(jQuery('a[data-tab="'+window.location.hash+'"]').parent())}jQuery(".gd-tabs .gd-tab-next").click(function(ele){var is_validate=true;if(is_validate){var tab=jQuery("dl.geodir-tab-head").find("dd.geodir-tab-active").next();if(tab.find("a").attr("data-status")=="enable"){activateTab(tab)}if(!jQuery("dl.geodir-tab-head").find("dd.geodir-tab-active").next().is("dd")){jQuery(this).hide();jQuery("#gd-add-listing-submit").show()}}});jQuery("#gd-login-options input").change(function(){jQuery(".gd-login_submit").toggle()});jQuery("ul.geodir-tabs-content").css({"z-index":"0",position:"relative"});jQuery("dl.geodir-tab-head dd.geodir-tab-active").trigger("click")});function autofill_click(ele){var fill_value=jQuery(ele).html();jQuery(ele).closest("div.gd-autofill-dl").closest("div.gd-autofill").find("input[type=text]").val(fill_value);jQuery(ele).closest(".gd-autofill-dl").remove()}jQuery(document).ready(function(){jQuery("input[type=text]").keyup(function(){var input_field=jQuery(this);if(input_field.attr("data-type")=="autofill"&&input_field.attr("data-fill")!=""){var data_fill=input_field.attr("data-fill");var fill_value=jQuery(this).val();jQuery.get(geodir_var.geodir_ajax_url,{autofill:data_fill,fill_str:fill_value},function(data){if(data!=""){if(input_field.closest("div.gd-autofill").length==0)input_field.wrap('<div class="gd-autofill"></div>');input_field.closest("div.gd-autofill").find(".gd-autofill-dl").remove();input_field.after('<div class="gd-autofill-dl"></div>');input_field.next(".gd-autofill-dl").html(data);input_field.focus()}})}});jQuery("input[type=text]").parent().mouseleave(function(){jQuery(this).find(".gd-autofill-dl").remove()});jQuery(".gd-trigger").click(function(){jQuery(this).toggleClass("active").next().slideToggle("slow");var aD=jQuery(this).toggleClass("active").next().hasClass("map_category")?true:false;if(jQuery(".gd-trigger").hasClass("gd-triggeroff")){jQuery(".gd-trigger").removeClass("gd-triggeroff");jQuery(".gd-trigger").addClass("gd-triggeron");if(aD){gd_compress_animate(this,0)}}else{jQuery(".gd-trigger").removeClass("gd-triggeron");jQuery(".gd-trigger").addClass("gd-triggeroff");if(aD){gd_compress_animate(this,parseFloat(jQuery(this).toggleClass("active").next().outerWidth()))}}});jQuery(".gd-trigger").each(function(){if(jQuery(this).hasClass("gd-triggeroff")&&jQuery(this).next().hasClass("map_category")){gd_compress_animate(this,parseFloat(jQuery(this).next().outerWidth()))}});jQuery(".trigger_sticky").click(function(){var effect="slide";var options={direction:"right"};var duration=500;var tigger_sticky=jQuery(this);tigger_sticky.hide();jQuery("div.stickymap").toggle(effect,options,duration,function(){tigger_sticky.show()});if(tigger_sticky.hasClass("triggeroff_sticky")){tigger_sticky.removeClass("triggeroff_sticky");tigger_sticky.addClass("triggeron_sticky");setCookie("geodir_stickystatus","shide",1)}else{tigger_sticky.removeClass("triggeron_sticky");tigger_sticky.addClass("triggeroff_sticky");setCookie("geodir_stickystatus","sshow",1)}});function gd_compress_animate(e,r){jQuery(e).animate({"margin-right":r+"px"},"fast")}var gd_modal="undefined"!=typeof geodir_var.geodir_gd_modal&&1==parseInt(geodir_var.geodir_gd_modal)?false:true;if(gd_modal){jQuery(".geodir-custom-post-gallery").each(function(){jQuery("a",this).lightBox({overlayOpacity:.5,imageLoading:geodir_var.geodir_plugin_url+"/geodirectory-assets/images/lightbox-ico-loading.gif",imageBtnNext:geodir_var.geodir_plugin_url+"/geodirectory-assets/images/lightbox-btn-next.gif",imageBtnPrev:geodir_var.geodir_plugin_url+"/geodirectory-assets/images/lightbox-btn-prev.gif",imageBtnClose:geodir_var.geodir_plugin_url+"/geodirectory-assets/images/lightbox-btn-close.gif",imageBlank:geodir_var.geodir_plugin_url+"/geodirectory-assets/images/lightbox-blank.gif"})})}jQuery(".gd_comment_replaylink a").bind("click",function(){jQuery("#commentform #err_no_rating").remove();jQuery("#commentform .gd_rating").hide();jQuery("#commentform .br-wrapper.br-theme-fontawesome-stars").hide();jQuery("#commentform #geodir_overallrating").val("0");jQuery("#respond .form-submit input#submit").val(geodir_all_js_msg.gd_cmt_btn_post_reply);jQuery("#respond .comment-form-comment label").html(geodir_all_js_msg.gd_cmt_btn_reply_text)});jQuery(".gd-cancel-replaylink a").bind("click",function(){jQuery("#commentform #err_no_rating").remove();jQuery("#commentform .gd_rating").show();jQuery("#commentform .br-wrapper.br-theme-fontawesome-stars").show();jQuery("#commentform #geodir_overallrating").val("0");jQuery("#respond .form-submit input#submit").val(geodir_all_js_msg.gd_cmt_btn_post_review);jQuery("#respond .comment-form-comment label").html(geodir_all_js_msg.gd_cmt_btn_review_text)});jQuery("#commentform .gd_rating, #commentform .gd-fa-rating").each(function(){var rat_obj=this;var $frm_obj=jQuery(rat_obj).closest("#commentform");if(parseInt($frm_obj.find("#comment_parent").val())>0){jQuery("#commentform #err_no_rating").remove();jQuery("#commentform .gd_rating").hide();jQuery("#respond .form-submit input#submit").val(geodir_all_js_msg.gd_cmt_btn_post_reply);jQuery("#respond .comment-form-comment label").html(geodir_all_js_msg.gd_cmt_btn_reply_text)}if(!geodir_all_js_msg.multirating){$frm_obj.find('input[name="submit"]').click(function(e){$frm_obj.find("#err_no_rating").remove();if(typeof geodir_all_js_msg.gd_cmt_disable_rating!="undefined"&&geodir_all_js_msg.gd_cmt_disable_rating){return true}var is_review=parseInt($frm_obj.find("#comment_parent").val());is_review=is_review==0?true:false;if(is_review){var btn_obj=this;var invalid=0;$frm_obj.find("input[name^=geodir_overallrating]").each(function(){var star_obj=this;var star=parseInt(jQuery(star_obj).val());if(!star>0){invalid++}});if(invalid>0){jQuery(rat_obj).after('<div id="err_no_rating" class="err-no-rating">'+geodir_all_js_msg.gd_cmt_err_no_rating+"</div>");return false}return true}})}})});jQuery(window).load(function(){if(jQuery(".map_background").length==0){jQuery(".geodir-pinpoint").hide()}else{jQuery(".geodir-pinpoint").show()}});function geodir_get_post_term(el){limit=jQuery(el).data("limit");term=jQuery(el).val();var parent_only=parseInt(jQuery(el).data("parent"))>0?1:0;jQuery(el).parent().parent().find(".geodir-popular-cat-list").html('<i class="fa fa-cog fa-spin"></i>');jQuery(el).parent().parent().parent().find(".geodir-cat-list-more").hide();jQuery.post(geodir_all_js_msg.geodir_admin_ajax_url+"?action=geodir_ajax_action",{ajax_action:"geodir_get_term_list",term:term,limit:limit,parent_only:parent_only}).done(function(data){if(jQuery.trim(data)!=""){jQuery(el).parent().parent().find(".geodir-popular-cat-list").hide().html(data).fadeIn("slow");if(jQuery(el).parent().parent().find(".geodir-popular-cat-list li").length>limit){jQuery(el).parent().parent().parent().find(".geodir-cat-list-more").fadeIn("slow")}}})}jQuery(window).load(function(){geodir_resize_rating_stars();jQuery(document).on("click",".geodir-rating,.gd-star-rating",function(e){if(reviewLink=jQuery(this).closest(".geodir-category-listing").find("a.geodir-pcomments").attr("href")){window.location=reviewLink}else if(reviewLink=jQuery(this).closest(".gd-bubble").find("a.geodir-pcomments").attr("href")){window.location=reviewLink}});jQuery(".geodir-details-sidebar-rating").on("click",".geodir-rating,.gd-star-rating",function(e){jQuery('#gd-tabs [data-tab="#reviews"]').trigger("click");jQuery("html, body").animate({scrollTop:jQuery("#reviews-wrap").offset().top},500)})});jQuery(window).resize(function(){geodir_resize_rating_stars(true)});function geodir_resize_rating_stars(re){jQuery(".geodir-rating").each(function(){var $this=jQuery(this);var parent_width=$this.width();if(!parent_width){return true}var star_width=$this.find(".geodir_Star img").width();var star_count=$this.find(".geodir_Star img").length;var width_calc=star_width*star_count;width_calc=typeof re!="undefined"&&re?"auto":width_calc;$this.width(width_calc)})}function geodir_load_search_form(stype,el){var $adv_show=jQuery(el).closest(".geodir_advance_search_widget").attr("data-show-adv");jQuery.ajax({url:geodir_all_js_msg.geodir_admin_ajax_url,type:"POST",dataType:"html",data:{action:"geodir_search_form",stype:stype,adv:$adv_show},beforeSend:function(){geodir_search_wait(1)},success:function(data,textStatus,xhr){jQuery(el).closest(".geodir_advance_search_widget").html(data);geodir_setup_search_form();jQuery("body").trigger("geodir_setup_search_form");geodir_search_wait(0)},error:function(xhr,textStatus,errorThrown){console.log(textStatus);geodir_search_wait(0)}})}function geodir_setup_search_form(){if(jQuery(".search_by_post").val()){gd_s_post_type=jQuery(".search_by_post").val()}else{gd_s_post_type="gd_place"}setTimeout(function(){jQuery(".search_by_post").change(function(){gd_s_post_type=jQuery(this).val();geodir_load_search_form(gd_s_post_type,this)})},100)}gdSearchDoing=0;var gdNearChanged=0;gd_search_icon="";function geodir_search_wait(on){waitTime=300;if(on){if(gdSearchDoing){return}gdSearchDoing=1;jQuery(".geodir_submit_search").addClass("gd-wait-btnsearch").prop("disabled",true);jQuery(".showFilters").prop("disabled",true);searchPos=1;gd_search_icon=jQuery(".geodir_submit_search").html();function geodir_search_wait_animate(){if(!searchPos){return}if(searchPos==1){jQuery('input[type="button"].geodir_submit_search').val("ï‡› ï„‘ ï„‘");searchPos=2;window.setTimeout(geodir_search_wait_animate,waitTime);return}if(searchPos==2){jQuery('input[type="button"].geodir_submit_search').val("ï„‘ ï‡› ï„‘");searchPos=3;window.setTimeout(geodir_search_wait_animate,waitTime);return}if(searchPos==3){jQuery('input[type="button"].geodir_submit_search').val("ï„‘ ï„‘ ï‡›");searchPos=1;window.setTimeout(geodir_search_wait_animate,waitTime);return}}geodir_search_wait_animate();jQuery("button.geodir_submit_search").html('<i class="fa fa-hourglass fa-spin" aria-hidden="true"></i>')}else{searchPos=0;gdSearchDoing=0;jQuery(".geodir_submit_search").removeClass("gd-wait-btnsearch").prop("disabled",false);jQuery(".showFilters").prop("disabled",false);jQuery('input[type="button"].geodir_submit_search').val(gdsText);jQuery("button.geodir_submit_search").html(gd_search_icon)}}

(function(){var g,r,w,z,u,A={}.hasOwnProperty,B=[].slice;this.OverlappingMarkerSpiderfier=function(){function t(a,d){var b,f,e;this.map=a;null==d&&(d={});null==this.constructor.N&&(this.constructor.N=!0,k=google.maps,m=k.event,p=k.MapTypeId,c.keepSpiderfied=!1,c.ignoreMapClick=!1,c.markersWontHide=!1,c.markersWontMove=!1,c.basicFormatEvents=!1,c.nearbyDistance=20,c.circleSpiralSwitchover=9,c.circleFootSeparation=23,c.circleStartAngle=x/12,c.spiralFootSeparation=26,c.spiralLengthStart=11,c.spiralLengthFactor=4,c.spiderfiedZIndex=k.Marker.MAX_ZINDEX+2e4,c.highlightedLegZIndex=k.Marker.MAX_ZINDEX+1e4,c.usualLegZIndex=k.Marker.MAX_ZINDEX+1,c.legWeight=1.5,c.legColors={usual:{},highlighted:{}},e=c.legColors.usual,f=c.legColors.highlighted,e[p.HYBRID]=e[p.SATELLITE]="#fff",f[p.HYBRID]=f[p.SATELLITE]="#f00",e[p.TERRAIN]=e[p.ROADMAP]="#444",f[p.TERRAIN]=f[p.ROADMAP]="#f00",this.constructor.j=function(a){return this.setMap(a)},this.constructor.j.prototype=new k.OverlayView,this.constructor.j.prototype.draw=function(){});for(b in d)A.call(d,b)&&(f=d[b],this[b]=f);this.g=new this.constructor.j(this.map);this.C();this.c={};this.B=this.l=null;this.addListener("click",function(a,b){return m.trigger(a,"spider_click",b)});this.addListener("format",function(a,b){return m.trigger(a,"spider_format",b)});this.ignoreMapClick||m.addListener(this.map,"click",function(a){return function(){return a.unspiderfy()}}(this));m.addListener(this.map,"maptypeid_changed",function(a){return function(){return a.unspiderfy()}}(this));m.addListener(this.map,"zoom_changed",function(a){return function(){a.unspiderfy();if(!a.basicFormatEvents)return a.h()}}(this))}var m,k,g,v,p,c,r,x,u;c=t.prototype;r=[t,c];g=0;for(v=r.length;g<v;g++)u=r[g],u.VERSION="1.0.1";x=2*Math.PI;k=m=p=null;t.markerStatus={SPIDERFIED:"SPIDERFIED",SPIDERFIABLE:"SPIDERFIABLE",UNSPIDERFIABLE:"UNSPIDERFIABLE",UNSPIDERFIED:"UNSPIDERFIED"};c.C=function(){this.a=[];this.s=[]};c.addMarker=function(a,d){a.setMap(this.map);return this.trackMarker(a,d)};c.trackMarker=function(a,d){var b;if(null!=a._oms)return this;a._oms=!0;b=[m.addListener(a,"click",function(b){return function(d){return b.V(a,d)}}(this))];this.markersWontHide||b.push(m.addListener(a,"visible_changed",function(b){return function(){return b.D(a,!1)}}(this)));this.markersWontMove||b.push(m.addListener(a,"position_changed",function(b){return function(){return b.D(a,!0)}}(this)));null!=d&&b.push(m.addListener(a,"spider_click",d));this.s.push(b);this.a.push(a);this.basicFormatEvents?this.trigger("format",a,this.constructor.markerStatus.UNSPIDERFIED):this.h();return this};c.D=function(a,d){if(!this.J&&!this.K)return null==a._omsData||!d&&a.getVisible()||this.unspiderfy(d?a:null),this.h()};c.getMarkers=function(){return this.a.slice(0)};c.removeMarker=function(a){this.forgetMarker(a);return a.setMap(null)};c.forgetMarker=function(a){var d,b,f,e,h;null!=a._omsData&&this.unspiderfy();d=this.A(this.a,a);if(0>d)return this;h=this.s.splice(d,1)[0];b=0;for(f=h.length;b<f;b++)e=h[b],m.removeListener(e);delete a._oms;this.a.splice(d,1);this.h();return this};c.removeAllMarkers=c.clearMarkers=function(){var a,d,b,f;f=this.getMarkers();this[forgetAllMarkers]();a=0;for(d=f.length;a<d;a++)b=f[a],b.setMap(null);return this};c.forgetAllMarkers=function(){var a,d,b,f,e,h,c,n;this.unspiderfy();n=this.a;a=d=0;for(b=n.length;d<b;a=++d){h=n[a];e=this.s[a];c=0;for(a=e.length;c<a;c++)f=e[c],m.removeListener(f);delete h._oms}this.C();return this};c.addListener=function(a,d){var b;(null!=(b=this.c)[a]?b[a]:b[a]=[]).push(d);return this};c.removeListener=function(a,d){var b;b=this.A(this.c[a],d);0>b||this.c[a].splice(b,1);return this};c.clearListeners=function(a){this.c[a]=[];return this};c.trigger=function(){var a,d,b,f,e,h;d=arguments[0];a=2<=arguments.length?B.call(arguments,1):[];d=null!=(b=this.c[d])?b:[];h=[];f=0;for(e=d.length;f<e;f++)b=d[f],h.push(b.apply(null,a));return h};c.L=function(a,d){var b,f,e,h,c;h=this.circleFootSeparation*(2+a)/x;f=x/a;c=[];for(b=e=0;0<=a?e<a:e>a;b=0<=a?++e:--e)b=this.circleStartAngle+b*f,c.push(new k.Point(d.x+h*Math.cos(b),d.y+h*Math.sin(b)));return c};c.M=function(a,d){var b,f,e,c,l;c=this.spiralLengthStart;b=0;l=[];for(f=e=0;0<=a?e<a:e>a;f=0<=a?++e:--e)b+=this.spiralFootSeparation/c+5e-4*f,f=new k.Point(d.x+c*Math.cos(b),d.y+c*Math.sin(b)),c+=x*this.spiralLengthFactor/b,l.push(f);return l};c.V=function(a,d){var b,f,e,c,l,n,y,m,k;(n=null!=a._omsData)&&this.keepSpiderfied||this.unspiderfy();if(n||this.map.getStreetView().getVisible()||"GoogleEarthAPI"===this.map.getMapTypeId())return this.trigger("click",a,d);n=[];y=[];b=this.nearbyDistance;m=b*b;l=this.f(a.position);k=this.a;b=0;for(f=k.length;b<f;b++)e=k[b],null!=e.map&&e.getVisible()&&(c=this.f(e.position),this.i(c,l)<m?n.push({R:e,G:c}):y.push(e));return 1===n.length?this.trigger("click",a,d):this.W(n,y)};c.markersNearMarker=function(a,d){var b,f,e,c,l,n,m,k,g,q;null==d&&(d=!1);if(null==this.g.getProjection())throw"Must wait for 'idle' event on map before calling markersNearMarker";b=this.nearbyDistance;m=b*b;l=this.f(a.position);n=[];k=this.a;b=0;for(f=k.length;b<f&&!(e=k[b],e!==a&&null!=e.map&&e.getVisible()&&(c=this.f(null!=(g=null!=(q=e._omsData)?q.v:void 0)?g:e.position),this.i(c,l)<m&&(n.push(e),d)));b++);return n};c.F=function(){var a,d,b,f,e,c,l,n,m,k,g;if(null==this.g.getProjection())throw"Must wait for 'idle' event on map before calling markersNearAnyOtherMarker";m=this.nearbyDistance;m*=m;var q;e=this.a;q=[];k=0;for(d=e.length;k<d;k++)f=e[k],q.push({H:this.f(null!=(a=null!=(b=f._omsData)?b.v:void 0)?a:f.position),b:!1});k=this.a;a=b=0;for(f=k.length;b<f;a=++b)if(d=k[a],null!=d.getMap()&&d.getVisible()&&(c=q[a],!c.b))for(g=this.a,d=n=0,e=g.length;n<e;d=++n)if(l=g[d],d!==a&&null!=l.getMap()&&l.getVisible()&&(l=q[d],(!(d<a)||l.b)&&this.i(c.H,l.H)<m)){c.b=l.b=!0;break}return q};c.markersNearAnyOtherMarker=function(){var a,d,b,c,e,h,l;e=this.F();h=this.a;l=[];a=d=0;for(b=h.length;d<b;a=++d)c=h[a],e[a].b&&l.push(c);return l};c.setImmediate=function(a){return window.setTimeout(a,0)};c.h=function(){if(!this.basicFormatEvents&&null==this.l)return this.l=this.setImmediate(function(a){return function(){a.l=null;return null!=a.g.getProjection()?a.w():null!=a.B?void 0:a.B=m.addListenerOnce(a.map,"idle",function(){return a.w()})}}(this))};c.w=function(){var a,d,b,c,e,h,l;if(this.basicFormatEvents){e=[];d=0;for(b=markers.length;d<b;d++)c=markers[d],a=null!=c._omsData?"SPIDERFIED":"UNSPIDERFIED",e.push(this.trigger("format",c,this.constructor.markerStatus[a]));return e}e=this.F();h=this.a;l=[];a=b=0;for(d=h.length;b<d;a=++b)c=h[a],a=null!=c._omsData?"SPIDERFIED":e[a].b?"SPIDERFIABLE":"UNSPIDERFIABLE",l.push(this.trigger("format",c,this.constructor.markerStatus[a]));return l};c.P=function(a){return{m:function(d){return function(){return a._omsData.o.setOptions({strokeColor:d.legColors.highlighted[d.map.mapTypeId],zIndex:d.highlightedLegZIndex})}}(this),u:function(d){return function(){return a._omsData.o.setOptions({strokeColor:d.legColors.usual[d.map.mapTypeId],zIndex:d.usualLegZIndex})}}(this)}};c.W=function(a,d){var b,c,e,h,l,n,g,p,t,q;this.J=!0;q=a.length;b=this.T(function(){var b,d,c;c=[];b=0;for(d=a.length;b<d;b++)p=a[b],c.push(p.G);return c}());h=q>=this.circleSpiralSwitchover?this.M(q,b).reverse():this.L(q,b);b=function(){var b,d,f;f=[];b=0;for(d=h.length;b<d;b++)e=h[b],c=this.U(e),t=this.S(a,function(a){return function(b){return a.i(b.G,e)}}(this)),g=t.R,n=new k.Polyline({map:this.map,path:[g.position,c],strokeColor:this.legColors.usual[this.map.mapTypeId],strokeWeight:this.legWeight,zIndex:this.usualLegZIndex}),g._omsData={v:g.position,o:n},this.legColors.highlighted[this.map.mapTypeId]!==this.legColors.usual[this.map.mapTypeId]&&(l=this.P(g),g._omsData.O={m:m.addListener(g,"mouseover",l.m),u:m.addListener(g,"mouseout",l.u)}),this.trigger("format",g,this.constructor.markerStatus.SPIDERFIED),g.setPosition(c),g.setZIndex(Math.round(this.spiderfiedZIndex+e.y)),f.push(g);return f}.call(this);delete this.J;this.I=!0;return this.trigger("spiderfy",b,d)};c.unspiderfy=function(a){var d,b,c,e,h,l,g;null==a&&(a=null);if(null==this.I)return this;this.K=!0;g=[];h=[];l=this.a;d=0;for(b=l.length;d<b;d++)e=l[d],null!=e._omsData?(e._omsData.o.setMap(null),e!==a&&e.setPosition(e._omsData.v),e.setZIndex(null),c=e._omsData.O,null!=c&&(m.removeListener(c.m),m.removeListener(c.u)),delete e._omsData,e!==a&&(c=this.basicFormatEvents?"UNSPIDERFIED":"SPIDERFIABLE",this.trigger("format",e,this.constructor.markerStatus[c])),g.push(e)):h.push(e);delete this.K;delete this.I;this.trigger("unspiderfy",g,h);return this};c.i=function(a,d){var b,c;b=a.x-d.x;c=a.y-d.y;return b*b+c*c};c.T=function(a){var c,b,f,e,h;c=e=h=0;for(b=a.length;c<b;c++)f=a[c],e+=f.x,h+=f.y;a=a.length;return new k.Point(e/a,h/a)};c.f=function(a){return this.g.getProjection().fromLatLngToDivPixel(a)};c.U=function(a){return this.g.getProjection().fromDivPixelToLatLng(a)};c.S=function(a,c){var b,d,e,h,g,k;e=g=0;for(k=a.length;g<k;e=++g)if(h=a[e],h=c(h),"undefined"===typeof b||null===b||h<d)d=h,b=e;return a.splice(b,1)[0]};c.A=function(a,c){var b,d,e,h;if(null!=a.indexOf)return a.indexOf(c);b=d=0;for(e=a.length;d<e;b=++d)if(h=a[b],h===c)return b;return-1};return t}();r=/(\?.*(&|&amp;)|\?)spiderfier_callback=(\w+)/;g=document.currentScript;null==g&&(g=function(){var g,m,k,w,v;k=document.getElementsByTagName("script");v=[];g=0;for(m=k.length;g<m;g++)u=k[g],null!=(w=u.getAttribute("src"))&&w.match(r)&&v.push(u);return v}()[0]);if(null!=g&&(g=null!=(w=g.getAttribute("src"))?null!=(z=w.match(r))?z[3]:void 0:void 0)&&"function"===typeof window[g])window[g]();"function"===typeof window.spiderfier_callback&&window.spiderfier_callback()}).call(this);

(function(){var e,t,n,r,i,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t){if(s.call(t,n))e[n]=t[n]}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e};r=function(){function e(){this.options_index=0;this.parsed=[]}e.prototype.add_node=function(e){if(e.nodeName.toUpperCase()==="OPTGROUP"){return this.add_group(e)}else{return this.add_option(e)}};e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length;this.parsed.push({array_index:t,group:true,label:this.escapeExpression(e.label),children:0,disabled:e.disabled});s=e.childNodes;o=[];for(r=0,i=s.length;r<i;r++){n=s[r];o.push(this.add_option(n,t,e.disabled))}return o};e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION"){if(e.text!==""){if(t!=null){this.parsed[t].children+=1}this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===true?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})}else{this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:true})}return this.options_index+=1}};e.prototype.escapeExpression=function(e){var t,n;if(e==null||e===false){return""}if(!/[\&\<\>\"\'\`]/.test(e)){return e}t={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};n=/&(?!\w+;)|[\<\>\"\'\`]/g;return e.replace(n,function(e){return t[e]||"&"})};return e}();r.select_to_array=function(e){var t,n,i,s,o;n=new r;o=e.childNodes;for(i=0,s=o.length;i<s;i++){t=o[i];n.add_node(t)}return n.parsed};t=function(){function e(t,n){this.form_field=t;this.options=n!=null?n:{};if(!e.browser_is_supported()){return}this.is_multiple=this.form_field.multiple;this.set_default_text();this.set_default_values();this.setup();this.set_up_html();this.register_observers()}e.prototype.set_default_values=function(){var e=this;this.click_test_action=function(t){return e.test_active_click(t)};this.activate_action=function(t){return e.activate_field(t)};this.active_field=false;this.mouse_on_container=false;this.results_showing=false;this.result_highlighted=null;this.result_single_selected=null;this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:false;this.disable_search_threshold=this.options.disable_search_threshold||0;this.disable_search=this.options.disable_search||false;this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:true;this.group_search=this.options.group_search!=null?this.options.group_search:true;this.search_contains=this.options.search_contains||false;this.single_backstroke_delete=this.options.single_backstroke_delete!=null?this.options.single_backstroke_delete:true;this.max_selected_options=this.options.max_selected_options||Infinity;this.inherit_select_classes=this.options.inherit_select_classes||false;this.display_selected_options=this.options.display_selected_options!=null?this.options.display_selected_options:true;return this.display_disabled_options=this.options.display_disabled_options!=null?this.options.display_disabled_options:true};e.prototype.set_default_text=function(){if(this.form_field.getAttribute("data-placeholder")){this.default_text=this.form_field.getAttribute("data-placeholder")}else if(this.is_multiple){this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||e.default_multiple_text}else{this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||e.default_single_text}return this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||e.default_no_result_text};e.prototype.mouse_enter=function(){return this.mouse_on_container=true};e.prototype.mouse_leave=function(){return this.mouse_on_container=false};e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field){return setTimeout(function(){return t.container_mousedown()},50)}}else{if(!this.active_field){return this.activate_field()}}};e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container){this.active_field=false;return setTimeout(function(){return t.blur_test()},100)}};e.prototype.results_option_build=function(e){var t,n,r,i,s;t="";s=this.results_data;for(r=0,i=s.length;r<i;r++){n=s[r];if(n.group){t+=this.result_add_group(n)}else{t+=this.result_add_option(n)}if(e!=null?e.first:void 0){if(n.selected&&this.is_multiple){this.choice_build(n)}else if(n.selected&&!this.is_multiple){this.single_set_selected_text(n.text)}}}return t};e.prototype.result_add_option=function(e){var t,n;if(!e.search_match){return""}if(!this.include_option_in_results(e)){return""}t=[];if(!e.disabled&&!(e.selected&&this.is_multiple)){t.push("active-result")}if(e.disabled&&!(e.selected&&this.is_multiple)){t.push("disabled-result")}if(e.selected){t.push("result-selected")}if(e.group_array_index!=null){t.push("group-option")}if(e.classes!==""){t.push(e.classes)}n=e.style.cssText!==""?' style="'+e.style+'"':"";return'<li class="'+t.join(" ")+'"'+n+' data-option-array-index="'+e.array_index+'">'+e.search_text+"</li>"};e.prototype.result_add_group=function(e){if(!(e.search_match||e.group_match)){return""}if(!(e.active_options>0)){return""}return'<li class="group-result">'+e.search_text+"</li>"};e.prototype.results_update_field=function(){this.set_default_text();if(!this.is_multiple){this.results_reset_cleanup()}this.result_clear_highlight();this.result_single_selected=null;this.results_build();if(this.results_showing){return this.winnow_results()}};e.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide()}else{return this.results_show()}};e.prototype.results_search=function(e){if(this.results_showing){return this.winnow_results()}else{return this.results_show()}};e.prototype.winnow_results=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,tt;this.no_results_clear();i=0;o=this.get_search_text();e=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");r=this.search_contains?"":"^";n=new RegExp(r+e,"i");f=new RegExp(e,"i");h=this.results_data;for(l=0,c=h.length;l<c;l++){t=h[l];t.search_match=false;s=null;if(this.include_option_in_results(t)){if(t.group){t.group_match=false;t.active_options=0}if(t.group_array_index!=null&&this.results_data[t.group_array_index]){s=this.results_data[t.group_array_index];if(s.active_options===0&&s.search_match){i+=1}s.active_options+=1}if(!(t.group&&!this.group_search)){t.search_text=t.group?t.label:t.html;t.search_match=this.search_string_match(t.search_text,n);if(t.search_match&&!t.group){i+=1}if(t.search_match){if(o.length){u=t.search_text.search(f);if(u!=0){var tt=gd_replace_accents(t.search_text);u=tt.search(f)}a=t.search_text.substr(0,u+o.length)+"</em>"+t.search_text.substr(u+o.length);t.search_text=a.substr(0,u)+"<em>"+a.substr(u)}if(s!=null){s.group_match=true}}else if(t.group_array_index!=null&&this.results_data[t.group_array_index].search_match){t.search_match=true}}}}this.result_clear_highlight();if(i<1&&o.length){this.update_results_content("");return this.no_results(o)}else{this.update_results_content(this.results_option_build());return this.winnow_results_set_highlight()}};e.prototype.search_string_match=function(e,t){var n,r,i,s,et;if(t.test(e)){return true}else if(this.enable_split_word_search&&(e.indexOf(" ")>=0||e.indexOf("[")===0)){r=e.replace(/\[|\]/g,"").split(" ");if(r.length){for(i=0,s=r.length;i<s;i++){n=r[i];if(t.test(n)){return true}}}et=gd_replace_accents(e);r=et.replace(/\[|\]/g,"").split(" ");if(r.length){for(i=0,s=r.length;i<s;i++){n=r[i];if(t.test(n)){return true}}}}else{et=gd_replace_accents(e);if(t.test(et)){return true}}};e.prototype.choices_count=function(){var e,t,n,r;if(this.selected_option_count!=null){return this.selected_option_count}this.selected_option_count=0;r=this.form_field.options;for(t=0,n=r.length;t<n;t++){e=r[t];if(e.selected){this.selected_option_count+=1}}return this.selected_option_count};e.prototype.choices_click=function(e){e.preventDefault();if(!(this.results_showing||this.is_disabled)){return this.results_show()}};e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0){return this.keydown_backstroke()}else if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search()}break;case 13:e.preventDefault();if(this.results_showing){return this.result_select(e)}break;case 27:if(this.results_showing){this.results_hide()}return true;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}};e.prototype.container_width=function(){if(this.options.width!=null){return this.options.width}else{return""+this.form_field.offsetWidth+"px"}};e.prototype.include_option_in_results=function(e){if(this.is_multiple&&!this.display_selected_options&&e.selected){return false}if(!this.display_disabled_options&&e.disabled){return false}if(e.empty){return false}return true};e.browser_is_supported=function(){if(window.navigator.appName==="Microsoft Internet Explorer"){return document.documentMode>=8}if(/iP(od|hone)/i.test(window.navigator.userAgent)){return false}if(/Android/i.test(window.navigator.userAgent)){if(/Mobile/i.test(window.navigator.userAgent)){return false}}return true};e.default_multiple_text="Select Some Options";e.default_single_text="Select an Option";e.default_no_result_text="No results match";return e}();e=jQuery;e.fn.extend({chosen:function(r){if(!t.browser_is_supported()){return this}return this.each(function(t){var i,s;i=e(this);s=i.data("chosen");if(r==="destroy"&&s){s.destroy()}else if(!s){i.data("chosen",new n(this,r))}})}});n=function(t){function n(){i=n.__super__.constructor.apply(this,arguments);return i}o(n,t);n.prototype.setup=function(){this.form_field_jq=e(this.form_field);this.current_selectedIndex=this.form_field.selectedIndex;return this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")};n.prototype.set_up_html=function(){var t,n;t=["geodir-chosen-container"];t.push("geodir-chosen-container-"+(this.is_multiple?"multi":"single"));if(this.inherit_select_classes&&this.form_field.className){t.push(this.form_field.className)}if(this.is_rtl){t.push("chosen-rtl")}n={"class":t.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title};if(this.form_field.id.length){n.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"}this.container=e("<div />",n);if(this.is_multiple){this.container.html('<div class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></div><div class="chosen-drop"><div class="chosen-results"></div></div>')}else{this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><div class="chosen-results"></div></div>')}this.form_field_jq.hide().after(this.container);this.dropdown=this.container.find("div.chosen-drop").first();this.search_field=this.container.find("input").first();this.search_results=this.container.find("div.chosen-results").first();this.search_field_scale();this.search_no_results=this.container.find("li.no-results").first();if(this.is_multiple){this.search_choices=this.container.find("div.chosen-choices").first();this.search_container=this.container.find("li.search-field").first()}else{this.search_container=this.container.find("div.chosen-search").first();this.selected_item=this.container.find(".chosen-single").first()}this.results_build();this.set_tab_index();this.set_label_behavior();return this.form_field_jq.trigger("chosen:ready",{chosen:this})};n.prototype.register_observers=function(){var e=this;this.container.bind("mousedown.chosen",function(t){e.container_mousedown(t)});this.container.bind("mouseup.chosen",function(t){e.container_mouseup(t)});this.container.bind("mouseenter.chosen",function(t){e.mouse_enter(t)});this.container.bind("mouseleave.chosen",function(t){e.mouse_leave(t)});this.search_results.bind("mouseup.chosen",function(t){e.search_results_mouseup(t)});this.search_results.bind("mouseover.chosen",function(t){e.search_results_mouseover(t)});this.search_results.bind("mouseout.chosen",function(t){e.search_results_mouseout(t)});this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(t){e.search_results_mousewheel(t)});this.form_field_jq.bind("chosen:updated.chosen",function(t){e.results_update_field(t)});this.form_field_jq.bind("chosen:activate.chosen",function(t){e.activate_field(t)});this.form_field_jq.bind("chosen:open.chosen",function(t){e.container_mousedown(t)});this.search_field.bind("blur.chosen",function(t){e.input_blur(t)});this.search_field.bind("keyup.chosen",function(t){e.keyup_checker(t)});this.search_field.bind("keydown.chosen",function(t){e.keydown_checker(t)});this.search_field.bind("focus.chosen",function(t){e.input_focus(t)});if(this.is_multiple){return this.search_choices.bind("click.chosen",function(t){e.choices_click(t)})}else{return this.container.bind("click.chosen",function(e){e.preventDefault()})}};n.prototype.destroy=function(){e(document).unbind("click.chosen",this.click_test_action);if(this.search_field[0].tabIndex){this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex}this.container.remove();this.form_field_jq.removeData("chosen");return this.form_field_jq.show()};n.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled){this.container.addClass("chosen-disabled");this.search_field[0].disabled=true;if(!this.is_multiple){this.selected_item.unbind("focus.chosen",this.activate_action)}return this.close_field()}else{this.container.removeClass("chosen-disabled");this.search_field[0].disabled=false;if(!this.is_multiple){return this.selected_item.bind("focus.chosen",this.activate_action)}}};n.prototype.container_mousedown=function(t){if(!this.is_disabled){if(t&&t.type==="mousedown"&&!this.results_showing){t.preventDefault()}if(!(t!=null&&e(t.target).hasClass("search-choice-close"))){if(!this.active_field){if(this.is_multiple){this.search_field.val("")}e(document).bind("click.chosen",this.click_test_action);this.results_show()}else if(!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chosen-single").length)){t.preventDefault();this.results_toggle()}return this.activate_field()}}};n.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled){return this.results_reset(e)}};n.prototype.search_results_mousewheel=function(e){var t,n,r;t=-((n=e.originalEvent)!=null?n.wheelDelta:void 0)||((r=e.originialEvent)!=null?r.detail:void 0);if(t!=null){e.preventDefault();if(e.type==="DOMMouseScroll"){t=t*40}return this.search_results.scrollTop(t+this.search_results.scrollTop())}};n.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("geodir-chosen-container-active")){return this.close_field()}};n.prototype.close_field=function(){e(document).unbind("click.chosen",this.click_test_action);this.active_field=false;this.results_hide();this.container.removeClass("geodir-chosen-container-active");this.clear_backstroke();this.show_search_field_default();return this.search_field_scale()};n.prototype.activate_field=function(){this.container.addClass("geodir-chosen-container-active");this.active_field=true;this.search_field.val(this.search_field.val());return this.search_field.focus()};n.prototype.test_active_click=function(t){if(this.container.is(e(t.target).closest(".geodir-chosen-container"))){return this.active_field=true}else{return this.close_field()}};n.prototype.results_build=function(){this.parsing=true;this.selected_option_count=null;this.results_data=r.select_to_array(this.form_field);if(this.is_multiple){this.search_choices.find("li.search-choice").remove()}else if(!this.is_multiple){this.single_set_selected_text();if(this.disable_search||this.form_field.options.length<=this.disable_search_threshold){this.search_field[0].readOnly=true;this.container.addClass("geodir-chosen-container-single-nosearch")}else{this.search_field[0].readOnly=false;this.container.removeClass("geodir-chosen-container-single-nosearch")}}this.update_results_content(this.results_option_build({first:true}));this.search_field_disabled();this.search_field_scale();return this.parsing=false};n.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight();this.result_highlight=e;this.result_highlight.addClass("highlighted");r=parseInt(this.search_results.css("maxHeight"),10);s=this.search_results.scrollTop();i=r+s;n=this.result_highlight.position().top+this.search_results.scrollTop();t=n+this.result_highlight.outerHeight();if(t>=i){return this.search_results.scrollTop(t-r>0?t-r:0)}else if(n<s){return this.search_results.scrollTop(n)}}};n.prototype.result_clear_highlight=function(){if(this.result_highlight){this.result_highlight.removeClass("highlighted")}return this.result_highlight=null};n.prototype.results_show=function(){if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field_jq.trigger("chosen:maxselected",{chosen:this});return false}this.container.addClass("chosen-with-drop");this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this});this.results_showing=true;this.search_field.focus();this.search_field.val(this.search_field.val());return this.winnow_results()};n.prototype.update_results_content=function(e){return this.search_results.html(e)};n.prototype.results_hide=function(){if(this.results_showing){this.result_clear_highlight();this.container.removeClass("chosen-with-drop");this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})}return this.results_showing=false};n.prototype.set_tab_index=function(e){var t;if(this.form_field.tabIndex){t=this.form_field.tabIndex;this.form_field.tabIndex=-1;return this.search_field[0].tabIndex=t}};n.prototype.set_label_behavior=function(){var t=this;this.form_field_label=this.form_field_jq.parents("label");if(!this.form_field_label.length&&this.form_field.id.length){this.form_field_label=e("label[for='"+this.form_field.id+"']")}if(this.form_field_label.length>0){return this.form_field_label.bind("click.chosen",function(e){if(t.is_multiple){return t.container_mousedown(e)}else{return t.activate_field()}})}};n.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices_count()<1&&!this.active_field){this.search_field.val(this.default_text);return this.search_field.addClass("default")}else{this.search_field.val("");return this.search_field.removeClass("default")}};n.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length){this.result_highlight=n;this.result_select(t);return this.search_field.focus()}};n.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n){return this.result_do_highlight(n)}};n.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"||e(t.target).parents(".active-result").first())){return this.result_clear_highlight()}};n.prototype.choice_build=function(t){var n,r,i=this;n=e("<li />",{"class":"search-choice"}).html("<span>"+t.html+"</span>");if(t.disabled){n.addClass("search-choice-disabled")}else{r=e("<a />",{"class":"search-choice-close","data-option-array-index":t.array_index});r.bind("click.chosen",function(e){return i.choice_destroy_link_click(e)});n.append(r)}return this.search_container.before(n)};n.prototype.choice_destroy_link_click=function(t){t.preventDefault();t.stopPropagation();if(!this.is_disabled){return this.choice_destroy(e(t.target))}};n.prototype.choice_destroy=function(e){if(this.result_deselect(e[0].getAttribute("data-option-array-index"))){this.show_search_field_default();if(this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1){this.results_hide()}e.parents("li").first().remove();return this.search_field_scale()}};n.prototype.results_reset=function(){this.form_field.options[0].selected=true;this.selected_option_count=null;this.single_set_selected_text();this.show_search_field_default();this.results_reset_cleanup();this.form_field_jq.trigger("change");if(this.active_field){return this.results_hide()}};n.prototype.results_reset_cleanup=function(){this.current_selectedIndex=this.form_field.selectedIndex;return this.selected_item.find("abbr").remove()};n.prototype.result_select=function(e){var t,n,r;if(this.result_highlight){t=this.result_highlight;this.result_clear_highlight();if(this.is_multiple&&this.max_selected_options<=this.choices_count()){this.form_field_jq.trigger("chosen:maxselected",{chosen:this});return false}if(this.is_multiple){t.removeClass("active-result")}else{if(this.result_single_selected){this.result_single_selected.removeClass("result-selected");r=this.result_single_selected[0].getAttribute("data-option-array-index");this.results_data[r].selected=false}this.result_single_selected=t}t.addClass("result-selected");n=this.results_data[t[0].getAttribute("data-option-array-index")];n.selected=true;this.form_field.options[n.options_index].selected=true;this.selected_option_count=null;if(this.is_multiple){this.choice_build(n)}else{this.single_set_selected_text(n.text)}if(!((e.metaKey||e.ctrlKey)&&this.is_multiple)){this.results_hide()}this.search_field.val("");if(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex){this.form_field_jq.trigger("change",{selected:this.form_field.options[n.options_index].value})}this.current_selectedIndex=this.form_field.selectedIndex;return this.search_field_scale()}};n.prototype.single_set_selected_text=function(e){if(e==null){e=this.default_text}if(e===this.default_text){this.selected_item.addClass("chosen-default")}else{this.single_deselect_control_build();this.selected_item.removeClass("chosen-default")}return this.selected_item.find("span").text(e)};n.prototype.result_deselect=function(e){var t;t=this.results_data[e];if(!this.form_field.options[t.options_index].disabled){t.selected=false;this.form_field.options[t.options_index].selected=false;this.selected_option_count=null;this.result_clear_highlight();if(this.results_showing){this.winnow_results()}this.form_field_jq.trigger("change",{deselected:this.form_field.options[t.options_index].value});this.search_field_scale();return true}else{return false}};n.prototype.single_deselect_control_build=function(){if(!this.allow_single_deselect){return}if(!this.selected_item.find("abbr").length){this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')}return this.selected_item.addClass("chosen-single-with-deselect")};n.prototype.get_search_text=function(){if(this.search_field.val()===this.default_text){return""}else{return e("<div/>").text(e.trim(this.search_field.val())).html()}};n.prototype.winnow_results_set_highlight=function(){var e,t;t=!this.is_multiple?this.search_results.find(".result-selected.active-result"):[];e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null){return this.result_do_highlight(e)}};n.prototype.no_results=function(t){var n;n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>');n.find("span").first().html(t);return this.search_results.append(n)};n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()};n.prototype.keydown_arrow=function(){var e;if(this.results_showing&&this.result_highlight){e=this.result_highlight.nextAll("li.active-result").first();if(e){return this.result_do_highlight(e)}}else{return this.results_show()}};n.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple){return this.results_show()}else if(this.result_highlight){e=this.result_highlight.prevAll("li.active-result");if(e.length){return this.result_do_highlight(e.first())}else{if(this.choices_count()>0){this.results_hide()}return this.result_clear_highlight()}}};n.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke()}else{e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled")){this.pending_backstroke=e;if(this.single_backstroke_delete){return this.keydown_backstroke()}else{return this.pending_backstroke.addClass("search-choice-focus")}}}};n.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClass("search-choice-focus")}return this.pending_backstroke=null};n.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode;this.search_field_scale();if(t!==8&&this.pending_backstroke){this.clear_backstroke()}switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:if(this.results_showing&&!this.is_multiple){this.result_select(e)}this.mouse_on_container=false;break;case 13:e.preventDefault();break;case 38:e.preventDefault();this.keyup_arrow();break;case 40:e.preventDefault();this.keydown_arrow();break}};n.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0;u=0;s="position:absolute; left: -1000px; top: -1000px; display:none;";o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++){i=o[a];s+=i+":"+this.search_field.css(i)+";"}t=e("<div />",{style:s});t.text(this.search_field.val());e("body").append(t);u=t.width()+25;t.remove();n=this.container.outerWidth();if(u>n-10){u=n-10}return this.search_field.css({width:u+"px"})}};return n}(t)}).call(this);

(function($){return $.fn.ajaxChosen=function(settings,callback,chosenOptions){var chosenXhr,defaultOptions,options,select;if(settings==null){settings={}}if(chosenOptions==null){chosenOptions={}}defaultOptions={minTermLength:0,afterTypeDelay:500,addSearchTermOnNorecord:0,noLocationUrl:0,jsonTermKey:"term",jsonTermKeyObject:"term",keepTypingMsg:"Keep typing...",lookingForMsg:"Looking for"};select=this;chosenXhr=null;options=$.extend({},defaultOptions,$(select).data(),settings);this.chosen(chosenOptions?chosenOptions:{});return this.each(function(){return $(this).next(".geodir-chosen-container").find(".search-field > input, .chosen-search > input").bind("keyup",function(){var field,msg,success,untrimmed_val,val;untrimmed_val=$(this).val();val=$.trim($(this).val());msg=val.length<options.minTermLength?options.keepTypingMsg:options.lookingForMsg+(" '"+val+"'");select.next(".geodir-chosen-container").find(".no-results").text(msg);$(this).data("prevVal",val);if(this.timer){clearTimeout(this.timer)}if(val.length<options.minTermLength){return false}if(val.length==0){select.find("option").each(function(){return $(this).remove()});$("<option />").attr("value","").html("").appendTo(select);select.trigger("chosen:updated")}field=$(this);if(options.data==null){options.data={}}options.data[options.jsonTermKey]=val;if(options.dataCallback!=null){options.data=options.dataCallback(options.data)}success=options.success;if(options.success==null){options.success=function(data){var items,nbItems,selected_values;if(data==null){return}selected_values=[];select.find("option").each(function(){if(!$(this).is(":selected")){return $(this).remove()}else{return selected_values.push($(this).val()+"-"+$(this).text())}});select.find("optgroup:empty").each(function(){return $(this).remove()});items=callback!=null?callback(data,field):data;nbItems=0;$.each(items,function(i,element){var group,text,value;nbItems++;if(element.group){group=select.find("optgroup[label='"+element.text+"']");if(!group.size()){group=$("<optgroup />")}group.attr("label",element.text).appendTo(select);return $.each(element.items,function(i,element){var text,value;if(typeof element==="string"){value=i;text=element}else{value=element.value;text=element.text}if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr("value",value).html(text).appendTo(group)}})}else{if(typeof element==="string"){value=i;text=element}else{value=element.value;text=element.text}if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr("value",value).html(text).appendTo(select)}}});if(nbItems){select.trigger("chosen:updated")}else{select.data().chosen.no_results_clear();select.data().chosen.no_results(field.val())}if(settings.success!=null){settings.success(data)}}}return this.timer=setTimeout(function(){if(chosenXhr){chosenXhr.abort()}return chosenXhr=$.ajax(options)},options.afterTypeDelay)})})}})(jQuery);

/*==================================================================================================

Application:   Utility Function
Author:        John Gardner
Website:       http://www.braemoor.co.uk/software/vat.shtml

Version:       V1.0
Date:          30th July 2005
Description:   Used to check the validity of an EU country VAT number

Version:       V1.1
Date:          3rd August 2005
Description:   Lithuanian legal entities & Maltese check digit checks added.

Version:       V1.2
Date:          20th October 2005
Description:   Italian checks refined (thanks Matteo Mike Peluso).

Version:       V1.3
Date:          16th November 2005
Description:   Error in GB numbers ending in 00 fixed (thanks Guy Dawson).

Version:       V1.4
Date:          28th September 2006
Description:   EU-type numbers added.

Version:       V1.5
Date:          1st January 2007
Description:   Romanian and Bulgarian numbers added.

Version:       V1.6
Date:          7th January 2007
Description:   Error with Slovenian numbers (thanks to Ales Hotko).

Version:       V1.7
Date:          10th February 2007
Description:   Romanian check digits added. 
               Thanks to Dragu Costel for the test suite.

Version:       V1.8
Date:          3rd August 2007
Description:   IE code modified to allow + and * in old format numbers. 
               Thanks to Antonin Moy of Sphere Solutions for pointing out the error.

Version:       V1.9
Date:          6th August 2007
Description:   BE code modified to make a specific check that the leading character of 10 digit 
               numbers is 0 (belts and braces).

Version:       V1.10
Date:          10th August 2007
Description:   Cypriot check digit support added.
               Check digit validation support for non-standard UK numbers

Version:       V1.11
Date:          25th September 2007
Description:   Spain check digit support for personal numbers.
               Author: David Perez Carmona

Version:       V1.12
Date:          23rd November 2009
Description:   GB code modified to take into account new style check digits.
               Thanks to Guy Dawson of Crossflight Ltd for pointing out the necessity.

Version:       V1.13
Date:          7th July 2012
Description:   EL, GB, SE and BE formats updated - thanks to Joost Van Biervliet of VAT Applications

Version:       V.14
Date:          8th April 2013
Description:   BE Pattern match refined
               BG Add check digit checks for all four types of VAT number
               CY Pattern match improved
               CZ Personal pattern match checking improved
               CZ Personal check digits incorporated
               EE improved pattern match
               ES Physical person number checking refined
               GB Check digit support provided for 12 digit VAT codes and range checks included
               IT Bug removed to allow 999 and 888 issuing office codes
               LT temporarily registered taxpayers check digit support added
               LV Natural persons checks added
               RO improved pattern match
               SK improved pattern match and added check digit support
               
               Thanks to Theo Vroom for his help in this latest release.
               
Version:      V1.15
Date:         15th April 2013
              Swedish algorithm re-implemented.
               
Version:      V1.16
Date:         25th July 2013
              Support for Croatian numbers added
              
Version       V1.17
              10th September 2013
              Support for Norwegian MVA numbers added (yes, I know that Norway is not in the EU!)
              
Version       V1.18
              29th October 2013
              Partial support for new style Irish numbers.
              See http://www.revenue.ie/en/practitioner/ebrief/2013/no-032013.html
              Thanks to Simon Leigh for drawing the author's attention to this.
              
Version       V1.19
              31st October 2013
              Support for Serbian PBI numbers added (yes, I know that Serbia is not in the EU!)
              
Version       V1.20
              1st November 2013
              Support for Swiss MWST numbers added (yes, I know that Switzerland is not in the EU!)
              
Version       V1.21
              16th December 2014
              Non-critical code tidies to French and Danish regular expressions. 
              Thanks to Bill Seddon of Lyquidity Solutions
              
Version       V1.22
              14th January 2014
              Non-critical code tidy to regular expression for new format Irish numbers. 
              Thanks to Olivier Reubens of UNIT4 C-Logic N.V.
              
Version       V1.23
              10th April 2014
              Support for Russian INN numbers added (yes, I know that Russia is not in the EU!).
              Thanks to Marco Cesaratto of Arki Tech, Italy
              
Version       V1.24
              4th June 2014
              Check digit validation supported for Irish Type 3 numbers
              Thanks to Olivier Reubens of UNIT4 C-Logic N.V.
              
Version       V1.25
              29th July 2014
              Code improvements
              Thanks to Sébastien Boelpaep and Nate Kerkhofs
              
Version       V1.26
              4th May 2015
              Code improvements to regular expressions
              Thanks to Robert Gust-Bardon of webcraft.ch
              
Version       V1.27
              3rd December 2015
              Extend Swiss optional suffix to allow TVA and ITA
              Thanks to Oskars Petermanis
              
Version       V1.28
              30th August 2016
              Correct Swiss optional suffix to allow TVA and IVA
              Thanks to Jan Verhaegen
              
Parameters:    toCheck - VAT number be checked. 

This function checks the value of the parameter for a valid European VAT number. 

If the number is found to be invalid format, the function returns a value of false. Otherwise it 
returns the VAT number re-formatted.
  
Example call:
  
  if (checkVATNumber (myVATNumber)) 
      alert ("VAT number has a valid format")
  else 
      alert ("VAT number has invalid format");
                    
---------------------------------------------------------------------------------------------------*/

function checkVATNumber (toCheck) {
 
  // Array holds the regular expressions for the valid VAT number
  var vatexp = new Array ();
  
  // To change the default country (e.g. from the UK to Germany - DE):
  //    1.  Change the country code in the defCCode variable below to "DE".
  //    2.  Remove the question mark from the regular expressions associated with the UK VAT number: 
  //        i.e. "(GB)?" -> "(GB)"
  //    3.  Add a question mark into the regular expression associated with Germany's number 
  //        following the country code: i.e. "(DE)" -> "(DE)?"
  
  var defCCode = "GB";
  
  // Note - VAT codes without the "**" in the comment do not have check digit checking.

  vatexp.push (/^(AT)U(\d{8})$/);                           //** Austria
  vatexp.push (/^(BE)(0?\d{9})$/);                          //** Belgium 
  vatexp.push (/^(BG)(\d{9,10})$/);                         //** Bulgaria 
  vatexp.push (/^(CHE)(\d{9})(MWST|TVA|IVA)?$/);            //** Switzerland
  vatexp.push (/^(CY)([0-59]\d{7}[A-Z])$/);                 //** Cyprus
  vatexp.push (/^(CZ)(\d{8,10})(\d{3})?$/);                 //** Czech Republic
  vatexp.push (/^(DE)([1-9]\d{8})$/);                       //** Germany 
  vatexp.push (/^(DK)(\d{8})$/);                            //** Denmark 
  vatexp.push (/^(EE)(10\d{7})$/);                          //** Estonia 
  vatexp.push (/^(EL)(\d{9})$/);                            //** Greece 
  vatexp.push (/^(ES)([A-Z]\d{8})$/);                       //** Spain (National juridical entities)
  vatexp.push (/^(ES)([A-HN-SW]\d{7}[A-J])$/);              //** Spain (Other juridical entities)
  vatexp.push (/^(ES)([0-9YZ]\d{7}[A-Z])$/);                //** Spain (Personal entities type 1)
  vatexp.push (/^(ES)([KLMX]\d{7}[A-Z])$/);                 //** Spain (Personal entities type 2)
  vatexp.push (/^(EU)(\d{9})$/);                            //** EU-type 
  vatexp.push (/^(FI)(\d{8})$/);                            //** Finland 
  vatexp.push (/^(FR)(\d{11})$/);                           //** France (1)
  vatexp.push (/^(FR)([A-HJ-NP-Z]\d{10})$/);                // France (2)
  vatexp.push (/^(FR)(\d[A-HJ-NP-Z]\d{9})$/);               // France (3)
  vatexp.push (/^(FR)([A-HJ-NP-Z]{2}\d{9})$/);              // France (4)
  vatexp.push (/^(GB)?(\d{9})$/);                           //** UK (Standard)
  vatexp.push (/^(GB)?(\d{12})$/);                          //** UK (Branches)
  vatexp.push (/^(GB)?(GD\d{3})$/);                         //** UK (Government)
  vatexp.push (/^(GB)?(HA\d{3})$/);                         //** UK (Health authority)
  vatexp.push (/^(HR)(\d{11})$/);                           //** Croatia 
  vatexp.push (/^(HU)(\d{8})$/);                            //** Hungary 
  vatexp.push (/^(IE)(\d{7}[A-W])$/);                       //** Ireland (1)
  vatexp.push (/^(IE)([7-9][A-Z\*\+)]\d{5}[A-W])$/);        //** Ireland (2)
  vatexp.push (/^(IE)(\d{7}[A-W][AH])$/);                   //** Ireland (3)
  vatexp.push (/^(IT)(\d{11})$/);                           //** Italy 
  vatexp.push (/^(LV)(\d{11})$/);                           //** Latvia 
  vatexp.push (/^(LT)(\d{9}|\d{12})$/);                     //** Lithunia
  vatexp.push (/^(LU)(\d{8})$/);                            //** Luxembourg 
  vatexp.push (/^(MT)([1-9]\d{7})$/);                       //** Malta
  vatexp.push (/^(NL)(\d{9})B\d{2}$/);                      //** Netherlands
  vatexp.push (/^(NO)(\d{9})$/);                            //** Norway (not EU)
  vatexp.push (/^(PL)(\d{10})$/);                           //** Poland
  vatexp.push (/^(PT)(\d{9})$/);                            //** Portugal
  vatexp.push (/^(RO)([1-9]\d{1,9})$/);                     //** Romania
  vatexp.push (/^(RU)(\d{10}|\d{12})$/);                    //** Russia
  vatexp.push (/^(RS)(\d{9})$/);                            //** Serbia
  vatexp.push (/^(SI)([1-9]\d{7})$/);                       //** Slovenia
  vatexp.push (/^(SK)([1-9]\d[2346-9]\d{7})$/);             //** Slovakia Republic
  vatexp.push (/^(SE)(\d{10}01)$/);                         //** Sweden

  // Load up the string to check
  var VATNumber = toCheck.toUpperCase();
  
  // Remove spaces etc. from the VAT number to help validation
  VATNumber = VATNumber.replace (/(\s|-|\.)+/g, '');

  // Assume we're not going to find a valid VAT number
  var valid = false;                         
  
  // Check the string against the regular expressions for all types of VAT numbers
  for (i=0; i<vatexp.length; i++) {
  
    // Have we recognised the VAT number?
    if (vatexp[i].test(VATNumber)) {
      
      // Yes - we have
      var cCode = RegExp.$1;                             // Isolate country code
      var cNumber = RegExp.$2;                           // Isolate the number
      if (cCode.length == 0) cCode = defCCode;           // Set up default country code
      
      // Call the appropriate country VAT validation routine depending on the country code
      if (eval(cCode+"VATCheckDigit ('"+cNumber+"')")) valid = VATNumber;
      
      // Having processed the number, we break from the loop
      break;
    }
  }
  
  // Return with either an error or the reformatted VAT number
  return valid;
}

function ATVATCheckDigit (vatnumber) {

  // Checks the check digits of an Austrian VAT number.
  
  var total = 0;
  var multipliers = [1,2,1,2,1,2,1];
  var temp = 0;
  
  // Extract the next digit and multiply by the appropriate multiplier.  
  for (var i = 0; i < 7; i++) {
    temp = Number(vatnumber.charAt(i)) * multipliers[i];
    if (temp > 9)
      total += Math.floor(temp/10) + temp%10
    else
      total += temp;
  }  
  
  // Establish check digit.
  total = 10 - (total+4) % 10; 
  if (total == 10) total = 0;
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (7,8)) 
    return true
  else 
    return false;
}

function BEVATCheckDigit (vatnumber) {

  // Checks the check digits of a Belgium VAT number.
  
  // Nine digit numbers have a 0 inserted at the front.
  if (vatnumber.length == 9) vatnumber = "0" + vatnumber;
  
  if (vatnumber.slice(1,2) == 0) return false;
  
  // Modulus 97 check on last nine digits
  if (97 - vatnumber.slice (0,8) % 97 == vatnumber.slice (8,10)) 
    return true
  else 
    return false;
}

function BGVATCheckDigit (vatnumber) {

  // Checks the check digits of a Bulgarian VAT number.

  if (vatnumber.length == 9) {
  
    // Check the check digit of 9 digit Bulgarian VAT numbers.
    var total = 0;
    
    // First try to calculate the check digit using the first multipliers  
    var temp = 0;
    for (var i = 0; i < 8; i++) temp += Number(vatnumber.charAt(i)) * (i+1);
    
    // See if we have a check digit yet
    total = temp % 11; 
    if (total != 10) {
      if (total == vatnumber.slice (8)) 
        return true
      else 
        return false;
    }
  
    // We got a modulus of 10 before so we have to keep going. Calculate the new check digit using  
    // the different multipliers  
    var temp = 0;
    for (var i = 0; i < 8; i++) temp += Number(vatnumber.charAt(i)) * (i+3);
    
    // See if we have a check digit yet. If we still have a modulus of 10, set it to 0.
    total = temp % 11; 
    if (total == 10) total = 0;
    if (total == vatnumber.slice (8)) 
      return true
    else 
      return false;
  }
  
  // 10 digit VAT code - see if it relates to a standard physical person
  if ((/^\d\d[0-5]\d[0-3]\d\d{4}$/).test(vatnumber)) {
  
    // Check month
    var month = Number(vatnumber.slice(2,4));
    if ((month > 0 && month < 13) || (month > 20 && month < 33) || (month > 40 && month < 53)) {
    
      // Extract the next digit and multiply by the counter.
      var multipliers = [2,4,8,5,10,9,7,3,6];    
      var total = 0;
      for (var i = 0; i < 9; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
      
      // Establish check digit.
      total = total % 11;
      if (total == 10) total = 0;  
      
      // Check to see if the check digit given is correct, If not, try next type of person
      if (total == vatnumber.substr (9,1)) return true;
    }
  }
  
  // It doesn't relate to a standard physical person - see if it relates to a foreigner.
  
  // Extract the next digit and multiply by the counter.
  var multipliers = [21,19,17,13,11,9,7,3,1];    
  var total = 0;
  for (var i = 0; i < 9; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Check to see if the check digit given is correct, If not, try next type of person
  if (total % 10 == vatnumber.substr (9,1)) return true;
  
  // Finally, if not yet identified, see if it conforms to a miscellaneous VAT number
  
  // Extract the next digit and multiply by the counter.
  var multipliers = [4,3,2,7,6,5,4,3,2];    
  var total = 0;
  for (var i = 0; i < 9; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = 11 - total % 11;
  if (total == 10) return false;  
  if (total == 11) total = 0;  
  
  // Check to see if the check digit given is correct, If not, we have an error with the VAT number
  if (total == vatnumber.substr (9,1)) 
    return true;
  else
    return false;
}

function CHEVATCheckDigit (vatnumber) {

  // Checks the check digits of a Swiss VAT number.
  
  // Extract the next digit and multiply by the counter.
  var multipliers = [5,4,3,2,7,6,5,4];    
  var total = 0;
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = 11 - total % 11;
  if (total == 10) return false;  
  if (total == 11) total = 0;  
  
  // Check to see if the check digit given is correct, If not, we have an error with the VAT number
  if (total == vatnumber.substr (8,1)) 
    return true;
  else
    return false;
}

function CYVATCheckDigit (vatnumber) {

  // Checks the check digits of a Cypriot VAT number.
  
  // Not allowed to start with '12'
  if (Number(vatnumber.slice(0,2) == 12)) return false;
  
  // Extract the next digit and multiply by the counter.
  var total = 0;
  for (var i = 0; i < 8; i++) {
    var temp = Number(vatnumber.charAt(i));
    if (i % 2 == 0) {
      switch (temp) {
        case 0: temp = 1; break;
        case 1: temp = 0; break;
        case 2: temp = 5; break;
        case 3: temp = 7; break;
        case 4: temp = 9; break;
        default: temp = temp*2 + 3;
      }
    }
    total += temp;
  }
  
  // Establish check digit using modulus 26, and translate to char. equivalent.
  total = total % 26;
  total = String.fromCharCode(total+65);
  
  // Check to see if the check digit given is correct
  if (total == vatnumber.substr (8,1)) 
    return true 
  else 
    return false;
}

function CZVATCheckDigit (vatnumber) {

  // Checks the check digits of a Czech Republic VAT number.
  
  var total = 0;
  var multipliers = [8,7,6,5,4,3,2];
  
  var czexp = new Array ();
  czexp[0] = (/^\d{8}$/);
  czexp[1] = (/^[0-5][0-9][0|1|5|6]\d[0-3]\d\d{3}$/);
  czexp[2] = (/^6\d{8}$/);
  czexp[3] = (/^\d{2}[0-3|5-8]\d[0-3]\d\d{4}$/);
  var i = 0;
  
  // Legal entities
  if (czexp[0].test(vatnumber)) {    
    
    // Extract the next digit and multiply by the counter.
    for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
    
    // Establish check digit.
    total = 11 - total % 11;
    if (total == 10) total = 0; 
    if (total == 11) total = 1; 
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (7,8)) 
      return true
    else 
      return false;
  }  
  
  // Individuals type 1
  else if (czexp[1].test(vatnumber)) {
    if (temp = Number(vatnumber.slice(0,2)) > 53) return false;
    return true;
  }
  
  // Individuals type 2
  else if (czexp[2].test(vatnumber)) {  
    
    // Extract the next digit and multiply by the counter.
    for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i+1)) * multipliers[i];
    
    // Establish check digit.
    total = 11 - total % 11;
    if (total == 10) total = 0; 
    if (total == 11) total = 1; 
    
    // Convert calculated check digit according to a lookup table;
    var lookup  = [8,7,6,5,4,3,2,1,0,9,10];
    if (lookup[total-1] == vatnumber.slice (8,9)) 
      return true
    else 
      return false;
  }
  
  // Individuals type 3
  else if (czexp[3].test(vatnumber)) {
    var temp = Number(vatnumber.slice(0,2)) + Number(vatnumber.slice(2,4)) + Number(vatnumber.slice(4,6)) + Number(vatnumber.slice(6,8)) + Number(vatnumber.slice(8));
    if (temp % 11 == 0 && Number(vatnumber) % 11 == 0)
      return true
    else
      return false;
  }
  
  // else error
  return false;
}

function DEVATCheckDigit (vatnumber) {

  // Checks the check digits of a German VAT number.
  
  var product = 10;
  var sum = 0;     
  var checkdigit = 0;                      
  for (var i = 0; i < 8; i++) {
    
    // Extract the next digit and implement peculiar algorithm!.
    sum = (Number(vatnumber.charAt(i)) + product) % 10;
    if (sum == 0) {sum = 10};
    product = (2 * sum) % 11;
  }
  
  // Establish check digit.  
  if (11 - product == 10) {checkdigit = 0} else {checkdigit = 11 - product};
  
  // Compare it with the last two characters of the VAT number. If the same, then it is a valid 
  // check digit.
  if (checkdigit == vatnumber.slice (8,9))
    return true
  else 
    return false;
}

function DKVATCheckDigit (vatnumber) {

  // Checks the check digits of a Danish VAT number.
  
  var total = 0;
  var multipliers = [2,7,6,5,4,3,2,1];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = total % 11;
  
  // The remainder should be 0 for it to be valid..
  if (total == 0) 
    return true
  else 
    return false;
}

function EEVATCheckDigit (vatnumber) {

  // Checks the check digits of an Estonian VAT number.
  
  var total = 0;
  var multipliers = [3,7,1,3,7,1,3,7];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits using modulus 10.
  total = 10 - total % 10;
  if (total == 10) total = 0;
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (8,9))
    return true
  else 
    return false;
}

function ELVATCheckDigit (vatnumber) {

  // Checks the check digits of a Greek VAT number.
  
  var total = 0;
  var multipliers = [256,128,64,32,16,8,4,2];
  
  //eight character numbers should be prefixed with an 0.
  if (vatnumber.length == 8) {vatnumber = "0" + vatnumber};
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = total % 11;
  if (total > 9) {total = 0;};  
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (8,9)) 
    return true
  else 
    return false;
}

function ESVATCheckDigit (vatnumber) {

  // Checks the check digits of a Spanish VAT number.
  
  var total = 0; 
  var temp = 0;
  var multipliers = [2,1,2,1,2,1,2];
  var esexp = new Array ();
  esexp[0] = (/^[A-H|J|U|V]\d{8}$/);
  esexp[1] = (/^[A-H|N-S|W]\d{7}[A-J]$/);
  esexp[2] = (/^[0-9|Y|Z]\d{7}[A-Z]$/);
  esexp[3] = (/^[K|L|M|X]\d{7}[A-Z]$/);
  var i = 0;
  
  // National juridical entities
  if (esexp[0].test(vatnumber)) {
  
    // Extract the next digit and multiply by the counter.
    for (i = 0; i < 7; i++) {
      temp = Number(vatnumber.charAt(i+1)) * multipliers[i];
      if (temp > 9) 
        total += Math.floor(temp/10) + temp%10 
      else 
        total += temp;
    }   
    // Now calculate the check digit itself. 
    total = 10 - total % 10;
    if (total == 10) {total = 0;}
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (8,9)) 
      return true
    else 
      return false;
  }
  
  // Juridical entities other than national ones
  else if (esexp[1].test(vatnumber)) {
  
    // Extract the next digit and multiply by the counter.
    for (i = 0; i < 7; i++) {
      temp = Number(vatnumber.charAt(i+1)) * multipliers[i];
      if (temp > 9) 
        total += Math.floor(temp/10) + temp%10 
      else 
        total += temp;
    }    
    
    // Now calculate the check digit itself.
    total = 10 - total % 10;
    total = String.fromCharCode(total+64);
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (8,9)) 
      return true
    else 
      return false;
  }
	
  // Personal number (NIF) (starting with numeric of Y or Z)
  else if (esexp[2].test(vatnumber)) {
    var tempnumber = vatnumber;
    if (tempnumber.substring(0,1) == 'Y') tempnumber = tempnumber.replace (/Y/, "1");
    if (tempnumber.substring(0,1) == 'Z') tempnumber = tempnumber.replace (/Z/, "2");
  	return tempnumber.charAt(8) == 'TRWAGMYFPDXBNJZSQVHLCKE'.charAt(Number(tempnumber.substring(0,8)) % 23);
  }
	
  // Personal number (NIF) (starting with K, L, M, or X)
  else if (esexp[3].test(vatnumber)) {
  	return vatnumber.charAt(8) == 'TRWAGMYFPDXBNJZSQVHLCKE'.charAt(Number(vatnumber.substring(1,8)) % 23);
  }
	
  else return false;
}

function EUVATCheckDigit (vatnumber) {

  // We know little about EU numbers apart from the fact that the first 3 digits represent the 
  // country, and that there are nine digits in total.
  return true;
}

function FIVATCheckDigit (vatnumber) {

  // Checks the check digits of a Finnish VAT number.
  
  var total = 0; 
  var multipliers = [7,9,10,5,8,4,2];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = 11 - total % 11;
  if (total > 9) {total = 0;};  
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (7,8)) 
    return true
  else 
    return false;
}

function FRVATCheckDigit (vatnumber) {

  // Checks the check digits of a French VAT number.
  
  if (!(/^\d{11}$/).test(vatnumber)) return true;
  
  // Extract the last nine digits as an integer.
  var total = vatnumber.substring(2); 
  
  // Establish check digit.
  total = (total*100+12) % 97;
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (0,2)) 
    return true
  else 
    return false;
}

function GBVATCheckDigit (vatnumber) {

  // Checks the check digits of a UK VAT number.
  
  var multipliers = [8,7,6,5,4,3,2];
  
  // Government departments
  if (vatnumber.substr(0,2) == 'GD') {
    if (vatnumber.substr(2,3) < 500) 
      return true 
    else 
      return false;
  }
  
  // Health authorities
  if (vatnumber.substr(0,2) == 'HA') {
    if (vatnumber.substr(2,3) > 499) 
      return true 
    else 
      return false;
  }
  
  // Standard and commercial numbers
  var total = 0;
  
  // 0 VAT numbers disallowed!
  if (Number(vatnumber.slice(0)) == 0) return false;
  
  // Check range is OK for modulus 97 calculation
  var no = Number(vatnumber.slice(0,7));
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];

  // Old numbers use a simple 97 modulus, but new numbers use an adaptation of that (less 55). Our 
  // VAT number could use either system, so we check it against both.

  // Establish check digits by subtracting 97 from total until negative.
  var cd = total;
  while (cd > 0) {cd = cd - 97;}    

  // Get the absolute value and compare it with the last two characters of the VAT number. If the 
  // same, then it is a valid traditional check digit. However, even then the number must fit within
  // certain specified ranges.
  cd = Math.abs(cd);
  if (cd == vatnumber.slice (7,9) && no < 9990001 && (no < 100000 || no > 999999) && (no < 9490001 || no > 9700000)) return true;
  
  // Now try the new method by subtracting 55 from the check digit if we can - else add 42
  if (cd >= 55) 
    cd = cd - 55
  else
    cd = cd + 42;
  if (cd == vatnumber.slice (7,9) && no > 1000000) 
    return true;
  else
    return false; 
}

function HRVATCheckDigit (vatnumber) {

  // Checks the check digits of a Croatian VAT number using ISO 7064, MOD 11-10 for check digit.
  
  var product = 10;
  var sum = 0;     
  var checkdigit = 0; 
  
  for (var i = 0; i < 10; i++) {
    
    // Extract the next digit and implement the algorithm
    sum = (Number(vatnumber.charAt(i)) + product) % 10;
    if (sum == 0) {sum = 10};
    product = (2 * sum) % 11;
  }
  
  // Now check that we have the right check digit
  if ((product + vatnumber.slice (10,11)*1) % 10== 1)
    return true
  else 
    return false;
}

function HUVATCheckDigit (vatnumber) {

  // Checks the check digits of a Hungarian VAT number.
  
  var total = 0;
  var multipliers = [9,7,3,1,9,7,3];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digit.
  total = 10 - total % 10; 
  if (total == 10) total = 0;
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (7,8)) 
    return true
  else 
    return false;
}

function IEVATCheckDigit (vatnumber) {

  // Checks the check digits of an Irish VAT number.
  
  var total = 0; 
  var multipliers = [8,7,6,5,4,3,2];  
 
  // If the code is type 1 format, we need to convert it to the new before performing the validation.
  if (/^\d[A-Z\*\+]/.test(vatnumber)) vatnumber = "0" + vatnumber.substring(2,7) + vatnumber.substring(0,1) + vatnumber.substring(7,8);
    
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // If the number is type 3 then we need to include the trailing A or H in the calculation
  if (/^\d{7}[A-Z][AH]$/.test(vatnumber)) {
  
    // Add in a multiplier for the character A (1*9=9) or H (8*9=72)
    if (vatnumber.charAt(8) == 'H')
      total += 72
    else
      total += 9;    
  }
  
  // Establish check digit using modulus 23, and translate to char. equivalent.
  total = total % 23;
  if (total == 0)
    total = "W"
  else
    total = String.fromCharCode(total+64);
    
  // Compare it with the eighth character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (7,8)) 
    return true
  else 
    return false;
}

function ITVATCheckDigit (vatnumber) {

  // Checks the check digits of an Italian VAT number.
  
  var total = 0;
  var multipliers = [1,2,1,2,1,2,1,2,1,2];
  var temp;
    
  // The last three digits are the issuing office, and cannot exceed more 201, unless 999 or 888
  if (Number(vatnumber.slice(0,7))==0) return false;
  temp=Number(vatnumber.slice(7,10));
  if ((temp<1) || (temp>201) && temp != 999 && temp != 888) return false;
  
  // Extract the next digit and multiply by the appropriate  
  for (var i = 0; i < 10; i++) {
    temp = Number(vatnumber.charAt(i)) * multipliers[i];
    if (temp > 9) 
      total += Math.floor(temp/10) + temp%10 
    else 
      total += temp;
  }
  
  // Establish check digit.
  total = 10 - total % 10;
  if (total > 9) {total = 0;};  
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (10,11)) 
    return true
  else 
    return false;
}

function LTVATCheckDigit (vatnumber) {

  // Checks the check digits of a Lithuanian VAT number.
  
  // 9 character VAT numbers are for legal persons
  if (vatnumber.length == 9) {
  
    // 8th character must be one
    if (!(/^\d{7}1/).test(vatnumber)) return false;
    
    // Extract the next digit and multiply by the counter+1.
    var total = 0;
    for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * (i+1);
    
    // Can have a double check digit calculation!
    if (total % 11 == 10) {
      var multipliers = [3,4,5,6,7,8,9,1];
      total = 0;
      for (i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
    }
    
    // Establish check digit.
    total = total % 11;
    if (total == 10) {total = 0;}; 
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (8,9)) 
      return true
    else 
      return false;
  }
  
  // 12 character VAT numbers are for temporarily registered taxpayers
  else {
  
    // 11th character must be one
    if (!(/^\d{10}1/).test(vatnumber)) return false;
    
    // Extract the next digit and multiply by the counter+1.
    var total = 0;
    var multipliers = [1,2,3,4,5,6,7,8,9,1,2];
    for (var i = 0; i < 11; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
    
    // Can have a double check digit calculation!
    if (total % 11 == 10) {
      var multipliers = [3,4,5,6,7,8,9,1,2,3,4];
      total = 0;
      for (i = 0; i < 11; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
    }
    
    // Establish check digit.
    total = total % 11;
    if (total == 10) {total = 0;}; 
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (11,12)) 
      return true
    else 
      return false;
  }
}

function LUVATCheckDigit (vatnumber) {

  // Checks the check digits of a Luxembourg VAT number.
  
  if (vatnumber.slice (0,6) % 89 == vatnumber.slice (6,8)) 
    return true
  else 
    return false;
}

function LVVATCheckDigit (vatnumber) {

  // Checks the check digits of a Latvian VAT number.
  
  // Differentiate between legal entities and natural bodies. For the latter we simply check that
  // the first six digits correspond to valid DDMMYY dates.
  if ((/^[0-3]/).test(vatnumber)) {
    if ((/^[0-3][0-9][0-1][0-9]/).test(vatnumber) )
      return true
    else
      return false;
  }
  
  else {
  
    var total = 0;
    var multipliers = [9,1,4,8,3,10,2,5,7,6];
    
    // Extract the next digit and multiply by the counter.
    for (var i = 0; i < 10; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
    
    // Establish check digits by getting modulus 11.
    if (total%11 == 4 && vatnumber[0] ==9) total = total - 45;
    if (total%11 == 4) 
      total = 4 - total%11
    else if (total%11 > 4) 
      total = 14 - total%11
    else if (total%11 < 4) 
      total = 3 - total%11;
    
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (10,11)) 
      return true
    else 
      return false;
  }
}

function MTVATCheckDigit (vatnumber) {

  // Checks the check digits of a Maltese VAT number.
  
  var total = 0;
  var multipliers = [3,4,6,7,8,9];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 6; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits by getting modulus 37.
  total = 37 - total % 37;
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (6,8) * 1) 
    return true
  else 
    return false;
}

function NLVATCheckDigit (vatnumber) {

  // Checks the check digits of a Dutch VAT number.
  
  var total = 0;
  var multipliers = [9,8,7,6,5,4,3,2];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits by getting modulus 11.
  total = total % 11;
  if (total > 9) {total = 0;};  
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (8,9)) 
    return true
  else 
    return false;
}

function NOVATCheckDigit (vatnumber) {

  // Checks the check digits of a Norwegian VAT number.
  // See http://www.brreg.no/english/coordination/number.html
  
  var total = 0;
  var multipliers = [3,2,7,6,5,4,3,2];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits by getting modulus 11. Check digits > 9 are invalid
  total = 11 - total % 11;
  if (total == 11) {total = 0;}
  if (total < 10) {  
  
    // Compare it with the last character of the VAT number. If it's the same, then it's valid.
    if (total == vatnumber.slice (8,9)) 
      return true
    else 
      return false;
  }
}

function PLVATCheckDigit (vatnumber) {

  // Checks the check digits of a Polish VAT number.
  
  var total = 0;
  var multipliers = [6,5,7,2,3,4,5,6,7];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 9; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits subtracting modulus 11 from 11.
  total = total % 11;
  if (total > 9) {total = 0;};
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (9,10)) 
    return true
  else 
    return false;
}

function PTVATCheckDigit (vatnumber) {

  // Checks the check digits of a Portugese VAT number.
  
  var total = 0;
  var multipliers = [9,8,7,6,5,4,3,2];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 8; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits subtracting modulus 11 from 11.
  total = 11 - total % 11;
  if (total > 9) {total = 0;};
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (8,9)) 
    return true
  else 
    return false;
}

function ROVATCheckDigit (vatnumber) {

  // Checks the check digits of a Romanian VAT number.
  
  var multipliers = [7,5,3,2,1,7,5,3,2];
  
  // Extract the next digit and multiply by the counter.
  var VATlen = vatnumber.length;
  multipliers = multipliers.slice (10-VATlen);
  var total = 0;
  for (var i = 0; i < vatnumber.length-1; i++) {
    total += Number(vatnumber.charAt(i)) * multipliers[i];
  }  
  
  // Establish check digits by getting modulus 11.
  total = (10 * total) % 11;
  if (total == 10) total = 0; 
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (total == vatnumber.slice (vatnumber.length-1, vatnumber.length))
    return true
  else 
    return false;
}

function RSVATCheckDigit (vatnumber) {

  // Checks the check digits of a Serbian VAT number using ISO 7064, MOD 11-10 for check digit.
  
  var product = 10;
  var sum = 0;     
  var checkdigit = 0; 
  
  for (var i = 0; i < 8; i++) {
    
    // Extract the next digit and implement the algorithm
    sum = (Number(vatnumber.charAt(i)) + product) % 10;
    if (sum == 0) {sum = 10};
    product = (2 * sum) % 11;
  }
  
  // Now check that we have the right check digit
  if ((product + vatnumber.slice (8,9)*1) % 10== 1)
    return true
  else 
    return false;
}
function RUVATCheckDigit (vatnumber) {

  // Checks the check digits of a Russian INN number 
  // See http://russianpartner.biz/test_inn.html for algorithm 
 
  // 10 digit INN numbers
	if (vatnumber.length == 10) {
		var total = 0;
		var multipliers = [2,4,10,3,5,9,4,6,8,0]
		for (var i = 0; i < 10; i++) {
			total += Number(vatnumber.charAt(i)) * multipliers[i];
		}
		total = total % 11
		if (total > 9) {total = total % 10} 
    
		// Compare it with the last character of the VAT number. If it is the same, then it's valid
		if (total == vatnumber.slice (9,10)) 
			return true
		else 
			return false
   
  // 12 digit INN numbers
	} else if(vatnumber.length == 12){
		var total1 = 0
		var multipliers1 = [7,2,4,10,3,5,9,4,6,8,0]
		var total2 = 0
		var multipliers2 = [3,7,2,4,10,3,5,9,4,6,8,0]
		
		for (var i = 0; i < 11; i++) total1 += Number(vatnumber.charAt(i)) * multipliers1[i];
		total1 = total1 % 11
		if (total1 > 9) {total1 = total1 % 10} 
		
		for (var i = 0; i < 11; i++) total2 += Number(vatnumber.charAt(i)) * multipliers2[i];
		total2 = total2 % 11
		if (total2 > 9) {total2 = total2 % 10}  
		
		// Compare the first check with the 11th character and the second check with the 12th and last 
    // character of the VAT number. If they're both the same, then it's valid
		if ((total1 == vatnumber.slice (10,11)) && (total2 == vatnumber.slice (11,12)))
			return true
		else 
			return false
	}
}

function SEVATCheckDigit (vatnumber) {

  // Calculate R where R = R1 + R3 + R5 + R7 + R9, and Ri = INT(Ci/5) + (Ci*2) modulo 10
  var R = 0;
  var digit;
  for (var i = 0; i < 9; i=i+2) {
    digit = Number(vatnumber.charAt(i));
    R += Math.floor(digit / 5)  + ((digit * 2) % 10);
  }
  
  // Calculate S where S = C2 + C4 + C6 + C8
  var S = 0;
  for (var i = 1; i < 9; i=i+2) S += Number(vatnumber.charAt(i));
  
  // Calculate the Check Digit
  var cd = (10 - (R + S) % 10) % 10;  
  
  // Compare it with the last character of the VAT number. If it's the same, then it's valid.
  if (cd == vatnumber.slice (9,10)) 
    return true
  else 
    return false;
}

function SIVATCheckDigit (vatnumber) {

  // Checks the check digits of a Slovenian VAT number.
  
  var total = 0; 
  var multipliers = [8,7,6,5,4,3,2];
  
  // Extract the next digit and multiply by the counter.
  for (var i = 0; i < 7; i++) total += Number(vatnumber.charAt(i)) * multipliers[i];
  
  // Establish check digits using modulus 11
  total = 11 - total % 11;
  if (total == 10) {total = 0;};  
  
  // Compare the number with the last character of the VAT number. If it is the 
  // same, then it's a valid check digit.
  if (total != 11 && total == vatnumber.slice (7,8)) 
    return true
  else 
    return false;
}

function SKVATCheckDigit (vatnumber) {

  // Checks the check digits of a Slovakian VAT number.
  
  // Check that the modulus of the whole VAT number is 0 - else error
  if (Number(vatnumber % 11) == 0) 
    return true
  else 
    return false;
}


/* <![CDATA[ */
var WPInv_VAT_Vars = {"UseTaxes":"","EUStates":["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],"NoRateSet":"You have not set a rate. Do you want to continue?","EmptyCompany":"Please enter your registered company name!","EmptyVAT":"Please enter your VAT number!","TotalsRefreshed":"The invoice totals will be refreshed to update the VAT.","ErrValidateVAT":"Fail to validate the VAT number!","ErrResetVAT":"Fail to reset the VAT number!","ErrInvalidVat":"The VAT number supplied does not have a valid format!","ErrInvalidResponse":"An invalid response has been received from the server!","ApplyVATRules":"","HideVatFields":"1","ErrResponse":"The request response is invalid!","ErrRateResponse":"The get rate request response is invalid","PageRefresh":"The page will be refreshed in 10 seconds to show the new options.","RequestResponseNotValidJSON":"The get rate request response is not valid JSON","GetRateRequestFailed":"The get rate request failed: ","NoRateInformationInResponse":"The get rate request response does not contain any rate information","RatesUpdated":"The rates have been updated. Press the save button to record these new rates.","IPAddressInformation":"IP Address Information","VatValidating":"Validating VAT number...","VatReseting":"Reseting...","VatValidated":"VAT number validated","VatNotValidated":"VAT number not validated","ConfirmDeleteClass":"Are you sure you wish to delete this rates class?","isFront":"1","checkoutNonce":"cda010205e","baseCountry":"US","disableVATSameCountry":"","disableVATSimpleCheck":""};
/* ]]> */

jQuery(function($) {
    $('body').bind('wpinv_tax_recalculated', function(e, data) {
        var el = $('#wpinv_adddress_confirm');
        el.hide();
        if (WPInv_VAT_Vars.ApplyVATRules) {
            var eu_state = wpinv_is_eu_state(data.post.country);
            var non_eu = !eu_state && !wpinv_is_eu_state(el.attr('value'));
            if (!non_eu && $('#wpinv_vat_number').val().trim().length === 0 && data.post.country !== el.attr('value')) {
                el.show();
            }
        }
    });
    var WPInv_VAT_Config = {
        init: function() {
            this.taxes(this);
            var me = this;
        },
        checkVATNumber: function(el, err) {
            try {
                if (el) {
                    var valid = false;
                    var msg = '';
                    var value = el.val();
                    if (value.length > 0) {
                        if (checkVATNumber(value)) {
                            valid = true;
                        } else {
                            msg = WPInv_VAT_Vars.ErrInvalidVat;
                        }
                    } else {
                        msg = WPInv_VAT_Vars.EmptyVAT;
                    }
                    if (valid) {
                        return true;
                    } else if (err && msg) {
                        alert(msg);
                    }
                    return false;
                }
                return;
            } catch (e) {
                if (err) {
                    alert(WPInv_VAT_Vars.ErrValidateVAT + ": " + e.message);
                }
                return false;
            }
        },
        taxes: function(config) {
            var has_vat = $('#wpi_vat_info').is(':visible');
            var eu_states = WPInv_VAT_Vars.EUStates;
            $('body').bind('wpinv_tax_recalculated', function(e, data) {
                $('.wpinv_errors').html('').hide();
                if (data.post.country === 'UK') {
                    data.post.country = 'GB';
                }
                var eu_state = wpinv_is_eu_state(data.post.country);
                if (eu_state && WPInv_VAT_Vars.disableVATSameCountry && wpinv_is_base_country(data.post.country)) {
                    eu_state = false;
                }
                if (eu_state && !WPInv_VAT_Vars.HideVatFields) {
                    $('#wpi_vat_info').show();
                    $('#wpi_vat_info').parent('.wpi-vat-details').show();
                } else {
                    $('#wpi_vat_info').hide();
                }
                if (has_vat == eu_state) {
                    if (eu_state) {
                        config.reset(config, $('#wpinv_vat_reset'), false);
                    }
                    return;
                }
                has_vat = eu_state;
                wpinv_recalculate_taxes();
            });
            $('#wpi_add_eu_states').on('click', function() {
                var rate = $('#wpinv_settings_rates_eu_fallback_rate').val();
                if (rate === null || rate === '') {
                    if (!confirm(WPInv_VAT_Vars.NoRateSet)) return;
                }
                $('#wpi_remove_eu_states').trigger('click');
                var row = $('#wpinv_tax_rates tbody tr:last');
                var clone = row.clone();
                var body = row.parent();
                var count = $('#wpinv_tax_rates tbody tr').length;
                $.each(eu_states, function(i, state) {
                    row = clone.clone();
                    row.find('td input').val('');
                    row.find('input, select').each(function() {
                        var name = $(this).attr('name');
                        name = name.replace(/\[(\d+)\]/, '[' + parseInt(count) + ']');
                        $(this).attr('name', name).attr('id', name);
                    });
                    row.find('#tax_rates\\[' + count + '\\]\\[rate\\]').val(rate);
                    row.find('#tax_rates\\[' + count + '\\]\\[country\\]').val(state);
                    row.find('#tax_rates\\[' + count + '\\]\\[state\\]').replaceWith('<input type="text" class="regular-text" value="" id="tax_rates[' + count + '][state]" name="tax_rates[' + count + '][state]">');
                    row.find('#tax_rates\\[' + count + '\\]\\[global\\]').prop('checked', true);
                    row.find('#tax_rates\\[' + count + '\\]\\[global\\]').val(1);
                    body.append(row);
                    count++;
                });
                return false;
            });
            $('#wpi_remove_eu_states').on('click', function() {
                $('#wpinv_tax_rates select.wpinv-tax-country').each(function(i) {
                    if (jQuery(this).val() && wpinv_is_eu_state(jQuery(this).val())) {
                        if ($('#wpinv_tax_rates tbody tr').length === 1) {
                            $('#wpinv_tax_rates select').val('');
                            $('#wpinv_tax_rates select').trigger('change');
                            $('#wpinv_tax_rates input[type="text"]').val('');
                            $('#wpinv_tax_rates input[type="number"]').val('');
                            $('#wpinv_tax_rates input[type="checkbox"]').attr('checked', false);
                        } else {
                            jQuery(this).closest('tr').remove();
                        }
                    }
                });
            });
            jQuery('#wpi_vat_get_rates').on('click', function(e) {
                e.preventDefault();
                var $this = $(this);
                $this.blur();
                WPInv_VAT_Config.disableButtons();
                var $loading = $this.closest('span').find('.fa-refresh');
                $loading.show();
                var data = {
                    action: 'wpinv_update_vat_rates',
                    group: 'standard'
                };
                jQuery.post(ajaxurl, data, function(response) {
                        try {
                            if (!response) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.ErrRateResponse);
                                return;
                            }
                            var vat_rates_array = response;
                            if (vat_rates_array.success !== true) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.GetRateRequestFailed + (vat_rates_array.error ? vat_rates_array.error : 'reason unknown'));
                                return;
                            }
                            if (!vat_rates_array.data) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.NoRateInformationInResponse);
                                return;
                            }
                            var vat_rates = vat_rates_array.data;
                            var countries = jQuery('#wpinv_tax_rates select.wpinv-tax-country');
                            countries.each(function(i, country_td) {
                                var country_el = jQuery(country_td);
                                var code = country_el.val();
                                if (!vat_rates.rates[code]) {
                                    return;
                                }
                                var rate_el = country_el.closest('tr').find('.wpinv_tax_rate input');
                                var rate_class = country_el.closest('tr').find('.wpinv_tax_rate input');
                                var rate = vat_rates.rates[code].standard;
                                rate_el.val(rate);
                            });
                            $loading.hide();
                            WPInv_VAT_Config.showError(WPInv_VAT_Vars.RatesUpdated);
                        } catch (e) {
                            $loading.hide();
                            WPInv_VAT_Config.showError(e.message);
                        }
                    })
                    .fail(function(jqXHR, textStatus, errorThrown) {
                        $loading.hide();
                        $this.removeAttr('disabled', 'disabled');
                    });
            });
            jQuery('#wpi_vat_get_rates_group').on('click', function(e) {
                e.preventDefault();
                var $this = $(this);
                $this.blur();
                WPInv_VAT_Config.disableButtons();
                var $loading = $this.closest('span').find('.fa-refresh');
                $loading.show();
                var data = {
                    action: 'wpinv_update_vat_rates'
                };
                jQuery.post(ajaxurl, data, function(response) {
                        try {
                            if (!response) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.ErrRateResponse);
                                return;
                            }
                            var vat_rates_array = response;
                            if (vat_rates_array.success !== true) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.GetRateRequestFailed + (vat_rates_array.error ? vat_rates_array.error : 'reason unknown'));
                                return;
                            }
                            if (!vat_rates_array.data) {
                                WPInv_VAT_Config.showError(WPInv_VAT_Vars.NoRateInformationInResponse);
                                return;
                            }
                            var vat_rates = vat_rates_array.data;
                            jQuery.each(vat_rates.rates, function(sCode, oRate) {
                                if (sCode) {
                                    var sGroup = jQuery('.wpinv_vat_group select[name="vat_rates[' + sCode + '][group]"]').val();
                                    if (sGroup && typeof oRate[sGroup] !== 'undefined') {
                                        jQuery('.wpinv_vat_rate input[name="vat_rates[' + sCode + '][rate]"]').val(parseFloat(oRate[sGroup]));
                                    }
                                }
                            });
                            $loading.hide();
                            WPInv_VAT_Config.showError(WPInv_VAT_Vars.RatesUpdated);
                        } catch (e) {
                            $loading.hide();
                            WPInv_VAT_Config.showError(e.message);
                        }
                    })
                    .fail(function(jqXHR, textStatus, errorThrown) {
                        $loading.hide();
                        $this.removeAttr('disabled', 'disabled');
                    });
            });
            $('#wpi_vat_rate_add').on('click', function() {
                var $n = $('#wpinv_settings\\[vat_rate_name\\]');
                var $d = $('#wpinv_settings\\[vat_rate_desc\\]');
                var $r = $('.wpi-vat-rate-actions .fa-refresh');
                var n = $.trim($n.val());
                var d = $.trim($d.val());
                if (!n) {
                    $n.focus();
                    return false;
                }
                var me = $(this);
                me.attr('disabled', 'disabled');
                $r.show();
                var data = {
                    action: 'wpinv_add_vat_class',
                    name: n,
                    desc: d
                };
                $.post(ajaxurl, data, function(json) {
                        var error = '';
                        var message = '';
                        if (json && typeof json == 'object') {
                            if (json.success === true) {
                                $r.removeClass('fa-refresh fa-spin').addClass('fa-check-circle orange');
                                window.location = json.redirect;
                                return;
                            } else {
                                error = json.error ? json.error : '';
                            }
                        }
                        me.removeAttr('disabled');
                        $r.hide();
                        if (error) {
                            alert(error);
                        }
                        return;
                    })
                    .fail(function() {
                        me.removeAttr('disabled');
                        $r.hide();
                    });
            });
            $('#wpi_vat_rate_delete').on('click', function() {
                var $c = $('#wpinv_settings\\[vat_rates_class\\]');
                var $r = $('.wpi-vat-rate-actions .fa-refresh');
                var c = $.trim($c.val());
                if (!confirm(WPInv_VAT_Vars.ConfirmDeleteClass)) {
                    return;
                }
                var me = $(this);
                me.attr('disabled', 'disabled');
                $r.show();
                var data = {
                    action: 'wpinv_delete_vat_class',
                    class: c,
                };
                $.post(ajaxurl, data, function(json) {
                        var error = '';
                        var message = '';
                        if (json && typeof json == 'object') {
                            if (json.success === true) {
                                $r.removeClass('fa-refresh fa-spin').addClass('fa-check-circle orange');
                                window.location = json.redirect;
                                return;
                            } else {
                                error = json.error ? json.error : '';
                            }
                        }
                        me.removeAttr('disabled');
                        $r.hide();
                        if (error) {
                            alert(error);
                        }
                        return;
                    })
                    .fail(function() {
                        me.removeAttr('disabled');
                        $r.hide();
                    });
            });
            jQuery('#wpi_geoip2').on('click', function(e) {
                e.preventDefault();
                var el = $(this);
                var action = el.attr('action');
                el.blur().attr('disabled', 'disabled');
                el.after('&nbsp;<i id="wpi-downloading" class="fa fa-refresh fa-spin"></i>');
                $('#wpi-downloading').show();
                var data = {
                    action: 'wpinv_geoip2',
                };
                jQuery.post(ajaxurl, data,
                    function(response) {
                        var msg = '';
                        var reload = false;
                        try {
                            if (response) {
                                reload = action == 'download' ? true : false;
                                msg = response + (action == 'download' ? ' ' + WPInv_VAT_Vars.PageRefresh : '');
                            } else {
                                msg = WPInv_VAT_Vars.ErrResponse;
                            }
                        } catch (e) {
                            msg = e.message;
                        }
                        WPInv_VAT_Config.showGeoIP2Error(msg, el, reload);
                    }).fail(function(jqXHR, textStatus, errorThrown) {
                    WPInv_VAT_Config.showGeoIP2Error("Status: " + textStatus, el);
                })
            });
            $('#wpinv_vat_reset').on('click', function(e) {
                e.preventDefault();
                WPInv_VAT_Config.reset(WPInv_VAT_Config, $(this), true);
            });
            if (WPInv_VAT_Vars.isFront) {
                var elErr = $('.wpi-cart-field-actions .wpi-vat-box-error');
                var elInfo = $('.wpi-cart-field-actions .wpi-vat-box-info');
                $('#wpinv_vat_validate').on('click', function() {
                    elErr.hide();
                    elInfo.hide();
                    var companyEl = $('#wpinv_checkout_form #wpinv_company');
                    var company = companyEl.val();
                    var numberEl = $('#wpinv_checkout_form #wpinv_vat_number');
                    var vat_number = numberEl.val();
                    if ((company && (company.length > 0)) || (vat_number && (vat_number.length > 0))) {
                        if (!(company && (company.length > 0))) {
                            WPInv_VAT_Config.displayMessage(WPInv_VAT_Vars.EmptyCompany, 'error');
                            return false;
                        }
                        if (!(vat_number && (vat_number.length > 0))) {
                            WPInv_VAT_Config.displayMessage(WPInv_VAT_Vars.EmptyVAT, 'error');
                            return false;
                        }
                    }
                    if (!WPInv_VAT_Vars.disableVATSimpleCheck && (vat_number && (vat_number.length > 0)) && !WPInv_VAT_Config.checkVATNumber(numberEl, false)) {
                        WPInv_VAT_Config.displayMessage(WPInv_VAT_Vars.ErrValidateVAT, 'error');
                        return false;
                    }
                    var number = numberEl.val();
                    var nonce = $('input[name=_wpi_nonce]').val();
                    var me = $(this);
                    me.attr('disabled', 'disabled');
                    $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-0 wpinv-vat-stat-1').addClass('wpinv-vat-stat-2');
                    $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatValidating);
                    var data = {
                        action: 'wpinv_vat_validate',
                        company: company,
                        number: number,
                        country: $('[name=wpinv_country]').val(),
                        source: 'checkout',
                        _wpi_nonce: nonce
                    };
                    $.post(ajaxurl, data, function(json) {
                            var validated = false;
                            var error = '';
                            var message = '';
                            if (json && typeof json == 'object') {
                                if (json.success === true) {
                                    validated = true;
                                    message = json.message ? json.message : '';
                                } else {
                                    error = json.error ? json.error : json.message;
                                }
                            }
                            me.removeAttr('disabled');
                            if (validated) {
                                if (number.length === 0) {} else {
                                    me.hide();
                                    $('#wpinv_vat_reset').show();
                                }
                                $('.wpinv-vat-stat font').html(message ? message : WPInv_VAT_Vars.VatValidated);
                                $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-1');
                            } else {
                                $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                                $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                            }
                            if (number.length > 0 || $('#wpinv_country').val() === $('#wpinv_adddress_confirm').attr('value')) {
                                $('#wpinv_adddress_confirm').hide();
                            } else {
                                $('#wpinv_adddress_confirm').show();
                            }
                            if (error) {
                                config.displayMessage(error + '<br>' + WPInv_VAT_Vars.TotalsRefreshed, 'error');
                            } else {
                                config.displayMessage(WPInv_VAT_Vars.TotalsRefreshed, 'info');
                            }
                            wpinv_recalculate_taxes();
                            return;
                        })
                        .fail(function() {
                            me.removeAttr('disabled');
                            $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                            $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                            WPInv_VAT_Config.displayMessage(WPInv_VAT_Vars.ErrValidateVAT, 'error');
                        });
                });
            } else {
                $('#wpinv_vat_validate').on('click', function() {
                    var companyEl = $('#wpinv_settings\\[vat_company_name\\]');
                    var company = companyEl.val();
                    if (company.length == 0) {
                        alert(WPInv_VAT_Vars.EmptyCompany);
                        return false;
                    }
                    var vatEl = $('#wpinv_settings\\[vat_number\\]');
                    var number = vatEl.val();
                    if (!WPInv_VAT_Vars.disableVATSimpleCheck && !WPInv_VAT_Config.checkVATNumber(vatEl, true)) {
                        return false;
                    }
                    var nonce = $('input[name=_wpi_nonce]').val();
                    var me = $(this);
                    me.attr('disabled', 'disabled');
                    $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-0 wpinv-vat-stat-1').addClass('wpinv-vat-stat-2');
                    $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatValidating);
                    var data = {
                        action: 'wpinv_vat_validate',
                        company: company,
                        number: number,
                        _wpi_nonce: nonce,
                        source: 'admin'
                    };
                    $.post(ajaxurl, data, function(json) {
                            var validated = false;
                            var error = '';
                            var message = '';
                            if (json && typeof json == 'object') {
                                if (json.success === true) {
                                    validated = true;
                                    message = json.message ? json.message : '';
                                } else {
                                    error = json.message ? json.message : json.error;
                                }
                            }
                            if (validated) {
                                $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatValidated);
                                $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-1');
                            } else {
                                me.removeAttr('disabled');
                                $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                                $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                                if (error) {
                                    alert(error);
                                }
                            }
                            return;
                        })
                        .fail(function() {
                            me.removeAttr('disabled');
                            $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                            $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                            alert(WPInv_VAT_Vars.ErrValidateVAT);
                        });
                });
            }
        },
        clearBox: function() {
            var texts = $('.wpi-vat-box #text');
            texts.html('');
            var boxes = texts.parents(".wpi-vat-box")
            boxes.fadeOut('fast');
        },
        reset: function(config, me, updateTaxes) {
            var tax = parseFloat($('#wpinv_checkout_form .wpinv_cart_tax_amount').attr('data-tax'));
            var total = parseFloat($('#wpinv_checkout_form .wpinv_cart_amount').attr('data-total'));
            var wpiCCaddressEl = $('#wpinv-fields .wpi-billing');
            var countryEl = wpiCCaddressEl.find('#wpinv_country').val();
            if (total === "0") {
                $('#wpi_vat_info').hide();
                return;
            }
            if (tax !== "0" && countryEl === undefined) {
                window.location.reload()
            }
            if (!WPInv_VAT_Vars.HideVatFields) {
                $('#wpi_vat_info').parent('.wpi-vat-details').show();
                $('#wpi_vat_info').show();
            }
            if (!updateTaxes) {
                return;
            }
            var numberEl = $('#wpinv_vat_number');
            var number = numberEl.val();
            if (number.length === 0 && $('.wpinv-vat-stat').hasClass('wpinv-vat-stat-1')) {
                return;
            }
            var nonce = $('input[name=_wpi_nonce]').val();
            me.attr('disabled', 'disabled');
            $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-0 wpinv-vat-stat-1').addClass('wpinv-vat-stat-2');
            $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatReseting);
            var validateButton = $('#wpinv_vat_validate');
            validateButton.hide();
            var data = {
                action: 'wpinv_vat_reset',
                _wpi_nonce: nonce,
                source: 'checkout'
            };
            $.post(ajaxurl, data, function(response) {
                    var json = response;
                    $('#wpinv_company').val("");
                    $('#wpinv_vat_number').val("");
                    $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                    $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                    validateButton.show();
                    me.removeAttr('disabled');
                    me.hide();
                    if (json.success) {
                        $('#wpinv_company').val(json.data.company); // TODO
                        $('#wpinv_vat_number').val(json.data.number); // TODO
                        if (updateTaxes) {
                            wpinv_recalculate_taxes();
                        }
                        return;
                    }
                    config.displayMessage(json === undefined || json.message === undefined ? WPInv_VAT_Vars.ErrInvalidResponse : json.message, 'error');
                })
                .fail(function(jqXHR, textStatus, errorThrown) {
                    me.removeAttr('disabled');
                    me.show();
                    $('.wpinv-vat-stat font').html(WPInv_VAT_Vars.VatNotValidated);
                    $('.wpinv-vat-stat').removeClass('wpinv-vat-stat-2').addClass('wpinv-vat-stat-0');
                    config.displayMessage(WPInv_VAT_Vars.ErrResetVAT + " (" + textStatus + " - " + errorThrown + ")", 'error');
                })
        },
        showGeoIP2Error: function(msg, el, reload) {
            el.removeAttr('disabled');
            jQuery('#wpi-downloading').hide();
            jQuery('#wpinv-geoip2-errors').html(msg).show();
            setTimeout(function() {
                if (reload) {
                    window.location.reload();
                } else {
                    jQuery('#wpinv-geoip2-errors').hide();
                }
            }, 10000);
        },
        showError: function(message) {
            WPInv_VAT_Config.enableButtons();
            var errorEl = jQuery('#wpinv-rates-error-wrap');
            errorEl.html(message);
            errorEl.css("display", "block");
            setTimeout(function() {
                errorEl.hide();
            }, 10000);
        },
        disableButtons: function() {
            $('#wpi_vat_get_rates').attr('disabled', 'disabled');
            $('#wpi_add_eu_states').attr('disabled', 'disabled');
            $('#wpi_remove_eu_states').attr('disabled', 'disabled');
            $('#wpi_vat_get_rates_group').attr('disabled', 'disabled');
        },
        enableButtons: function() {
            $('#wpi_vat_get_rates').removeAttr('disabled');
            $('#wpi_add_eu_states').removeAttr('disabled');
            $('#wpi_remove_eu_states').removeAttr('disabled');
            $('#wpi_vat_get_rates_group').removeAttr('disabled');
        },
        displayMessage: function(m, c) {
            var box = $('.wpi-vat-box.wpi-vat-box-' + c + ' #text');
            if (box) {
                box.html(m);
                box.parent().show().slideDown().css("display", "inline-block");
            }
        }
    };
    WPInv_VAT_Config.init();
});

function wpinv_recalculate_taxes(state) {
    if (!WPInv_VAT_Vars.UseTaxes) {
        return false;
    }
    var $address = jQuery('#wpi-billing');
    if (!state) {
        state = $address.find('#wpinv_state').val();
    }
    var postData = {
        action: 'wpinv_recalculate_tax',
        nonce: WPInv_VAT_Vars.checkoutNonce,
        country: $address.find('#wpinv_country').val(),
        state: state
    };
    wpinvBlock(jQuery('#wpinv_checkout_cart_wrap'));
    jQuery.ajax({
        type: "POST",
        data: postData,
        dataType: "json",
        url: ajaxurl,
        success: function(res) {
            jQuery('#wpinv_checkout_cart_wrap').unblock();
            if (res && typeof res == 'object') {
                var $wrap = jQuery('#wpinv_checkout_form_wrap');
                jQuery('#wpinv_checkout_cart_form').replaceWith(res.html);
                jQuery('.wpinv-chdeckout-total', $wrap).text(res.total);
                if (res.free) {
                    jQuery('#wpinv_payment_mode_select', $wrap).hide();
                    gw = 'manual';
                } else {
                    jQuery('#wpinv_payment_mode_select', $wrap).show();
                    gw = jQuery('#wpinv_payment_mode_select', $wrap).attr('data-gateway');
                }
                jQuery('.wpi-payment_methods .wpi-pmethod[value="' + gw + '"]', $wrap).attr('checked', true);
                var data = new Object();
                data.post = postData;
                data.response = res;
                data.recalculated = true;
                jQuery('body').trigger('wpinv_tax_recalculated', [data]);
            }
            setTimeout(function() {
                var texts = jQuery('.wpi-vat-box #text');
                texts.html('');
                var boxes = texts.parents(".wpi-vat-box")
                boxes.fadeOut('fast');
            }, 15000);
        }
    }).fail(function(jqXHR, textStatus, errorThrown) {
        jQuery('#wpinv_checkout_cart_wrap').unblock();
        console.log(errorThrown);
    });
}

function wpinv_is_eu_state(country) {
    return jQuery.inArray(country, WPInv_VAT_Vars.EUStates) !== -1 ? true : false;
}

function wpinv_is_base_country(country) {
    var baseCountry = WPInv_VAT_Vars.baseCountry;
    if (baseCountry === 'UK') {
        baseCountry = 'GB';
    }
    if (country == 'UK') {
        country = 'GB';
    }
    return (country && country === baseCountry) ? true : false;
}

/* <![CDATA[ */
var WPInv = {"ajax_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin-ajax.php","nonce":"0cfaa79bce","currency_symbol":"$","currency_pos":"left","thousand_sep":",","decimal_sep":".","decimals":"2"};
/* ]]> */

// make sure ajaxurl is defined
if (typeof ajaxurl === 'undefined' || ajaxurl === null) {
    // variable is undefined or null
    ajaxurl = WPInv.ajax_url;
}
window.wpiSubmit = typeof window.wpiSubmit !== 'undefined' ? window.wpiSubmit : true;
jQuery(function($) {
    var valid = false;
    $('#wpinv_checkout_form').on('submit', function(e) {
        var $form = $(this).closest('#wpinv_checkout_form');
        $('.wpinv_errors').remove();
        if (valid) {
            return true;
        }
        e.preventDefault();
        wpinvBlock($form);
        var data = $form.serialize();
        data = wpinvRemoveQueryVar(data, 'action');
        data = wpinvRemoveQueryVar(data, 'wpinv_ajax');
        $.post(ajaxurl, data + '&action=wpinv_checkout', function(res) {
            if (res && typeof res == 'object' && res.success) {
                valid = true;
                var data = new Object();
                data.form = $form;
                data.totals = res.data;
                jQuery('body').trigger('wpinv_checkout_submit', data);
                if (window.wpiSubmit) {
                    $form.submit();
                }
            } else {
                $form.unblock();
                if (res && res.search("wpinv_adddress_confirm") !== -1) {
                    $('#wpinv_adddress_confirm').show();
                }
                $('#wpinv_purchase_submit', $form).before(res);
            }
        });
        return false;
    });
    var elB = $('#wpinv-fields');
    $('#wpinv_country', elB).change(function(e) {
        $('.wpinv_errors').remove();
        wpinvBlock(jQuery('#wpinv_state_box'));
        var $this = $(this);
        data = {
            action: 'wpinv_get_states_field',
            country: $(this).val(),
            field_name: 'wpinv_state',
        };
        $.post(ajaxurl, data, function(response) {
            if ('nostates' === response) {
                var text_field = '<input type="text" required="required" class="wpi-input required" id="wpinv_state" name="wpinv_state">';
                $('#wpinv_state', elB).replaceWith(text_field);
            } else {
                $('#wpinv_state', elB).replaceWith(response);
                var changeState = function() {
                    console.log('69 : wpinv_recalculate_taxes(' + $(this).val() + ')');
                    wpinv_recalculate_taxes($(this).val());
                };
                $("#wpinv_state").unbind("change", changeState);
                $("#wpinv_state").bind("change", changeState);
            }
            $('#wpinv_state', elB).find('option[value=""]').remove();
            $('#wpinv_state', elB).addClass('form-control wpi-input required');
        }).done(function(data) {
            jQuery('#wpinv_state_box').unblock();
            console.log('78 : wpinv_recalculate_taxes()');
            wpinv_recalculate_taxes();
        });
        return false;
    });
    $('select#wpinv_state', elB).change(function(e) {
        $('.wpinv_errors').remove();
        console.log('86 : wpinv_recalculate_taxes()');
        wpinv_recalculate_taxes($(this).val());
    });
    var WPInv_Checkout = {
        checkout_form: $('form#wpinv_checkout_form'),
        init: function() {
            if (!$(this.checkout_form).length) {
                return;
            }
            // Payment methods
            this.checkout_form.on('click', 'input[name="wpi-gateway"]', this.payment_method_selected);
            this.init_payment_methods();
            //this.recalculate_taxes();
        },
        init_payment_methods: function() {
            var $checkout_form = this.checkout_form;
            var $payment_methods = $('.wpi-payment_methods input[name="wpi-gateway"]');
            // If there is one method, we can hide the radio input
            if (1 === $payment_methods.length) {
                $payment_methods.eq(0).hide();
            }
            // If there are none selected, select the first.
            if (0 === $payment_methods.filter(':checked').length) {
                $payment_methods.eq(0).prop('checked', true);
            }
            // Trigger click event for selected method
            $payment_methods.filter(':checked').eq(0).trigger('click');
            // Validate and apply a discount
            $checkout_form.on('click', '#wpi-apply-discount', this.applyDiscount);
            // Prevent the checkout form from submitting when hitting enter key in the discount field
            $checkout_form.on('keypress', '#wpinv_discount_code', function(event) {
                if (event.keyCode == '13') {
                    return false;
                }
            });
            // Apply the discount when hitting enter key in the discount field instead
            $checkout_form.on('keyup', '#wpinv_discount_code', function(event) {
                if (event.keyCode == '13') {
                    $('#wpi-apply-discount', $checkout_form).trigger('click');
                }
            });
            // Remove a discount
            $(document.body).on('click', '.wpi-discount-remove', this.removeDiscount);
        },
        payment_method_selected: function() {
            if ($('.wpi-payment_methods input.wpi-pmethod').length > 1) {
                var target_payment_box = $('div.payment_box.' + $(this).attr('ID'));
                if ($(this).is(':checked') && !target_payment_box.is(':visible')) {
                    $('div.payment_box').filter(':visible').slideUp(250);
                    if ($(this).is(':checked')) {
                        var content = $('div.payment_box.' + $(this).attr('ID')).html();
                        content = content ? content.trim() : '';
                        if (content) {
                            $('div.payment_box.' + $(this).attr('ID')).slideDown(250);
                        }
                    }
                }
            } else {
                $('div.payment_box').show();
            }
            $('#wpinv_payment_mode_select').attr('data-gateway', $(this).val());
            if ($(this).data('button-text')) {
                $('#wpinv-payment-button').val($(this).data('button-text'));
            } else {
                $('#wpinv-payment-button').val($('#wpinv-payment-button').data('value'));
            }
        },
        applyDiscount: function(e) {
            e.preventDefault();
            var $this = $(this),
                $box = $this.closest('.panel-body'),
                discount_code = $('#wpinv_discount_code', $box).val(),
                $msg = $('.wpinv-discount-msg', $box),
                $msgS = $('.alert-success', $msg),
                $msgF = $('.alert-error', $msg);
            if (discount_code == '') {
                $('#wpinv_discount_code', $box).focus();
                return false;
            }
            var data = {
                action: 'wpinv_apply_discount',
                code: discount_code,
                _nonce: WPInv.nonce
            };
            $('.wpinv_errors').remove();
            $msg.hide();
            $msgS.hide().find('.wpi-msg').html('');
            $msgF.hide().find('.wpi-msg').html('');
            wpinvBlock($box);
            $.ajax({
                type: "POST",
                data: data,
                dataType: "json",
                url: WPInv.ajax_url,
                xhrFields: {
                    withCredentials: true
                },
                success: function(res) {
                    wpinvUnblock($box);
                    var success = false;
                    if (res && typeof res == 'object') {
                        if (res.success) {
                            success = true;
                            jQuery('#wpinv_checkout_cart_form', $this.checkout_form).replaceWith(res.data.html);
                            jQuery('.wpinv-chdeckout-total').text(res.data.total);
                            $('#wpinv_discount_code', $box).val('');
                            //console.log('217 : wpinv_recalculate_taxes()');
                            //wpinv_recalculate_taxes();
                            if (res.data.free) {
                                $('#wpinv_payment_mode_select', $this.checkout_form).hide();
                                gw = 'manual';
                            } else {
                                $('#wpinv_payment_mode_select', $this.checkout_form).show();
                                gw = $('#wpinv_payment_mode_select', $this.checkout_form).attr('data-gateway');
                            }
                            $('.wpi-payment_methods .wpi-pmethod[value="' + gw + '"]', $this.checkout_form).prop('checked', true);
                            $(document.body).trigger('wpinv_discount_applied', [res]);
                        }
                        if (res.msg) {
                            $msg.show();
                            if (success) {
                                $msgS.show().find('.wpi-msg').html(res.msg);
                            } else {
                                $msgF.show().find('.wpi-msg').html(res.msg);
                            }
                        }
                    }
                }
            }).fail(function(res) {
                wpinvUnblock($box);
                if (window.console && window.console.log) {
                    console.log(res);
                }
            });
            return false;
        },
        removeDiscount: function(e) {
            e.preventDefault();
            var $this = $(this),
                $block = $this.closest('#wpinv_checkout_cart_wrap'),
                discount_code = $this.data('code');
            if (discount_code == '') {
                return false;
            }
            var data = {
                action: 'wpinv_remove_discount',
                code: discount_code,
                _nonce: WPInv.nonce
            };
            wpinvBlock($block);
            $.ajax({
                type: "POST",
                data: data,
                dataType: "json",
                url: WPInv.ajax_url,
                xhrFields: {
                    withCredentials: true
                },
                success: function(res) {
                    if (res && typeof res == 'object') {
                        if (res.success) {
                            jQuery('#wpinv_checkout_cart_form', $this.checkout_form).replaceWith(res.data.html);
                            jQuery('.wpinv-chdeckout-total').text(res.data.total);
                            if (res.data.free) {
                                $('#wpinv_payment_mode_select', $this.checkout_form).hide();
                                gw = 'manual';
                            } else {
                                $('#wpinv_payment_mode_select', $this.checkout_form).show();
                                gw = $('#wpinv_payment_mode_select', $this.checkout_form).attr('data-gateway');
                            }
                            $('input[name="wpi-gateway"][value="' + gw + '"]', $this.checkout_form).prop('checked', true);
                            //console.log('291 : wpinv_recalculate_taxes()');
                            //wpinv_recalculate_taxes();
                            $(document.body).trigger('wpinv_discount_removed', [res]);
                        }
                    }
                }
            }).fail(function(res) {
                wpinvUnblock($block);
                if (window.console && window.console.log) {
                    console.log(res);
                }
            });
            return false;
        },
        recalculate_taxes: function() {
            console.log('308 : wpinv_recalculate_taxes()');
            wpinv_recalculate_taxes();
        }
    }
    WPInv_Checkout.init();
});

function wpinvBlock(el, message) {
    message = typeof message != 'undefined' && message !== '' ? '&nbsp;' + message : '';
    el.block({
        message: '<i class="fa fa-refresh fa-spin"></i>' + message,
        overlayCSS: {
            background: '#fff',
            opacity: 0.6
        },
        ignoreIfBlocked: true
    });
}

function wpinvUnblock(el) {
    el.unblock();
}

function wpinvRemoveQueryVar(url, parameter) {
    //prefer to use l.search if you have a location/link object
    var urlparts = url.split('?');
    var urlparts2 = url.split('&');
    if (urlparts.length >= 2) {
        var prefix = encodeURIComponent(parameter) + '=';
        var pars = urlparts[1].split(/[&;]/g);
        //reverse iteration as may be destructive
        for (var i = pars.length; i-- > 0;) {
            //idiom for string.startsWith
            if (pars[i].lastIndexOf(prefix, 0) !== -1) {
                pars.splice(i, 1);
            }
        }
        url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : "");
        return url;
    } else if (urlparts2.length >= 2) {
        var prefix = encodeURIComponent(parameter) + '=';
        var pars = url.split(/[&;]/g);
        //reverse iteration as may be destructive
        for (var i = pars.length; i-- > 0;) {
            //idiom for string.startsWith
            if (pars[i].lastIndexOf(prefix, 0) !== -1) {
                pars.splice(i, 1);
            }
        }
        url = pars.join('&');
        return url;
    } else {
        return url;
    }
}

/**
 * Allow a invoice to be created for items via ajax.
 * @param items This is a comma separated and pipe separated for quantity eg:  item_id|quantity,item_id|quantity,item_id|quantity
 */
function wpi_buy(items,$post_id){
    var $nonce = jQuery('#wpinv_buy_nonce').val();
    jQuery.ajax({
        url : ajaxurl,
        type : 'post',
        data : {
            action : 'wpinv_buy_items',
            items : items,
            post_id : $post_id,
            wpinv_buy_nonce : $nonce
        },
        success : function( res ) {
            console.log(res);
            if (typeof res == 'object' && res) {
                if (res.success) {
                    window.location.href = res.success;
                    return;
                }
                if (res.error) {
                    alert(res.error);
                }
            }
        }
    });
}

jQuery(function($) {
        var gd_datepicker_loaded = $('body').hasClass('gd-multi-datepicker') ? true : false;
        if (!gd_datepicker_loaded) {
            $('body').addClass('gd-multi-datepicker');
        }
    });

function geodir_list_view_select(list) {
			//alert(listval);
			val = list.value;
			if (!val) {
				return;
			}

			var listSel = jQuery(list).parent().parent().next('.geodir_category_list_view');
			if (val != 1) {
				jQuery(listSel).children('li').addClass('geodir-gridview');
				jQuery(listSel).children('li').removeClass('geodir-listview');
			} else {
				jQuery(listSel).children('li').addClass('geodir-listview');
			}

			if (val == 1) {
				jQuery(listSel).children('li').removeClass('geodir-gridview gridview_onehalf gridview_onethird gridview_onefourth gridview_onefifth');
			}
			else if (val == 2) {
				jQuery(listSel).children('li').switchClass('gridview_onethird gridview_onefourth gridview_onefifth', 'gridview_onehalf', 600);
			}
			else if (val == 3) {
				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onefourth gridview_onefifth', 'gridview_onethird', 600);
			}
			else if (val == 4) {
				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefifth', 'gridview_onefourth', 600);
			}
			else if (val == 5) {
				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
			}

			jQuery.post("http://www.new-brennanhealingscience.org/directory/wp-admin/admin-ajax.php?action=geodir_ajax_action&gd_listing_view=" + val, function (data) {
				//alert(data );
			});
		}

jQuery(function ($) {
				if (typeof(animate_marker) == 'function') {
					var groupTab = $("ul.geodir_category_list_view").children("li");
					groupTab.hover(function () {
						animate_marker('listing_map_canvas', String($(this).data("post-id")));
					}, function () {
						stop_marker_animation('listing_map_canvas', String($(this).data("post-id")));
					});
				} else {
					window.animate_marker = function () {
					};
					window.stop_marker_animation = function () {
					};
				}
			});

jQuery(document).ready(function () {
                build_map_ajax_search_param('gd_listing_map', false);
                map_sticky('gd_listing_map');
            });

(function () {
                    var screenH = jQuery(window).height();
                    var heightVH = "370";
                    var ptypeH = '';
                    if (jQuery("#gd_listing_map_posttype_menu").length) {
                        ptypeH = jQuery("#gd_listing_map_posttype_menu").outerHeight();
                    }

                    jQuery("#gd_listing_map_cat").css("max-height", heightVH - ptypeH + 'px');

                }());

var geodir_advanced_search_js_msg = {"geodir_advanced_search_plugin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodir_advance_search_filters","geodir_plugin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodirectory","geodir_admin_ajax_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin-ajax.php","request_param":"{\"geo_url\":\"is_search\",\"geo_request_uri\":\"geodir_search=1&stype=gd_practitioner&s=+&snear=&set_location_type=2&set_location_val=2&sgeo_lat=&sgeo_lon=\"}","msg_Near":"Near:","default_Near":"Near","msg_Me":"Me","unom_dist":"miles","autocomplete_field_name":"s","geodir_enable_autocompleter_near":"1","geodir_enable_autocompleter":"1","geodir_autocompleter_autosubmit_near":"0","geodir_autocompleter_autosubmit":"1","geodir_location_manager_active":"1","msg_User_defined":"User defined","ask_for_share_location":"","geodir_autolocate_ask":"","geodir_autolocate_ask_msg":"Do you wish to be geolocated to listings near you?","UNKNOWN_ERROR":"Unable to find your location.","PERMISSION_DENINED":"Permission denied in finding your location.","POSITION_UNAVAILABLE":"Your location is currently unknown.","BREAK":"Attempt to find location took too long.","GEOLOCATION_NOT_SUPPORTED":"Geolocation is not supported by this browser.","DEFAUTL_ERROR":"Browser unable to find your location.","text_more":"More","text_less":"Less","msg_In":"In:","txt_in_country":"(Country)","txt_in_region":"(Region)","txt_in_city":"(City)","txt_in_hood":"(Neighbourhood)","compass_active_color":"#087CC9","onload_redirect":"no","onload_askRedirect":"","onload_redirectLocation":"","search_new_style":"1"};

map_id_arr = [];
gdUmarker = '';
my_location = '';
lat = '';
lon = '';
gdUmarker = '';
userMarkerActive = false;
gdLocationOptions = {
  enableHighAccuracy: true,
  timeout: 5000,
  maximumAge: 0
};

jQuery(document).ready(function(){
	geodir_insert_compass();
	gdSetupUserLoc();
});
jQuery(window).load(function() {
	geodir_reposition_compass();// set compass position after images loaded so not to change position
	});
jQuery("body").on("map_show", function(event, map_id) {
    map_id_arr.push(map_id);
    if (lat && lon) {
        setTimeout(function(map_id) {
            setusermarker(lat, lon, map_id); //createUserMarker(lat,lon,true);//set marker on map<br />
        }, 1, map_id);
    }
});

var geodir_custom_post_type_all_js_msg = {"geodir_cp_post_type_char_validation":"Post Type can not be more than 17 characters.","geodir_cp_post_type_illegal_characters_validation":"Post Type contains illegal characters.","geodir_cp_post_type_blank_validation":"Post Type must not be blank.","geodir_cp_listing_slug_illegal_characters_validation":"Listing Slug contains illegal characters.","geodir_cp_listing_slug_blank_validation":"Listing Slug must not be blank.","geodir_cp_listing_order_value_validation":"Enter valid order value."};

var geodir_location_all_js_msg = {"geodir_location_admin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin.php","geodir_location_plugin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodir_location_manager","geodir_location_admin_ajax_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin-ajax.php","select_merge_city_msg":"Please select merge city.","set_location_default_city_confirmation":"Are sure you want to make this city default?","LISTING_URL_PREFIX":"Please enter listing url prefix","LISTING_URL_PREFIX_INVALID_CHAR":"Invalid character in listing url prefix","LOCATION_URL_PREFIX":"Please enter location url prefix","LOCATOIN_PREFIX_INVALID_CHAR":"Invalid character in location url prefix","LOCATION_CAT_URL_SEP":"Please enter location and category url separator","LOCATION_CAT_URL_SEP_INVALID_CHAR":"Invalid character in location and category url separator","LISTING_DETAIL_URL_SEP":"Please enter listing detail url separator","LISTING_DETAIL_URL_SEP_INVALID_CHAR":"Invalid character in listing detail url separator","LOCATION_PLEASE_WAIT":"Please wait...","LOCATION_CHOSEN_NO_RESULT_TEXT":"Sorry, nothing found!","LOCATION_CHOSEN_KEEP_TYPE_TEXT":"Please wait...","LOCATION_CHOSEN_LOOKING_FOR_TEXT":"We are searching for","select_location_translate_msg":"Please select country to update translation.","select_location_translate_confirm_msg":"Are you sure?","gd_text_search_city":"Search City","gd_text_search_region":"Search Region","gd_text_search_country":"Search Country","gd_text_search_location":"Search location","gd_base_location":"http:\/\/www.new-brennanhealingscience.org\/directory\/location\/","UNKNOWN_ERROR":"Unable to find your location.","PERMISSION_DENINED":"Permission denied in finding your location.","POSITION_UNAVAILABLE":"Your location is currently unknown.","BREAK":"Attempt to find location took too long.","DEFAUTL_ERROR":"Browser unable to find your location.","msg_Near":"Near:","msg_Me":"Me","msg_User_defined":"User defined","delete_location_msg":"Deleting location will also DELETE any LISTINGS in this location. Are you sure want to DELETE this location?","delete_bulk_location_select_msg":"Please select at least one location."};

var geodir_all_js_msg = {"geodir_plugin_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodirectory","geodir_admin_ajax_url":"http:\/\/www.new-brennanhealingscience.org\/directory\/wp-admin\/admin-ajax.php","custom_field_not_blank_var":"HTML Variable Name must not be blank","custom_field_not_special_char":"Please do not use special character and spaces in HTML Variable Name.","custom_field_unique_name":"HTML Variable Name should be a unique name.","custom_field_delete":"Are you wish to delete this field?","tax_meta_class_succ_del_msg":"File has been successfully deleted.","tax_meta_class_not_permission_to_del_msg":"You do NOT have permission to delete this file.","tax_meta_class_order_save_msg":"Order saved!","tax_meta_class_not_permission_record_img_msg":"You do not have permission to reorder images.","address_not_found_on_map_msg":"Address not found for:","my_place_listing_del":"Are you sure you wish to delete this listing?","my_main_listing_del":"Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?","rating_error_msg":"Error : please retry","listing_url_prefix_msg":"Please enter listing url prefix","invalid_listing_prefix_msg":"Invalid character in listing url prefix","location_url_prefix_msg":"Please enter location url prefix","invalid_location_prefix_msg":"Invalid character in location url prefix","location_and_cat_url_separator_msg":"Please enter location and category url separator","invalid_char_and_cat_url_separator_msg":"Invalid character in location and category url separator","listing_det_url_separator_msg":"Please enter listing detail url separator","invalid_char_listing_det_url_separator_msg":"Invalid character in listing detail url separator","loading_listing_error_favorite":"Error loading listing.","geodir_field_id_required":"This field is required.","geodir_valid_email_address_msg":"Please enter valid email address.","geodir_default_marker_icon":"https:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodirectory\/geodirectory-functions\/map-functions\/icons\/pin.png","geodir_default_marker_w":"20","geodir_default_marker_h":"34","geodir_latitude_error_msg":"A numeric value is required. Please make sure you have either dragged the marker or clicked the button: Set Address On Map","geodir_longgitude_error_msg":"A numeric value is required. Please make sure you have either dragged the marker or clicked the button: Set Address On Map","geodir_default_rating_star_icon":"https:\/\/www.new-brennanhealingscience.org\/directory\/wp-content\/plugins\/geodirectory\/geodirectory-assets\/images\/stars.png","gd_cmt_btn_post_reply":"Post Reply","gd_cmt_btn_reply_text":"Reply text","gd_cmt_btn_post_review":"Post Review","gd_cmt_btn_review_text":"Review text","gd_cmt_err_no_rating":"Please select star rating, you can't leave a review without stars.","geodir_onoff_dragging":"","geodir_is_mobile":"","geodir_on_dragging_text":"Enable Dragging","geodir_off_dragging_text":"Disable Dragging","geodir_err_max_file_size":"File size error : You tried to upload a file over %s","geodir_err_file_upload_limit":"You have reached your upload limit of %s files.","geodir_err_pkg_upload_limit":"You may only upload %s files with this package, please try again.","geodir_action_remove":"Remove","geodir_txt_all_files":"Allowed files","geodir_err_file_type":"File type error. Allowed file types: %s","gd_allowed_img_types":"jpg,jpeg,jpe,gif,png","geodir_txt_form_wait":"Wait...","geodir_txt_form_searching":"Searching...","fa_rating":"1","reviewrating":"","multirating":"","geodir_map_name":"auto","osmStart":"Start","osmVia":"Via {viaNumber}","osmEnd":"Enter Your Location","ga_delete_check":"Do you wish to Deauthorize and break Analytics?","geoMyLocation":"My Location","geoErrUNKNOWN_ERROR":"Unable to find your location","geoErrPERMISSION_DENINED":"Permission denied in finding your location","geoErrPOSITION_UNAVAILABLE":"Your location is currently unknown","geoErrBREAK":"Attempt to find location took too long","geoErrDEFAULT":"Location detection not supported in browser"};

var default_location = 'New York';
        var latlng;
        var address;
        var dist = 0;
        var Sgeocoder = (typeof google!=='undefined' && typeof google.maps!=='undefined') ? new google.maps.Geocoder() : {};

		function geodir_setup_submit_search() {
            jQuery('.geodir_submit_search').unbind('click');// unbind any other click events
			jQuery('.geodir_submit_search').click(function(e) {

                e.preventDefault();

				var s = ' ';
				var $form = jQuery(this).closest('form');

				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == 'Search for') jQuery('.search_text', $form).val(s);
				
				// Disable location based search for disabled location post type.
				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
					if (gd_cpt_no_location(jQuery('.search_by_post', $form).val())) {
						jQuery('.snear', $form).remove();
						jQuery('.sgeo_lat', $form).remove();
						jQuery('.sgeo_lon', $form).remove();
						jQuery('select[name="sort_by"]', $form).remove();
						jQuery($form).submit();
						return;
					}
				}
				
				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != 'Near')) {
					geodir_setsearch($form);
				} else {
					jQuery(".snear", $form).val('');
					jQuery($form).submit();
				}
			});
		}

        jQuery(document).ready(function() {
            geodir_setup_submit_search();
            //setup advanced search form on form ajax load
            jQuery("body").on("geodir_setup_search_form", function(){
                geodir_setup_submit_search();
            });
        });
        
		function geodir_setsearch($form) {
			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == 'Near')) jQuery(".snear", $form).val(default_location);
			geocodeAddress($form);
		}

        function updateSearchPosition(latLng, $form) {
            if (window.gdMaps === 'google') {
                jQuery('.sgeo_lat').val(latLng.lat());
                jQuery('.sgeo_lon').val(latLng.lng());
            } else if (window.gdMaps === 'osm') {
                jQuery('.sgeo_lat').val(latLng.lat);
                jQuery('.sgeo_lon').val(latLng.lon);
            }
            jQuery($form).submit(); // submit form after insering the lat long positions
        }

        function geocodeAddress($form) {
            // Call the geocode function
            Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;

            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^In:")) {
                if (jQuery('.snear', $form).val().match("^In:")) {
                    jQuery(".snear", $form).val('');
                }
                jQuery($form).submit();
            } else {
                var address = jQuery(".snear", $form).val();

                if (jQuery('.snear', $form).val() == 'Near') {
                    initialise2();
                } else {
                                        if (window.gdMaps === 'google') {
                        Sgeocoder.geocode({'address': address},
                            function (results, status) {
                                if (status == google.maps.GeocoderStatus.OK) {
                                    updateSearchPosition(results[0].geometry.location, $form);
                                } else {
                                    alert("Search was not successful for the following reason :" + status);
                                }
                            });
                    } else if (window.gdMaps === 'osm') {
                        geocodePositionOSM(false, address, false, false, 
                            function(geo) {
                                if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
                                    updateSearchPosition(geo, $form);
                                } else {
                                    alert("Search was not successful for the requested address.");
                                }
                            });
                    } else {
                        jQuery($form).submit();
                    }
                }
            }
        }

        function initialise2() {
            if (!window.gdMaps) {
                return;
            }
            
            if (window.gdMaps === 'google') {
                var latlng = new google.maps.LatLng(56.494343, -4.205446);
                var myOptions = {
                    zoom: 4,
                    mapTypeId: google.maps.MapTypeId.TERRAIN,
                    disableDefaultUI: true
                }
            } else if (window.gdMaps === 'osm') {
                var latlng = new L.LatLng(56.494343, -4.205446);
                var myOptions = {
                    zoom: 4,
                    mapTypeId: 'TERRAIN',
                    disableDefaultUI: true
                }
            }
            try { prepareGeolocation(); } catch (e) {}
            doGeolocation();
        }

        function doGeolocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(positionSuccess, positionError);
            } else {
                positionError(-1);
            }
        }

        function positionError(err) {
            var msg;
            switch (err.code) {
                case err.UNKNOWN_ERROR:
                    msg = "Unable to find your location";
                    break;
                case err.PERMISSION_DENINED:
                    msg = "Permission denied in finding your location";
                    break;
                case err.POSITION_UNAVAILABLE:
                    msg = "Your location is currently unknown";
                    break;
                case err.BREAK:
                    msg = "Attempt to find location took too long";
                    break;
                default:
                    msg = "Location detection not supported in browser";
            }
            jQuery('#info').html(msg);
        }

        function positionSuccess(position) {
            var coords = position.coords || position.coordinate || position;
            jQuery('.sgeo_lat').val(coords.latitude);
            jQuery('.sgeo_lon').val(coords.longitude);

            jQuery('.geodir-listing-search').submit();
        }

        /**
         * On unload page do some cleaning so back button cache does not store these values.
         */
        window.onunload = function(){
            if(jQuery('.sgeo_lat').length ){
                jQuery('.sgeo_lat').val('');
                jQuery('.sgeo_lon').val('');
            }
        };

jQuery( document ).ready(function() {
            var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
            var is_safari = navigator.userAgent.indexOf("Safari") > -1 && !is_chrome;
            if (is_safari) {
                window.onpageshow = function(event) {
                    if (event.persisted) {
                        jQuery(window).trigger('resize');
                    }
                };
            }
        });

jQuery(document).ready(function () {
            jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) {
                var widgetBox = jQuery(this).closest('.geodir_bestof_widget');
                var loading = jQuery(widgetBox).find("#geodir-bestof-loading");
                var container = jQuery(widgetBox).find('#geodir-bestof-places');

                jQuery(document).ajaxStart(function () {
                    //container.hide(); // Not working when more then one widget on page
                    //loading.show();
                }).ajaxStop(function () {
                    loading.hide();
                    container.fadeIn('slow');
                });

                e.preventDefault();

                var activeTab = jQuery(this).closest('dl').find('dd.geodir-tab-active');
                activeTab.removeClass('geodir-tab-active');
                jQuery(this).parent().addClass('geodir-tab-active');

                var term_id = 0;
                if (e.type === "change") {
                    term_id = jQuery(this).val();
                } else if (e.type === "click") {
                    term_id = jQuery(this).attr('data-termid');
                }

                var post_type = jQuery(widgetBox).find('#bestof_widget_post_type').val();
                var excerpt_type = jQuery(widgetBox).find('#bestof_widget_excerpt_type').val();
                var post_limit = jQuery(widgetBox).find('#bestof_widget_post_limit').val();
                var taxonomy = jQuery(widgetBox).find('#bestof_widget_taxonomy').val();
                var char_count = jQuery(widgetBox).find('#bestof_widget_char_count').val();
                var add_location_filter = jQuery(widgetBox).find('#bestof_widget_location_filter').val();

                var data = {
                    'action': 'geodir_bestof',
                    'geodir_bestof_nonce': 'ef9ceda4a1',
                    'post_type': post_type,
                    'excerpt_type': excerpt_type,
                    'post_limit': post_limit,
                    'taxonomy': taxonomy,
                    'geodir_ajax': true,
                    'term_id': term_id,
                    'char_count': char_count,
                    'add_location_filter': add_location_filter
                };

                container.hide();
                loading.show();

                jQuery.post(geodir_var.geodir_ajax_url, data, function (response) {
                    container.html(response);
                    jQuery(widgetBox).find('.geodir_category_list_view li .geodir-post-img .geodir_thumbnail img').css('display', 'block');

                    // start lazy load if it's turned on
                    if(geodir_var.geodir_lazy_load==1){
                        geodir_init_lazy_load();
                    }

                });
            })
        });
        jQuery(document).ready(function () {
            if (jQuery(window).width() < 660) {
                if (jQuery('.bestof-widget-tab-layout').hasClass('bestof-tabs-on-left')) {
                    jQuery('.bestof-widget-tab-layout').removeClass('bestof-tabs-on-left').addClass('bestof-tabs-as-dropdown');
                } else if (jQuery('.bestof-widget-tab-layout').hasClass('bestof-tabs-on-top')) {
                    jQuery('.bestof-widget-tab-layout').removeClass('bestof-tabs-on-top').addClass('bestof-tabs-as-dropdown');
                }
            }
        });

"undefined"!=typeof jQuery?("undefined"==typeof jQuery.fn.hoverIntent&&!function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:6,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.sqrt((h-f)*(h-f)+(i-g)*(i-g))<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=!0,e.over.apply(c,[b])):(h=f,i=g,void(c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval)))},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=!1,e.out.apply(b,[a])},m=function(b){var c=a.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"===b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),d.hoverIntent_s||(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery),jQuery(document).ready(function(a){var b,c,d,e=a("#wpadminbar"),f=!1;b=function(b,c){var d=a(c),e=d.attr("tabindex");e&&d.attr("tabindex","0").attr("tabindex",e)},c=function(b){e.find("li.menupop").on("click.wp-mobile-hover",function(c){var d=a(this);d.parent().is("#wp-admin-bar-root-default")&&!d.hasClass("hover")?(c.preventDefault(),e.find("li.menupop.hover").removeClass("hover"),d.addClass("hover")):d.hasClass("hover")?a(c.target).closest("div").hasClass("ab-sub-wrapper")||(c.stopPropagation(),c.preventDefault(),d.removeClass("hover")):(c.stopPropagation(),c.preventDefault(),d.addClass("hover")),b&&(a("li.menupop").off("click.wp-mobile-hover"),f=!1)})},d=function(){var b=/Mobile\/.+Safari/.test(navigator.userAgent)?"touchstart":"click";a(document.body).on(b+".wp-mobile-hover",function(b){a(b.target).closest("#wpadminbar").length||e.find("li.menupop.hover").removeClass("hover")})},e.removeClass("nojq").removeClass("nojs"),"ontouchstart"in window?(e.on("touchstart",function(){c(!0),f=!0}),d()):/IEMobile\/[1-9]/.test(navigator.userAgent)&&(c(),d()),e.find("li.menupop").hoverIntent({over:function(){f||a(this).addClass("hover")},out:function(){f||a(this).removeClass("hover")},timeout:180,sensitivity:7,interval:100}),window.location.hash&&window.scrollBy(0,-32),a("#wp-admin-bar-get-shortlink").click(function(b){b.preventDefault(),a(this).addClass("selected").children(".shortlink-input").blur(function(){a(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()}),a("#wpadminbar li.menupop > .ab-item").bind("keydown.adminbar",function(c){if(13==c.which){var d=a(c.target),e=d.closest(".ab-sub-wrapper"),f=d.parent().hasClass("hover");c.stopPropagation(),c.preventDefault(),e.length||(e=a("#wpadminbar .quicklinks")),e.find(".menupop").removeClass("hover"),f||d.parent().toggleClass("hover"),d.siblings(".ab-sub-wrapper").find(".ab-item").each(b)}}).each(b),a("#wpadminbar .ab-item").bind("keydown.adminbar",function(c){if(27==c.which){var d=a(c.target);c.stopPropagation(),c.preventDefault(),d.closest(".hover").removeClass("hover").children(".ab-item").focus(),d.siblings(".ab-sub-wrapper").find(".ab-item").each(b)}}),e.click(function(b){"wpadminbar"!=b.target.id&&"wp-admin-bar-top-secondary"!=b.target.id||(e.find("li.menupop.hover").removeClass("hover"),a("html, body").animate({scrollTop:0},"fast"),b.preventDefault())}),a(".screen-reader-shortcut").keydown(function(b){var c,d;13==b.which&&(c=a(this).attr("href"),d=navigator.userAgent.toLowerCase(),d.indexOf("applewebkit")!=-1&&c&&"#"==c.charAt(0)&&setTimeout(function(){a(c).focus()},100))}),a("#adminbar-search").on({focus:function(){a("#adminbarsearch").addClass("adminbar-focused")},blur:function(){a("#adminbarsearch").removeClass("adminbar-focused")}}),"sessionStorage"in window&&a("#wp-admin-bar-logout a").click(function(){try{for(var a in sessionStorage)a.indexOf("wp-autosave-")!=-1&&sessionStorage.removeItem(a)}catch(b){}}),navigator.userAgent&&document.body.className.indexOf("no-font-face")===-1&&/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test(navigator.userAgent)&&(document.body.className+=" no-font-face")})):!function(a,b){var c,d=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,function(){return c.call(a,window.event)})},e=new RegExp("\\bhover\\b","g"),f=[],g=new RegExp("\\bselected\\b","g"),h=function(a){for(var b=f.length;b--;)if(f[b]&&a==f[b][1])return f[b][0];return!1},i=function(b){for(var d,i,j,k,l,m,n=[],o=0;b&&b!=c&&b!=a;)"LI"==b.nodeName.toUpperCase()&&(n[n.length]=b,i=h(b),i&&clearTimeout(i),b.className=b.className?b.className.replace(e,"")+" hover":"hover",k=b),b=b.parentNode;if(k&&k.parentNode&&(l=k.parentNode,l&&"UL"==l.nodeName.toUpperCase()))for(d=l.childNodes.length;d--;)m=l.childNodes[d],m!=k&&(m.className=m.className?m.className.replace(g,""):"");for(d=f.length;d--;){for(j=!1,o=n.length;o--;)n[o]==f[d][1]&&(j=!0);j||(f[d][1].className=f[d][1].className?f[d][1].className.replace(e,""):"")}},j=function(b){for(;b&&b!=c&&b!=a;)"LI"==b.nodeName.toUpperCase()&&!function(a){var b=setTimeout(function(){a.className=a.className?a.className.replace(e,""):""},500);f[f.length]=[b,a]}(b),b=b.parentNode},k=function(b){for(var d,e,f,h=b.target||b.srcElement;;){if(!h||h==a||h==c)return;if(h.id&&"wp-admin-bar-get-shortlink"==h.id)break;h=h.parentNode}for(b.preventDefault&&b.preventDefault(),b.returnValue=!1,-1==h.className.indexOf("selected")&&(h.className+=" selected"),d=0,e=h.childNodes.length;d<e;d++)if(f=h.childNodes[d],f.className&&-1!=f.className.indexOf("shortlink-input")){f.focus(),f.select(),f.onblur=function(){h.className=h.className?h.className.replace(g,""):""};break}return!1},l=function(a){var b,c,d,e,f,g;if(!("wpadminbar"!=a.id&&"wp-admin-bar-top-secondary"!=a.id||(b=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,b<1)))for(g=b>800?130:100,c=Math.min(12,Math.round(b/g)),d=b>800?Math.round(b/30):Math.round(b/20),e=[],f=0;b;)b-=d,b<0&&(b=0),e.push(b),setTimeout(function(){window.scrollTo(0,e.shift())},f*c),f++};d(b,"load",function(){c=a.getElementById("wpadminbar"),a.body&&c&&(a.body.appendChild(c),c.className&&(c.className=c.className.replace(/nojs/,"")),d(c,"mouseover",function(a){i(a.target||a.srcElement)}),d(c,"mouseout",function(a){j(a.target||a.srcElement)}),d(c,"click",k),d(c,"click",function(a){l(a.target||a.srcElement)}),d(document.getElementById("wp-admin-bar-logout"),"click",function(){if("sessionStorage"in window)try{for(var a in sessionStorage)a.indexOf("wp-autosave-")!=-1&&sessionStorage.removeItem(a)}catch(b){}})),b.location.hash&&b.scrollBy(0,-32),navigator.userAgent&&document.body.className.indexOf("no-font-face")===-1&&/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test(navigator.userAgent)&&(document.body.className+=" no-font-face")})}(document,window);

jQuery(document).ready(function(){setTimeout(function(){var keyup_timer;var gdlm_msgWait=geodir_location_all_js_msg.LOCATION_PLEASE_WAIT;var gdlm_ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;jQuery('input[name="loc_pick_country_filter"]').keyup(function(){var $obj=jQuery(this);jQuery(this).parent().find("ul").html(gdlm_msgWait);clearInterval(keyup_timer);total=parseInt(jQuery(this).parent().data("limit"));if(isNaN(total)||!total>0){total=0}keyup_timer=setTimeout(function(){jQuery.post(gdlm_ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:"country",gd_country_val:$obj.val(),lscroll:total},function(data){$obj.parent().find("ul").html(data)})},500)});jQuery('input[name="loc_pick_region_filter"]').keyup(function(){var country_val=jQuery(this).parent().parent().find('input[name="loc_pick_country_filter"]').val();jQuery(this).parent().find("ul").html(gdlm_msgWait);var $obj=jQuery(this);total=parseInt(jQuery(this).parent().data("limit"));if(isNaN(total)||!total>0){total=0}clearInterval(keyup_timer);keyup_timer=setTimeout(function(){jQuery.post(gdlm_ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:"region",gd_country_val:country_val,gd_region_val:$obj.val(),lscroll:total},function(data){$obj.parent().find("ul").html(data)})},500)});jQuery('input[name="loc_pick_city_filter"]').keyup(function(){jQuery(this).parent().find("ul").html(gdlm_msgWait);var country_val=jQuery(this).parent().parent().find('input[name="loc_pick_country_filter"]').val();var region_val=jQuery(this).parent().parent().find('input[name="loc_pick_region_filter"]').val();var $obj=jQuery(this);total=parseInt(jQuery(this).parent().data("limit"));if(isNaN(total)||!total>0){total=0}clearInterval(keyup_timer);keyup_timer=setTimeout(function(){jQuery.post(gdlm_ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:"city",gd_country_val:country_val,gd_region_val:region_val,gd_city_val:$obj.val(),lscroll:total},function(data){$obj.parent().find("ul").html(data)})},500)});jQuery(".geodir-locListing_column ul").on("click",".geodir_loc_arrow a",function(){var which_location="",country_val="",region_val="",city_val="";var $mainDiv=jQuery(this).parents(".geodir_locListing_main");var $curDiv=jQuery(this).parents(".geodir-locListing_column");var $nextDiv=jQuery($curDiv,$mainDiv).next();var $curUl=jQuery(this).parents("ul");var $curLi=jQuery(this).parents("li");var sVal=jQuery("a",$curLi).text().trim();jQuery("li",$curUl).removeClass("geodir_active");$curLi.addClass("geodir_active");jQuery('input[name^="loc_pick_"]',$curDiv).val(sVal);jQuery('input[name^="loc_pick_"]',$nextDiv).val("");if($curUl.hasClass("geodir_country_column")){which_location="region";country_val=sVal}else if($curUl.hasClass("geodir_city_column")){which_location="neighbourhood";city_val=sVal}else{which_location="city";region_val=sVal}var ul_item=jQuery("ul",$nextDiv).html(gdlm_msgWait);total=parseInt($nextDiv.data("limit"));if(isNaN(total)||!total>0){total=0}jQuery.post(gdlm_ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:which_location,gd_country_val:country_val,gd_region_val:region_val,gd_city_val:city_val,lscroll:total},function(data){jQuery("ul",$nextDiv).html(data)})});jQuery(".geodir_location_tab_container .geodir_location_tabs").bind("click",function(){var tab=this;var tab_id=jQuery(this).data("location");var autoredirect=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("autoredirect");var show_every_where=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("showeverywhere");jQuery.post(gdlm_ajax_url+"?action=geodir_location_ajax&gd_loc_ajax_action=fill_location&autoredirect="+autoredirect+"&gd_which_location="+tab_id+"&show_every_where="+show_every_where,function(data){jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").html(data).chosen().trigger("chosen:updated");geodir_enable_click_on_chosen_list_item()});jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_tabs").removeClass("gd-tab-active");jQuery(tab).addClass("gd-tab-active");if(!geodir_lm_chosen_supported()){geodir_no_chosen_add_search(jQuery(tab).parents(".geodir_location_tab_container"))}geodir_location_switcher_chosen_ajax()});if(!geodir_lm_chosen_supported()){jQuery("body").removeClass("gd-chosen-no-support").addClass("gd-chosen-no-support");jQuery(".geodir_location_tab_container").each(function(){var $this=this;geodir_no_chosen_add_search($this)})}else{if(jQuery("select.geodir_location_switcher_chosen").length>0){jQuery("select.geodir_location_switcher_chosen").chosen({no_results_text:geodir_location_all_js_msg.LOCATION_CHOSEN_NO_RESULT_TEXT})}if(jQuery("select.geodir_location_add_listing_chosen").length>0){jQuery("select.geodir_location_add_listing_chosen").chosen({no_results_text:geodir_location_all_js_msg.LOCATION_CHOSEN_NO_RESULT_TEXT})}geodir_location_switcher_chosen_ajax()}geodir_enable_click_on_chosen_list_item();if(!geodir_lm_chosen_supported()){jQuery(document).click(function(e){var isSwitcher=jQuery(e.target).closest(".geodir_location_sugestion").html();if(typeof isSwitcher=="undefined"){jQuery(document).find(".geodir_location_sugestion").each(function(){jQuery(this).find('select[name="gd_location"]').removeAttr("size");jQuery(this).find('select[name="gd_location"]').removeClass("geodir-loc-select-list")})}});jQuery(document).find('.geodir_location_sugestion select[name="gd_location"] option').click(function(){if(jQuery(this).attr("selected")=="selected"||jQuery(this).attr("value")==geodir_location_all_js_msg.gd_base_location){jQuery(this).closest("select").removeAttr("size");jQuery(this).closest("select").removeClass("geodir-loc-select-list")}})}jQuery('input[name="loc_pick_neighbourhood_filter"]').keyup(function(){var $this=jQuery(this);var hoodDiv=$this.closest(".geodir-locListing_column");var mainDiv=jQuery(hoodDiv).parent();var country_val=jQuery('input[name="loc_pick_country_filter"]',mainDiv).val();var region_val=jQuery('input[name="loc_pick_region_filter"]',mainDiv).val();var city_val=jQuery('input[name="loc_pick_city_filter"]',mainDiv).val();total=parseInt(hoodDiv.data("limit"));if(isNaN(total)||!total>0){total=0}jQuery("ul",hoodDiv).html(gdlm_msgWait);clearInterval(keyup_timer);keyup_timer=setTimeout(function(){jQuery.post(gdlm_ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:"neighbourhood",gd_country_val:country_val,gd_region_val:region_val,gd_city_val:city_val,gd_neighbourhood_val:$this.val(),lscroll:total},function(data){jQuery("ul",hoodDiv).html(data)})},500)});jQuery(".gd-loc-loadmore button").on("click",function(e){var $this=jQuery(this);if($this.data("title")){$this.find("font").text($this.data("title"))}$this.find(".fa").addClass("fa-spin");var $obj=$this.closest(".geodir-locListing_column"),$mainObj=$obj.closest(".geodir_locListing_main");var type=$obj.data("type"),total=parseInt($obj.data("limit")),pages=parseInt($this.data("pages")),next=parseInt($this.data("next"));if(isNaN(pages)||!pages>0){pages=1}if(isNaN(next)){next=1}if(isNaN(total)||!total>0){total=0}if(!type){return false}var data={action:"geodir_location_ajax",gd_loc_ajax_action:"get_location",gd_formated_for:"location_switcher",gd_which_location:type,_task:"loadmore",_pages:pages,lscroll:total,spage:next};data.gd_country_val=jQuery('input[name="loc_pick_country_filter"]',$mainObj).val();if(type=="region"||type=="city"||type=="neighbourhood"){data.gd_region_val=jQuery('input[name="loc_pick_region_filter"]',$mainObj).val();if(type=="city"||type=="neighbourhood"){data.gd_city_val=jQuery('input[name="loc_pick_city_filter"]',$mainObj).val();if(type=="neighbourhood"){data.gd_neighbourhood_val=jQuery('input[name="loc_pick_neighbourhood_filter"]',$mainObj).val()}}}jQuery.post(gdlm_ajax_url,data,function(response){$obj.find("li.gd-loc-loadmore").remove();if(response&&jQuery.trim(response)!=""){$obj.find("ul").append(response)}})})},100)});function geodir_location_switcher_chosen_ajax(){jQuery("select.geodir_location_switcher_chosen").each(function(){var curr_chosen=jQuery(this);var autoredirect=curr_chosen.data("autoredirect");var countrysearch=curr_chosen.data("countrysearch");var ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;if(curr_chosen.data("ajaxchosen")=="1"||curr_chosen.data("ajaxchosen")===undefined){var listfor=curr_chosen.parents(".geodir_location_tab_container").find(".gd-tab-active").data("location");var show_every_where=curr_chosen.data("showeverywhere");curr_chosen.ajaxChosen({keepTypingMsg:geodir_location_all_js_msg.LOCATION_CHOSEN_KEEP_TYPE_TEXT,lookingForMsg:geodir_location_all_js_msg.LOCATION_CHOSEN_LOOKING_FOR_TEXT,type:"GET",url:ajax_url+"?action=geodir_location_ajax&gd_loc_ajax_action=fill_location&autoredirect="+autoredirect+"&gd_which_location="+listfor+"&show_every_where="+show_every_where,dataType:"html",success:function(data){curr_chosen.html(data).chosen().trigger("chosen:updated");geodir_enable_click_on_chosen_list_item()}},null,{})}})}jQuery(document).ready(function(){geodir_location_add_listing_chosen();jQuery("select.geodir_location_add_listing_chosen").bind("change",function(){var curr_chosen=jQuery(this);var location_type=curr_chosen.data("location_type");var ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;var $loader='<div class="location_dl_loader" align="center" style="width:100%;"><img src="'+geodir_all_js_msg.geodir_plugin_url+'/geodirectory-assets/images/loadingAnimation.gif"  /></div>';var gd_loc_chosen=curr_chosen.parents(".geodir_location_add_listing_all_chosen_container");var gd_country_el=gd_loc_chosen.find(".geodir_location_add_listing_country_chosen_div").find('input[name="geodir_location_add_listing_country_val"]');var gd_region_div=gd_loc_chosen.find(".geodir_location_add_listing_region_chosen_div");var gd_city_div=gd_loc_chosen.find(".geodir_location_add_listing_city_chosen_div");var country_val="";var region_val="";var city_val="";if(location_type=="country"){if(curr_chosen.attr("name")!="post_country")return false;gd_country_el.val(curr_chosen.val());country_val=curr_chosen.val();gd_region_div.hide();gd_region_div.after($loader);jQuery.post(ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"fill_location_on_add_listing",gd_which_location:"region",country_val:country_val},function(data){if(data){gd_region_div.next(".location_dl_loader").remove();gd_region_div.show();gd_region_div.find("select").html(data).chosen().trigger("chosen:updated");gd_region_div.find("select").trigger("change");geodir_location_add_listing_chosen()}if(!geodir_lm_chosen_supported()){jQuery(".gd-new-loc-div",gd_region_div).show()}})}if(location_type=="region"){country_val=gd_country_el.val();gd_region_div.find('input[name="geodir_location_add_listing_region_val"]').val(curr_chosen.val());region_val=curr_chosen.val();gd_city_div.hide();gd_city_div.after($loader);jQuery.post(ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"fill_location_on_add_listing",gd_which_location:"city",country_val:country_val,region_val:region_val},function(data){if(data){gd_city_div.next(".location_dl_loader").remove();gd_city_div.show();gd_city_div.find("select").html(data).chosen().trigger("chosen:updated");gd_city_div.find("select").trigger("change");geodir_location_add_listing_chosen()}if(!geodir_lm_chosen_supported()){jQuery(".gd-new-loc-div",gd_city_div).show()}})}if(location_type=="city"){var gd_hood_chosen=gd_loc_chosen.find(".geodir_location_add_listing_neighbourhood_chosen_container");var gd_hood_div=gd_loc_chosen.find(".geodir_location_add_listing_neighbourhood_chosen_div");country_val=gd_country_el.val();region_val=gd_region_div.find('input[name="geodir_location_add_listing_region_val"]').val();gd_city_div.find('input[name="geodir_location_add_listing_city_val"]').val(curr_chosen.val());city_val=curr_chosen.val();if(!window.gdGeo){window.neighbourhood=""}neighbourhood_val=window.neighbourhood?window.neighbourhood:"";gd_hood_chosen.show();gd_hood_div.hide();gd_hood_div.after($loader);jQuery.post(ajax_url,{action:"geodir_location_ajax",gd_loc_ajax_action:"fill_location_on_add_listing",gd_which_location:"neighbourhood",country_val:country_val,region_val:region_val,city_val:city_val,neighbourhood_val:neighbourhood_val},function(data){gd_hood_div.find('input[name="geodir_location_add_listing_neighbourhood_val"]').val(neighbourhood_val);if(data){var hood_val=gd_hood_div.find("select").val();gd_hood_chosen.show();gd_hood_div.next(".location_dl_loader").remove();gd_hood_div.show();gd_hood_div.find("select").html(data);if(!neighbourhood_val&&hood_val){gd_hood_div.find("select").val(hood_val)}gd_hood_div.find("select").chosen().trigger("chosen:updated")}else{gd_hood_div.find("select").val("");gd_hood_div.next(".location_dl_loader").remove();gd_hood_chosen.hide()}window.gdGeo=false})}})});function geodir_location_add_listing_chosen(){jQuery("select.geodir_location_add_listing_chosen").each(function(){var curr_chosen=jQuery(this);var gd_loc_chosen=curr_chosen.parents(".geodir_location_add_listing_all_chosen_container");var ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;var obj_name=curr_chosen.prop("name");var obbj_info=obj_name.split("_");listfor=obbj_info[1];var country_val="";var region_val="";var city_val="";country_val=gd_loc_chosen.find(".geodir_location_add_listing_country_chosen_div").find('input[name="geodir_location_add_listing_country_val"]').val();if(country_val===undefined){country_val=jQuery("#post_country").val()}region_val=gd_loc_chosen.find(".geodir_location_add_listing_region_chosen_div").find('input[name="geodir_location_add_listing_region_val"]').val();city_val=gd_loc_chosen.find(".geodir_location_add_listing_city_chosen_div").find('input[name="geodir_location_add_listing_city_val"]').val();if(curr_chosen.data("ajaxchosen")=="1"||curr_chosen.data("ajaxchosen")===undefined){curr_chosen.ajaxChosen({keepTypingMsg:geodir_location_all_js_msg.LOCATION_CHOSEN_KEEP_TYPE_TEXT,lookingForMsg:geodir_location_all_js_msg.LOCATION_CHOSEN_LOOKING_FOR_TEXT,type:"GET",url:ajax_url+"?action=geodir_location_ajax&gd_loc_ajax_action=fill_location_on_add_listing&gd_which_location="+listfor+"&country_val="+country_val+"&region_val="+region_val+"&city_val="+city_val,dataType:"html",success:function(data){curr_chosen.html(data).chosen().trigger("chosen:updated");geodir_location_add_listing_chosen()}},null,{})}var search_placeholder=curr_chosen.data("searchplaceholder");if(search_placeholder){setTimeout(function(){curr_chosen.parent().find(".chosen-drop .chosen-search input").attr("placeholder",search_placeholder)},200)}})}function geodir_enable_click_on_chosen_list_item(){jQuery(".chosen-results").bind("click",function(){var first_item_text=jQuery(".chosen-results").find('li[data-option-array-index="0"]').html();var selected_item_text=jQuery(this).parents(".geodir_location_sugestion").find(".chosen-single > span").html();if(first_item_text==selected_item_text){jQuery(this).parents(".geodir_location_sugestion").find("select").trigger("change")}})}function geodir_set_map_default_location(mapid,lat,lng){if(mapid!=""&&lat!=""&&lng!=""){jQuery("#"+mapid).goMap();jQuery.goMap.map.setCenter(new google.maps.LatLng(lat,lng));baseMarker.setPosition(new google.maps.LatLng(lat,lng));updateMarkerPosition(baseMarker.getPosition());geocodePosition(baseMarker.getPosition())}}function geodir_lm_chosen_supported(){if(window.navigator.appName==="Microsoft Internet Explorer"){return document.documentMode>=8}if(/iP(od|hone|ad)/i.test(window.navigator.userAgent)){return false}if(/Android/i.test(window.navigator.userAgent)){if(/Mobile/i.test(window.navigator.userAgent)){return false}}return true}function geodir_no_chosen_add_search(cont,tab){var contLoc=jQuery(cont).find('select[name="gd_location"]');jQuery(contLoc).removeAttr("size");jQuery(contLoc).removeClass("geodir-loc-select-list");jQuery(cont).find(".gd-no-chosen-seach").remove();var inputSearch='<div class="chosen-search"><input type="text" name="term" class="gd-no-chosen-seach" value="" onkeyup="javascript:geodir_no_chosen_search(this);" /></div>';jQuery(contLoc).before(inputSearch);if(typeof tab=="undefined"||tab==""){tab=jQuery(cont).find(".geodir_location_tabs.gd-tab-active").attr("data-location")}var placeHold="";if(tab=="city"){placeHold=geodir_location_all_js_msg.gd_text_search_city}else if(tab=="region"){placeHold=geodir_location_all_js_msg.gd_text_search_region}else if(tab=="country"){placeHold=geodir_location_all_js_msg.gd_text_search_country}placeHold=placeHold!=""?placeHold:geodir_location_all_js_msg.gd_text_search_location;jQuery(cont).find(".gd-no-chosen-seach").attr("placeholder",placeHold)}function geodir_no_chosen_search(obj){var term=jQuery(obj).val();if(typeof term!="undefined"&&term!=""){term=term.replace(/^\s+/,"")}else{term=""}var ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;var attach_term=term!=""?"&term="+term:"";var cont=jQuery(obj).closest(".geodir_location_tab_container");var tab=jQuery(cont).find(".geodir_location_tabs.gd-tab-active");var tab_id=jQuery(tab).data("location");var autoredirect=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("autoredirect");var show_every_where=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("showeverywhere");jQuery.post(ajax_url+"?action=geodir_location_ajax&gd_loc_ajax_action=fill_location&autoredirect="+autoredirect+"&gd_which_location="+tab_id+"&show_every_where="+show_every_where+attach_term,function(data){jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").html(data).chosen().trigger("chosen:updated");geodir_enable_click_on_chosen_list_item();geodir_expand_option(cont);jQuery(cont).find('select[name="gd_location"] option').each(function(){jQuery(this).bind("click",function(){if(jQuery(this).attr("selected")=="selected"||jQuery(this).attr("value")==geodir_location_all_js_msg.gd_base_location){jQuery(this).closest("select").removeAttr("size");jQuery(this).closest("select").removeClass("geodir-loc-select-list")}})})});geodir_location_switcher_chosen_ajax()}function geodir_expand_option(cont,one){var objSel=jQuery(cont).find('select[name="gd_location"]');var optCount=jQuery(objSel).children("option").length;if(typeof one!="undefined"){jQuery(objSel).removeAttr("size");jQuery(objSel).removeClass("geodir-loc-select-list")}else{if(parseInt(optCount)<2){jQuery(objSel).removeAttr("size");jQuery(objSel).removeClass("geodir-loc-select-list")}else{jQuery(objSel).attr("size",optCount);jQuery(objSel).addClass("geodir-loc-select-list")}}}jQuery(document).ready(function(){locationSPage=[];locationSPage["city"]=1;locationSPage["region"]=1;locationSPage["country"]=1;locationSPage["neighbourhood"]=1;locationSActive=false;setTimeout(function(){jQuery(".geodir_location_sugestion .geodir-chosen-container .chosen-results").scroll(function(){if(jQuery(this).scrollTop()+jQuery(this).innerHeight()>=jQuery(this)[0].scrollHeight){if(locationSActive){return}if(jQuery(this).scrollTop()==0){return}obj=this;var tempScrollTop=jQuery(this).scrollTop();var term="";var ajax_url=geodir_location_all_js_msg.geodir_location_admin_ajax_url;var attach_term=term!=""?"&term="+term:"";var cont=jQuery(obj).closest(".geodir_location_tab_container");var tab=jQuery(cont).find(".geodir_location_tabs.gd-tab-active");var tab_id=jQuery(tab).data("location");var autoredirect=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("autoredirect");var show_every_where=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").data("showeverywhere");if(locationSPage[tab_id]=="0"){return}locationSActive=true;jQuery(obj).addClass("loading_div_loc");jQuery.post(ajax_url+"?action=geodir_location_ajax&gd_loc_ajax_action=fill_location&autoredirect="+autoredirect+"&gd_which_location="+tab_id+"&show_every_where="+show_every_where+attach_term+"&lscroll=true&spage="+locationSPage[tab_id],function(data){jQuery(obj).removeClass("loading_div_loc");locationSPage[tab_id]++;if(data==""){locationSPage[tab_id]="0"}var orig_data=jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").html();jQuery(tab).parents(".geodir_location_tab_container").find(".geodir_location_switcher_chosen").html(orig_data+data).chosen().trigger("chosen:updated");geodir_enable_click_on_chosen_list_item();geodir_expand_option(cont);jQuery(cont).find('select[name="gd_location"] option').each(function(){jQuery(this).bind("click",function(){if(jQuery(this).attr("selected")=="selected"||jQuery(this).attr("value")==geodir_location_all_js_msg.gd_base_location){jQuery(this).closest("select").removeAttr("size");jQuery(this).closest("select").removeClass("geodir-loc-select-list")}})});jQuery(obj).scrollTop(tempScrollTop);locationSActive=false});geodir_location_switcher_chosen_ajax()}})},1e3)});function gdShareLocationError(error){switch(error.code){case error.PERMISSION_DENIED:alert(geodir_location_all_js_msg.PERMISSION_DENINED);break;case error.POSITION_UNAVAILABLE:alert(geodir_location_all_js_msg.POSITION_UNAVAILABLE);break;case error.TIMEOUT:alert(geodir_location_all_js_msg.DEFAUTL_ERROR);break;case error.UNKNOWN_ERROR:alert(geodir_location_all_js_msg.UNKNOWN_ERROR);break}}function gdLocationSetupUserLoc(){if(my_location){jQuery(".geodir-search .fa-compass").css("color","#087CC9");jQuery(".gt_near_me_s").prop("checked",true);jQuery(".snear").val(geodir_location_all_js_msg.msg_Near+" "+geodir_location_all_js_msg.msg_Me);jQuery(".sgeo_lat").val(lat);jQuery(".sgeo_lon").val(lon)}else{if(lat&&lon){jQuery(".geodir-search .fa-compass").css("color","#087CC9");jQuery(".gt_near_me_s").prop("checked",true);jQuery(".snear").val(geodir_location_all_js_msg.msg_Near+" "+geodir_location_all_js_msg.msg_User_defined);jQuery(".sgeo_lat").val(lat);jQuery(".sgeo_lon").val(lon)}else if(jQuery(".snear").length&&jQuery(".snear").val().match("^"+geodir_location_all_js_msg.msg_Near)){jQuery(".geodir-search .fa-compass").css("color","");jQuery(".gt_near_me_s").prop("checked",false);jQuery(".snear").val("");jQuery(".snear").blur();jQuery(".sgeo_lat").val("");jQuery(".sgeo_lon").val("")}}}function gd_location_admin_filter(el,lt){var o,data,v=jQuery(el).val(),f=jQuery(el).closest("form"),scn=jQuery('select[name="_gd_country"]',f),srg=jQuery('select[name="_gd_region"]',f),sct=jQuery('select[name="_gd_city"]',f),org=jQuery("option:first-child",srg),oct=jQuery("option:first-child",sct);switch(lt){case"cn":sct.html(oct).attr("disabled","disabled");if(!v){srg.html(org).attr("disabled","disabled");return false}data={cn:v};break;case"rg":if(!v){sct.html(oct).attr("disabled","disabled");return false}var cnv=scn.val();if(!cnv){srg.html(org).attr("disabled","disabled");return false}data={cn:cnv,rg:v};break;default:return false;break}data.action="geodir_location_ajax";data.gd_loc_ajax_action="get_location_options";jQuery.ajax({type:"POST",data:data,dataType:"json",url:ajaxurl,success:function(res){if(typeof res=="object"&&typeof res.options!="undefined"){switch(lt){case"cn":srg.html(org).append(res.options).removeAttr("disabled");break;case"rg":sct.html(oct).append(res.options).removeAttr("disabled");break}}}})}function geodir_lm_type_new_location(el,type){var $el=jQuery(el).parent(".gd-new-loc-div");var loc=jQuery('input[type="text"]',$el).val();loc=loc?jQuery.trim(loc):"";if(loc){var $select=$el.closest(".geodir_form_row").find("select.geodir_location_add_listing_chosen");if(!jQuery('option[value=""]',$select).text()){jQuery('option[value=""]',$select).remove()}if(jQuery("option:contains('"+loc+"')",$select).length==0){$select.append('<option value="'+loc+'">'+loc+"</option>")}jQuery('option[value="'+loc+'"]',$select).attr("selected",true);$select.trigger("change");jQuery('input[type="text"]',$el).val("");$el.hide()}else{jQuery('input[type="text"]',$el).focus()}}

!function(e){e.fn.lightBox=function(t){function i(){return a(this,y),!1}function a(i,a){if(e("embed, object, select").css({visibility:"hidden"}),n(),t.imageArray.length=0,t.activeImage=0,1==a.length)t.imageArray.push(new Array(i.getAttribute("href"),i.getAttribute("title")));else for(var r=0;r<a.length;r++)t.imageArray.push(new Array(a[r].getAttribute("href"),a[r].getAttribute("title")));for(;t.imageArray[t.activeImage][0]!=i.getAttribute("href");)t.activeImage++;o()}function n(){e("body").append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+t.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+t.imageBtnClose+'"></a></div></div></div></div>');var i=s();e("#jquery-overlay").css({backgroundColor:t.overlayBgColor,opacity:t.overlayOpacity,width:"100%",height:i[1]}).fadeIn();var a=v();e("#jquery-lightbox").css({top:e(window).scrollTop()+50,left:e(window).scrollLeft()}).show(),e("#jquery-overlay,#jquery-lightbox").click(function(){u()}),e("#lightbox-loading-link,#lightbox-secNav-btnClose").click(function(){return u(),!1}),e(window).resize(function(){var t=s();e("#jquery-overlay").css({width:"100%",height:t[1]});var i=v();e("#jquery-lightbox").css({top:e(window).scrollTop()+50,left:e(window).scrollLeft()})})}function o(){e("#lightbox-loading").show(),t.fixedNavigation?e("#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide():e("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide();var i=new Image;i.onload=function(){var imageHeight;var imageWidth;var maxWidth;var maxHeight;var $container=e("#lightbox-container-image");var $image=e("#lightbox-image",$container);$image.attr("src",t.imageArray[t.activeImage][0]);$image.width(i.width);$image.height(i.height);var containerTopPadding=parseInt($container.css("padding-top"),10);var containerRightPadding=parseInt($container.css("padding-right"),10);var containerBottomPadding=parseInt($container.css("padding-bottom"),10);var containerLeftPadding=parseInt($container.css("padding-left"),10);var heightBtn=parseInt(e("#lightbox-container-image-data-box","#jquery-lightbox").height(),10);var windowWidth=e(window).width();var windowHeight=e(window).height();var maxImageWidth=windowWidth-containerLeftPadding-containerRightPadding-20;var maxImageHeight=windowHeight-containerTopPadding-containerBottomPadding-120;if(maxWidth&&maxWidth<maxImageWidth){maxImageWidth=maxWidth}if(maxHeight&&maxHeight<maxImageWidth){maxImageHeight=maxHeight}if(i.width>maxImageWidth||i.height>maxImageHeight){if(i.width/maxImageWidth>i.height/maxImageHeight){imageWidth=maxImageWidth;imageHeight=parseInt(i.height/(i.width/imageWidth),10);$image.width(imageWidth);$image.height(imageHeight)}else{imageHeight=maxImageHeight;imageWidth=parseInt(i.width/(i.height/imageHeight),10);$image.width(imageWidth);$image.height(imageHeight)}}i.width=$image.width();i.height=$image.height();e("#lightbox-image").attr("src",t.imageArray[t.activeImage][0]),r(i.width,i.height),i.onload=function(){}},i.src=t.imageArray[t.activeImage][0]}function r(i,a){var n=e("#lightbox-container-image-box").width(),o=e("#lightbox-container-image-box").height(),r=i+2*t.containerBorderSize,c=a+2*t.containerBorderSize;intImageWidthDataBox=i,intImageHeightBTN=a+2*t.containerBorderSize;var l=s();r>l[0]&&(r="100%",c="auto",intImageWidthDataBox="100%",intImageHeightBTN=c-2*t.containerBorderSize);var d=n-r,m=o-c;e("#lightbox-container-image-box").animate({width:r,height:c},t.containerResizeSpeed,function(){g()}),0==d&&0==m&&x(e.browser.msie?250:100),e("#lightbox-container-image-data-box").css({width:intImageWidthDataBox}),e("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css({height:intImageHeightBTN})}function g(){e("#lightbox-loading").hide(),e("#lightbox-image").fadeIn(function(){c(),l()}),b()}function c(){e("#lightbox-container-image-data-box").slideDown("fast"),e("#lightbox-image-details-caption").hide(),t.imageArray[t.activeImage][1]&&e("#lightbox-image-details-caption").html(t.imageArray[t.activeImage][1]).show(),t.imageArray.length>1&&e("#lightbox-image-details-currentNumber").html(t.txtImage+" "+(t.activeImage+1)+" "+t.txtOf+" "+t.imageArray.length).show()}function l(){e("#lightbox-nav").show(),e("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css({background:"transparent url("+t.imageBlank+") no-repeat"}),0!=t.activeImage&&(t.fixedNavigation?e("#lightbox-nav-btnPrev").css({background:"url("+t.imageBtnPrev+") left 15% no-repeat"}).unbind().bind("click",function(){return t.activeImage=t.activeImage-1,o(),!1}):e("#lightbox-nav-btnPrev").unbind().hover(function(){e(this).css({background:"url("+t.imageBtnPrev+") left 15% no-repeat"})},function(){e(this).css({background:"transparent url("+t.imageBlank+") no-repeat"})}).show().bind("click",function(){return t.activeImage=t.activeImage-1,o(),!1})),t.activeImage!=t.imageArray.length-1&&(t.fixedNavigation?e("#lightbox-nav-btnNext").css({background:"url("+t.imageBtnNext+") right 15% no-repeat"}).unbind().bind("click",function(){return t.activeImage=t.activeImage+1,o(),!1}):e("#lightbox-nav-btnNext").unbind().hover(function(){e(this).css({background:"url("+t.imageBtnNext+") right 15% no-repeat"})},function(){e(this).css({background:"transparent url("+t.imageBlank+") no-repeat"})}).show().bind("click",function(){return t.activeImage=t.activeImage+1,o(),!1})),d()}function d(){e(document).keydown(function(e){h(e)})}function m(){e(document).unbind()}function h(e){null==e?(keycode=event.keyCode,escapeKey=27):(keycode=e.keyCode,escapeKey=e.DOM_VK_ESCAPE),key=String.fromCharCode(keycode).toLowerCase(),(key==t.keyToClose||"x"==key||keycode==escapeKey)&&u(),(key==t.keyToPrev||37==keycode)&&0!=t.activeImage&&(t.activeImage=t.activeImage-1,o(),m()),(key==t.keyToNext||39==keycode)&&t.activeImage!=t.imageArray.length-1&&(t.activeImage=t.activeImage+1,o(),m())}function b(){t.imageArray.length-1>t.activeImage&&(objNext=new Image,objNext.src=t.imageArray[t.activeImage+1][0]),t.activeImage>0&&(objPrev=new Image,objPrev.src=t.imageArray[t.activeImage-1][0])}function u(){e("#jquery-lightbox").remove(),e("#jquery-overlay").fadeOut(function(){e("#jquery-overlay").remove()}),e("embed, object, select").css({visibility:"visible"})}function s(){var e,t;window.innerHeight&&window.scrollMaxY?(e=window.innerWidth+window.scrollMaxX,t=window.innerHeight+window.scrollMaxY):document.body.scrollHeight>document.body.offsetHeight?(e=document.body.scrollWidth,t=document.body.scrollHeight):(e=document.body.offsetWidth,t=document.body.offsetHeight);var i,a;return self.innerHeight?(i=document.documentElement.clientWidth?document.documentElement.clientWidth:self.innerWidth,a=self.innerHeight):document.documentElement&&document.documentElement.clientHeight?(i=document.documentElement.clientWidth,a=document.documentElement.clientHeight):document.body&&(i=document.body.clientWidth,a=document.body.clientHeight),pageHeight=a>t?a:t,pageWidth=i>e?e:i,arrayPageSize=new Array(pageWidth,pageHeight,i,a),arrayPageSize}function v(){var e,t;return self.pageYOffset?(t=self.pageYOffset,e=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(t=document.documentElement.scrollTop,e=document.documentElement.scrollLeft):document.body&&(t=document.body.scrollTop,e=document.body.scrollLeft),arrayPageScroll=new Array(e,t),arrayPageScroll}function x(e){var t=new Date;i=null;do var i=new Date;while(e>i-t)}t=jQuery.extend({overlayBgColor:"#000",overlayOpacity:.8,fixedNavigation:!1,imageLoading:"images/lightbox-ico-loading.gif",imageBtnPrev:"images/lightbox-btn-prev.gif",imageBtnNext:"images/lightbox-btn-next.gif",imageBtnClose:"images/lightbox-btn-close.gif",imageBlank:"images/lightbox-blank.gif",containerBorderSize:10,containerResizeSpeed:400,txtImage:"Image",txtOf:"of",keyToClose:"c",keyToPrev:"p",keyToNext:"n",imageArray:[],activeImage:0},t);var y=this;return this.unbind("click").click(i)}}(jQuery);

