(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.1",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=lt(),k=lt(),E=lt(),S=!1,A=function(){return 0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=bt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+xt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return At(e.replace(z,"$1"),t,n,i)}function st(e){return K.test(e+"")}function lt(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function ut(e){return e[b]=!0,e}function ct(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function pt(e,t,n){e=e.split("|");var r,i=e.length,a=n?null:t;while(i--)(r=o.attrHandle[e[i]])&&r!==t||(o.attrHandle[e[i]]=a)}function ft(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:e[t]===!0?t.toLowerCase():null}function dt(e,t){return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}function ht(e){return"input"===e.nodeName.toLowerCase()?e.defaultValue:t}function gt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function mt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function yt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function vt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.parentWindow;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.frameElement&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ct(function(e){return e.innerHTML="<a href='#'></a>",pt("type|href|height|width",dt,"#"===e.firstChild.getAttribute("href")),pt(B,ft,null==e.getAttribute("disabled")),e.className="i",!e.getAttribute("className")}),r.input=ct(function(e){return e.innerHTML="<input>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}),pt("value",ht,r.attributes&&r.input),r.getElementsByTagName=ct(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ct(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ct(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=st(n.querySelectorAll))&&(ct(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ct(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=st(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ct(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=st(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},r.sortDetached=ct(function(e){return 1&e.compareDocumentPosition(n.createElement("div"))}),A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return gt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?gt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:ut,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=bt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ut(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?ut(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ut(function(e){return function(t){return at(e,t).length>0}}),contains:ut(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:ut(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:vt(function(){return[0]}),last:vt(function(e,t){return[t-1]}),eq:vt(function(e,t,n){return[0>n?n+t:n]}),even:vt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:vt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:vt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:vt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=mt(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=yt(n);function bt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function xt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function wt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function Tt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ct(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function Nt(e,t,n,r,i,o){return r&&!r[b]&&(r=Nt(r)),i&&!i[b]&&(i=Nt(i,o)),ut(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||St(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:Ct(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=Ct(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=Ct(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function kt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=wt(function(e){return e===t},s,!0),p=wt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[wt(Tt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return Nt(l>1&&Tt(f),l>1&&xt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&kt(e.slice(l,r)),i>r&&kt(e=e.slice(r)),i>r&&xt(e))}f.push(n)}return Tt(f)}function Et(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=Ct(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?ut(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=bt(e)),n=t.length;while(n--)o=kt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Et(i,r))}return o};function St(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function At(e,t,n,i){var a,s,u,c,p,f=bt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&xt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}o.pseudos.nth=o.pseudos.eq;function jt(){}jt.prototype=o.filters=o.pseudos,o.setFilters=new jt,r.sortStable=b.split("").sort(A).join("")===b,p(),[0,0].sort(A),r.detectDuplicates=S,x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||i&&!u||(n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=x(this),l=t,u=e.match(T)||[];while(o=u[a++])l=r?l:!s.hasClass(o),s[l?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={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:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.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(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);(function(jQuery,window,undefined){var warnedAbout={};jQuery.migrateWarnings=[];if(!jQuery.migrateMute&&window.console&&window.console.log){window.console.log("JQMIGRATE: Logging is active");}
if(jQuery.migrateTrace===undefined){jQuery.migrateTrace=true;}
jQuery.migrateReset=function(){warnedAbout={};jQuery.migrateWarnings.length=0;};function migrateWarn(msg){var console=window.console;if(!warnedAbout[msg]){warnedAbout[msg]=true;jQuery.migrateWarnings.push(msg);if(console&&console.warn&&!jQuery.migrateMute){console.warn("JQMIGRATE: "+msg);if(jQuery.migrateTrace&&console.trace){console.trace();}}}}
function migrateWarnProp(obj,prop,value,msg){if(Object.defineProperty){try{Object.defineProperty(obj,prop,{configurable:true,enumerable:true,get:function(){migrateWarn(msg);return value;},set:function(newValue){migrateWarn(msg);value=newValue;}});return;}catch(err){}}
jQuery._definePropertyBroken=true;obj[prop]=value;}
if(document.compatMode==="BackCompat"){migrateWarn("jQuery is not compatible with Quirks Mode");}
var attrFn=jQuery("<input/>",{size:1}).attr("size")&&jQuery.attrFn,oldAttr=jQuery.attr,valueAttrGet=jQuery.attrHooks.value&&jQuery.attrHooks.value.get||function(){return null;},valueAttrSet=jQuery.attrHooks.value&&jQuery.attrHooks.value.set||function(){return undefined;},rnoType=/^(?:input|button)$/i,rnoAttrNodeType=/^[238]$/,rboolean=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,ruseDefault=/^(?:checked|selected)$/i;migrateWarnProp(jQuery,"attrFn",attrFn||{},"jQuery.attrFn is deprecated");jQuery.attr=function(elem,name,value,pass){var lowerName=name.toLowerCase(),nType=elem&&elem.nodeType;if(pass){if(oldAttr.length<4){migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");}
if(elem&&!rnoAttrNodeType.test(nType)&&(attrFn?name in attrFn:jQuery.isFunction(jQuery.fn[name]))){return jQuery(elem)[name](value);}}
if(name==="type"&&value!==undefined&&rnoType.test(elem.nodeName)&&elem.parentNode){migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");}
if(!jQuery.attrHooks[lowerName]&&rboolean.test(lowerName)){jQuery.attrHooks[lowerName]={get:function(elem,name){var attrNode,property=jQuery.prop(elem,name);return property===true||typeof property!=="boolean"&&(attrNode=elem.getAttributeNode(name))&&attrNode.nodeValue!==false?name.toLowerCase():undefined;},set:function(elem,value,name){var propName;if(value===false){jQuery.removeAttr(elem,name);}else{propName=jQuery.propFix[name]||name;if(propName in elem){elem[propName]=true;}
elem.setAttribute(name,name.toLowerCase());}
return name;}};if(ruseDefault.test(lowerName)){migrateWarn("jQuery.fn.attr('"+lowerName+"') may use property instead of attribute");}}
return oldAttr.call(jQuery,elem,name,value);};jQuery.attrHooks.value={get:function(elem,name){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="button"){return valueAttrGet.apply(this,arguments);}
if(nodeName!=="input"&&nodeName!=="option"){migrateWarn("jQuery.fn.attr('value') no longer gets properties");}
return name in elem?elem.value:null;},set:function(elem,value){var nodeName=(elem.nodeName||"").toLowerCase();if(nodeName==="button"){return valueAttrSet.apply(this,arguments);}
if(nodeName!=="input"&&nodeName!=="option"){migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");}
elem.value=value;}};var matched,browser,oldInit=jQuery.fn.init,oldParseJSON=jQuery.parseJSON,rquickExpr=/^([^<]*)(<[\w\W]+>)([^>]*)$/;jQuery.fn.init=function(selector,context,rootjQuery){var match;if(selector&&typeof selector==="string"&&!jQuery.isPlainObject(context)&&(match=rquickExpr.exec(jQuery.trim(selector)))&&match[0]){if(selector.charAt(0)!=="<"){migrateWarn("$(html) HTML strings must start with '<' character");}
if(match[3]){migrateWarn("$(html) HTML text after last tag is ignored");}
if(match[0].charAt(0)==="#"){migrateWarn("HTML string cannot start with a '#' character");jQuery.error("JQMIGRATE: Invalid selector string (XSS)");}
if(context&&context.context){context=context.context;}
if(jQuery.parseHTML){return oldInit.call(this,jQuery.parseHTML(match[2],context,true),context,rootjQuery);}}
return oldInit.apply(this,arguments);};jQuery.fn.init.prototype=jQuery.fn;jQuery.parseJSON=function(json){if(!json&&json!==null){migrateWarn("jQuery.parseJSON requires a valid JSON string");return null;}
return oldParseJSON.apply(this,arguments);};jQuery.uaMatch=function(ua){ua=ua.toLowerCase();var match=/(chrome)[ \/]([\w.]+)/.exec(ua)||/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||ua.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};};if(!jQuery.browser){matched=jQuery.uaMatch(navigator.userAgent);browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version;}
if(browser.chrome){browser.webkit=true;}else if(browser.webkit){browser.safari=true;}
jQuery.browser=browser;}
migrateWarnProp(jQuery,"browser",jQuery.browser,"jQuery.browser is deprecated");jQuery.sub=function(){function jQuerySub(selector,context){return new jQuerySub.fn.init(selector,context);}
jQuery.extend(true,jQuerySub,this);jQuerySub.superclass=this;jQuerySub.fn=jQuerySub.prototype=this();jQuerySub.fn.constructor=jQuerySub;jQuerySub.sub=this.sub;jQuerySub.fn.init=function init(selector,context){if(context&&context instanceof jQuery&&!(context instanceof jQuerySub)){context=jQuerySub(context);}
return jQuery.fn.init.call(this,selector,context,rootjQuerySub);};jQuerySub.fn.init.prototype=jQuerySub.fn;var rootjQuerySub=jQuerySub(document);migrateWarn("jQuery.sub() is deprecated");return jQuerySub;};jQuery.ajaxSetup({converters:{"text json":jQuery.parseJSON}});var oldFnData=jQuery.fn.data;jQuery.fn.data=function(name){var ret,evt,elem=this[0];if(elem&&name==="events"&&arguments.length===1){ret=jQuery.data(elem,name);evt=jQuery._data(elem,name);if((ret===undefined||ret===evt)&&evt!==undefined){migrateWarn("Use of jQuery.fn.data('events') is deprecated");return evt;}}
return oldFnData.apply(this,arguments);};var rscriptType=/\/(java|ecma)script/i,oldSelf=jQuery.fn.andSelf||jQuery.fn.addBack;jQuery.fn.andSelf=function(){migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");return oldSelf.apply(this,arguments);};if(!jQuery.clean){jQuery.clean=function(elems,context,fragment,scripts){context=context||document;context=!context.nodeType&&context[0]||context;context=context.ownerDocument||context;migrateWarn("jQuery.clean() is deprecated");var i,elem,handleScript,jsTags,ret=[];jQuery.merge(ret,jQuery.buildFragment(elems,context).childNodes);if(fragment){handleScript=function(elem){if(!elem.type||rscriptType.test(elem.type)){return scripts?scripts.push(elem.parentNode?elem.parentNode.removeChild(elem):elem):fragment.appendChild(elem);}};for(i=0;(elem=ret[i])!=null;i++){if(!(jQuery.nodeName(elem,"script")&&handleScript(elem))){fragment.appendChild(elem);if(typeof elem.getElementsByTagName!=="undefined"){jsTags=jQuery.grep(jQuery.merge([],elem.getElementsByTagName("script")),handleScript);ret.splice.apply(ret,[i+1,0].concat(jsTags));i+=jsTags.length;}}}}
return ret;};}
var eventAdd=jQuery.event.add,eventRemove=jQuery.event.remove,eventTrigger=jQuery.event.trigger,oldToggle=jQuery.fn.toggle,oldLive=jQuery.fn.live,oldDie=jQuery.fn.die,ajaxEvents="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",rajaxEvent=new RegExp("\\b(?:"+ajaxEvents+")\\b"),rhoverHack=/(?:^|\s)hover(\.\S+|)\b/,hoverHack=function(events){if(typeof(events)!=="string"||jQuery.event.special.hover){return events;}
if(rhoverHack.test(events)){migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");}
return events&&events.replace(rhoverHack,"mouseenter$1 mouseleave$1");};if(jQuery.event.props&&jQuery.event.props[0]!=="attrChange"){jQuery.event.props.unshift("attrChange","attrName","relatedNode","srcElement");}
if(jQuery.event.dispatch){migrateWarnProp(jQuery.event,"handle",jQuery.event.dispatch,"jQuery.event.handle is undocumented and deprecated");}
jQuery.event.add=function(elem,types,handler,data,selector){if(elem!==document&&rajaxEvent.test(types)){migrateWarn("AJAX events should be attached to document: "+types);}
eventAdd.call(this,elem,hoverHack(types||""),handler,data,selector);};jQuery.event.remove=function(elem,types,handler,selector,mappedTypes){eventRemove.call(this,elem,hoverHack(types)||"",handler,selector,mappedTypes);};jQuery.fn.error=function(){var args=Array.prototype.slice.call(arguments,0);migrateWarn("jQuery.fn.error() is deprecated");args.splice(0,0,"error");if(arguments.length){return this.bind.apply(this,args);}
this.triggerHandler.apply(this,args);return this;};jQuery.fn.toggle=function(fn,fn2){if(!jQuery.isFunction(fn)||!jQuery.isFunction(fn2)){return oldToggle.apply(this,arguments);}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");var args=arguments,guid=fn.guid||jQuery.guid++,i=0,toggler=function(event){var lastToggle=(jQuery._data(this,"lastToggle"+fn.guid)||0)%i;jQuery._data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;};toggler.guid=guid;while(i<args.length){args[i++].guid=guid;}
return this.click(toggler);};jQuery.fn.live=function(types,data,fn){migrateWarn("jQuery.fn.live() is deprecated");if(oldLive){return oldLive.apply(this,arguments);}
jQuery(this.context).on(types,this.selector,data,fn);return this;};jQuery.fn.die=function(types,fn){migrateWarn("jQuery.fn.die() is deprecated");if(oldDie){return oldDie.apply(this,arguments);}
jQuery(this.context).off(types,this.selector||"**",fn);return this;};jQuery.event.trigger=function(event,data,elem,onlyHandlers){if(!elem&&!rajaxEvent.test(event)){migrateWarn("Global events are undocumented and deprecated");}
return eventTrigger.call(this,event,data,elem||document,onlyHandlers);};jQuery.each(ajaxEvents.split("|"),function(_,name){jQuery.event.special[name]={setup:function(){var elem=this;if(elem!==document){jQuery.event.add(document,name+"."+jQuery.guid,function(){jQuery.event.trigger(name,null,elem,true);});jQuery._data(this,name,jQuery.guid++);}
return false;},teardown:function(){if(this!==document){jQuery.event.remove(document,name+"."+jQuery._data(this,name));}
return false;}};});})(jQuery,window);Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/^yes(terday)?/i,today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ute)?s?/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,year:/^y(ear)?s?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"},{name:"GMT",offset:"-000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset:"-0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offset:"-0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]};(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,p=function(s,l){if(!l){l=2;}
return("000"+s).slice(l*-1);};$P.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};$P.setTimeToNow=function(){var n=new Date();this.setHours(n.getHours());this.setMinutes(n.getMinutes());this.setSeconds(n.getSeconds());this.setMilliseconds(n.getMilliseconds());return this;};$D.today=function(){return new Date().clearTime();};$D.compare=function(date1,date2){if(isNaN(date1)||isNaN(date2)){throw new Error(date1+" - "+date2);}else if(date1 instanceof Date&&date2 instanceof Date){return(date1<date2)?-1:(date1>date2)?1:0;}else{throw new TypeError(date1+" - "+date2);}};$D.equals=function(date1,date2){return(date1.compareTo(date2)===0);};$D.getDayNumberFromName=function(name){var n=$C.dayNames,m=$C.abbreviatedDayNames,o=$C.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s||o[i].toLowerCase()==s){return i;}}
return-1;};$D.getMonthNumberFromName=function(name){var n=$C.monthNames,m=$C.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
return-1;};$D.isLeapYear=function(year){return((year%4===0&&year%100!==0)||year%400===0);};$D.getDaysInMonth=function(year,month){return[31,($D.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};$D.getTimezoneAbbreviation=function(offset){var z=$C.timezones,p;for(var i=0;i<z.length;i++){if(z[i].offset===offset){return z[i].name;}}
return null;};$D.getTimezoneOffset=function(name){var z=$C.timezones,p;for(var i=0;i<z.length;i++){if(z[i].name===name.toUpperCase()){return z[i].offset;}}
return null;};$P.clone=function(){return new Date(this.getTime());};$P.compareTo=function(date){return Date.compare(this,date);};$P.equals=function(date){return Date.equals(this,date||new Date());};$P.between=function(start,end){return this.getTime()>=start.getTime()&&this.getTime()<=end.getTime();};$P.isAfter=function(date){return this.compareTo(date||new Date())===1;};$P.isBefore=function(date){return(this.compareTo(date||new Date())===-1);};$P.isToday=function(){return this.isSameDay(new Date());};$P.isSameDay=function(date){return this.clone().clearTime().equals(date.clone().clearTime());};$P.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};$P.addSeconds=function(value){return this.addMilliseconds(value*1000);};$P.addMinutes=function(value){return this.addMilliseconds(value*60000);};$P.addHours=function(value){return this.addMilliseconds(value*3600000);};$P.addDays=function(value){this.setDate(this.getDate()+value);return this;};$P.addWeeks=function(value){return this.addDays(value*7);};$P.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,$D.getDaysInMonth(this.getFullYear(),this.getMonth())));return this;};$P.addYears=function(value){return this.addMonths(value*12);};$P.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
var x=config;if(x.milliseconds){this.addMilliseconds(x.milliseconds);}
if(x.seconds){this.addSeconds(x.seconds);}
if(x.minutes){this.addMinutes(x.minutes);}
if(x.hours){this.addHours(x.hours);}
if(x.weeks){this.addWeeks(x.weeks);}
if(x.months){this.addMonths(x.months);}
if(x.years){this.addYears(x.years);}
if(x.days){this.addDays(x.days);}
return this;};var $y,$m,$d;$P.getWeek=function(){var a,b,c,d,e,f,g,n,s,w;$y=(!$y)?this.getFullYear():$y;$m=(!$m)?this.getMonth()+1:$m;$d=(!$d)?this.getDate():$d;if($m<=2){a=$y-1;b=(a/4|0)-(a/100|0)+(a/400|0);c=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);s=b-c;e=0;f=$d-1+(31*($m-1));}else{a=$y;b=(a/4|0)-(a/100|0)+(a/400|0);c=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);s=b-c;e=s+1;f=$d+((153*($m-3)+2)/5)+58+s;}
g=(a+b)%7;d=(f+g-e)%7;n=(f+3-d)|0;if(n<0){w=53-((g-s)/5|0);}else if(n>364+s){w=1;}else{w=(n/7|0)+1;}
$y=$m=$d=null;return w;};$P.getISOWeek=function(){$y=this.getUTCFullYear();$m=this.getUTCMonth()+1;$d=this.getUTCDate();return p(this.getWeek());};$P.setWeek=function(n){return this.moveToDayOfWeek(1).addWeeks(n-this.getWeek());};$D._validate=function(n,min,max,name){if(typeof n=="undefined"){return false;}else if(typeof n!="number"){throw new TypeError(n+" is not a Number.");}else if(n<min||n>max){throw new RangeError(n+" is not a valid value for "+name+".");}
return true;};$D.validateMillisecond=function(value){return $D._validate(value,0,999,"millisecond");};$D.validateSecond=function(value){return $D._validate(value,0,59,"second");};$D.validateMinute=function(value){return $D._validate(value,0,59,"minute");};$D.validateHour=function(value){return $D._validate(value,0,23,"hour");};$D.validateDay=function(value,year,month){return $D._validate(value,1,$D.getDaysInMonth(year,month),"day");};$D.validateMonth=function(value){return $D._validate(value,0,11,"month");};$D.validateYear=function(value){return $D._validate(value,0,9999,"year");};$P.set=function(config){if($D.validateMillisecond(config.millisecond)){this.addMilliseconds(config.millisecond-this.getMilliseconds());}
if($D.validateSecond(config.second)){this.addSeconds(config.second-this.getSeconds());}
if($D.validateMinute(config.minute)){this.addMinutes(config.minute-this.getMinutes());}
if($D.validateHour(config.hour)){this.addHours(config.hour-this.getHours());}
if($D.validateMonth(config.month)){this.addMonths(config.month-this.getMonth());}
if($D.validateYear(config.year)){this.addYears(config.year-this.getFullYear());}
if($D.validateDay(config.day,this.getFullYear(),this.getMonth())){this.addDays(config.day-this.getDate());}
if(config.timezone){this.setTimezone(config.timezone);}
if(config.timezoneOffset){this.setTimezoneOffset(config.timezoneOffset);}
if(config.week&&$D._validate(config.week,0,53,"week")){this.setWeek(config.week);}
return this;};$P.moveToFirstDayOfMonth=function(){return this.set({day:1});};$P.moveToLastDayOfMonth=function(){return this.set({day:$D.getDaysInMonth(this.getFullYear(),this.getMonth())});};$P.moveToNthOccurrence=function(dayOfWeek,occurrence){var shift=0;if(occurrence>0){shift=occurrence-1;}
else if(occurrence===-1){this.moveToLastDayOfMonth();if(this.getDay()!==dayOfWeek){this.moveToDayOfWeek(dayOfWeek,-1);}
return this;}
return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(dayOfWeek,+1).addWeeks(shift);};$P.moveToDayOfWeek=function(dayOfWeek,orient){var diff=(dayOfWeek-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};$P.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};$P.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/86400000)+1;};$P.getTimezone=function(){return $D.getTimezoneAbbreviation(this.getUTCOffset());};$P.setTimezoneOffset=function(offset){var here=this.getTimezoneOffset(),there=Number(offset)*-6/10;return this.addMinutes(there-here);};$P.setTimezone=function(offset){return this.setTimezoneOffset($D.getTimezoneOffset(offset));};$P.hasDaylightSavingTime=function(){return(Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.isDaylightSavingTime=function(){return(this.hasDaylightSavingTime()&&new Date().getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r.charAt(0)+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};$P.getElapsed=function(date){return(date||new Date())-this;};if(!$P.toISOString){$P.toISOString=function(){function f(n){return n<10?'0'+n:n;}
return'"'+this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z"';};}
$P._toString=$P.toString;$P.toString=function(format){var x=this;if(format&&format.length==1){var c=$C.formatPatterns;x.t=x.toString;switch(format){case"d":return x.t(c.shortDate);case"D":return x.t(c.longDate);case"F":return x.t(c.fullDateTime);case"m":return x.t(c.monthDay);case"r":return x.t(c.rfc1123);case"s":return x.t(c.sortableDateTime);case"t":return x.t(c.shortTime);case"T":return x.t(c.longTime);case"u":return x.t(c.universalSortableDateTime);case"y":return x.t(c.yearMonth);}}
var ord=function(n){switch(n*1){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};return format?format.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g,function(m){if(m.charAt(0)==="\\"){return m.replace("\\","");}
x.h=x.getHours;switch(m){case"hh":return p(x.h()<13?(x.h()===0?12:x.h()):(x.h()-12));case"h":return x.h()<13?(x.h()===0?12:x.h()):(x.h()-12);case"HH":return p(x.h());case"H":return x.h();case"mm":return p(x.getMinutes());case"m":return x.getMinutes();case"ss":return p(x.getSeconds());case"s":return x.getSeconds();case"yyyy":return p(x.getFullYear(),4);case"yy":return p(x.getFullYear());case"dddd":return $C.dayNames[x.getDay()];case"ddd":return $C.abbreviatedDayNames[x.getDay()];case"dd":return p(x.getDate());case"d":return x.getDate();case"MMMM":return $C.monthNames[x.getMonth()];case"MMM":return $C.abbreviatedMonthNames[x.getMonth()];case"MM":return p((x.getMonth()+1));case"M":return x.getMonth()+1;case"t":return x.h()<12?$C.amDesignator.substring(0,1):$C.pmDesignator.substring(0,1);case"tt":return x.h()<12?$C.amDesignator:$C.pmDesignator;case"S":return ord(x.getDate());default:return m;}}):this._toString();};}());(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,$N=Number.prototype;$P._orient=+1;$P._nth=null;$P._is=false;$P._same=false;$P._isSecond=false;$N._dateElement="day";$P.next=function(){this._orient=+1;return this;};$D.next=function(){return $D.today().next();};$P.last=$P.prev=$P.previous=function(){this._orient=-1;return this;};$D.last=$D.prev=$D.previous=function(){return $D.today().last();};$P.is=function(){this._is=true;return this;};$P.same=function(){this._same=true;this._isSecond=false;return this;};$P.today=function(){return this.same().day();};$P.weekday=function(){if(this._is){this._is=false;return(!this.is().sat()&&!this.is().sun());}
return false;};$P.at=function(time){return(typeof time==="string")?$D.parse(this.toString("d")+" "+time):this.set(time);};$N.fromNow=$N.after=function(date){var c={};c[this._dateElement]=this;return((!date)?new Date():date.clone()).add(c);};$N.ago=$N.before=function(date){var c={};c[this._dateElement]=this*-1;return((!date)?new Date():date.clone()).add(c);};var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),pxf=("Milliseconds Seconds Minutes Hours Date Week Month FullYear").split(/\s/),nth=("final first second third fourth fifth").split(/\s/),de;$P.toObject=function(){var o={};for(var i=0;i<px.length;i++){o[px[i].toLowerCase()]=this["get"+pxf[i]]();}
return o;};$D.fromObject=function(config){config.week=null;return Date.today().set(config);};var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
if(this._nth!==null){if(this._isSecond){this.addSeconds(this._orient*-1);}
this._isSecond=false;var ntemp=this._nth;this._nth=null;var temp=this.clone().moveToLastDayOfMonth();this.moveToNthOccurrence(n,ntemp);if(this>temp){throw new RangeError($D.getDayName(n)+" does not occur "+ntemp+" times in the month of "+$D.getMonthName(temp.getMonth())+" "+temp.getFullYear()+".");}
return this;}
return this.moveToDayOfWeek(n,this._orient);};};var sdf=function(n){return function(){var t=$D.today(),shift=n-t.getDay();if(n===0&&$C.firstDayOfWeek===1&&t.getDay()!==0){shift=shift+7;}
return t.addDays(shift);};};for(var i=0;i<dx.length;i++){$D[dx[i].toUpperCase()]=$D[dx[i].toUpperCase().substring(0,3)]=i;$D[dx[i]]=$D[dx[i].substring(0,3)]=sdf(i);$P[dx[i]]=$P[dx[i].substring(0,3)]=df(i);}
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
return this.moveToMonth(n,this._orient);};};var smf=function(n){return function(){return $D.today().set({month:n,day:1});};};for(var j=0;j<mx.length;j++){$D[mx[j].toUpperCase()]=$D[mx[j].toUpperCase().substring(0,3)]=j;$D[mx[j]]=$D[mx[j].substring(0,3)]=smf(j);$P[mx[j]]=$P[mx[j].substring(0,3)]=mf(j);}
var ef=function(j){return function(){if(this._isSecond){this._isSecond=false;return this;}
if(this._same){this._same=this._is=false;var o1=this.toObject(),o2=(arguments[0]||new Date()).toObject(),v="",k=j.toLowerCase();for(var m=(px.length-1);m>-1;m--){v=px[m].toLowerCase();if(o1[v]!=o2[v]){return false;}
if(k==v){break;}}
return true;}
if(j.substring(j.length-1)!="s"){j+="s";}
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$P[de]=$P[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}
$P._ss=ef("Second");var nthfn=function(n){return function(dayOfWeek){if(this._same){return this._ss(arguments[0]);}
if(dayOfWeek||dayOfWeek===0){return this.moveToNthOccurrence(dayOfWeek,n);}
this._nth=n;if(n===2&&(dayOfWeek===undefined||dayOfWeek===null)){this._isSecond=true;return this.addSeconds(this._orient);}
return this;};};for(var l=0;l<nth.length;l++){$P[nth[l]]=(l===0)?nthfn(-1):nthfn(l);}}());(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
break;}
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
rx.push(r[0]);s=r[1];}
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){r=null;}
if(r){return r;}}
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
rx.push(r[0]);s=r[1];}
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
s=q[1];}
if(!r){throw new $P.Exception(s);}
if(q){throw new $P.Exception(q[1]);}
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
if(!last&&q[1].length===0){last=true;}
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
if(rx[1].length<best[1].length){best=rx;}
if(best[1].length===0){break;}}
if(best[0].length===0){return best;}
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
best[1]=q[1];}
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo;var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
return rx;};$D.Grammar={};$D.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=(s.length==3)?"jan feb mar apr may jun jul aug sep oct nov dec".indexOf(s)/4:Number(s)-1;};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<$C.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
var now=new Date();if((this.hour||this.minute)&&(!this.month&&!this.year&&!this.day)){this.day=now.getDate();}
if(!this.year){this.year=now.getFullYear();}
if(!this.month&&this.month!==0){this.month=now.getMonth();}
if(!this.day){this.day=1;}
if(!this.hour){this.hour=0;}
if(!this.minute){this.minute=0;}
if(!this.second){this.second=0;}
if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12;}else if(this.meridian=="a"&&this.hour==12){this.hour=0;}}
if(this.day>$D.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
var today=$D.today();if(this.now&&!this.unit&&!this.operator){return new Date();}else if(this.now){today=new Date();}
var expression=!!(this.days&&this.days!==null||this.orient||this.operator);var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(!this.now&&"hour minute second".indexOf(this.unit)!=-1){today.setTimeToNow();}
if(this.month||this.month===0){if("year day hour minute second".indexOf(this.unit)!=-1){this.value=this.month+1;this.month=null;expression=true;}}
if(!expression&&this.weekday&&!this.day&&!this.days){var temp=Date[this.weekday]();this.day=temp.getDate();if(!this.month){this.month=temp.getMonth();}
this.year=temp.getFullYear();}
if(expression&&this.weekday&&this.unit!="month"){this.unit="day";gap=($D.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
if(this.month&&this.unit=="day"&&this.operator){this.value=(this.month+1);this.month=null;}
if(this.value!=null&&this.month!=null&&this.year!=null){this.day=this.value*1;}
if(this.month&&!this.day&&this.value){today.set({day:this.value*1});if(!expression){this.day=this.value*1;}}
if(!this.month&&this.value&&this.unit=="month"&&!this.now){this.month=this.value;expression=true;}
if(expression&&(this.month||this.month===0)&&this.unit!="year"){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
if(!this.unit){this.unit="day";}
if(!this.value&&this.operator&&this.operator!==null&&this[this.unit+"s"]&&this[this.unit+"s"]!==null){this[this.unit+"s"]=this[this.unit+"s"]+((this.operator=="add")?1:-1)+(this.value||0)*orient;}else if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
this[this.unit+"s"]=this.value*orient;}
if(this.meridian&&this.hour){if(this.meridian=="p"&&this.hour<12){this.hour=this.hour+12;}else if(this.meridian=="a"&&this.hour==12){this.hour=0;}}
if(this.weekday&&!this.day&&!this.days){var temp=Date[this.weekday]();this.day=temp.getDate();if(temp.getMonth()!==today.getMonth()){this.month=temp.getMonth();}}
if((this.month||this.month===0)&&!this.day){this.day=1;}
if(!this.orient&&!this.operator&&this.unit=="week"&&this.value&&!this.day&&!this.month){return Date.today().setWeek(this.value);}
if(expression&&this.timezone&&this.day&&this.days){this.day=this.days;}
return(expression)?today.add(this):today.set(this);}};var _=$D.Parsing.Operators,g=$D.Grammar,t=$D.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|@|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=$C.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
fn=_C[keys]=_.any.apply(null,px);}
return fn;};g.ctoken2=function(key){return _.rtoken($C.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.m,g.s],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("second minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[$C.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw $D.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["\"yyyy-MM-ddTHH:mm:ssZ\"","yyyy-MM-ddTHH:mm:ssZ","yyyy-MM-ddTHH:mm:ssz","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mmZ","yyyy-MM-ddTHH:mmz","yyyy-MM-ddTHH:mm","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","MMddyyyy","ddMMyyyy","Mddyyyy","ddMyyyy","Mdyyyy","dMyyyy","yyyy","Mdyy","dMyy","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
return g._start.call({},s);};$D._parse=$D.parse;$D.parse=function(s){var r=null;if(!s){return null;}
if(s instanceof Date){return s;}
try{r=$D.Grammar.start.call({},s.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"));}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};$D.getParseFunction=function(fx){var fn=$D.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
return((r[1].length===0)?r[0]:null);};};$D.parseExact=function(s,fx){return $D.getParseFunction(fx)(s);};}());var TimeSpan=function(days,hours,minutes,seconds,milliseconds){var attrs="days hours minutes seconds milliseconds".split(/\s+/);var gFn=function(attr){return function(){return this[attr];};};var sFn=function(attr){return function(val){this[attr]=val;return this;};};for(var i=0;i<attrs.length;i++){var $a=attrs[i],$b=$a.slice(0,1).toUpperCase()+$a.slice(1);TimeSpan.prototype[$a]=0;TimeSpan.prototype["get"+$b]=gFn($a);TimeSpan.prototype["set"+$b]=sFn($a);}
if(arguments.length==4){this.setDays(days);this.setHours(hours);this.setMinutes(minutes);this.setSeconds(seconds);}else if(arguments.length==5){this.setDays(days);this.setHours(hours);this.setMinutes(minutes);this.setSeconds(seconds);this.setMilliseconds(milliseconds);}else if(arguments.length==1&&typeof days=="number"){var orient=(days<0)?-1:+1;this.setMilliseconds(Math.abs(days));this.setDays(Math.floor(this.getMilliseconds()/86400000)*orient);this.setMilliseconds(this.getMilliseconds()%86400000);this.setHours(Math.floor(this.getMilliseconds()/3600000)*orient);this.setMilliseconds(this.getMilliseconds()%3600000);this.setMinutes(Math.floor(this.getMilliseconds()/60000)*orient);this.setMilliseconds(this.getMilliseconds()%60000);this.setSeconds(Math.floor(this.getMilliseconds()/1000)*orient);this.setMilliseconds(this.getMilliseconds()%1000);this.setMilliseconds(this.getMilliseconds()*orient);}
this.getTotalMilliseconds=function(){return(this.getDays()*86400000)+(this.getHours()*3600000)+(this.getMinutes()*60000)+(this.getSeconds()*1000);};this.compareTo=function(time){var t1=new Date(1970,1,1,this.getHours(),this.getMinutes(),this.getSeconds()),t2;if(time===null){t2=new Date(1970,1,1,0,0,0);}
else{t2=new Date(1970,1,1,time.getHours(),time.getMinutes(),time.getSeconds());}
return(t1<t2)?-1:(t1>t2)?1:0;};this.equals=function(time){return(this.compareTo(time)===0);};this.add=function(time){return(time===null)?this:this.addSeconds(time.getTotalMilliseconds()/1000);};this.subtract=function(time){return(time===null)?this:this.addSeconds(-time.getTotalMilliseconds()/1000);};this.addDays=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*86400000));};this.addHours=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*3600000));};this.addMinutes=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*60000));};this.addSeconds=function(n){return new TimeSpan(this.getTotalMilliseconds()+(n*1000));};this.addMilliseconds=function(n){return new TimeSpan(this.getTotalMilliseconds()+n);};this.get12HourHour=function(){return(this.getHours()>12)?this.getHours()-12:(this.getHours()===0)?12:this.getHours();};this.getDesignator=function(){return(this.getHours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;};this.toString=function(format){this._toString=function(){if(this.getDays()!==null&&this.getDays()>0){return this.getDays()+"."+this.getHours()+":"+this.p(this.getMinutes())+":"+this.p(this.getSeconds());}
else{return this.getHours()+":"+this.p(this.getMinutes())+":"+this.p(this.getSeconds());}};this.p=function(s){return(s.toString().length<2)?"0"+s:s;};var me=this;return format?format.replace(/dd?|HH?|hh?|mm?|ss?|tt?/g,function(format){switch(format){case"d":return me.getDays();case"dd":return me.p(me.getDays());case"H":return me.getHours();case"HH":return me.p(me.getHours());case"h":return me.get12HourHour();case"hh":return me.p(me.get12HourHour());case"m":return me.getMinutes();case"mm":return me.p(me.getMinutes());case"s":return me.getSeconds();case"ss":return me.p(me.getSeconds());case"t":return((me.getHours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator).substring(0,1);case"tt":return(me.getHours()<12)?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;}}):this._toString();};return this;};Date.prototype.getTimeOfDay=function(){return new TimeSpan(0,this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds());};var TimePeriod=function(years,months,days,hours,minutes,seconds,milliseconds){var attrs="years months days hours minutes seconds milliseconds".split(/\s+/);var gFn=function(attr){return function(){return this[attr];};};var sFn=function(attr){return function(val){this[attr]=val;return this;};};for(var i=0;i<attrs.length;i++){var $a=attrs[i],$b=$a.slice(0,1).toUpperCase()+$a.slice(1);TimePeriod.prototype[$a]=0;TimePeriod.prototype["get"+$b]=gFn($a);TimePeriod.prototype["set"+$b]=sFn($a);}
if(arguments.length==7){this.years=years;this.months=months;this.setDays(days);this.setHours(hours);this.setMinutes(minutes);this.setSeconds(seconds);this.setMilliseconds(milliseconds);}else if(arguments.length==2&&arguments[0]instanceof Date&&arguments[1]instanceof Date){var d1=years.clone();var d2=months.clone();var temp=d1.clone();var orient=(d1>d2)?-1:+1;this.years=d2.getFullYear()-d1.getFullYear();temp.addYears(this.years);if(orient==+1){if(temp>d2){if(this.years!==0){this.years--;}}}else{if(temp<d2){if(this.years!==0){this.years++;}}}
d1.addYears(this.years);if(orient==+1){while(d1<d2&&d1.clone().addDays(Date.getDaysInMonth(d1.getYear(),d1.getMonth()))<d2){d1.addMonths(1);this.months++;}}
else{while(d1>d2&&d1.clone().addDays(-d1.getDaysInMonth())>d2){d1.addMonths(-1);this.months--;}}
var diff=d2-d1;if(diff!==0){var ts=new TimeSpan(diff);this.setDays(ts.getDays());this.setHours(ts.getHours());this.setMinutes(ts.getMinutes());this.setSeconds(ts.getSeconds());this.setMilliseconds(ts.getMilliseconds());}}
return this;};var response_commands={};var commands={};var parser_prototype={_initializeOn:'mouseover',command:null,nodeElement:null,element:null,nodeId:null,_initBase:function(){this.messages={};this.urls={};},setMsg:function(key,msg){this.messages[key]=msg;},setUrl:function(key,url){this.urls[key]=url;},init:function(){return;},isAttrBased:function(){var attr=this.element.attr('data-status');return typeof attr!=='undefined'&&attr!==false;},getStatus:function(){if(this.isAttrBased()){return this.element.attr("data-status");}
return this.element.hasClass('on')?'on':'off';},setStatus:function(status){if(this.isAttrBased()){this.element.attr("data-status",status);return;}
status=='on'?this.element.addClass('on'):this.element.removeClass('on');},switchStatus:function(){this.setStatus(this.getStatus()=="on"?'off':'on');},getUrlSkeleton:function(name){return this.urls[name]!=undefined?this.urls[name]:false;},getParsedUrl:function(name){var urlSkeleton=this.getUrlSkeleton(name);if(urlSkeleton){return urlSkeleton.replace(new RegExp('%25ID%25','g'),this.nodeId);}
return null;},getUrl:function(){var url=this.getParsedUrl('click.'+this.getStatus());if(!url){url=this.getParsedUrl('click');}
if(!url){url=this.getParsedUrl('click.off');}
if(url){return url;}
url=this.element.attr('href');return url?url:false;},getMessage:function(name){return this.messages[name]!=undefined?this.messages[name]:null;},getTitle:function(){var title=this.getMessage('title.'+this.getStatus());if(title==null){title=this.getMessage('title');}
return title;},getLinkText:function(){var text=this.getMessage('linkText.'+this.getStatus());if(text==null){text=this.getMessage('linkText');}
return text;},updateTitle:function(){var title=this.getTitle();if(title!=null){this.element.attr('title',title);}},updateLinkText:function(){var text=this.getLinkText();if(text!=null){this.element.html(text);}},executeRequest:function(data,evt){var thiz=this;try{var rUrl=this.getUrl();if(thiz.element.attr('data-process')=='process')return;if(rUrl){var parser=this;var response_type=this.getResponseType().toLowerCase();var opts={url:rUrl,cache:false,beforeSend:function(){thiz.element.attr('data-process','process');},success:function(data){thiz.element.attr('data-process','no');parser.onSuccess(data,evt);parser.onCompleted(true,evt);},error:function(request,status,error){thiz.element.attr('data-process','no');var data=request.responseText;if(response_type=='json'){try{data=$.parseJSON(data);}catch(e){console.log(e);}}
parser.onFailure(data,request.status,status,evt);parser.onCompleted(false,evt);},type:this.getRequestMethod().toUpperCase(),dataType:response_type,traditional:true};if(data){opts.data=data;}
$.ajax(opts);}}catch(e){console.error(e);}},execute:function(evt){this.executeRequest(this.getRequestData(),evt);},onSuccess:function(data,evt){return;},onCompleted:function(success,evt){if(success){this.switchStatus();this.updateTitle();this.updateLinkText();}},onFailure:function(data,status,error,evt){if(data.errors!=undefined&&data.errors.message!=undefined){this.alert(evt,data.errors.message);}},getRequestMethod:function(){return'POST';},getResponseType:function(){return'json';},getRequestData:function(){return this.element.dataAttributes();},confirm:function(evt,title,msg){var parser=this;commandUtils.showConfirmation(evt,title,msg,function(){parser.executeRequest(parser.getRequestData(),evt);})},alert:function(evt,msg){var parser=this;commandUtils.showMessage(evt,msg);},dialog:function(evt,dialogId,context,title){var parser=this;commandUtils.showPrompt(evt,dialogId,context?context:this.messages,{title:title,onOk:function(data){parser.executeRequest(data);}});}};function create_object(o){function F(){}
F.prototype=o;return new F();}
function register_command(command,parser){var base=create_object(parser_prototype);base.command=command;if(parser){$.extend(base,parser);}
base._initBase();commands[command]=base;}
var commandUtils={getInputFile:function(input){var file;if(!window.FileReader){return null;}
if(!input.files){return null;}
if(!input.files[0]){return null;}
file=input.files[0];return file;},getHumanReadableSize:function(size,decimal){if(typeof decimal==="undefined"||decimal!==true){var bytes=1024;}else{var bytes=1000;}
var SizePrefixes=' KMGT';if(size<=0)return'0';var t2=Math.min(Math.floor(Math.log(size)/Math.log(bytes)),12);return(Math.round(size*10/Math.pow(bytes,t2))/10)+
SizePrefixes.charAt(t2).replace(' ','')+'B';},reloadPage:function(){window.location.href=window.location.href.replace(/#[^#]*$/,'');},getScript:function(url,success){if(url.constructor==Array){function run(i){if(i<url.length){commandUtils.getScript(url[i],function(){run(++i);});}else{if(success){success();}}}
run(0);}
var script=document.createElement('script');script.src=url;var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;if(success){success();}
script.onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);},getStyle:function(url){if(url.constructor==Array){for(var i=0;i<url.length;i++){commandUtils.getStyle(url[i]);}}
var style=document.createElement('link');style.type='text/css';style.rel='stylesheet';style.href=url;style.media='screen';document.getElementsByTagName('head')[0].appendChild(style);},loadExtraScript:function(extra,callback){if(extra.css){commandUtils.getStyle(extra.css);}
if(extra.js){commandUtils.getScript(extra.js,callback);}},preloadImage:function(src,success){var img=document.createElement('img');img.src=src;$(img).hide();var body=document.getElementsByTagName('body')[0],done=false;img.onload=img.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;if(success){success();}
img.onload=img.onreadystatechange=null;body.removeChild(img);}};body.appendChild(img);},findNodeElement:function($el){var nodeId=$($el.parents("*[nodeId]").get(0)).attr("nodeId");var $with_nodeId=$el.parents("*[nodeId="+nodeId+"]");if($with_nodeId.length>0){return $($with_nodeId.get($with_nodeId.length-1));}
return null;},findCommand:function(nodeId,commandName){return $('*[nodeId='+nodeId+'] *[command='+commandName+']');},extractCommand:function($el){var parser=$el.data('command_parser');if(!parser){var command=$el.attr('command');if(commands[command]!=undefined){parser=create_object(commands[command]);parser.element=$el;var $node_el=this.findNodeElement($el);if($node_el!=null){parser.nodeElement=$node_el;parser.nodeId=$node_el.attr('nodeId');}
parser.init();$el.data('command_parser',parser);}}
return parser;},findAndExtractCommand:function(nodeId,commandName){return this.extractCommand(this.findCommand(nodeId,commandName));},_initializeLablesOnCommands:function($commnads){$commnads.each(function(){var parser=commandUtils.extractCommand($(this));if(parser){parser.updateTitle();parser.updateLinkText();}});},initializeLabels:function(){this._initializeLablesOnCommands($("*[command]"));},initializeLabelsOnElement:function($element){this._initializeLablesOnCommands($element.find("*[command]"));},updatePostScore:function(id,newScore,hideOnZero){var $score_box=$('#post-'+id+'-score');var $score_box_wrapper=$('#post-'+id+'-score-wrapper');$score_box.html(newScore);if($score_box_wrapper.length===1){if(newScore===1&&!$score_box_wrapper.hasClass("votes")){$score_box.parent().html($score_box).prepend("<i class='icon-thumbs-up'></i> ");}
if(newScore===0){$score_box.removeClass("positive");$score_box.removeClass("negative");$score_box_wrapper.removeClass("positive");$score_box_wrapper.removeClass("negative");}else if(newScore>0){$score_box.removeClass("negative");$score_box.addClass("positive");$score_box_wrapper.removeClass("negative");$score_box_wrapper.addClass("positive");}else{$score_box.removeClass("positive");$score_box.addClass("negative");$score_box_wrapper.removeClass("positive");$score_box_wrapper.addClass("negative");}}},startCommand:function(){$('body').append($('<div id="command-loader"></div>'));running=true;},endCommand:function(success){if(success){$('#command-loader').addClass('success');$('#command-loader').fadeOut("slow",function(){$('#command-loader').remove();running=false;});}else{$('#command-loader').remove();running=false;}},renderTemplate:function(id,context){$.extend(context,pageContext);return $('#'+id).tmpl(context);},renderTemplateSource:function(src,context){$.extend(context,pageContext);return $.tmpl(src,context);},closeDialogFunction:function($diag){return function(){$diag.dialog("close");}},dialogSkeleton:function(options){return{type:'src',value:'<div class="${extraClass}" style="display: none;"><div>${content}</div></div>'}},renderDialog:function($dialog,options){var ui_options={draggable:false,modal:true,width:options.dim.w>200?'auto':200,height:'auto',position:'center'};if(options.ui_options){$.extend(true,ui_options,options.ui_options);}
if(!ui_options.buttons){ui_options.buttons={};}
if(options.title!=undefined){ui_options.title=options.title;}
var closeFunction=this.closeDialogFunction($dialog);if(options.show_yes){ui_options.buttons[options.yes_text]=function(){options.yes_callback($dialog,closeFunction);}}
if(options.show_no){ui_options.buttons[options.no_text]=closeFunction;}
ui_options.closeText="X";return{element:$dialog,display:function(){$dialog.css('visibility','visible');$dialog.dialog(ui_options);}};},closeDialogFunction:function($diag){return function(){$diag.modal("hide");};},getModalBody:function(){var $body=$(document.createElement('DIV'));$body.addClass('modal-body');return $body;},getModalNode:function(extra_class){var $modal=$(document.createElement('DIV'));$modal.addClass('modal');if(extra_class){$modal.addClass(extra_class);}
return $modal;},getModalHeader:function(titleText){var $header=$(document.createElement('DIV'));$header.addClass('modal-header');var $close=$(document.createElement('BUTTON'));$close.addClass('close');$close.attr({'type':'button','data-dismiss':'modal','aria-hidden':'true'});$close.html('&times;');$header.append($close);$title=$(document.createElement('H3'));if(titleText){$title.text(titleText);}
$header.append($title);return $header;},getModalFooter:function(yesText,noText,yesCallback,$modal,noCallback){var $footer=$(document.createElement('DIV'));$footer.addClass('modal-footer');if(noText){var $noButton=$(document.createElement('A'));$noButton.attr('href','#');$noButton.attr('data-dismiss','modal');$noButton.attr('aria-hidden','true');$noButton.addClass('btn');$noButton.text(noText);$footer.append($noButton);if(typeof noCallback==='function'){$noButton.on('click',function(event){event.preventDefault();noCallback($modal,commandUtils.closeDialogFunction($modal));});$modal.modal('hide');}}
if(yesText){var $yesButton=$(document.createElement('A'));$yesButton.attr('href','#');$yesButton.addClass('btn btn-primary');$yesButton.text(yesText);if(typeof yesCallback==='function'){$yesButton.on('click',function(event){event.preventDefault();yesCallback($modal,commandUtils.closeDialogFunction($modal));});$modal.modal('hide');}
$footer.append($yesButton);}
return $footer;},showDialog:function(extern){var options={title:'',extra_class:'',yes_text:pageContext.i18n.ok,show_yes:true,yes_callback:function(){},no_text:pageContext.i18n.cancel,show_no:false};$.extend(true,options,extern);$.extend(options,pageContext);var $modal=this.getModalNode(options.extra_class);$modal.close=this.closeDialogFunction($modal);if(options.title){$modal.append(this.getModalHeader(options.title));}
var $dialog=this.getModalBody();$dialog.append(options.nodes);$modal.append($dialog);if(options.show_no||options.show_yes){if(!options.show_yes)options.yes_text=false;if(!options.show_no)options.no_text=false;$modal.append(this.getModalFooter(options.yes_text,options.no_text,options.yes_callback,$modal,options.no_callback));}
if(options.beforeShow&&typeof options.beforeShow==='function'){options.beforeShow($modal);}
$modal.modal('show');if(options.onAfterShow&&typeof options.onAfterShow==='function'){options.onAfterShow($modal);}
return $modal;},getDialogNodes:function(options,defFunc,baseContext){if(options.tpl){var context=options.context?options.context:(options.dialogContext?options.dialogContext:{});if(options.context){context=options.context;}
$.extend(context,baseContext);return commandUtils.renderTemplate(options.tpl,context);}else if(options.nodes){return options.nodes;}else{if(options.autorizeContext){return defFunc(options.authorizeContext.image);}else{return defFunc(false);}}},uploadTrackers:0,createUploadTracker:function(authorizeUrl,authorizeContext,callbacks){this.uploadTrackers+=1;var tracker=$(document.createElement('div')),bar=$(document.createElement('div'));tracker.addClass('progress');bar.addClass('bar');tracker.append(bar);var trackerId="uploadTracker"+this.uploadTrackers;bar.attr("id",trackerId);var errors=0;function track(trackingId){$.ajax({type:'POST',url:pageContext.url.uploadProgress,data:{'trackingId':trackingId},success:function(data){if(data.success){var bar=$('#'+trackerId);bar.html(data.result.progress+'%');bar.css("width",data.result.progress+'%');if(!data.result.complete){track(trackingId);}else{if(callbacks.onSuccess){callbacks.onSuccess(data);}}}else{errors++;if(errors>3&&callbacks.onError){callbacks.onError(data);}else{track(trackingId);}}},dataType:'json',traditional:true});}
$.ajax({type:'POST',url:authorizeUrl,data:authorizeContext,success:function(data){if(data.success){callbacks.onAuthorize(true,data.result.trackingId);track(data.result.trackingId);}else{callbacks.onAuthorize(false,(data.errors&&data.errors.error)?data.errors.error:"unauthorized");}},dataType:'json',traditional:true});return tracker;},createUploadDialogNodes:function(isImage){var NON_MATCHED_TYPES=["application/octet-stream","text/plain"];var getAcceptTypesForExtension=function(extension){var mimeTypes=$.grep(jsmime.getMimesByExt(extension),function(value){return NON_MATCHED_TYPES.indexOf(value)==-1;});if(mimeTypes.length!=0){return mimeTypes;}
return['.'+extension];};var $nodes=$('<div></div>');var $urlInput=$('<span><h3></h3></span>');$nodes.append($urlInput);var $form=$('<form enctype="multipart/form-data" method="POST" target="uploaderFrame"></form>');var authorizedTypes=isImage?authorizedImageTypes:authorizedFileTypes;var authorizedMimeTypes=[];for(var i=0;i<authorizedTypes.length;i++){var acceptTypes=getAcceptTypesForExtension(authorizedTypes[i]);authorizedMimeTypes=authorizedMimeTypes.concat(acceptTypes);}
$form.append($('<input type="file" name="file"/>'));$nodes.append($form);var $progressContainer=$('<span id="uploadProgressContainer"></span>');$nodes.append($progressContainer);return $nodes;},showUploadDialog:function(evt,options){var doptions={nodes:commandUtils.getDialogNodes(options,commandUtils.createUploadDialogNodes,pageContext.i18n.uploadDialog),title:pageContext.i18n.uploadDialog.uploadFile,yes_text:pageContext.i18n.uploadDialog.doUpload,show_no:true};var $progressContainer=doptions.nodes.find(options.progressContainer?options.progressContainer:"#uploadProgressContainer");var $form=doptions.nodes.find('form');var isUploading=false;var $input=$form.find("input[type=file]");var fileIsOk=false;var fileInProgress=false;var cancelUpload=function(){console.log("cancelable");if(isUploading){try{window.stop();}catch(e){document.execCommand('Stop');}}};$input.change(function(){var file=commandUtils.getInputFile($input[0]);if(file!=null){$uploadButton=$('.modal.in .modal-footer .btn-primary');$('.modal.in .modal-header .close').on('click',cancelUpload);$uploadButton.removeClass('disabled');fileIsOk=true;$form.find(".alert").remove();if(file.size>pageContext.attachments.maxSizeBytes){$uploadButton.addClass('disabled');fileIsOk=false;$input.after("<div class='alert alert-warning'>"+pageContext.i18n.uploadDialog.fileTooBig.replace("$size",commandUtils.getHumanReadableSize(pageContext.attachments.maxSizeBytes,true))+"</div>");}
var extension=file.name.toLowerCase().split('.').pop();if(extension=="gz"){var fileParts=file.name.toLowerCase().split('.');if(fileParts.length>2&&fileParts[fileParts.length-2]=="tar"){extension="tar.gz";}}
if(((options.authorizeContext&&options.authorizeContext.image)?authorizedImageTypes:authorizedFileTypes).indexOf(extension)===-1){$uploadButton.addClass('disabled');fileIsOk=false;$input.after("<div class='alert alert-warning'>"+(options.authorizeContext.image?pageContext.i18n.uploadDialog.invalidImageType:pageContext.i18n.uploadDialog.invalidAttachmentType)+"</div>");}}});var actions={dialog:null,close:null,authorizeAndStart:function(){var trackingId=null;var $tracker=commandUtils.createUploadTracker(options.authorizeUrl,options.authorizeContext,{onAuthorize:function(authorized,msg){if(authorized){trackingId=msg;$form.attr('action',pageContext.url.uploadFile+'?trackingId='+msg);var $frame=$('<iframe name="uploaderFrame" style="display: none;"></iframe>');$progressContainer.after($frame);$form.submit();}else{actions.close();commandUtils.showMessage(evt,msg);}},onSuccess:function(data){function done(){if(options.onSuccess){options.onSuccess(trackingId,data.result);actions.close();}}
if(data.result.isImage&&(options.disableCrop==undefined||!options.disableCrop)){var previewOptions=options.previewDialogOptions?options.previewDialogOptions:{};previewOptions.fileData=data.result;if(previewOptions.beforeShow){var oldBeforeShow=options.beforeShow;previewOptions.beforeShow=function($dialog){actions.close();oldBeforeShow($dialog);}}else{previewOptions.beforeShow=function(){actions.close();}}
previewOptions.onSuccess=function(){done();}
commandUtils.showPreviewAndCropDialog(evt,previewOptions);}else{done();}},onError:function(data){if(options.onError){options.onError();}
if(data.errors&&data.errors.error){actions.close();commandUtils.showMessage(evt,data.errors.error);}}});if(!isUploading){$progressContainer.append($tracker);isUploading=true;}}};if(options.override_yes_callback){doptions.yes_callback=function($dialog,close){options.override_yes_callback($dialog,close,actions);};}else{doptions.yes_callback=function($dialog,close){if(!fileIsOk||isUploading)return;actions.close=close;actions.dialog=$dialog;$uploadButton=$('.modal.in .modal-footer .btn-primary');$uploadButton.addClass('disabled');if(options.yes_callback){options.yes_callback($dialog,close,actions);}else{actions.authorizeAndStart();}};}
doptions.no_callback=function($dialog,close){cancelUpload();actions.close=close;actions.dialog=$dialog;};if(options.dialogContext){$.extend(doptions,options.dialogContext);}
this.showDialog(doptions);},createPreviewAndCropDialogNodes:function(){var $nodes=$('<div></div>');var $table=$('<table>'+'<tr><td style="padding: 5px; border: 1px solid black;">'+'<img class="previewEditor" style="max-width: 500px; max-height: 500px;" src="" />'+'</td>'+'</tr></table>');$nodes.append($table);return $nodes;},jcropLoaded:false,showPreviewAndCropDialog:function(evt,options){var doptions={nodes:commandUtils.getDialogNodes(options,commandUtils.createPreviewAndCropDialogNodes,pageContext.i18n.previewAndCropDialog),title:pageContext.i18n.previewAndCropDialog.previewAndResize,yes_text:pageContext.i18n.previewAndCropDialog.accept,show_no:true};var $imageEditor=doptions.nodes.find(options.editor?options.editor:'.previewEditor');var $imagePreview=doptions.nodes.find(options.preview?options.preview:'.finalPreview');var data={'file':options.fileData.fileId,x:0,y:0,w:0,h:0};function showPreview(coords){var rx=100/coords.w;var ry=100/coords.h;$imagePreview.css({width:Math.round(rx*500)+'px',height:Math.round(ry*500)+'px',marginLeft:'-'+Math.round(rx*coords.x)+'px',marginTop:'-'+Math.round(ry*coords.y)+'px'});data.x=coords.x;data.y=coords.y;data.w=coords.w;data.h=coords.h;}
doptions.yes_callback=function($dialog,close){data.refWidth=$imageEditor.width();data.refHeight=$imageEditor.height();$.ajax({type:'POST',url:pageContext.url.cropUpload,data:data,success:function(data){if(data.success){close();if(data.result.newSize){options.fileData.size=data.result.newSize;}
if(options.onSuccess){options.onSuccess();}}else{if(data.errors&&data.errors.image){close();commandUtils.showMessage(evt,data.errors.image);}}},dataType:'json'});};if(options){$.extend(options,doptions);doptions=options;}
var noCacheImageUrl=options.fileData.url+"?noCache="+(new Date().getTime()+""+Math.floor(Math.random()*1001));commandUtils.preloadImage(noCacheImageUrl,function(){$imageEditor.attr('src',noCacheImageUrl);$imagePreview.attr('src',noCacheImageUrl);commandUtils.showDialog(doptions);function setupEditor(){commandUtils.jcropLoaded=true;var jcropOptions={onChange:showPreview,onSelect:showPreview};if(options.forceSquare){jcropOptions.aspectRatio=1;}
$imageEditor.Jcrop(jcropOptions);}
if(!commandUtils.jcropLoaded){commandUtils.loadExtraScript(pageContext.extraScripts.jcrop,setupEditor);}else{setupEditor();}});},showMessage:function(evt,msg,callback,title){msg=msg.replace("\n","<br />");msg=msg.replace(new RegExp(pageContext.i18n.login,"ig"),'<a href="'+pageContext.url.login+'">'+pageContext.i18n.login+'</a>');msg=msg.replace(new RegExp(pageContext.i18n.register,"ig"),'<a href="'+pageContext.url.register+'">'+pageContext.i18n.register+'</a>');return this.showDialog({nodes:$('<span>'+msg+'</span>'),extra_class:'warning',event:evt,title:title,yes_callback:function($dialog,close){close();if(callback){callback();}},close_on_clickoutside:true});},showConfirmation:function(evt,title,msg,callback){return this.showDialog({event:evt,title:title?title:'',nodes:$('<center>'+(msg?msg:pageContext.i18n.confirm)+'</center>'),extra_class:'prompt',show_no:true,no_test:pageContext.i18n.no,yes_text:pageContext.i18n.yes,yes_callback:function($dialog,close){if(callback){callback();}
close();}});},showPrompt:function(evt,tpl,context,options){var doptions={nodes:commandUtils.renderTemplate(tpl,context),extra_class:'prompt',yes_callback:function($dialog,close){var data=commandUtils.extractFormData($dialog);var result=true;if(options.onOk!=undefined){result=options.onOk(data);}
if(result!==false){close();}},show_no:true};if(options){$.extend(options,doptions);}else{options=doptions;}
if(options.centered==undefined||!options.centered){options.event=evt;}
return this.showDialog(options);},extractFormData:function($el){var ret={};var data=null;if($el.is('form')){data=$el.serializeArray();}else{data=$el.find('form').serializeArray();}
for(var i=0;i<data.length;i++){if(ret[data[i].name]){var old=ret[data[i].name];if(old.constructor==Array){old.push(data[i].value);}else{var a=new Array();a.push(old);a.push(data[i].value);ret[data[i].name]=a;}}else{ret[data[i].name]=data[i].value;}}
return ret;},fillFormData:function($form,values){$form.find(':text, :password, :file, textarea').each(function(){var $input=$(this);$input.val(values[$input.attr('name')?$input.attr('name'):'']);});$form.find('input[type=radio], input[type=checkbox], option').each(function(){var $input=$(this);var name=this.tagName.toUpperCase()=='OPTION'?$input.parents('select').attr('name'):$input.attr('name');var value=values[name];if(value&&((value.constructor==Array&&$.inArray($input.val(),value)>=0)||(value==$input.val()))||(value===true)){$input.attr('checked','checked').attr('selected','selected');}else{$input.removeAttr('checked').removeAttr('selected');}});},friendlyDate:function(toParse,def){var dif=null;var date=null;var parsed=null;var now=Date.today().setTimeToNow();if(toParse.constructor==Date){date=toParse;}else{var negateServerOffset=false;var serverOffset=0;var splitted=toParse.split("+");if(splitted.length!=2){splitted=toParse.split("-");negateServerOffset=true;}
if(splitted.length==2){serverOffset=parseInt(splitted[1],10)/100;toParse=splitted[0];}
var viewerOffset=parseInt(new Date().getUTCOffset(),10)/100;if(negateServerOffset)serverOffset=(0-serverOffset);date=Date.parse(toParse).addHours(viewerOffset-serverOffset);}
dif=new TimeSpan(now-date);if(dif.getDays()>10||pageContext.useRelativeTime!=true){if(def){parsed=def;}else{if(dif.getDays()>=365){parsed=date.toString("MMM dd 'yy");}else{parsed=date.toString("MMM dd")}
parsed=parsed+" "+pageContext.i18n.timeAt+" "+date.toString("h:mm tt");}}else{if(dif.getDays()>1){parsed=dif.getDays()+' '+pageContext.i18n.days;}else if(dif.getDays()==1){parsed='1 '+pageContext.i18n.day;}else if(dif.getHours()>1){parsed=dif.getHours()+' '+pageContext.i18n.hours;}else if(dif.getHours()==1){parsed='1 '+pageContext.i18n.hour;}else if(dif.getMinutes()>1){parsed=dif.getMinutes()+' '+pageContext.i18n.minutes;}else if(dif.getMinutes()==1){parsed='1 '+pageContext.i18n.minute;}else if(dif.getSeconds()>1){parsed=dif.getSeconds()+' '+pageContext.i18n.seconds;}else if(dif.getSeconds()==1){parsed='1 '+pageContext.i18n.second;}else{parsed='0 '+pageContext.i18n.seconds;}
parsed=pageContext.i18n.timeAgo.replace('{0}',parsed);}
return parsed;},generateUploadTrackingCode:function(){return new Date().getTime()+""+Math.floor(Math.random()*1001)},decode:function(s){return decodeURIComponent(s.replace(/\+/g,' '));},decodeAndParse:function(s){var pluses=/\+/g;if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,'\\');}
s=this.decode(s);return s;},getCookie:function(key){var cookies=document.cookie.split('; ');var result=key?undefined:{};for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split('=');var name=this.decode(parts.shift());var cookie=parts.join('=');if(key&&key===name){result=this.decodeAndParse(cookie);break;}
if(!key){result[name]=this.decodeAndParse(cookie);}}
return result;},setCookie:function(key,value,options){if(!options){options={};}
if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}
value=""+value;return(document.cookie=[encodeURIComponent(key),'=',encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'; expires=-1',options.path?'; path='+options.path:': path=/',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));},escapeHtml:function(value){return $("<div>").text(value).html();}};$(function($){commandUtils.initializeLabels();$(document).on('click',"*[command]",function(evt){var parser=commandUtils.extractCommand($(this));if(parser){$('.context-menu-dropdown').slideUp('fast');parser.execute(evt);}
return false;});function checkFormsForCSRFToken(){$('form').each(function(){var $form=$(this);if($form.attr('method')&&$form.attr('method').toUpperCase()=='POST'&&$form.find('input[name=TH_CSRF]').length==0){$form.prepend('<input type="hidden" name="TH_CSRF" value="'+pageContext.additional.TH_CSRF+'" />');}});}
function startFormCheckTimeout(){window.setTimeout(function(){checkFormsForCSRFToken();startFormCheckTimeout();},1000);}
checkFormsForCSRFToken();startFormCheckTimeout();$(document).ajaxSend(function(elm,xhr,s){if(s.type&&s.type.toUpperCase()=="POST"){xhr.setRequestHeader('X-TH-CSRF',pageContext.additional.TH_CSRF);}});try{var jsSupportCookie=commandUtils.getCookie("TH_JS_SUPPORT");if(!jsSupportCookie){$.get(pageContext.url.trackJs);}}catch(e){console.log(e);}});(function($){$.fn.dataAttributes=function(){var attributes={};if(!this.length)
return this;$.each(this[0].attributes,function(index,attr){if(/^data\-/.test(attr.nodeName)){attributes[attr.nodeName.substr(5)]=attr.nodeValue;}});return attributes;}})(jQuery);if(typeof String.prototype.trim!=='function'){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');}}
(function($){$(document).on('autocompleteopen',".ui-autocomplete-input",function(){var autocomplete=$(this).data("uiAutocomplete"),menu=autocomplete.menu;if(!autocomplete.options.autoFocus){return;}
if(autocomplete.term!=$(this).val()){return;}
menu.options.blur=function(event,ui){return}
menu.activate($.Event({type:"mouseenter"}),menu.element.children().first());});}(jQuery));register_command('resendEmailValidation',{execute:function(evt){this.confirm(evt,pageContext.i18n.emailValidationPrompt,pageContext.i18n.emailValidationPromptBody);},onSuccess:function(data){commandUtils.showMessage(null,data.result.success);}});register_command('follow',{execute:function(evt){var parser=this;var follownodeid=this.element.attr("nodeId");if(follownodeid.indexOf("#")>-1){follownodeid=follownodeid.replace("#","%23");}
$.ajax({url:(this.element.hasClass("on")?pageContext.url.unfollow:pageContext.url.follow).replace("%7BobjId%7D",follownodeid).replace("%7Btype%7D",this.element.attr("data-node-type")),cache:false,success:function(data){parser.onSuccess(data,evt);},error:function(data){if(data.status==401){window.location=pageContext.url.login;}}})},onSuccess:function(data,evt){$this=$(evt.target);if($this.hasClass("on")){$this.removeClass("on");}else{$this.addClass("on");}
this.updateLinkText();},updateLinkText:function(){$("[command='follow']").each(function(){var $btn=$(this);if($btn.hasClass("on")){if($btn.hasClass("btn")){$btn.addClass("btn-info");$btn.mouseenter(function(){$btn.addClass("btn-danger");$btn.removeClass("btn-info");$btn.html(pageContext.i18n.unfollow);}).mouseleave(function(){$btn.removeClass("btn-danger");$btn.addClass("btn-info");$btn.html(pageContext.i18n.following);});$btn.html(pageContext.i18n.following);}else{$btn.html(pageContext.i18n.unfollow);}}else{if($btn.hasClass("btn")){$btn.removeClass("btn-info");$btn.removeClass("btn-danger");$btn.unbind("mouseenter");$btn.unbind("mouseleave");}
$btn.html("<i class='icon-plus'></i> "+pageContext.i18n.follow);}});}});register_command('deleteAllPosts',{execute:function(evt){this.confirm(evt,null);},onSuccess:function(data){commandUtils.showMessage(null,data.result.success);}});(function(a){a.fn.each2===void 0&&a.fn.extend({each2:function(b){for(var c=a([0]),d=-1,e=this.length;e>++d&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})})(jQuery),function(a,b){"use strict";function m(a,b){for(var c=0,d=b.length;d>c;c+=1)if(o(a,b[c]))return c;return-1}function n(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function o(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function p(b,c){var d,e,f;if(null===b||1>b.length)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function q(a){return a.outerWidth(!1)-a.width()}function r(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function s(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function t(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function u(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function v(a,b){var c=t(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){m(a.target,b.get())>=0&&c(a)})}function w(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function x(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function y(a){a.preventDefault(),a.stopPropagation()}function z(a){a.preventDefault(),a.stopImmediatePropagation()}function A(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function B(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(this))})),b.attr("class",f.join(" "))}function C(a,c,d,e){var f=a.toUpperCase().indexOf(c.toUpperCase()),g=c.length;return 0>f?(d.push(e(a)),b):(d.push(e(a.substring(0,f))),d.push("<span class='select2-match'>"),d.push(e(a.substring(f,f+g))),d.push("</span>"),d.push(e(a.substring(f+g,a.length))),b)}function D(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return(a+"").replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function E(c){var d,e=0,f=null,g=c.quietMillis||100,h=c.url,i=this;return function(j){window.clearTimeout(d),d=window.setTimeout(function(){e+=1;var d=e,g=c.data,k=h,l=c.transport||a.fn.select2.ajaxDefaults.transport,m={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},n=a.extend({},a.fn.select2.ajaxDefaults.params,m);g=g?g.call(i,j.term,j.page,j.context):null,k="function"==typeof k?k.call(i,j.term,j.page,j.context):k,f&&f.abort(),c.params&&(a.isFunction(c.params)?a.extend(n,c.params.call(i)):a.extend(n,c.params)),a.extend(n,{url:k,dataType:c.dataType,data:g,success:function(a){if(!(e>d)){var b=c.results(a,j.page);j.callback(b)}}}),f=l.call(i,n)},g)}}function F(c){var e,f,d=c,g=function(a){return""+a.text};a.isArray(d)&&(f=d,d={results:f}),a.isFunction(d)===!1&&(f=d,d=function(){return f});var h=d();return h.text&&(g=h.text,a.isFunction(g)||(e=h.text,g=function(a){return a[e]})),function(c){var h,e=c.term,f={results:[]};return""===e?(c.callback(d()),b):(h=function(b,d){var f,i;if(b=b[0],b.children){f={};for(i in b)b.hasOwnProperty(i)&&(f[i]=b[i]);f.children=[],a(b.children).each2(function(a,b){h(b,f.children)}),(f.children.length||c.matcher(e,g(f),b))&&d.push(f)}else c.matcher(e,g(b),b)&&d.push(b)},a(d().results).each2(function(a,b){h(b,f.results)}),c.callback(f),b)}}function G(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function H(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw Error(c+" must be a function or a falsy value")}function I(b){return a.isFunction(b)?b():b}function J(b){var c=0;return a.each(b,function(a,b){b.children?c+=J(b.children):c++}),c}function K(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||1>e.tokenSeparators.length)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(o(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:b}function L(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>";j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=L(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,h,i,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=u(function(){return c.element.closest("body")}),B(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.css(I(c.containerCss)),this.container.addClass(I(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),this.dropdown.addClass(I(c.dropdownCssClass)),this.dropdown.data("select2",this),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.resultsPage=0,this.context=null,this.initContainer(),s(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),v(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),y(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),y(a))}),r(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||n(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus()},destroy:function(){var a=this.opts.element,c=a.data("select2");this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:o(a.attr("locked"),"locked")||o(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:b},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var g,l=this.opts.id;g=function(d,e,i){var j,k,m,n,o,p,q,r,s,t;for(d=c.sortResults(d,e,f),j=0,k=d.length;k>j;j+=1)m=d[j],o=m.disabled===!0,n=!o&&l(m)!==b,p=m.children&&m.children.length>0,q=a("<li></li>"),q.addClass("select2-results-dept-"+i),q.addClass("select2-result"),q.addClass(n?"select2-result-selectable":"select2-result-unselectable"),o&&q.addClass("select2-disabled"),p&&q.addClass("select2-result-with-children"),q.addClass(h.opts.formatResultCssClass(m)),r=a(document.createElement("div")),r.addClass("select2-result-label"),t=c.formatResult(m,r,f,h.opts.escapeMarkup),t!==b&&r.html(t),q.append(r),p&&(s=a("<ul></ul>"),s.addClass("select2-result-sub"),g(m.children,s,i+1),q.append(s)),q.data("select2-data",m),e.append(q)},g(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,i,c={results:[],more:!1},e=a.term;i=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(h.optionToData(b)):b.is("optgroup")&&(d=h.optionToData(b),b.children().each2(function(a,b){i(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){i(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id},c.formatResultCssClass=function(a){return a.css}):"query"in c||("ajax"in c?(g=c.element.data("ajax-url"),g&&g.length>0&&(c.ajax.url=g),c.query=E.call(c.element,c.ajax)):"data"in c?c.query=F(c.data):"tags"in c&&(c.query=G(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(a){return{id:a,text:a}}),c.initSelection===b&&(c.initSelection=function(d,e){var f=[];a(p(d.val(),c.separator)).each(function(){var d=this,e=this,g=c.tags;a.isFunction(g)&&(g=g()),a(g).each(function(){return o(this.id,d)?(e=this.text,!1):b}),f.push({id:d,text:e})}),e(f)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");return c},monitorSource:function(){var c,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var d,f=a.prop("disabled");f===b&&(f=!1),this.enable(!f);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),B(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(I(this.opts.containerCssClass)),B(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(I(this.opts.dropdownCssClass))}),a.on("propertychange.select2 DOMAttrModified.select2",c),this.mutationCallback===b&&(this.mutationCallback=function(a){a.forEach(c)}),"undefined"!=typeof WebKitMutationObserver&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new WebKitMutationObserver(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){return a===b&&(a=!0),this._enabled===a?!1:(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface(),!0)},readonly:function(a){return a===b&&(a=!1),this._readonly===a?!1:(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var q,r,s,t,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window).scrollLeft()+a(window).width(),h=a(window).scrollTop()+a(window).height(),i=c.top+d,j=c.left,l=h>=i+f,m=c.top-f>=this.body().scrollTop(),n=b.outerWidth(!1),o=g>=j+n,p=b.hasClass("select2-drop-above");this.opts.dropdownAutoWidth?(t=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),n=b.outerWidth(!1)+(t.scrollHeight===t.clientHeight?0:k.width),n>e?e=n:n=e,o=g>=j+n):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(q=this.body().offset(),i-=q.top,j-=q.left),p?(r=!0,!m&&l&&(r=!1)):(r=!1,!l&&m&&(r=!0)),o||(j=c.left+e-n),r?(i=c.top-f,this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),s=a.extend({top:i,left:j,width:e},I(this.opts.dropdownCss)),b.css(s)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){function i(){return{width:Math.max(document.documentElement.scrollWidth,a(window).width()),height:Math.max(document.documentElement.scrollHeight,a(window).height())}}var f,g,b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),f=a("#select2-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body()),f.on("mousedown touchstart click",function(b){var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),g=i(),f.css(g).show(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var h=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){var c=i();a("#select2-drop-mask").css(c),h.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return I(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var d,e,f,g,h,i,j,c=this.results;if(e=this.highlight(),!(0>e)){if(0==e)return c.scrollTop(0),b;d=this.findHighlightableChoices().find(".select2-result-label"),f=a(d[e]),g=f.offset().top+f.outerHeight(!0),e===d.length-1&&(j=c.find("li.select2-more-results"),j.length>0&&(g=j.offset().top+j.outerHeight(!0))),h=c.offset().top+c.outerHeight(!0),g>h&&c.scrollTop(c.scrollTop()+(g-h)),i=f.offset().top-c.offset().top,0>i&&"none"!=f.css("display")&&c.scrollTop(c.scrollTop()+i)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-selected):not(.select2-disabled)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&c.length>d;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(c){var e,f,d=this.findHighlightableChoices();return 0===arguments.length?m(d.filter(".select2-highlighted")[0],d.get()):(c>=d.length&&(c=d.length-1),0>c&&(c=0),this.results.find(".select2-highlighted").removeClass("select2-highlighted"),e=a(d[c]),e.addClass("select2-highlighted"),this.ensureHighlightVisible(),f=e.data("select2-data"),f&&this.opts.element.trigger({type:"select2-highlight",val:this.id(f),choice:f}),b)},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),e=this.resultsPage+1,f=this,g=this.search.val(),h=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),this.opts.loadMorePadding>=c&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:g,page:e,context:h,matcher:this.opts.matcher,callback:this.bind(function(c){f.opened()&&(f.opts.populateResults.call(this,a,c.results,{term:g,page:e,context:h}),f.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(f.opts.formatLoadMore(e+1)),window.setTimeout(function(){f.loadMoreIfNeeded()},10)):b.remove(),f.positionDropdown(),f.resultsPage=e,f.context=c.context)})})))},tokenize:function(){},updateResults:function(c){function l(){d.removeClass("select2-active"),h.positionDropdown()}function m(a){e.html(a),l()}var g,i,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!o(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){var n=this.getMaximumSelectionSize();if(n>=1&&(g=this.data(),a.isArray(g)&&g.length>=n&&H(f.formatSelectionTooBig,"formatSelectionTooBig")))return m("<li class='select2-selection-limit'>"+f.formatSelectionTooBig(n)+"</li>"),b;if(d.val().length<f.minimumInputLength)return H(f.formatInputTooShort,"formatInputTooShort")?m("<li class='select2-no-results'>"+f.formatInputTooShort(d.val(),f.minimumInputLength)+"</li>"):m(""),c&&this.showSearch&&this.showSearch(!0),b;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return H(f.formatInputTooLong,"formatInputTooLong")?m("<li class='select2-no-results'>"+f.formatInputTooLong(d.val(),f.maximumInputLength)+"</li>"):m(""),b;f.formatSearching&&0===this.findHighlightableChoices().length&&m("<li class='select2-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2-active"),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;return this.opened()?(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return o(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&H(f.formatNoMatches,"formatNoMatches")?(m("<li class='select2-no-results'>"+f.formatNoMatches(d.val())+"</li>"),b):(e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&H(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),l(),this.opts.element.trigger({type:"select2-loaded",items:g}),b)):(this.search.removeClass("select2-active"),b)})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){w(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children().first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(e=d[f].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=L(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>","   <span class='select2-chosen'>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>","   <span class='select2-arrow'><b></b></span>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>","   <div class='select2-search'>","       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>","   </div>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var b,c,d;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),b=this.search.get(0),b.createTextRange?(c=b.createTextRange(),c.collapse(!1),c.select()):b.setSelectionRange&&(d=this.search.val().length,b.setSelectionRange(d,d)),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},initContainer:function(){var d,e=this.container,f=this.dropdown;0>this.opts.minimumResultsForSearch?this.showSearch(!1):this.showSearch(!0),this.selection=d=e.find(".select2-choice"),this.focusser=e.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return y(a),b;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),y(a),b;case c.ENTER:return this.selectHighlighted(),y(a),b;case c.TAB:return this.selectHighlighted({noFocus:!0}),b;case c.ESC:return this.cancel(a),y(a),b}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return y(a),b;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),y(a),b}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),y(a),b):b}})),r(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),d.on("mousedown","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),z(a),this.close(),this.selection.focus())})),d.on("mousedown",this.bind(function(b){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),y(b)})),f.on("mousedown",this.bind(function(){this.search.focus()})),d.on("focus",this.bind(function(a){y(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(a){var b=this.selection.data("select2-data");if(b){var c=this.getPlaceholderOption();this.opts.element.val(c?c.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),a!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(b),choice:b}),this.triggerChange({removed:b}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection([]),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var a;return(a=this.getPlaceholderOption())!==b&&a.is(":selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find(":selected");b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=o(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,c,d){var e=0,f=this;if(this.findHighlightableChoices().each2(function(a,c){return o(f.id(c.data("select2-data")),f.opts.element.val())?(e=a,!1):b}),d!==!1&&(c===!0&&e>=0?this.highlight(e):this.highlight(0)),c===!0){var h=this.opts.minimumResultsForSearch;h>=0&&this.showSearch(J(a.results)>=h)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.close(),b&&b.noFocus||this.selection.focus(),o(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),d=this.opts.formatSelection(a,c,this.opts.escapeMarkup),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find(":selected").each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),b;if(this.opts.initSelection===b)throw Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a,c){var d;return 0===arguments.length?(d=this.selection.data("select2-data"),d==b&&(d=null),d):(a&&""!==a?(d=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),c&&this.triggerChange({added:a,removed:d})):this.clear(c),b)}}),f=L(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>","  <li class='select2-search-field'>","    <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find(":selected").each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=p(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return o(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;e.length>c;c++)for(var g=e[c],h=0;f.length>h;h++){var i=f[h];if(o(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},initContainer:function(){var e,d=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=e=this.container.find(d);var f=this;this.selection.on("mousedown",".select2-search-choice",function(){f.search[0].focus(),f.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var d=e.find(".select2-search-choice-focus"),f=d.prev(".select2-search-choice:not(.select2-locked)"),g=d.next(".select2-search-choice:not(.select2-locked)"),h=x(this.search);if(d.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var i=d;return a.which==c.LEFT&&f.length?i=f:a.which==c.RIGHT?i=g.length?g:null:a.which===c.BACKSPACE?(this.unselect(d.first()),this.search.width(10),i=f.length?f:g):a.which==c.DELETE?(this.unselect(d.first()),this.search.width(10),i=g.length?g:null):a.which==c.ENTER&&(i=null),this.selectChoice(i),y(a),i&&i.length||this.open(),b}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==h.offset&&!h.length)return this.selectChoice(e.find(".select2-search-choice:not(.select2-locked)").last()),y(a),b;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),y(a),b;case c.ENTER:return this.selectHighlighted(),y(a),b;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),b;case c.ESC:return this.cancel(a),y(a),b}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&y(a),a.which===c.ENTER&&y(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",d,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",d,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){0>m(e.id(this),c)&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'>    <div></div>    <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",y).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),y(b))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(a){var c,d,b=this.getVal();if(a=a.closest(".select2-search-choice"),0===a.length)throw"Invalid argument: "+a+". Must be .select2-search-choice";c=a.data("select2-data"),c&&(d=m(this.id(c),b),d>=0&&(b.splice(d,1),this.setVal(b),this.select&&this.postprocessResults()),a.remove(),this.opts.element.trigger({type:"removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));m(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&H(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+g.opts.formatNoMatches(g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-q(this.search)},resizeSearch:function(){var a,b,c,d,e,f=q(this.search);a=A(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(e)},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),p(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){0>m(this,c)&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;b.length>c;c++)for(var d=0;a.length>d;d++)o(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),b;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(this.buildChangeDetails(e,this.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(c,d){var f,g,e=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(g=this.data(),c||(c=[]),f=a.map(c,function(a){return e.opts.id(a)}),this.setVal(f),this.updateSelection(c),this.clearSearch(),d&&this.triggerChange(this.buildChangeDetails(g,this.data())),b)}}),a.fn.select2=function(){var d,g,h,i,j,c=Array.prototype.slice.call(arguments,0),k=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","readonly","positionDropdown","data","search"],l=["val","opened","isFocused","container","data"],n={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?j=d.element.prop("multiple"):(j=d.multiple||!1,"tags"in d&&(d.multiple=j=!0)),g=j?new f:new e,g.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(0>m(c[0],k))throw"Unknown method: "+c[0];if(i=b,g=a(this).data("select2"),g===b)return;if(h=c[0],"container"===h?i=g.container:"dropdown"===h?i=g.dropdown:(n[h]&&(h=n[h]),i=g[h].apply(g,c.slice(1))),m(c[0],l)>=0)return!1}}),i===b?this:i},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return C(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatSelectionCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return(""+b).toUpperCase().indexOf((""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:K,escapeMarkup:D,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:E,local:F,tags:G},util:{debounce:t,markMatch:C,escapeMarkup:D},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);(function($){$.expander={version:'1.4.5',defaults:{slicePoint:100,preserveWords:true,widow:4,expandText:'read more',expandPrefix:'&hellip; ',expandAfterSummary:false,summaryClass:'summary',detailClass:'details',moreClass:'read-more',lessClass:'read-less',collapseTimer:0,expandEffect:'slideDown',expandSpeed:250,collapseEffect:'slideUp',collapseSpeed:200,userCollapse:true,userCollapseText:'read less',userCollapsePrefix:' ',onSlice:null,beforeExpand:null,afterExpand:null,onCollapse:null,afterCollapse:null}};$.fn.expander=function(options){var meth='init';if(typeof options=='string'){meth=options;options={};}
var opts=$.extend({},$.expander.defaults,options),rSelfClose=/^<(?:area|br|col|embed|hr|img|input|link|meta|param).*>$/i,rAmpWordEnd=opts.wordEnd||/(&(?:[^;]+;)?|[a-zA-Z\u00C0-\u0100]+)$/,rOpenCloseTag=/<\/?(\w+)[^>]*>/g,rOpenTag=/<(\w+)[^>]*>/g,rCloseTag=/<\/(\w+)>/g,rLastCloseTag=/(<\/[^>]+>)\s*$/,rTagPlus=/^(<[^>]+>)+.?/,delayedCollapse;var methods={init:function(){this.each(function(){var i,l,tmp,newChar,summTagless,summOpens,summCloses,lastCloseTag,detailText,detailTagless,html,expand,$thisDetails,$readMore,openTagsForDetails=[],closeTagsForsummaryText=[],defined={},thisEl=this,$this=$(this),$summEl=$([]),o=$.extend({},opts,$this.data('expander')||$.meta&&$this.data()||{}),hasDetails=!!$this.find('.'+o.detailClass).length,hasBlocks=!!$this.find('*').filter(function(){var display=$(this).css('display');return(/^block|table|list/).test(display);}).length,el=hasBlocks?'div':'span',detailSelector=el+'.'+o.detailClass,moreClass=o.moreClass+'',lessClass=o.lessClass+'',expandSpeed=o.expandSpeed||0,allHtml=$.trim($this.html()),allText=$.trim($this.text()),summaryText=allHtml.slice(0,o.slicePoint);o.moreSelector='span.'+moreClass.split(' ').join('.');o.lessSelector='span.'+lessClass.split(' ').join('.');if($.data(this,'expanderInit')){return;}
$.data(this,'expanderInit',true);$.data(this,'expander',o);$.each(['onSlice','beforeExpand','afterExpand','onCollapse','afterCollapse'],function(index,val){defined[val]=$.isFunction(o[val]);});summaryText=backup(summaryText);summTagless=summaryText.replace(rOpenCloseTag,'').length;while(summTagless<o.slicePoint){newChar=allHtml.charAt(summaryText.length);if(newChar=='<'){newChar=allHtml.slice(summaryText.length).match(rTagPlus)[0];}
summaryText+=newChar;summTagless++;}
summaryText=backup(summaryText,o.preserveWords);summOpens=summaryText.match(rOpenTag)||[];summCloses=summaryText.match(rCloseTag)||[];tmp=[];$.each(summOpens,function(index,val){if(!rSelfClose.test(val)){tmp.push(val);}});summOpens=tmp;l=summCloses.length;for(i=0;i<l;i++){summCloses[i]=summCloses[i].replace(rCloseTag,'$1');}
$.each(summOpens,function(index,val){var thisTagName=val.replace(rOpenTag,'$1');var closePosition=$.inArray(thisTagName,summCloses);if(closePosition===-1){openTagsForDetails.push(val);closeTagsForsummaryText.push('</'+thisTagName+'>');}else{summCloses.splice(closePosition,1);}});closeTagsForsummaryText.reverse();if(!hasDetails){detailText=allHtml.slice(summaryText.length);detailTagless=$.trim(detailText.replace(rOpenCloseTag,''));if(detailTagless===''||detailTagless.split(/\s+/).length<o.widow){return;}
lastCloseTag=closeTagsForsummaryText.pop()||'';summaryText+=closeTagsForsummaryText.join('');detailText=openTagsForDetails.join('')+detailText;}else{detailText=$this.find(detailSelector).remove().html();summaryText=$this.html();allHtml=summaryText+detailText;lastCloseTag='';}
o.moreLabel=$this.find(o.moreSelector).length?'':buildMoreLabel(o);if(hasBlocks){detailText=allHtml;}
summaryText+=lastCloseTag;o.summary=summaryText;o.details=detailText;o.lastCloseTag=lastCloseTag;if(defined.onSlice){tmp=o.onSlice.call(thisEl,o);o=tmp&&tmp.details?tmp:o;}
html=buildHTML(o,hasBlocks);$this.html(html);$thisDetails=$this.find(detailSelector);$readMore=$this.find(o.moreSelector);if(o.collapseEffect==='slideUp'&&o.expandEffect!=='slideDown'||$this.is(':hidden')){$thisDetails.css({display:'none'});}else{$thisDetails[o.collapseEffect](0);}
$summEl=$this.find('div.'+o.summaryClass);expand=function(event){event.preventDefault();$readMore.hide();$summEl.hide();if(defined.beforeExpand){o.beforeExpand.call(thisEl);}
$thisDetails.stop(false,true)[o.expandEffect](expandSpeed,function(){$thisDetails.css({zoom:''});if(defined.afterExpand){o.afterExpand.call(thisEl);}
delayCollapse(o,$thisDetails,thisEl);});};$readMore.find('a').unbind('click.expander').bind('click.expander',expand);if(o.userCollapse&&!$this.find(o.lessSelector).length){$this.find(detailSelector).append('<span class="'+o.lessClass+'">'+o.userCollapsePrefix+'<a href="#">'+o.userCollapseText+'</a></span>');}
$this.find(o.lessSelector+' a').unbind('click.expander').bind('click.expander',function(event){event.preventDefault();clearTimeout(delayedCollapse);var $detailsCollapsed=$(this).closest(detailSelector);reCollapse(o,$detailsCollapsed);if(defined.onCollapse){o.onCollapse.call(thisEl,true);}});});},destroy:function(){this.each(function(){var o,details,$this=$(this);if(!$this.data('expanderInit')){return;}
o=$.extend({},$this.data('expander')||{},opts),details=$this.find('.'+o.detailClass).contents();$this.removeData('expanderInit');$this.removeData('expander');$this.find(o.moreSelector).remove();$this.find('.'+o.summaryClass).remove();$this.find('.'+o.detailClass).after(details).remove();$this.find(o.lessSelector).remove();});}};if(methods[meth]){methods[meth].call(this);}
function buildHTML(o,blocks){var el='span',summary=o.summary;if(blocks){el='div';if(rLastCloseTag.test(summary)&&!o.expandAfterSummary){summary=summary.replace(rLastCloseTag,o.moreLabel+'$1');}else{summary+=o.moreLabel;}
summary='<div class="'+o.summaryClass+'">'+summary+'</div>';}else{summary+=o.moreLabel;}
return[summary,'<',el+' class="'+o.detailClass+'"','>',o.details,'</'+el+'>'].join('');}
function buildMoreLabel(o){var ret='<span class="'+o.moreClass+'">'+o.expandPrefix;ret+='<a href="#">'+o.expandText+'</a></span>';return ret;}
function backup(txt,preserveWords){if(txt.lastIndexOf('<')>txt.lastIndexOf('>')){txt=txt.slice(0,txt.lastIndexOf('<'));}
if(preserveWords){txt=txt.replace(rAmpWordEnd,'');}
return $.trim(txt);}
function reCollapse(o,el){el.stop(true,true)[o.collapseEffect](o.collapseSpeed,function(){var prevMore=el.prev('span.'+o.moreClass).show();if(!prevMore.length){el.parent().children('div.'+o.summaryClass).show().find('span.'+o.moreClass).show();}
if(o.afterCollapse){o.afterCollapse.call(el);}});}
function delayCollapse(option,$collapseEl,thisEl){if(option.collapseTimer){delayedCollapse=setTimeout(function(){reCollapse(option,$collapseEl);if($.isFunction(option.onCollapse)){option.onCollapse.call(thisEl,false);}},option.collapseTimer);}}
return this;};$.fn.expander.defaults=$.expander.defaults;})(jQuery);function createTopicPopOver(el){var $cur=$(el);$(el).qtip({style:{classes:'qtip-bootstrap topic'},content:{text:'<i class="icon-spinner icon-spin icon-2x"></i>',ajax:{url:pageContext.url.viewTopicJSON.replace("%7Btopic%7D",$(el).attr("nodeId")),cache:false,type:'GET',dataType:'json',success:function(data){data.result.topic.icon=pageContext.url.topicIcon.replace("%7Btopic%7D",data.result.topic.id);data.result.topic.url=pageContext.url.topic.replace("%7Btopic%7D",data.result.topic.name);this.set('content.text',commandUtils.renderTemplate("topic-popover",data.result));commandUtils.initializeLabels();$cur.removeAttr("title");$cur.find("img").removeAttr("title");}}},hide:{delay:200,fixed:true},position:{viewport:$(window),adjust:{method:'shift flip'},corner:{target:'center'}},show:{delay:500}});}
function createAwardPopOver(el){var $cur=$(el);$(el).qtip({style:{classes:'qtip-bootstrap award'},content:{text:'<i class="icon-spinner icon-spin icon-2x"></i>',ajax:{url:pageContext.url.awardListUrl.replace("%7BawardType%7D",$(el).attr("awardType")).replace("%7Bdesc%7D",$(el).attr("desc")).concat("?pageSize=5"),cache:false,type:'GET',dataType:'json',success:function(data){data.awardType.awardIconSrc=$cur.attr("awardIconSrc");data.awardType.awardUrl=pageContext.url.awardListUrl.replace("%7BawardType%7D",$cur.attr("awardType")).replace("%7Bdesc%7D",$(el).attr("desc")).replace("json","html")
for(i in data.awardPager.list){data.awardPager.list[i].user={};data.awardPager.list[i].user.profileUrl=pageContext.url.profile.replace("{id}",data.awardPager.list[i].userid).replace("{plug}",data.awardPager.list[i].userplug);data.awardPager.list[i].user.username=data.awardPager.list[i].username;data.awardPager.list[i].user.avatar=pageContext.url.userAvatar.replace("%7BuserId%7D",data.awardPager.list[i].userid);_data=data;}
this.set('content.text',commandUtils.renderTemplate("badge-popover",data));}}},hide:{delay:200,fixed:true},position:{viewport:$(window),adjust:{method:'flip flip'},corner:{target:'center'}},show:{delay:500,}});}
function createUserPopOver(el){var $cur=$(el);$(el).qtip({style:{classes:'qtip-bootstrap user'},content:{text:'<i class="icon-spinner icon-spin icon-2x"></i>',ajax:{url:pageContext.url.condensedProfileUrl.replace("%7Buser%7D",$(el).attr("nodeId")),cache:false,type:'GET',dataType:'json',success:function(data){data.profileUser.displayName=(pageContext.userRealName&&data.profileUser.realname)?data.profileUser.realname:data.profileUser.username;data.profileUser.profileUrl=pageContext.url.profile.replace('{id}',data.profileUser.id).replace('{plug}',data.profileUser.plug);data.profileUser.creationDateObj=new Date(data.profileUser.creationDate);this.set('content.text',commandUtils.renderTemplate("user-popover",data));commandUtils.initializeLabels();$cur.removeAttr("title");$cur.find("img").removeAttr("title");}}},hide:{delay:200,fixed:true},position:{viewport:$(window),adjust:{method:'shift flip'},corner:{target:'center'}},show:{delay:500}});}
$(function(){$(document).ready(function(){$("[rel=user]").each(function(){createUserPopOver($(this));});$("[rel=award]").each(function(){createAwardPopOver($(this));});$("[rel=topic]").each(function(){createTopicPopOver($(this));});});});(function(d,f,g,b){var e="tooltipster",c={animation:"fade",arrow:true,arrowColor:"",content:"",delay:200,fixedWidth:0,functionBefore:function(k,l){l()},functionAfter:function(k){},icon:"(?)",iconTheme:".tooltipster-icon",iconDesktop:false,iconTouch:false,interactive:false,interactiveTolerance:350,offsetX:0,offsetY:0,onlyOne:true,position:"top",speed:350,timer:0,theme:".tooltipster-default",touchDevices:true,trigger:"hover"};function h(l,k){this.element=l;this.options=d.extend({},c,k);this._defaults=c;this._name=e;this.init()}function i(){return!!("ontouchstart"in f)}function a(){var k=g.body||g.documentElement;var m=k.style;var n="transition";if(typeof m[n]=="string"){return true}v=["Moz","Webkit","Khtml","O","ms"],n=n.charAt(0).toUpperCase()+n.substr(1);for(var l=0;l<v.length;l++){if(typeof m[v[l]+n]=="string"){return true}}return false}var j=true;if(!a()){j=false}h.prototype={init:function(){var p=d(this.element);var l=this;var o=true;if((l.options.touchDevices==false)&&(i())){o=false}if(g.all&&!g.querySelector){o=false}if(o==true){if((this.options.iconDesktop==true)&&(!i())||((this.options.iconTouch==true)&&(i()))){var k=p.attr("title");p.removeAttr("title");var n=l.options.iconTheme;var m=d('<span class="'+n.replace(".","")+'" title="'+k+'">'+this.options.icon+"</span>");m.insertAfter(p);p.data("tooltipsterIcon",m);p=m}var q=p.attr("title");p.data("tooltipsterContent",q);p.removeAttr("title");if((this.options.touchDevices==true)&&(i())){p.bind("touchstart",function(s,r){l.showTooltip()})}else{if(this.options.trigger=="hover"){p.mouseenter(function(){l.showTooltip()});if(this.options.interactive==true){p.mouseleave(function(){var s=p.data("tooltipster");var t=false;if((s!==b)&&(s!=="")){s.mouseenter(function(){t=true});s.mouseleave(function(){t=false});var r=setTimeout(function(){if(t==true){s.mouseleave(function(){l.hideTooltip()})}else{l.hideTooltip()}},l.options.interactiveTolerance)}else{l.hideTooltip()}})}else{p.mouseleave(function(){l.hideTooltip()})}}if(this.options.trigger=="click"){p.click(function(){if((p.data("tooltipster")=="")||(p.data("tooltipster")==b)){l.showTooltip()}else{l.hideTooltip()}})}}}},showTooltip:function(l){var m=d(this.element);var k=this;if(m.data("tooltipsterIcon")!==b){m=m.data("tooltipsterIcon")}if((d(".tooltipster-base").not(".tooltipster-dying").length>0)&&(k.options.onlyOne==true)){d(".tooltipster-base").not(".tooltipster-dying").each(function(){if(m.data("tooltipster")!==d(this)){d(this).addClass("tooltipster-kill");var n=d(this).data("origin");n.data("plugin_tooltipster").hideTooltip()}})}m.clearQueue().delay(k.options.delay).queue(function(){k.options.functionBefore(m,function(){if((m.data("tooltipster")!==b)&&(m.data("tooltipster")!=="")){var E=m.data("tooltipster");if(!E.hasClass("tooltipster-kill")){var O="tooltipster-"+k.options.animation;E.removeClass("tooltipster-dying");if(j==true){E.clearQueue().addClass(O+"-show")}if(k.options.timer>0){var z=E.data("tooltipsterTimer");clearTimeout(z);z=setTimeout(function(){E.data("tooltipsterTimer",b);k.hideTooltip()},k.options.timer);E.data("tooltipsterTimer",z)}if((k.options.touchDevices==true)&&(i())){d("body").bind("touchstart",function(X){if(k.options.interactive==true){var Z=d(X.target);var Y=true;Z.parents().each(function(){if(d(this).hasClass("tooltipster-base")){Y=false}});if(Y==true){k.hideTooltip();d("body").unbind("touchstart")}}else{k.hideTooltip();d("body").unbind("touchstart")}})}}}else{d("body").css("overflow-x","hidden");var I=m.data("tooltipsterContent");if(d.trim(k.options.content).length>0){I=k.options.content}var Q=k.options.theme;var W=Q.replace(".","");var O="tooltipster-"+k.options.animation;var S="-webkit-transition-duration: "+k.options.speed+"ms; -webkit-animation-duration: "+k.options.speed+"ms; -moz-transition-duration: "+k.options.speed+"ms; -moz-animation-duration: "+k.options.speed+"ms; -o-transition-duration: "+k.options.speed+"ms; -o-animation-duration: "+k.options.speed+"ms; -ms-transition-duration: "+k.options.speed+"ms; -ms-animation-duration: "+k.options.speed+"ms; transition-duration: "+k.options.speed+"ms; animation-duration: "+k.options.speed+"ms;";var L=k.options.fixedWidth>0?"width:"+k.options.fixedWidth+"px;":"";var A=k.options.interactive==true?"pointer-events: auto;":"";var E=d('<div class="tooltipster-base '+W+" "+O+'" style="'+L+" "+A+" "+S+'"><div class="tooltipster-content">'+I+"</div></div>");E.appendTo("body");m.data("tooltipster",E);E.data("origin",m);var U=d(f).width();var y=m.outerWidth(false);var B=m.outerHeight(false);var M=E.outerWidth(false);var T=E.innerWidth();var D=E.outerHeight(false);var s=m.offset();var r=b;if(k.options.fixedWidth==0){E.css({width:(T+1)+"px","padding-left":"0px","padding-right":"0px"})}function H(){var Y=d(f).scrollLeft();if((x-Y)<0){var X=x-Y;x=Y;E.data("arrow-reposition",X)}if(((x+M)-Y)>U){var X=x-((U+Y)-M);x=(U+Y)-M;E.data("arrow-reposition",X)}}function t(Y,X){if((s.top-d(f).scrollTop()-D-k.options.offsetY-11)<0){k.options.position=Y;r=X}}if(k.options.position=="top"){var G=(s.left+M)-(s.left+m.outerWidth(false));var x=(s.left+k.options.offsetX)-(G/2);var p=(s.top-D)-k.options.offsetY-12;H();t("bottom","top")}if(k.options.position=="top-left"){var x=s.left+k.options.offsetX;var p=(s.top-D)-k.options.offsetY-12;H();t("bottom-left","top-left")}if(k.options.position=="top-right"){var x=(s.left+y+k.options.offsetX)-M;var p=(s.top-D)-k.options.offsetY-12;H();t("bottom-right","top-right")}if(k.options.position=="bottom"){var G=(s.left+M)-(s.left+m.outerWidth(false));var x=s.left-(G/2)+k.options.offsetX;var p=(s.top+B)+k.options.offsetY+12;H()}if(k.options.position=="bottom-left"){var x=s.left+k.options.offsetX;var p=(s.top+B)+k.options.offsetY+12;H()}if(k.options.position=="bottom-right"){var x=(s.left+y+k.options.offsetX)-M;var p=(s.top+B)+k.options.offsetY+12;H()}if(k.options.position=="left"){var x=s.left-k.options.offsetX-M-12;var R=s.left+k.options.offsetX+y+12;var u=(s.top+D)-(s.top+m.outerHeight(false));var p=s.top-(u/2)-k.options.offsetY;if((x<0)&&((R+M)>U)){var V=parseFloat(E.css("border-width"))*2;var w=(M+x)-V;E.css("width",w+"px");D=E.outerHeight(false);x=s.left-k.options.offsetX-w-12-V;u=(s.top+D)-(s.top+m.outerHeight(false));p=s.top-(u/2)-k.options.offsetY}else{if(x<0){var x=s.left+k.options.offsetX+y+12;E.data("arrow-reposition","left")}}}if(k.options.position=="right"){var x=s.left+k.options.offsetX+y+12;var R=s.left-k.options.offsetX-M-12;var u=(s.top+D)-(s.top+m.outerHeight(false));var p=s.top-(u/2)-k.options.offsetY;if(((x+M)>U)&&(R<0)){var V=parseFloat(E.css("border-width"))*2;var w=(U-x)-V;E.css("width",w+"px");D=E.outerHeight(false);u=(s.top+D)-(s.top+m.outerHeight(false));p=s.top-(u/2)-k.options.offsetY}else{if((x+M)>U){x=s.left-k.options.offsetX-M-12;E.data("arrow-reposition","right")}}}if(k.options.arrow==true){var F="tooltipster-arrow-"+k.options.position;if(k.options.arrowColor.length<1){var P=E.css("background-color")}else{var P=k.options.arrowColor}var n=E.data("arrow-reposition");if(!n){n=""}else{if(n=="left"){F="tooltipster-arrow-right";n=""}else{if(n=="right"){F="tooltipster-arrow-left";n=""}else{n="left:"+n+"px;"}}}if((k.options.position=="top")||(k.options.position=="top-left")||(k.options.position=="top-right")){var J=parseFloat(E.css("border-bottom-width"));var N=E.css("border-bottom-color")}else{if((k.options.position=="bottom")||(k.options.position=="bottom-left")||(k.options.position=="bottom-right")){var J=parseFloat(E.css("border-top-width"));var N=E.css("border-top-color")}else{if(k.options.position=="left"){var J=parseFloat(E.css("border-right-width"));var N=E.css("border-right-color")}else{if(k.options.position=="right"){var J=parseFloat(E.css("border-left-width"));var N=E.css("border-left-color")}else{var J=parseFloat(E.css("border-bottom-width"));var N=E.css("border-bottom-color")}}}}if(J>1){J++}var o="";if(J!==0){var K="";var q="border-color: "+N+";";if(F.indexOf("bottom")!==-1){K="margin-top: -"+J+"px;"}else{if(F.indexOf("top")!==-1){K="margin-bottom: -"+J+"px;"}else{if(F.indexOf("left")!==-1){K="margin-right: -"+J+"px;"}else{if(F.indexOf("right")!==-1){K="margin-left: -"+J+"px;"}}}}o='<span class="tooltipster-arrow-border" style="'+K+" "+q+';"></span>'}var C='<div class="'+F+' tooltipster-arrow" style="'+n+'">'+o+'<span style="border-color:'+P+';"></span></div>'}else{var C=""}E.css({top:p+"px",left:x+"px"}).append(C);if(j==true){E.addClass(O+"-show")}else{E.css("display","none").removeClass(O).fadeIn(k.options.speed)}if(k.options.timer>0){var z=setTimeout(function(){E.data("tooltipsterTimer",b);k.hideTooltip()},k.options.timer+k.options.speed);E.data("tooltipsterTimer",z)}if((k.options.touchDevices==true)&&(i())){d("body").bind("touchstart",function(X){if(k.options.interactive==true){var Z=d(X.target);var Y=true;Z.parents().each(function(){if(d(this).hasClass("tooltipster-base")){Y=false}});if(Y==true){k.hideTooltip();d("body").unbind("touchstart")}}else{k.hideTooltip();d("body").unbind("touchstart")}})}E.mouseleave(function(){k.hideTooltip()})}});m.dequeue()})},hideTooltip:function(l){var o=d(this.element);var k=this;if(o.data("tooltipsterIcon")!==b){o=o.data("tooltipsterIcon")}var n=o.data("tooltipster");o.clearQueue();if((n!==b)&&(n!=="")){var p=n.data("tooltipsterTimer");if(p!==b){clearTimeout(p)}var m="tooltipster-"+k.options.animation;if(j==true){n.clearQueue().removeClass(m+"-show").addClass("tooltipster-dying").delay(k.options.speed).queue(function(){n.remove();o.data("tooltipster","");d("body").css("verflow-x","");k.options.functionAfter(o)})}else{n.clearQueue().addClass("tooltipster-dying").fadeOut(k.options.speed,function(){n.remove();o.data("tooltipster","");d("body").css("verflow-x","");k.options.functionAfter(o)})}}}};d.fn[e]=function(k){return this.each(function(){if(!d.data(this,"plugin_"+e)){d.data(this,"plugin_"+e,new h(this,k))}var l=d(this).data("plugin_tooltipster").options;if((l.iconDesktop==true)&&(!i())||((l.iconTouch==true)&&(i()))){var m=d(this).data("plugin_tooltipster");d(this).next().data("plugin_tooltipster",m)}})}})(jQuery,window,document);(function(window,document,undefined){(function(factory){"use strict";if(typeof define==='function'&&define.amd){define(['jquery'],factory);}
else if(jQuery&&!jQuery.fn.qtip){factory(jQuery);}}
(function($){;var TRUE=true,FALSE=false,NULL=null,X='x',Y='y',WIDTH='width',HEIGHT='height',TOP='top',LEFT='left',BOTTOM='bottom',RIGHT='right',CENTER='center',FLIP='flip',FLIPINVERT='flipinvert',SHIFT='shift',QTIP,PROTOTYPE,CORNER,CHECKS,PLUGINS={},NAMESPACE='qtip',ATTR_HAS='data-hasqtip',ATTR_ID='data-qtip-id',WIDGET=['ui-widget','ui-tooltip'],SELECTOR='.'+NAMESPACE,INACTIVE_EVENTS='click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' '),CLASS_FIXED=NAMESPACE+'-fixed',CLASS_DEFAULT=NAMESPACE+'-default',CLASS_FOCUS=NAMESPACE+'-focus',CLASS_HOVER=NAMESPACE+'-hover',CLASS_DISABLED=NAMESPACE+'-disabled',replaceSuffix='_replacedByqTip',oldtitle='oldtitle',trackingBound;BROWSER={ie:(function(){var v=3,div=document.createElement('div');while((div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->')){if(!div.getElementsByTagName('i')[0]){break;}}
return v>4?v:NaN;}()),iOS:parseFloat((''+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,''])[1]).replace('undefined','3_2').replace('_','.').replace('_',''))||FALSE};;function QTip(target,options,id,attr){this.id=id;this.target=target;this.tooltip=NULL;this.elements=elements={target:target};this._id=NAMESPACE+'-'+id;this.timers={img:{}};this.options=options;this.plugins={};this.cache=cache={event:{},target:$(),disabled:FALSE,attr:attr,onTooltip:FALSE,lastClass:''};this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=FALSE;}
PROTOTYPE=QTip.prototype;PROTOTYPE.render=function(show){if(this.rendered||this.destroyed){return this;}
var self=this,options=this.options,cache=this.cache,elements=this.elements,text=options.content.text,title=options.content.title,button=options.content.button,posOptions=options.position,namespace='.'+this._id+' ',deferreds=[];$.attr(this.target[0],'aria-describedby',this._id);this.tooltip=elements.tooltip=tooltip=$('<div/>',{'id':this._id,'class':[NAMESPACE,CLASS_DEFAULT,options.style.classes,NAMESPACE+'-pos-'+options.position.my.abbrev()].join(' '),'width':options.style.width||'','height':options.style.height||'','tracking':posOptions.target==='mouse'&&posOptions.adjust.mouse,'role':'alert','aria-live':'polite','aria-atomic':FALSE,'aria-describedby':this._id+'-content','aria-hidden':TRUE}).toggleClass(CLASS_DISABLED,this.disabled).attr(ATTR_ID,this.id).data(NAMESPACE,this).appendTo(posOptions.container).append(elements.content=$('<div />',{'class':NAMESPACE+'-content','id':this._id+'-content','aria-atomic':TRUE}));this.rendered=-1;this.positioning=TRUE;if(title){this._createTitle();if(!$.isFunction(title)){deferreds.push(this._updateTitle(title,FALSE));}}
if(button){this._createButton();}
if(!$.isFunction(text)){deferreds.push(this._updateContent(text,FALSE));}
this.rendered=TRUE;this._setWidget();$.each(options.events,function(name,callback){$.isFunction(callback)&&tooltip.bind((name==='toggle'?['tooltipshow','tooltiphide']:['tooltip'+name]).join(namespace)+namespace,callback);});$.each(PLUGINS,function(name){var instance;if(this.initialize==='render'&&(instance=this(self))){self.plugins[name]=instance;}});this._assignEvents();$.when.apply($,deferreds).then(function(){self._trigger('render');self.positioning=FALSE;if(!self.hiddenDuringWait&&(options.show.ready||show)){self.toggle(TRUE,cache.event,FALSE);}
self.hiddenDuringWait=FALSE;});QTIP.api[this.id]=this;return this;};PROTOTYPE.destroy=function(immediate){if(this.destroyed){return this.target;}
function process(){if(this.destroyed){return;}
this.destroyed=TRUE;var target=this.target,title=target.attr(oldtitle);if(this.rendered){this.tooltip.stop(1,0).find('*').remove().end().remove();}
$.each(this.plugins,function(name){this.destroy&&this.destroy();});clearTimeout(this.timers.show);clearTimeout(this.timers.hide);this._unassignEvents();target.removeData(NAMESPACE).removeAttr(ATTR_ID).removeAttr('aria-describedby');if(this.options.suppress&&title){target.attr('title',title).removeAttr(oldtitle);}
this._unbind(target);this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=NULL;delete QTIP.api[this.id];}
if(immediate!==TRUE&&this.rendered){tooltip.one('tooltiphidden',$.proxy(process,this));!this.triggering&&this.hide();}
else{process.call(this);}
return this.target;};;function invalidOpt(a){return a===NULL||$.type(a)!=='object';}
function invalidContent(c){return!($.isFunction(c)||(c&&c.attr)||c.length||($.type(c)==='object'&&(c.jquery||c.then)));}
function sanitizeOptions(opts){var content,text,ajax,once;if(invalidOpt(opts)){return FALSE;}
if(invalidOpt(opts.metadata)){opts.metadata={type:opts.metadata};}
if('content'in opts){content=opts.content;if(invalidOpt(content)||content.jquery||content.done){content=opts.content={text:(text=invalidContent(content)?FALSE:content)};}
else{text=content.text;}
if('ajax'in content){ajax=content.ajax;once=ajax&&ajax.once!==FALSE;delete content.ajax;content.text=function(event,api){var loading=text||$(this).attr(api.options.content.attr)||'Loading...',deferred=$.ajax($.extend({},ajax,{context:api})).then(ajax.success,NULL,ajax.error).then(function(content){if(content&&once){api.set('content.text',content);}
return content;},function(xhr,status,error){if(api.destroyed||xhr.status===0){return;}
api.set('content.text',status+': '+error);});return!once?(api.set('content.text',loading),deferred):loading;};}
if('title'in content){if(!invalidOpt(content.title)){content.button=content.title.button;content.title=content.title.text;}
if(invalidContent(content.title||FALSE)){content.title=FALSE;}}}
if('position'in opts&&invalidOpt(opts.position)){opts.position={my:opts.position,at:opts.position};}
if('show'in opts&&invalidOpt(opts.show)){opts.show=opts.show.jquery?{target:opts.show}:opts.show===TRUE?{ready:TRUE}:{event:opts.show};}
if('hide'in opts&&invalidOpt(opts.hide)){opts.hide=opts.hide.jquery?{target:opts.hide}:{event:opts.hide};}
if('style'in opts&&invalidOpt(opts.style)){opts.style={classes:opts.style};}
$.each(PLUGINS,function(){this.sanitize&&this.sanitize(opts);});return opts;}
CHECKS=PROTOTYPE.checks={builtin:{'^id$':function(obj,o,v,prev){var id=v===TRUE?QTIP.nextid:v,new_id=NAMESPACE+'-'+id;if(id!==FALSE&&id.length>0&&!$('#'+new_id).length){this._id=new_id;if(this.rendered){this.tooltip[0].id=this._id;this.elements.content[0].id=this._id+'-content';this.elements.title[0].id=this._id+'-title';}}
else{obj[o]=prev;}},'^prerender':function(obj,o,v){v&&!this.rendered&&this.render(this.options.show.ready);},'^content.text$':function(obj,o,v){this._updateContent(v);},'^content.attr$':function(obj,o,v,prev){if(this.options.content.text===this.target.attr(prev)){this._updateContent(this.target.attr(v));}},'^content.title$':function(obj,o,v){if(!v){return this._removeTitle();}
v&&!this.elements.title&&this._createTitle();this._updateTitle(v);},'^content.button$':function(obj,o,v){this._updateButton(v);},'^content.title.(text|button)$':function(obj,o,v){this.set('content.'+o,v);},'^position.(my|at)$':function(obj,o,v){'string'===typeof v&&(obj[o]=new CORNER(v,o==='at'));},'^position.container$':function(obj,o,v){this.tooltip.appendTo(v);},'^show.ready$':function(obj,o,v){v&&(!this.rendered&&this.render(TRUE)||this.toggle(TRUE));},'^style.classes$':function(obj,o,v,p){this.tooltip.removeClass(p).addClass(v);},'^style.width|height':function(obj,o,v){this.tooltip.css(o,v);},'^style.widget|content.title':function(){this._setWidget();},'^style.def':function(obj,o,v){this.tooltip.toggleClass(CLASS_DEFAULT,!!v);},'^events.(render|show|move|hide|focus|blur)$':function(obj,o,v){tooltip[($.isFunction(v)?'':'un')+'bind']('tooltip'+o,v);},'^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)':function(){var posOptions=this.options.position;tooltip.attr('tracking',posOptions.target==='mouse'&&posOptions.adjust.mouse);this._unassignEvents();this._assignEvents();}}};function convertNotation(options,notation){var i=0,obj,option=options,levels=notation.split('.');while(option=option[levels[i++]]){if(i<levels.length){obj=option;}}
return[obj||options,levels.pop()];}
PROTOTYPE.get=function(notation){if(this.destroyed){return this;}
var o=convertNotation(this.options,notation.toLowerCase()),result=o[0][o[1]];return result.precedance?result.string():result;};function setCallback(notation,args){var category,rule,match;for(category in this.checks){for(rule in this.checks[category]){if(match=(new RegExp(rule,'i')).exec(notation)){args.push(match);if(category==='builtin'||this.plugins[category]){this.checks[category][rule].apply(this.plugins[category]||this,args);}}}}}
var rmove=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,rrender=/^prerender|show\.ready/i;PROTOTYPE.set=function(option,value){if(this.destroyed){return this;}
var rendered=this.rendered,reposition=FALSE,options=this.options,checks=this.checks,name;if('string'===typeof option){name=option;option={};option[name]=value;}
else{option=$.extend({},option);}
$.each(option,function(notation,value){if(!rendered&&!rrender.test(notation)){delete option[notation];return;}
var obj=convertNotation(options,notation.toLowerCase()),previous;previous=obj[0][obj[1]];obj[0][obj[1]]=value&&value.nodeType?$(value):value;reposition=rmove.test(notation)||reposition;option[notation]=[obj[0],obj[1],value,previous];});sanitizeOptions(options);this.positioning=TRUE;$.each(option,$.proxy(setCallback,this));this.positioning=FALSE;if(this.rendered&&this.tooltip[0].offsetWidth>0&&reposition){this.reposition(options.position.target==='mouse'?NULL:this.cache.event);}
return this;};;PROTOTYPE._update=function(content,element,reposition){var self=this,cache=this.cache;if(!this.rendered||!content){return FALSE;}
if($.isFunction(content)){content=content.call(this.elements.target,cache.event,this)||'';}
if($.isFunction(content.then)){cache.waiting=TRUE;return content.then(function(c){cache.waiting=FALSE;return self._update(c,element,reposition);},NULL,function(e){return self._update(e,element,reposition);});}
if(content===FALSE||(!content&&content!=='')){return FALSE;}
if(content.jquery&&content.length>0){element.empty().append(content.css({display:'block'}));}
else{element.html(content);}
cache.waiting=TRUE;return element.imagesLoaded().done(function(images){cache.waiting=FALSE;if(reposition!==FALSE&&self.rendered&&self.tooltip[0].offsetWidth>0){self.reposition(cache.event,!images.length);}}).promise();};PROTOTYPE._updateContent=function(content,reposition){this._update(content,this.elements.content,reposition);};PROTOTYPE._updateTitle=function(content,reposition){if(this._update(content,this.elements.title,reposition)===FALSE){this._removeTitle(FALSE);}};PROTOTYPE._createTitle=function()
{var elements=this.elements,id=this._id+'-title';if(elements.titlebar){this._removeTitle();}
elements.titlebar=$('<div />',{'class':NAMESPACE+'-titlebar '+(this.options.style.widget?createWidgetClass('header'):'')}).append(elements.title=$('<div />',{'id':id,'class':NAMESPACE+'-title','aria-atomic':TRUE})).insertBefore(elements.content).delegate('.qtip-close','mousedown keydown mouseup keyup mouseout',function(event){$(this).toggleClass('ui-state-active ui-state-focus',event.type.substr(-4)==='down');}).delegate('.qtip-close','mouseover mouseout',function(event){$(this).toggleClass('ui-state-hover',event.type==='mouseover');});if(this.options.content.button){this._createButton();}};PROTOTYPE._removeTitle=function(reposition)
{var elements=this.elements;if(elements.title){elements.titlebar.remove();elements.titlebar=elements.title=elements.button=NULL;if(reposition!==FALSE){this.reposition();}}};;PROTOTYPE.reposition=function(event,effect){if(!this.rendered||this.positioning||this.destroyed){return this;}
this.positioning=TRUE;var cache=this.cache,tooltip=this.tooltip,posOptions=this.options.position,target=posOptions.target,my=posOptions.my,at=posOptions.at,viewport=posOptions.viewport,container=posOptions.container,adjust=posOptions.adjust,method=adjust.method.split(' '),elemWidth=tooltip.outerWidth(FALSE),elemHeight=tooltip.outerHeight(FALSE),targetWidth=0,targetHeight=0,type=tooltip.css('position'),position={left:0,top:0},visible=tooltip[0].offsetWidth>0,isScroll=event&&event.type==='scroll',win=$(window),doc=container[0].ownerDocument,mouse=this.mouse,pluginCalculations,offset;if($.isArray(target)&&target.length===2){at={x:LEFT,y:TOP};position={left:target[0],top:target[1]};}
else if(target==='mouse'&&((event&&event.pageX)||cache.event.pageX)){at={x:LEFT,y:TOP};event=mouse&&mouse.pageX&&(adjust.mouse||!event||!event.pageX)?mouse:(event&&(event.type==='resize'||event.type==='scroll')?cache.event:event&&event.pageX&&event.type==='mousemove'?event:(!adjust.mouse||this.options.show.distance)&&cache.origin&&cache.origin.pageX?cache.origin:event)||event||cache.event||mouse||{};if(type!=='static'){position=container.offset();}
if(doc.body.offsetWidth!==(window.innerWidth||doc.documentElement.clientWidth)){offset=$(doc.body).offset();}
position={left:event.pageX-position.left+(offset&&offset.left||0),top:event.pageY-position.top+(offset&&offset.top||0)};if(adjust.mouse&&isScroll){position.left-=mouse.scrollX-win.scrollLeft();position.top-=mouse.scrollY-win.scrollTop();}}
else{if(target==='event'&&event&&event.target&&event.type!=='scroll'&&event.type!=='resize'){cache.target=$(event.target);}
else if(target!=='event'){cache.target=$(target.jquery?target:elements.target);}
target=cache.target;target=$(target).eq(0);if(target.length===0){return this;}
else if(target[0]===document||target[0]===window){targetWidth=BROWSER.iOS?window.innerWidth:target.width();targetHeight=BROWSER.iOS?window.innerHeight:target.height();if(target[0]===window){position={top:(viewport||target).scrollTop(),left:(viewport||target).scrollLeft()};}}
else if(PLUGINS.imagemap&&target.is('area')){pluginCalculations=PLUGINS.imagemap(this,target,at,PLUGINS.viewport?method:FALSE);}
else if(PLUGINS.svg&&target[0].ownerSVGElement){pluginCalculations=PLUGINS.svg(this,target,at,PLUGINS.viewport?method:FALSE);}
else{targetWidth=target.outerWidth(FALSE);targetHeight=target.outerHeight(FALSE);position=target.offset();}
if(pluginCalculations){targetWidth=pluginCalculations.width;targetHeight=pluginCalculations.height;offset=pluginCalculations.offset;position=pluginCalculations.position;}
position=this.reposition.offset(target,position,container);if((BROWSER.iOS>3.1&&BROWSER.iOS<4.1)||(BROWSER.iOS>=4.3&&BROWSER.iOS<4.33)||(!BROWSER.iOS&&type==='fixed')){position.left-=win.scrollLeft();position.top-=win.scrollTop();}
if(!pluginCalculations||(pluginCalculations&&pluginCalculations.adjustable!==FALSE)){position.left+=at.x===RIGHT?targetWidth:at.x===CENTER?targetWidth/2:0;position.top+=at.y===BOTTOM?targetHeight:at.y===CENTER?targetHeight/2:0;}}
position.left+=adjust.x+(my.x===RIGHT?-elemWidth:my.x===CENTER?-elemWidth/2:0);position.top+=adjust.y+(my.y===BOTTOM?-elemHeight:my.y===CENTER?-elemHeight/2:0);if(PLUGINS.viewport){position.adjusted=PLUGINS.viewport(this,position,posOptions,targetWidth,targetHeight,elemWidth,elemHeight);if(offset&&position.adjusted.left){position.left+=offset.left;}
if(offset&&position.adjusted.top){position.top+=offset.top;}}
else{position.adjusted={left:0,top:0};}
if(!this._trigger('move',[position,viewport.elem||viewport],event)){return this;}
delete position.adjusted;if(effect===FALSE||!visible||isNaN(position.left)||isNaN(position.top)||target==='mouse'||!$.isFunction(posOptions.effect)){tooltip.css(position);}
else if($.isFunction(posOptions.effect)){posOptions.effect.call(tooltip,this,$.extend({},position));tooltip.queue(function(next){$(this).css({opacity:'',height:''});if(BROWSER.ie){this.style.removeAttribute('filter');}
next();});}
this.positioning=FALSE;return this;};PROTOTYPE.reposition.offset=function(elem,pos,container){if(!container[0]){return pos;}
var ownerDocument=$(elem[0].ownerDocument),quirks=!!BROWSER.ie&&document.compatMode!=='CSS1Compat',parent=container[0],scrolled,position,parentOffset,overflow;function scroll(e,i){pos.left+=i*e.scrollLeft();pos.top+=i*e.scrollTop();}
do{if((position=$.css(parent,'position'))!=='static'){if(position==='fixed'){parentOffset=parent.getBoundingClientRect();scroll(ownerDocument,-1);}
else{parentOffset=$(parent).position();parentOffset.left+=(parseFloat($.css(parent,'borderLeftWidth'))||0);parentOffset.top+=(parseFloat($.css(parent,'borderTopWidth'))||0);}
pos.left-=parentOffset.left+(parseFloat($.css(parent,'marginLeft'))||0);pos.top-=parentOffset.top+(parseFloat($.css(parent,'marginTop'))||0);if(!scrolled&&(overflow=$.css(parent,'overflow'))!=='hidden'&&overflow!=='visible'){scrolled=$(parent);}}}
while((parent=parent.offsetParent));if(scrolled&&(scrolled[0]!==ownerDocument[0]||quirks)){scroll(scrolled,1);}
return pos;};var C=(CORNER=PROTOTYPE.reposition.Corner=function(corner,forceY){corner=(''+corner).replace(/([A-Z])/,' $1').replace(/middle/gi,CENTER).toLowerCase();this.x=(corner.match(/left|right/i)||corner.match(/center/)||['inherit'])[0].toLowerCase();this.y=(corner.match(/top|bottom|center/i)||['inherit'])[0].toLowerCase();this.forceY=!!forceY;var f=corner.charAt(0);this.precedance=(f==='t'||f==='b'?Y:X);}).prototype;C.invert=function(z,center){this[z]=this[z]===LEFT?RIGHT:this[z]===RIGHT?LEFT:center||this[z];};C.string=function(){var x=this.x,y=this.y;return x===y?x:this.precedance===Y||(this.forceY&&y!=='center')?y+' '+x:x+' '+y;};C.abbrev=function(){var result=this.string().split(' ');return result[0].charAt(0)+(result[1]&&result[1].charAt(0)||'');};C.clone=function(){return new CORNER(this.string(),this.forceY);};;PROTOTYPE.toggle=function(state,event){var cache=this.cache,options=this.options,tooltip=this.tooltip;if(event){if((/over|enter/).test(event.type)&&(/out|leave/).test(cache.event.type)&&options.show.target.add(event.target).length===options.show.target.length&&tooltip.has(event.relatedTarget).length){return this;}
cache.event=$.extend({},event);}
this.waiting&&!state&&(this.hiddenDuringWait=TRUE);if(!this.rendered){return state?this.render(1):this;}
else if(this.destroyed||this.disabled){return this;}
var type=state?'show':'hide',opts=this.options[type],otherOpts=this.options[!state?'show':'hide'],posOptions=this.options.position,contentOptions=this.options.content,width=this.tooltip.css('width'),visible=this.tooltip[0].offsetWidth>0,animate=state||opts.target.length===1,sameTarget=!event||opts.target.length<2||cache.target[0]===event.target,identicalState,allow,showEvent,delay;if((typeof state).search('boolean|number')){state=!visible;}
identicalState=!tooltip.is(':animated')&&visible===state&&sameTarget;allow=!identicalState?!!this._trigger(type,[90]):NULL;if(allow!==FALSE&&state){this.focus(event);}
if(!allow||identicalState){return this;}
$.attr(tooltip[0],'aria-hidden',!!!state);if(state){cache.origin=$.extend({},this.mouse);if($.isFunction(contentOptions.text)){this._updateContent(contentOptions.text,FALSE);}
if($.isFunction(contentOptions.title)){this._updateTitle(contentOptions.title,FALSE);}
if(!trackingBound&&posOptions.target==='mouse'&&posOptions.adjust.mouse){$(document).bind('mousemove.'+NAMESPACE,this._storeMouse);trackingBound=TRUE;}
if(!width){tooltip.css('width',tooltip.outerWidth(FALSE));}
this.reposition(event,arguments[2]);if(!width){tooltip.css('width','');}
if(!!opts.solo){(typeof opts.solo==='string'?$(opts.solo):$(SELECTOR,opts.solo)).not(tooltip).not(opts.target).qtip('hide',$.Event('tooltipsolo'));}}
else{clearTimeout(this.timers.show);delete cache.origin;if(trackingBound&&!$(SELECTOR+'[tracking="true"]:visible',opts.solo).not(tooltip).length){$(document).unbind('mousemove.'+NAMESPACE);trackingBound=FALSE;}
this.blur(event);}
after=$.proxy(function(){if(state){if(BROWSER.ie){tooltip[0].style.removeAttribute('filter');}
tooltip.css('overflow','');if('string'===typeof opts.autofocus){$(this.options.show.autofocus,tooltip).focus();}
this.options.show.target.trigger('qtip-'+this.id+'-inactive');}
else{tooltip.css({display:'',visibility:'',opacity:'',left:'',top:''});}
this._trigger(state?'visible':'hidden');},this);if(opts.effect===FALSE||animate===FALSE){tooltip[type]();after();}
else if($.isFunction(opts.effect)){tooltip.stop(1,1);opts.effect.call(tooltip,this);tooltip.queue('fx',function(n){after();n();});}
else{tooltip.fadeTo(90,state?1:0,after);}
if(state){opts.target.trigger('qtip-'+this.id+'-inactive');}
return this;};PROTOTYPE.show=function(event){return this.toggle(TRUE,event);};PROTOTYPE.hide=function(event){return this.toggle(FALSE,event);};;PROTOTYPE.focus=function(event){if(!this.rendered||this.destroyed){return this;}
var qtips=$(SELECTOR),tooltip=this.tooltip,curIndex=parseInt(tooltip[0].style.zIndex,10),newIndex=QTIP.zindex+qtips.length,focusedElem;if(!tooltip.hasClass(CLASS_FOCUS)){if(this._trigger('focus',[newIndex],event)){if(curIndex!==newIndex){qtips.each(function(){if(this.style.zIndex>curIndex){this.style.zIndex=this.style.zIndex-1;}});qtips.filter('.'+CLASS_FOCUS).qtip('blur',event);}
tooltip.addClass(CLASS_FOCUS)[0].style.zIndex=newIndex;}}
return this;};PROTOTYPE.blur=function(event){if(!this.rendered||this.destroyed){return this;}
this.tooltip.removeClass(CLASS_FOCUS);this._trigger('blur',[this.tooltip.css('zIndex')],event);return this;};;PROTOTYPE.disable=function(state){if(this.destroyed){return this;}
if('boolean'!==typeof state){state=!(this.tooltip.hasClass(CLASS_DISABLED)||this.disabled);}
if(this.rendered){this.tooltip.toggleClass(CLASS_DISABLED,state).attr('aria-disabled',state);}
this.disabled=!!state;return this;};PROTOTYPE.enable=function(){return this.disable(FALSE);};;PROTOTYPE._createButton=function()
{var self=this,elements=this.elements,tooltip=elements.tooltip,button=this.options.content.button,isString=typeof button==='string',close=isString?button:'Close tooltip';if(elements.button){elements.button.remove();}
if(button.jquery){elements.button=button;}
else{elements.button=$('<a />',{'class':'qtip-close '+(this.options.style.widget?'':NAMESPACE+'-icon'),'title':close,'aria-label':close}).prepend($('<span />',{'class':'ui-icon ui-icon-close','html':'&times;'}));}
elements.button.appendTo(elements.titlebar||tooltip).attr('role','button').click(function(event){if(!tooltip.hasClass(CLASS_DISABLED)){self.hide(event);}
return FALSE;});};PROTOTYPE._updateButton=function(button)
{if(!this.rendered){return FALSE;}
var elem=this.elements.button;if(button){this._createButton();}
else{elem.remove();}};;function createWidgetClass(cls){return WIDGET.concat('').join(cls?'-'+cls+' ':' ');}
PROTOTYPE._setWidget=function()
{var on=this.options.style.widget,elements=this.elements,tooltip=elements.tooltip,disabled=tooltip.hasClass(CLASS_DISABLED);tooltip.removeClass(CLASS_DISABLED);CLASS_DISABLED=on?'ui-state-disabled':'qtip-disabled';tooltip.toggleClass(CLASS_DISABLED,disabled);tooltip.toggleClass('ui-helper-reset '+createWidgetClass(),on).toggleClass(CLASS_DEFAULT,this.options.style.def&&!on);if(elements.content){elements.content.toggleClass(createWidgetClass('content'),on);}
if(elements.titlebar){elements.titlebar.toggleClass(createWidgetClass('header'),on);}
if(elements.button){elements.button.toggleClass(NAMESPACE+'-icon',!on);}};;function showMethod(event){if(this.tooltip.hasClass(CLASS_DISABLED)){return FALSE;}
clearTimeout(this.timers.show);clearTimeout(this.timers.hide);var callback=$.proxy(function(){this.toggle(TRUE,event);},this);if(this.options.show.delay>0){this.timers.show=setTimeout(callback,this.options.show.delay);}
else{callback();}}
function hideMethod(event){if(this.tooltip.hasClass(CLASS_DISABLED)){return FALSE;}
var relatedTarget=$(event.relatedTarget),ontoTooltip=relatedTarget.closest(SELECTOR)[0]===this.tooltip[0],ontoTarget=relatedTarget[0]===this.options.show.target[0];clearTimeout(this.timers.show);clearTimeout(this.timers.hide);if(this!==relatedTarget[0]&&(this.options.position.target==='mouse'&&ontoTooltip)||(this.options.hide.fixed&&((/mouse(out|leave|move)/).test(event.type)&&(ontoTooltip||ontoTarget))))
{try{event.preventDefault();event.stopImmediatePropagation();}catch(e){}
return;}
var callback=$.proxy(function(){this.toggle(FALSE,event);},this);if(this.options.hide.delay>0){this.timers.hide=setTimeout(callback,this.options.hide.delay);}
else{callback();}}
function inactiveMethod(event){if(this.tooltip.hasClass(CLASS_DISABLED)||!this.options.hide.inactive){return FALSE;}
clearTimeout(this.timers.inactive);this.timers.inactive=setTimeout($.proxy(function(){this.hide(event);},this),this.options.hide.inactive);}
function repositionMethod(event){if(this.rendered&&this.tooltip[0].offsetWidth>0){this.reposition(event);}}
PROTOTYPE._storeMouse=function(event){this.mouse={pageX:event.pageX,pageY:event.pageY,type:'mousemove',scrollX:window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,scrollY:window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop};};PROTOTYPE._bind=function(targets,events,method,suffix,context){var ns='.'+this._id+(suffix?'-'+suffix:'');events.length&&$(targets).bind((events.split?events:events.join(ns+' '))+ns,$.proxy(method,context||this));};PROTOTYPE._unbind=function(targets,suffix){$(targets).unbind('.'+this._id+(suffix?'-'+suffix:''));};var ns='.'+NAMESPACE;function delegate(selector,events,method){$(document.body).delegate(selector,(events.split?events:events.join(ns+' '))+ns,function(){var api=QTIP.api[$.attr(this,ATTR_ID)];api&&!api.disabled&&method.apply(api,arguments);});}
$(function(){delegate(SELECTOR,['mouseenter','mouseleave'],function(event){var state=event.type==='mouseenter',tooltip=$(event.currentTarget),target=$(event.relatedTarget||event.target),options=this.options;if(state){this.focus(event);tooltip.hasClass(CLASS_FIXED)&&!tooltip.hasClass(CLASS_DISABLED)&&clearTimeout(this.timers.hide);}
else{if(options.position.target==='mouse'&&options.hide.event&&options.show.target&&!target.closest(options.show.target[0]).length){this.hide(event);}}
tooltip.toggleClass(CLASS_HOVER,state);});delegate('['+ATTR_ID+']',INACTIVE_EVENTS,inactiveMethod);});PROTOTYPE._trigger=function(type,args,event){var callback=$.Event('tooltip'+type);callback.originalEvent=(event&&$.extend({},event))||this.cache.event||NULL;this.triggering=TRUE;this.tooltip.trigger(callback,[this].concat(args||[]));this.triggering=FALSE;return!callback.isDefaultPrevented();};PROTOTYPE._assignEvents=function(){var options=this.options,posOptions=options.position,tooltip=this.tooltip,showTarget=options.show.target,hideTarget=options.hide.target,containerTarget=posOptions.container,viewportTarget=posOptions.viewport,documentTarget=$(document),bodyTarget=$(document.body),windowTarget=$(window),showEvents=options.show.event?$.trim(''+options.show.event).split(' '):[],hideEvents=options.hide.event?$.trim(''+options.hide.event).split(' '):[],toggleEvents=[];if(/mouse(out|leave)/i.test(options.hide.event)&&options.hide.leave==='window'){this._bind(documentTarget,['mouseout','blur'],function(event){if(!/select|option/.test(event.target.nodeName)&&!event.relatedTarget){this.hide(event);}});}
if(options.hide.fixed){hideTarget=hideTarget.add(tooltip.addClass(CLASS_FIXED));}
else if(/mouse(over|enter)/i.test(options.show.event)){this._bind(hideTarget,'mouseleave',function(){clearTimeout(this.timers.show);});}
if((''+options.hide.event).indexOf('unfocus')>-1){this._bind(containerTarget.closest('html'),['mousedown','touchstart'],function(event){var elem=$(event.target),enabled=this.rendered&&!this.tooltip.hasClass(CLASS_DISABLED)&&this.tooltip[0].offsetWidth>0,isAncestor=elem.parents(SELECTOR).filter(this.tooltip[0]).length>0;if(elem[0]!==this.target[0]&&elem[0]!==this.tooltip[0]&&!isAncestor&&!this.target.has(elem[0]).length&&enabled){this.hide(event);}});}
if('number'===typeof options.hide.inactive){this._bind(showTarget,'qtip-'+this.id+'-inactive',inactiveMethod);this._bind(hideTarget.add(tooltip),QTIP.inactiveEvents,inactiveMethod,'-inactive');}
hideEvents=$.map(hideEvents,function(type){var showIndex=$.inArray(type,showEvents);if((showIndex>-1&&hideTarget.add(showTarget).length===hideTarget.length)){toggleEvents.push(showEvents.splice(showIndex,1)[0]);return;}
return type;});this._bind(showTarget,showEvents,showMethod);this._bind(hideTarget,hideEvents,hideMethod);this._bind(showTarget,toggleEvents,function(event){(this.tooltip[0].offsetWidth>0?hideMethod:showMethod).call(this,event);});this._bind(showTarget.add(tooltip),'mousemove',function(event){if('number'===typeof options.hide.distance){var origin=this.cache.origin||{},limit=this.options.hide.distance,abs=Math.abs;if(abs(event.pageX-origin.pageX)>=limit||abs(event.pageY-origin.pageY)>=limit){this.hide(event);}}
this._storeMouse(event);});if(posOptions.target==='mouse'){if(posOptions.adjust.mouse){if(options.hide.event){this._bind(showTarget,['mouseenter','mouseleave'],function(event){this.cache.onTarget=event.type==='mouseenter';});}
this._bind(documentTarget,'mousemove',function(event){if(this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass(CLASS_DISABLED)&&this.tooltip[0].offsetWidth>0){this.reposition(event);}});}}
if(posOptions.adjust.resize||viewportTarget.length){this._bind($.event.special.resize?viewportTarget:windowTarget,'resize',repositionMethod);}
if(posOptions.adjust.scroll){this._bind(windowTarget.add(posOptions.container),'scroll',repositionMethod);}};PROTOTYPE._unassignEvents=function(){var targets=[this.options.show.target[0],this.options.hide.target[0],this.rendered&&this.tooltip[0],this.options.position.container[0],this.options.position.viewport[0],this.options.position.container.closest('html')[0],window,document];if(this.rendered){this._unbind($([]).pushStack($.grep(targets,function(i){return typeof i==='object';})));}
else{$(targets[0]).unbind('.'+this._id+'-create');}};;function init(elem,id,opts)
{var obj,posOptions,attr,config,title,docBody=$(document.body),newTarget=elem[0]===document?docBody:elem,metadata=(elem.metadata)?elem.metadata(opts.metadata):NULL,metadata5=opts.metadata.type==='html5'&&metadata?metadata[opts.metadata.name]:NULL,html5=elem.data(opts.metadata.name||'qtipopts');try{html5=typeof html5==='string'?$.parseJSON(html5):html5;}catch(e){}
config=$.extend(TRUE,{},QTIP.defaults,opts,typeof html5==='object'?sanitizeOptions(html5):NULL,sanitizeOptions(metadata5||metadata));posOptions=config.position;config.id=id;if('boolean'===typeof config.content.text){attr=elem.attr(config.content.attr);if(config.content.attr!==FALSE&&attr){config.content.text=attr;}
else{return FALSE;}}
if(!posOptions.container.length){posOptions.container=docBody;}
if(posOptions.target===FALSE){posOptions.target=newTarget;}
if(config.show.target===FALSE){config.show.target=newTarget;}
if(config.show.solo===TRUE){config.show.solo=posOptions.container.closest('body');}
if(config.hide.target===FALSE){config.hide.target=newTarget;}
if(config.position.viewport===TRUE){config.position.viewport=posOptions.container;}
posOptions.container=posOptions.container.eq(0);posOptions.at=new CORNER(posOptions.at,TRUE);posOptions.my=new CORNER(posOptions.my);if(elem.data(NAMESPACE)){if(config.overwrite){elem.qtip('destroy');}
else if(config.overwrite===FALSE){return FALSE;}}
elem.attr(ATTR_HAS,id);if(config.suppress&&(title=elem.attr('title'))){elem.removeAttr('title').attr(oldtitle,title).attr('title','');}
obj=new QTip(elem,config,id,!!attr);elem.data(NAMESPACE,obj);elem.one('remove.qtip-'+id+' removeqtip.qtip-'+id,function(){var api;if((api=$(this).data(NAMESPACE))){api.destroy();}});return obj;}
QTIP=$.fn.qtip=function(options,notation,newValue)
{var command=(''+options).toLowerCase(),returned=NULL,args=$.makeArray(arguments).slice(1),event=args[args.length-1],opts=this[0]?$.data(this[0],NAMESPACE):NULL;if((!arguments.length&&opts)||command==='api'){return opts;}
else if('string'===typeof options)
{this.each(function()
{var api=$.data(this,NAMESPACE);if(!api){return TRUE;}
if(event&&event.timeStamp){api.cache.event=event;}
if(notation&&(command==='option'||command==='options')){if(newValue!==undefined||$.isPlainObject(notation)){api.set(notation,newValue);}
else{returned=api.get(notation);return FALSE;}}
else if(api[command]){api[command].apply(api,args);}});return returned!==NULL?returned:this;}
else if('object'===typeof options||!arguments.length)
{opts=sanitizeOptions($.extend(TRUE,{},options));return QTIP.bind.call(this,opts,event);}};QTIP.bind=function(opts,event)
{return this.each(function(i){var options,targets,events,namespace,api,id;id=$.isArray(opts.id)?opts.id[i]:opts.id;id=!id||id===FALSE||id.length<1||QTIP.api[id]?QTIP.nextid++:id;namespace='.qtip-'+id+'-create';api=init($(this),id,opts);if(api===FALSE){return TRUE;}
else{QTIP.api[id]=api;}
options=api.options;$.each(PLUGINS,function(){if(this.initialize==='initialize'){this(api);}});targets={show:options.show.target,hide:options.hide.target};events={show:$.trim(''+options.show.event).replace(/ /g,namespace+' ')+namespace,hide:$.trim(''+options.hide.event).replace(/ /g,namespace+' ')+namespace};if(/mouse(over|enter)/i.test(events.show)&&!/mouse(out|leave)/i.test(events.hide)){events.hide+=' mouseleave'+namespace;}
targets.show.bind('mousemove'+namespace,function(event){api._storeMouse(event);api.cache.onTarget=TRUE;});function hoverIntent(event){function render(){api.render(typeof event==='object'||options.show.ready);targets.show.add(targets.hide).unbind(namespace);}
if(api.disabled){return FALSE;}
api.cache.event=$.extend({},event);api.cache.target=event?$(event.target):[undefined];if(options.show.delay>0){clearTimeout(api.timers.show);api.timers.show=setTimeout(render,options.show.delay);if(events.show!==events.hide){targets.hide.bind(events.hide,function(){clearTimeout(api.timers.show);});}}
else{render();}}
targets.show.bind(events.show,hoverIntent);if(options.show.ready||options.prerender){hoverIntent(event);}});};QTIP.api={};;$.each({attr:function(attr,val){if(this.length){var self=this[0],title='title',api=$.data(self,'qtip');if(attr===title&&api&&'object'===typeof api&&api.options.suppress){if(arguments.length<2){return $.attr(self,oldtitle);}
if(api&&api.options.content.attr===title&&api.cache.attr){api.set('content.text',val);}
return this.attr(oldtitle,val);}}
return $.fn['attr'+replaceSuffix].apply(this,arguments);},clone:function(keepData){var titles=$([]),title='title',elems=$.fn['clone'+replaceSuffix].apply(this,arguments);if(!keepData){elems.filter('['+oldtitle+']').attr('title',function(){return $.attr(this,oldtitle);}).removeAttr(oldtitle);}
return elems;}},function(name,func){if(!func||$.fn[name+replaceSuffix]){return TRUE;}
var old=$.fn[name+replaceSuffix]=$.fn[name];$.fn[name]=function(){return func.apply(this,arguments)||old.apply(this,arguments);};});if(!$.ui){$['cleanData'+replaceSuffix]=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=$(elems[i])).length&&elem.attr(ATTR_ID);i++){try{elem.triggerHandler('removeqtip');}
catch(e){}}
$['cleanData'+replaceSuffix](elems);};};QTIP.version='2.0.1-108';QTIP.nextid=0;QTIP.inactiveEvents=INACTIVE_EVENTS;QTIP.zindex=15000;QTIP.defaults={prerender:FALSE,id:FALSE,overwrite:TRUE,suppress:TRUE,content:{text:TRUE,attr:'title',title:FALSE,button:FALSE},position:{my:'top left',at:'bottom right',target:FALSE,container:FALSE,viewport:FALSE,adjust:{x:0,y:0,mouse:TRUE,scroll:TRUE,resize:TRUE,method:'flipinvert flipinvert'},effect:function(api,pos,viewport){$(this).animate(pos,{duration:200,queue:FALSE});}},show:{target:FALSE,event:'mouseenter',effect:TRUE,delay:90,solo:FALSE,ready:FALSE,autofocus:FALSE},hide:{target:FALSE,event:'mouseleave',effect:TRUE,delay:0,fixed:FALSE,inactive:FALSE,leave:'window',distance:FALSE},style:{classes:'',widget:FALSE,width:FALSE,height:FALSE,def:TRUE},events:{render:NULL,move:NULL,show:NULL,hide:NULL,toggle:NULL,visible:NULL,hidden:NULL,focus:NULL,blur:NULL}};;var TIP,TIPNS='.qtip-tip',MARGIN='margin',BORDER='border',COLOR='color',BG_COLOR='background-color',TRANSPARENT='transparent',IMPORTANT=' !important',HASCANVAS=!!document.createElement('canvas').getContext,INVALID=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i;function camel(s){return s.charAt(0).toUpperCase()+s.slice(1);}
var cssProps={},cssPrefixes=["Webkit","O","Moz","ms"];function vendorCss(elem,prop){var ucProp=prop.charAt(0).toUpperCase()+prop.slice(1),props=(prop+' '+cssPrefixes.join(ucProp+' ')+ucProp).split(' '),cur,val,i=0;if(cssProps[prop]){return elem.css(cssProps[prop]);}
while((cur=props[i++])){if((val=elem.css(cur))!==undefined){return cssProps[prop]=cur,val;}}}
function intCss(elem,prop){return parseInt(vendorCss(elem,prop),10);}
if(!HASCANVAS){createVML=function(tag,props,style){return'<qtipvml:'+tag+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(props||'')+' style="behavior: url(#default#VML); '+(style||'')+'" />';};}
function Tip(qtip,options){this._ns='tip';this.options=options;this.offset=options.offset;this.size=[options.width,options.height];this.init((this.qtip=qtip));}
$.extend(Tip.prototype,{init:function(qtip){var context,tip;tip=this.element=qtip.elements.tip=$('<div />',{'class':NAMESPACE+'-tip'}).prependTo(qtip.tooltip);if(HASCANVAS){context=$('<canvas />').appendTo(this.element)[0].getContext('2d');context.lineJoin='miter';context.miterLimit=100;context.save();}
else{context=createVML('shape','coordorigin="0,0"','position:absolute;');this.element.html(context+context);qtip._bind($('*',tip).add(tip),['click','mousedown'],function(event){event.stopPropagation();},this._ns);}
qtip._bind(qtip.tooltip,'tooltipmove',this.reposition,this._ns,this);this.create();},_swapDimensions:function(){this.size[0]=this.options.height;this.size[1]=this.options.width;},_resetDimensions:function(){this.size[0]=this.options.width;this.size[1]=this.options.height;},_useTitle:function(corner){var titlebar=this.qtip.elements.titlebar;return titlebar&&(corner.y===TOP||(corner.y===CENTER&&this.element.position().top+(size[1]/2)+options.offset<titlebar.outerHeight(TRUE)));},_parseCorner:function(corner){var my=this.qtip.options.position.my;if(corner===FALSE||my===FALSE){corner=FALSE;}
else if(corner===TRUE){corner=new CORNER(my.string());}
else if(!corner.string){corner=new CORNER(corner);corner.fixed=TRUE;}
return corner;},_parseWidth:function(corner,side,use){var elements=this.qtip.elements,prop=BORDER+camel(side)+'Width';return(use?intCss(use,prop):(intCss(elements.content,prop)||intCss(this._useTitle(corner)&&elements.titlebar||elements.content,prop)||intCss(tooltip,prop)))||0;},_parseRadius:function(corner){var elements=this.qtip.elements,prop=BORDER+camel(corner.y)+camel(corner.x)+'Radius';return BROWSER.ie<9?0:intCss(this._useTitle(corner)&&elements.titlebar||elements.content,prop)||intCss(elements.tooltip,prop)||0;},_invalidColour:function(elem,prop,compare){var val=elem.css(prop);return!val||(compare&&val===elem.css(compare))||INVALID.test(val)?FALSE:val;},_parseColours:function(corner){var elements=this.qtip.elements,tip=this.element.css('cssText',''),borderSide=BORDER+camel(corner[corner.precedance])+camel(COLOR),colorElem=this._useTitle(corner)&&elements.titlebar||elements.content,css=this._invalidColour,color=[];color[0]=css(tip,BG_COLOR)||css(colorElem,BG_COLOR)||css(elements.content,BG_COLOR)||css(tooltip,BG_COLOR)||tip.css(BG_COLOR);color[1]=css(tip,borderSide,COLOR)||css(colorElem,borderSide,COLOR)||css(elements.content,borderSide,COLOR)||css(tooltip,borderSide,COLOR)||tooltip.css(borderSide);$('*',tip).add(tip).css('cssText',BG_COLOR+':'+TRANSPARENT+IMPORTANT+';'+BORDER+':0'+IMPORTANT+';');return color;},_calculateSize:function(corner){var y=corner.precedance===Y,width=this.options[y?'height':'width'],height=this.options[y?'width':'height'],isCenter=corner.abbrev()==='c',base=width*(isCenter?0.5:1),pow=Math.pow,round=Math.round,bigHyp,ratio,result,smallHyp=Math.sqrt(pow(base,2)+pow(height,2)),hyp=[(this.border/base)*smallHyp,(this.border/height)*smallHyp];hyp[2]=Math.sqrt(pow(hyp[0],2)-pow(this.border,2));hyp[3]=Math.sqrt(pow(hyp[1],2)-pow(this.border,2));bigHyp=smallHyp+hyp[2]+hyp[3]+(isCenter?0:hyp[0]);ratio=bigHyp/smallHyp;result=[round(ratio*width),round(ratio*height)];return y?result:result.reverse();},_calculateTip:function(corner){var width=this.size[0],height=this.size[1],width2=Math.ceil(width/2),height2=Math.ceil(height/2),tips={br:[0,0,width,height,width,0],bl:[0,0,width,0,0,height],tr:[0,height,width,0,width,height],tl:[0,0,0,height,width,height],tc:[0,height,width2,0,width,height],bc:[0,0,width,0,width2,height],rc:[0,0,width,height2,0,height],lc:[width,0,width,height,0,height2]};tips.lt=tips.br;tips.rt=tips.bl;tips.lb=tips.tr;tips.rb=tips.tl;return tips[corner.abbrev()];},create:function(){var c=this.corner=(HASCANVAS||BROWSER.ie)&&this._parseCorner(this.options.corner);if((this.enabled=!!this.corner&&this.corner.abbrev()!=='c')){this.qtip.cache.corner=c.clone();this.update();}
this.element.toggle(this.enabled);return this.corner;},update:function(corner,position){if(!this.enabled){return this;}
var elements=this.qtip.elements,tip=this.element,inner=tip.children(),options=this.options,size=this.size,mimic=options.mimic,round=Math.round,color,precedance,context,coords,translate,newSize,border;if(!corner){corner=this.qtip.cache.corner||this.corner;}
if(mimic===FALSE){mimic=corner;}
else{mimic=new CORNER(mimic);mimic.precedance=corner.precedance;if(mimic.x==='inherit'){mimic.x=corner.x;}
else if(mimic.y==='inherit'){mimic.y=corner.y;}
else if(mimic.x===mimic.y){mimic[corner.precedance]=corner[corner.precedance];}}
precedance=mimic.precedance;if(corner.precedance===X){this._swapDimensions();}
else{this._resetDimensions();}
color=this.color=this._parseColours(corner);if(color[1]!==TRANSPARENT){border=this.border=this._parseWidth(corner,corner[corner.precedance]);if(options.border&&border<1){color[0]=color[1];}
this.border=border=options.border!==TRUE?options.border:border;}
else{this.border=border=0;}
coords=this._calculateTip(mimic);newSize=this.size=this._calculateSize(corner);tip.css({width:newSize[0],height:newSize[1],lineHeight:newSize[1]+'px'});if(corner.precedance===Y){translate=[round(mimic.x===LEFT?border:mimic.x===RIGHT?newSize[0]-size[0]-border:(newSize[0]-size[0])/2),round(mimic.y===TOP?newSize[1]-size[1]:0)];}
else{translate=[round(mimic.x===LEFT?newSize[0]-size[0]:0),round(mimic.y===TOP?border:mimic.y===BOTTOM?newSize[1]-size[1]-border:(newSize[1]-size[1])/2)];}
if(HASCANVAS){inner.attr(WIDTH,newSize[0]).attr(HEIGHT,newSize[1]);context=inner[0].getContext('2d');context.restore();context.save();context.clearRect(0,0,3000,3000);context.fillStyle=color[0];context.strokeStyle=color[1];context.lineWidth=border*2;context.translate(translate[0],translate[1]);context.beginPath();context.moveTo(coords[0],coords[1]);context.lineTo(coords[2],coords[3]);context.lineTo(coords[4],coords[5]);context.closePath();if(border){if(tooltip.css('background-clip')==='border-box'){context.strokeStyle=color[0];context.stroke();}
context.strokeStyle=color[1];context.stroke();}
context.fill();}
else{coords='m'+coords[0]+','+coords[1]+' l'+coords[2]+','+coords[3]+' '+coords[4]+','+coords[5]+' xe';translate[2]=border&&/^(r|b)/i.test(corner.string())?BROWSER.ie===8?2:1:0;inner.css({coordsize:(size[0]+border)+' '+(size[1]+border),antialias:''+(mimic.string().indexOf(CENTER)>-1),left:translate[0],top:translate[1],width:size[0]+border,height:size[1]+border}).each(function(i){var $this=$(this);$this[$this.prop?'prop':'attr']({coordsize:(size[0]+border)+' '+(size[1]+border),path:coords,fillcolor:color[0],filled:!!i,stroked:!i}).toggle(!!(border||i));!i&&$this.html(createVML('stroke','weight="'+(border*2)+'px" color="'+color[1]+'" miterlimit="1000" joinstyle="miter"'));});}
if(position!==FALSE){this.calculate(corner);}},calculate:function(corner){if(!this.enabled){return FALSE;}
var self=this,elements=this.qtip.elements,tip=this.element,userOffset=Math.max(0,this.options.offset),isWidget=this.qtip.tooltip.hasClass('ui-widget'),position={},precedance,size,corners;corner=corner||this.corner;precedance=corner.precedance;size=this._calculateSize(corner);corners=[corner.x,corner.y];if(precedance===X){corners.reverse();}
$.each(corners,function(i,side){var b,bc,br;if(side===CENTER){b=precedance===Y?LEFT:TOP;position[b]='50%';position[MARGIN+'-'+b]=-Math.round(size[precedance===Y?0:1]/2)+userOffset;}
else{b=self._parseWidth(corner,side,elements.tooltip);bc=self._parseWidth(corner,side,elements.content);br=self._parseRadius(corner);position[side]=Math.max(-self.border,i?bc:(userOffset+(br>b?br:-b)));}});position[corner[precedance]]-=size[precedance===X?0:1];tip.css({margin:'',top:'',bottom:'',left:'',right:''}).css(position);return position;},reposition:function(event,api,pos,viewport){if(!this.enabled){return;}
var cache=api.cache,newCorner=this.corner.clone(),adjust=pos.adjusted,method=api.options.position.adjust.method.split(' '),horizontal=method[0],vertical=method[1]||method[0],shift={left:FALSE,top:FALSE,x:0,y:0},offset,css={},props;if(this.corner.fixed!==TRUE){if(horizontal===SHIFT&&newCorner.precedance===X&&adjust.left&&newCorner.y!==CENTER){newCorner.precedance=newCorner.precedance===X?Y:X;}
else if(horizontal!==SHIFT&&adjust.left){newCorner.x=newCorner.x===CENTER?(adjust.left>0?LEFT:RIGHT):(newCorner.x===LEFT?RIGHT:LEFT);}
if(vertical===SHIFT&&newCorner.precedance===Y&&adjust.top&&newCorner.x!==CENTER){newCorner.precedance=newCorner.precedance===Y?X:Y;}
else if(vertical!==SHIFT&&adjust.top){newCorner.y=newCorner.y===CENTER?(adjust.top>0?TOP:BOTTOM):(newCorner.y===TOP?BOTTOM:TOP);}
if(newCorner.string()!==cache.corner.string()&&(cache.cornerTop!==adjust.top||cache.cornerLeft!==adjust.left)){this.update(newCorner,FALSE);}}
offset=this.calculate(newCorner,adjust);if(offset.right!==undefined){offset.left=-offset.right;}
if(offset.bottom!==undefined){offset.top=-offset.bottom;}
offset.user=Math.max(0,this.offset);if(shift.left=(horizontal===SHIFT&&!!adjust.left)){if(newCorner.x===CENTER){css[MARGIN+'-left']=shift.x=offset[MARGIN+'-left']-adjust.left;}
else{props=offset.right!==undefined?[adjust.left,-offset.left]:[-adjust.left,offset.left];if((shift.x=Math.max(props[0],props[1]))>props[0]){pos.left-=adjust.left;shift.left=FALSE;}
css[offset.right!==undefined?RIGHT:LEFT]=shift.x;}}
if(shift.top=(vertical===SHIFT&&!!adjust.top)){if(newCorner.y===CENTER){css[MARGIN+'-top']=shift.y=offset[MARGIN+'-top']-adjust.top;}
else{props=offset.bottom!==undefined?[adjust.top,-offset.top]:[-adjust.top,offset.top];if((shift.y=Math.max(props[0],props[1]))>props[0]){pos.top-=adjust.top;shift.top=FALSE;}
css[offset.bottom!==undefined?BOTTOM:TOP]=shift.y;}}
this.element.css(css).toggle(!((shift.x&&shift.y)||(newCorner.x===CENTER&&shift.y)||(newCorner.y===CENTER&&shift.x)));pos.left-=offset.left.charAt?offset.user:horizontal!==SHIFT||shift.top||!shift.left&&!shift.top?offset.left:0;pos.top-=offset.top.charAt?offset.user:vertical!==SHIFT||shift.left||!shift.left&&!shift.top?offset.top:0;cache.cornerLeft=adjust.left;cache.cornerTop=adjust.top;cache.corner=newCorner.clone();},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns);if(this.qtip.elements.tip){this.qtip.elements.tip.find('*').remove().end().remove();}}});TIP=PLUGINS.tip=function(api){return new Tip(api,api.options.style.tip);};TIP.initialize='render';TIP.sanitize=function(options){if(options.style&&'tip'in options.style){opts=options.style.tip;if(typeof opts!=='object'){opts=options.style.tip={corner:opts};}
if(!(/string|boolean/i).test(typeof opts.corner)){opts.corner=TRUE;}}};CHECKS.tip={'^position.my|style.tip.(corner|mimic|border)$':function(){this.create();this.qtip.reposition();},'^style.tip.(height|width)$':function(obj){this.size=size=[obj.width,obj.height];this.update();this.qtip.reposition();},'^content.title|style.(classes|widget)$':function(){this.update();}};$.extend(TRUE,QTIP.defaults,{style:{tip:{corner:TRUE,mimic:FALSE,width:6,height:6,border:TRUE,offset:0}}});;var MODAL,OVERLAY,MODALCLASS='qtip-modal',MODALSELECTOR='.'+MODALCLASS;OVERLAY=function()
{var self=this,focusableElems={},current,onLast,prevState,elem;function focusable(element){if($.expr[':'].focusable){return $.expr[':'].focusable;}
var isTabIndexNotNaN=!isNaN($.attr(element,'tabindex')),nodeName=element.nodeName&&element.nodeName.toLowerCase(),map,mapName,img;if('area'===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=='map'){return false;}
img=$('img[usemap=#'+mapName+']')[0];return!!img&&img.is(':visible');}
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN);}
function focusInputs(blurElems){if(focusableElems.length<1&&blurElems.length){blurElems.not('body').blur();}
else{focusableElems.first().focus();}}
function stealFocus(event){if(!elem.is(':visible')){return;}
var target=$(event.target),tooltip=current.tooltip,container=target.closest(SELECTOR),targetOnTop;targetOnTop=container.length<1?FALSE:(parseInt(container[0].style.zIndex,10)>parseInt(tooltip[0].style.zIndex,10));if(!targetOnTop&&target.closest(SELECTOR)[0]!==tooltip[0]){focusInputs(target);}
onLast=event.target===focusableElems[focusableElems.length-1];}
$.extend(self,{init:function(){elem=self.elem=$('<div />',{id:'qtip-overlay',html:'<div></div>',mousedown:function(){return FALSE;}}).hide();function resize(){var win=$(this);elem.css({height:win.height(),width:win.width()});}
$(window).bind('resize'+MODALSELECTOR,resize);resize();$(document.body).bind('focusin'+MODALSELECTOR,stealFocus);$(document).bind('keydown'+MODALSELECTOR,function(event){if(current&&current.options.show.modal.escape&&event.keyCode===27){current.hide(event);}});elem.bind('click'+MODALSELECTOR,function(event){if(current&&current.options.show.modal.blur){current.hide(event);}});return self;},update:function(api){current=api;if(api.options.show.modal.stealfocus!==FALSE){focusableElems=api.tooltip.find('*').filter(function(){return focusable(this);});}
else{focusableElems=[];}},toggle:function(api,state,duration){var docBody=$(document.body),tooltip=api.tooltip,options=api.options.show.modal,effect=options.effect,type=state?'show':'hide',visible=elem.is(':visible'),visibleModals=$(MODALSELECTOR).filter(':visible:not(:animated)').not(tooltip),zindex;self.update(api);if(state&&options.stealfocus!==FALSE){focusInputs($(':focus'));}
elem.toggleClass('blurs',options.blur);if(state){elem.css({left:0,top:0}).appendTo(document.body);}
if((elem.is(':animated')&&visible===state&&prevState!==FALSE)||(!state&&visibleModals.length)){return self;}
elem.stop(TRUE,FALSE);if($.isFunction(effect)){effect.call(elem,state);}
else if(effect===FALSE){elem[type]();}
else{elem.fadeTo(parseInt(duration,10)||90,state?1:0,function(){if(!state){elem.hide();}});}
if(!state){elem.queue(function(next){elem.css({left:'',top:''});if(!$(MODALSELECTOR).length){elem.detach();}
next();});}
prevState=state;if(current.destroyed){current=NULL;}
return self;}});self.init();};OVERLAY=new OVERLAY();function Modal(api,options){this.options=options;this._ns='-modal';this.init((this.qtip=api));}
$.extend(Modal.prototype,{init:function(qtip){var tooltip=qtip.tooltip;if(!this.options.on){return this;}
qtip.elements.overlay=OVERLAY.elem;tooltip.addClass(MODALCLASS).css('z-index',PLUGINS.modal.zindex+$(MODALSELECTOR).length);qtip._bind(tooltip,['tooltipshow','tooltiphide'],function(event,api,duration){var oEvent=event.originalEvent;if(event.target===tooltip[0]){if(oEvent&&event.type==='tooltiphide'&&/mouse(leave|enter)/.test(oEvent.type)&&$(oEvent.relatedTarget).closest(overlay[0]).length){try{event.preventDefault();}catch(e){}}
else if(!oEvent||(oEvent&&!oEvent.solo)){this.toggle(event,event.type==='tooltipshow',duration);}}},this._ns,this);qtip._bind(tooltip,'tooltipfocus',function(event,api){if(event.isDefaultPrevented()||event.target!==tooltip[0]){return;}
var qtips=$(MODALSELECTOR),newIndex=PLUGINS.modal.zindex+qtips.length,curIndex=parseInt(tooltip[0].style.zIndex,10);OVERLAY.elem[0].style.zIndex=newIndex-1;qtips.each(function(){if(this.style.zIndex>curIndex){this.style.zIndex-=1;}});qtips.filter('.'+CLASS_FOCUS).qtip('blur',event.originalEvent);tooltip.addClass(CLASS_FOCUS)[0].style.zIndex=newIndex;OVERLAY.update(api);try{event.preventDefault();}catch(e){}},this._ns,this);qtip._bind(tooltip,'tooltiphide',function(event){if(event.target===tooltip[0]){$(MODALSELECTOR).filter(':visible').not(tooltip).last().qtip('focus',event);}},this._ns,this);},toggle:function(event,state,duration){if(event&&event.isDefaultPrevented()){return this;}
OVERLAY.toggle(this.qtip,!!state,duration);},destroy:function(){this.qtip.tooltip.removeClass(MODALCLASS);this.qtip._unbind(this.qtip.tooltip,this._ns);OVERLAY.toggle(this.qtip,FALSE);delete this.qtip.elements.overlay;}});MODAL=PLUGINS.modal=function(api){return new Modal(api,api.options.show.modal);};MODAL.sanitize=function(opts){if(opts.show){if(typeof opts.show.modal!=='object'){opts.show.modal={on:!!opts.show.modal};}
else if(typeof opts.show.modal.on==='undefined'){opts.show.modal.on=TRUE;}}};MODAL.zindex=QTIP.zindex-200;MODAL.initialize='render';CHECKS.modal={'^show.modal.(on|blur)$':function(){this.destroy();this.init();this.qtip.elems.overlay.toggle(this.qtip.tooltip[0].offsetWidth>0);}};$.extend(TRUE,QTIP.defaults,{show:{modal:{on:FALSE,effect:TRUE,blur:TRUE,stealfocus:TRUE,escape:TRUE}}});;PLUGINS.viewport=function(api,position,posOptions,targetWidth,targetHeight,elemWidth,elemHeight)
{var target=posOptions.target,tooltip=api.elements.tooltip,my=posOptions.my,at=posOptions.at,adjust=posOptions.adjust,method=adjust.method.split(' '),methodX=method[0],methodY=method[1]||method[0],viewport=posOptions.viewport,container=posOptions.container,cache=api.cache,tip=api.plugins.tip,adjusted={left:0,top:0},fixed,newMy,newClass;if(!viewport.jquery||target[0]===window||target[0]===document.body||adjust.method==='none'){return adjusted;}
fixed=tooltip.css('position')==='fixed';viewport={elem:viewport,width:viewport[0]===window?viewport.width():viewport.outerWidth(FALSE),height:viewport[0]===window?viewport.height():viewport.outerHeight(FALSE),scrollleft:fixed?0:viewport.scrollLeft(),scrolltop:fixed?0:viewport.scrollTop(),offset:viewport.offset()||{left:0,top:0}};container={elem:container,scrollLeft:container.scrollLeft(),scrollTop:container.scrollTop(),offset:container.offset()||{left:0,top:0}};function calculate(side,otherSide,type,adjust,side1,side2,lengthName,targetLength,elemLength){var initialPos=position[side1],mySide=my[side],atSide=at[side],isShift=type===SHIFT,viewportScroll=-container.offset[side1]+viewport.offset[side1]+viewport['scroll'+side1],myLength=mySide===side1?elemLength:mySide===side2?-elemLength:-elemLength/2,atLength=atSide===side1?targetLength:atSide===side2?-targetLength:-targetLength/2,tipLength=tip&&tip.size?tip.size[lengthName]||0:0,tipAdjust=tip&&tip.corner&&tip.corner.precedance===side&&!isShift?tipLength:0,overflow1=viewportScroll-initialPos+tipAdjust,overflow2=initialPos+elemLength-viewport[lengthName]-viewportScroll+tipAdjust,offset=myLength-(my.precedance===side||mySide===my[otherSide]?atLength:0)-(atSide===CENTER?targetLength/2:0);if(isShift){tipAdjust=tip&&tip.corner&&tip.corner.precedance===otherSide?tipLength:0;offset=(mySide===side1?1:-1)*myLength-tipAdjust;position[side1]+=overflow1>0?overflow1:overflow2>0?-overflow2:0;position[side1]=Math.max(-container.offset[side1]+viewport.offset[side1]+(tipAdjust&&tip.corner[side]===CENTER?tip.offset:0),initialPos-offset,Math.min(Math.max(-container.offset[side1]+viewport.offset[side1]+viewport[lengthName],initialPos+offset),position[side1]));}
else{adjust*=(type===FLIPINVERT?2:0);if(overflow1>0&&(mySide!==side1||overflow2>0)){position[side1]-=offset+adjust;newMy.invert(side,side1);}
else if(overflow2>0&&(mySide!==side2||overflow1>0)){position[side1]-=(mySide===CENTER?-offset:offset)+adjust;newMy.invert(side,side2);}
if(position[side1]<viewportScroll&&-position[side1]>overflow2){position[side1]=initialPos;newMy=my.clone();}}
return position[side1]-initialPos;}
if(methodX!=='shift'||methodY!=='shift'){newMy=my.clone();}
adjusted={left:methodX!=='none'?calculate(X,Y,methodX,adjust.x,LEFT,RIGHT,WIDTH,targetWidth,elemWidth):0,top:methodY!=='none'?calculate(Y,X,methodY,adjust.y,TOP,BOTTOM,HEIGHT,targetHeight,elemHeight):0};if(newMy&&cache.lastClass!==(newClass=NAMESPACE+'-pos-'+newMy.abbrev())){tooltip.removeClass(api.cache.lastClass).addClass((api.cache.lastClass=newClass));}
return adjusted;};;PLUGINS.polys={polygon:function(baseCoords,corner){var result={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10},adjustable:FALSE},i=0,next,coords=[],compareX=1,compareY=1,realX=0,realY=0,newWidth,newHeight;i=baseCoords.length;while(i--){next=[parseInt(baseCoords[--i],10),parseInt(baseCoords[i+1],10)];if(next[0]>result.position.right){result.position.right=next[0];}
if(next[0]<result.position.left){result.position.left=next[0];}
if(next[1]>result.position.bottom){result.position.bottom=next[1];}
if(next[1]<result.position.top){result.position.top=next[1];}
coords.push(next);}
newWidth=result.width=Math.abs(result.position.right-result.position.left);newHeight=result.height=Math.abs(result.position.bottom-result.position.top);if(corner.abbrev()==='c'){result.position={left:result.position.left+(result.width/2),top:result.position.top+(result.height/2)};}
else{while(newWidth>0&&newHeight>0&&compareX>0&&compareY>0)
{newWidth=Math.floor(newWidth/2);newHeight=Math.floor(newHeight/2);if(corner.x===LEFT){compareX=newWidth;}
else if(corner.x===RIGHT){compareX=result.width-newWidth;}
else{compareX+=Math.floor(newWidth/2);}
if(corner.y===TOP){compareY=newHeight;}
else if(corner.y===BOTTOM){compareY=result.height-newHeight;}
else{compareY+=Math.floor(newHeight/2);}
i=coords.length;while(i--)
{if(coords.length<2){break;}
realX=coords[i][0]-result.position.left;realY=coords[i][1]-result.position.top;if((corner.x===LEFT&&realX>=compareX)||(corner.x===RIGHT&&realX<=compareX)||(corner.x===CENTER&&(realX<compareX||realX>(result.width-compareX)))||(corner.y===TOP&&realY>=compareY)||(corner.y===BOTTOM&&realY<=compareY)||(corner.y===CENTER&&(realY<compareY||realY>(result.height-compareY)))){coords.splice(i,1);}}}
result.position={left:coords[0][0],top:coords[0][1]};}
return result;},rect:function(ax,ay,bx,by,corner){return{width:Math.abs(bx-ax),height:Math.abs(by-ay),position:{left:Math.min(ax,bx),top:Math.min(ay,by)}};},_angles:{tc:3/2,tr:7/4,tl:5/4,bc:1/2,br:1/4,bl:3/4,rc:2,lc:1,c:0},ellipse:function(cx,cy,rx,ry,corner){var c=PLUGINS.polys._angles[corner.abbrev()],rxc=rx*Math.cos(c*Math.PI),rys=ry*Math.sin(c*Math.PI);return{width:(rx*2)-Math.abs(rxc),height:(ry*2)-Math.abs(rys),position:{left:cx+rxc,top:cy+rys},adjustable:FALSE};},circle:function(cx,cy,r,corner){return PLUGINS.polys.ellipse(cx,cy,r,r,corner);}};;PLUGINS.svg=function(api,svg,corner,adjustMethod)
{var doc=$(document),elem=svg[0],result=FALSE,name,box,position,dimensions;while(!elem.getBBox){elem=elem.parentNode;}
if(!elem.getBBox||!elem.parentNode){return FALSE;}
switch(elem.nodeName){case'rect':position=PLUGINS.svg.toPixel(elem,elem.x.baseVal.value,elem.y.baseVal.value);dimensions=PLUGINS.svg.toPixel(elem,elem.x.baseVal.value+elem.width.baseVal.value,elem.y.baseVal.value+elem.height.baseVal.value);result=PLUGINS.polys.rect(position[0],position[1],dimensions[0],dimensions[1],corner);break;case'ellipse':case'circle':position=PLUGINS.svg.toPixel(elem,elem.cx.baseVal.value,elem.cy.baseVal.value);result=PLUGINS.polys.ellipse(position[0],position[1],(elem.rx||elem.r).baseVal.value,(elem.ry||elem.r).baseVal.value,corner);break;case'line':case'polygon':case'polyline':points=elem.points||[{x:elem.x1.baseVal.value,y:elem.y1.baseVal.value},{x:elem.x2.baseVal.value,y:elem.y2.baseVal.value}];for(result=[],i=-1,len=points.numberOfItems||points.length;++i<len;){next=points.getItem?points.getItem(i):points[i];result.push.apply(result,PLUGINS.svg.toPixel(elem,next.x,next.y));}
result=PLUGINS.polys.polygon(result,corner);break;default:return FALSE;}
result.position.left+=doc.scrollLeft();result.position.top+=doc.scrollTop();return result;};PLUGINS.svg.toPixel=function(elem,x,y){var mtx=elem.getScreenCTM(),root=elem.farthestViewportElement||elem,result,point;if(!root.createSVGPoint){return FALSE;}
point=root.createSVGPoint();point.x=x;point.y=y;result=point.matrixTransform(mtx);return[result.x,result.y];};;PLUGINS.imagemap=function(api,area,corner,adjustMethod)
{if(!area.jquery){area=$(area);}
var shape=area.attr('shape').toLowerCase().replace('poly','polygon'),image=$('img[usemap="#'+area.parent('map').attr('name')+'"]'),coordsString=area.attr('coords'),coordsArray=coordsString.split(','),imageOffset,coords,i,next;if(!image.length){return FALSE;}
if(shape==='polygon'){result=PLUGINS.polys.polygon(coordsArray,corner);}
else if(PLUGINS.polys[shape]){for(i=-1,len=coordsArray.length,coords=[];++i<len;){coords.push(parseInt(coordsArray[i],10));}
result=PLUGINS.polys[shape].apply(this,coords.concat(corner));}
else{return FALSE;}
imageOffset=image.offset();imageOffset.left+=Math.ceil((image.outerWidth(FALSE)-image.width())/2);imageOffset.top+=Math.ceil((image.outerHeight(FALSE)-image.height())/2);result.position.left+=imageOffset.left;result.position.top+=imageOffset.top;return result;};;var IE6,BGIFRAME='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" '+' style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); '+'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>';function Ie6(api,qtip){this._ns='ie6';this.init((this.qtip=api));}
$.extend(Ie6.prototype,{_scroll:function(){var overlay=this.qtip.elements.overlay;overlay&&(overlay[0].style.top=$(window).scrollTop()+'px');},init:function(qtip){var tooltip=qtip.tooltip,scroll;if($('select, object').length<1){this.bgiframe=qtip.elements.bgiframe=$(BGIFRAME).appendTo(tooltip);qtip._bind(tooltip,'tooltipmove',this.adjustBGIFrame,this._ns,this);}
this.redrawContainer=$('<div/>',{id:NAMESPACE+'-rcontainer'}).appendTo(document.body);if(qtip.elements.overlay&&qtip.elements.overlay.addClass('qtipmodal-ie6fix')){qtip._bind(window,['scroll','resize'],this._scroll,this._ns,this);qtip._bind(tooltip,['tooltipshow'],this._scroll,this._ns,this);}
this.redraw();},adjustBGIFrame:function(){var tooltip=this.qtip.tooltip,dimensions={height:tooltip.outerHeight(FALSE),width:tooltip.outerWidth(FALSE)},plugin=this.qtip.plugins.tip,tip=this.qtip.elements.tip,tipAdjust,offset;offset=parseInt(tooltip.css('borderLeftWidth'),10)||0;offset={left:-offset,top:-offset};if(plugin&&tip){tipAdjust=(plugin.corner.precedance==='x')?[WIDTH,LEFT]:[HEIGHT,TOP];offset[tipAdjust[1]]-=tip[tipAdjust[0]]();}
this.bgiframe.css(offset).css(dimensions);},redraw:function(){if(this.qtip.rendered<1||this.drawing){return self;}
var tooltip=this.qtip.tooltip,style=this.qtip.options.style,container=this.qtip.options.position.container,perc,width,max,min;this.qtip.drawing=1;if(style.height){tooltip.css(HEIGHT,style.height);}
if(style.width){tooltip.css(WIDTH,style.width);}
else{tooltip.css(WIDTH,'').appendTo(this.redrawContainer);width=tooltip.width();if(width%2<1){width+=1;}
max=tooltip.css('maxWidth')||'';min=tooltip.css('minWidth')||'';perc=(max+min).indexOf('%')>-1?container.width()/100:0;max=((max.indexOf('%')>-1?perc:1)*parseInt(max,10))||width;min=((min.indexOf('%')>-1?perc:1)*parseInt(min,10))||0;width=max+min?Math.min(Math.max(width,min),max):width;tooltip.css(WIDTH,Math.round(width)).appendTo(container);}
this.drawing=0;return self;},destroy:function(){this.bgiframe&&this.bgiframe.remove();this.qtip._unbind([window,this.qtip.tooltip],this._ns);}});IE6=PLUGINS.ie6=function(api){return BROWSER.ie===6?new Ie6(api):FALSE;};IE6.initialize='render';CHECKS.ie6={'^content|style$':function(){this.redraw();}};;}));}(window,document));;(function($,undefined){'use strict';var BLANK='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';$.fn.imagesLoaded=function(callback){var $this=this,deferred=$.isFunction($.Deferred)?$.Deferred():0,hasNotify=$.isFunction(deferred.notify),$images=$this.find('img').add($this.filter('img')),loaded=[],proper=[],broken=[];if($.isPlainObject(callback)){$.each(callback,function(key,value){if(key==='callback'){callback=value;}else if(deferred){deferred[key](value);}});}
function doneLoading(){var $proper=$(proper),$broken=$(broken);if(deferred){if(broken.length){deferred.reject($images,$proper,$broken);}else{deferred.resolve($images);}}
if($.isFunction(callback)){callback.call($this,$images,$proper,$broken);}}
function imgLoadedHandler(event){imgLoaded(event.target,event.type==='error');}
function imgLoaded(img,isBroken){if(img.src===BLANK||$.inArray(img,loaded)!==-1){return;}
loaded.push(img);if(isBroken){broken.push(img);}else{proper.push(img);}
$.data(img,'imagesLoaded',{isBroken:isBroken,src:img.src});if(hasNotify){deferred.notifyWith($(img),[isBroken,$images,$(proper),$(broken)]);}
if($images.length===loaded.length){setTimeout(doneLoading);$images.unbind('.imagesLoaded',imgLoadedHandler);}}
if(!$images.length){doneLoading();}else{$images.bind('load.imagesLoaded error.imagesLoaded',imgLoadedHandler).each(function(i,el){var src=el.src;var cached=$.data(el,'imagesLoaded');if(cached&&cached.src===src){imgLoaded(el,cached.isBroken);return;}
if(el.complete&&el.naturalWidth!==undefined){imgLoaded(el,el.naturalWidth===0||el.naturalHeight===0);return;}
if(el.readyState||el.complete){el.src=BLANK;el.src=src;}});}
return deferred?deferred.promise($this):$this;};})(jQuery);jsmime={};(function(){"use strict";var mimes={"sco":["audio/csound"],"sci":["application/x-scilab"],"sce":["application/x-scilab"],"alc":["chemical/x-alchemy"],"gf":["application/x-tex-gf"],"mp4":["video/mp4"],"mp2":["audio/mpeg"],"mp3":["audio/mpeg"],"nwc":["application/x-nwc"],"sct":["text/scriptlet"],"ros":["chemical/x-rosdal"],"scr":["application/x-silverlight"],"wmz":["application/x-ms-wmz"],"xlsb":["application/vnd.ms-excel.sheet.binary.macroEnabled.12"],"gcd":["text/x-pcs-gcd"],"tr":["application/x-troff"],"ts":["video/MP2T"],"tm":["text/texmacs"],"tk":["text/x-tcl"],"wml":["text/vnd.wap.wml"],"wma":["audio/x-ms-wma"],"fchk":["chemical/x-gaussian-checkpoint"],"wmd":["application/x-ms-wmd"],"mpg":["video/mpeg"],"cascii":["chemical/x-cactvs-binary"],"mpe":["video/mpeg"],"smi":["application/smil","chemical/x-daylight-smiles"],"mph":["application/x-comsol"],"mpv":["video/x-matroska"],"wsc":["text/scriptlet"],"cml":["chemical/x-cml"],"dif":["video/dv"],"thmx":["application/vnd.ms-officetheme"],"p":["text/x-pascal"],"pbm":["image/x-portable-bitmap"],"dir":["application/x-director"],"htc":["text/x-component"],"hta":["application/hta"],"odp":["application/vnd.oasis.opendocument.presentation"],"htm":["text/html"],"nbp":["application/mathematica"],"odt":["application/vnd.oasis.opendocument.text"],"tex":["text/x-tex"],"odi":["application/vnd.oasis.opendocument.image"],"odm":["application/vnd.oasis.opendocument.text-master"],"oda":["application/oda"],"odb":["application/vnd.oasis.opendocument.database"],"odc":["application/vnd.oasis.opendocument.chart"],"odf":["application/vnd.oasis.opendocument.formula"],"odg":["application/vnd.oasis.opendocument.graphics"],"gl":["video/gl"],"nef":["image/x-nikon-nef"],"rtx":["text/richtext"],"abw":["application/x-abiword"],"mng":["video/x-mng"],"cr2":["image/x-canon-cr2"],"oza":["application/x-oz-application"],"wmx":["video/x-ms-wmx"],"asc":["text/plain"],"onepkg":["application/onenote"],"rdp":["application/x-rdp"],"m3u":["audio/mpegurl","audio/x-mpegurl"],"ctx":["chemical/x-ctx"],"appcache":["text/cache-manifest"],"cbin":["chemical/x-cactvs-binary"],"rdf":["application/rdf+xml"],"boo":["text/x-boo"],"m3g":["application/m3g"],"maker":["application/x-maker"],"wmv":["video/x-ms-wmv"],"apk":["application/vnd.android.package-archive"],"sgl":["application/vnd.stardivision.writer-global"],"brf":["text/plain"],"txt":["text/plain"],"wbmp":["image/vnd.wap.wbmp"],"sgf":["application/x-go-sgf"],"zip":["application/zip"],"epsi":["application/postscript"],"epsf":["application/postscript"],"chm":["chemical/x-chemdraw"],"asn":["chemical/x-ncbi-asn1","chemical/x-ncbi-asn1-spec"],"msi":["application/x-msi"],"msh":["model/mesh"],"pfa":["application/x-font"],"wvx":["video/x-ms-wvx"],"pfb":["application/x-font"],"flv":["video/x-flv"],"flac":["audio/flac"],"wbxml":["application/vnd.wap.wbxml"],"iii":["application/x-iphone"],"me":["application/x-troff-me"],"mm":["application/x-freemind"],"uls":["text/iuls"],"cap":["application/vnd.tcpdump.pcap"],"cat":["application/vnd.ms-pki.seccat"],"fli":["video/fli"],"erf":["image/x-epson-erf"],"jdx":["chemical/x-jcamp-dx"],"ms":["application/x-troff-ms"],"xht":["application/xhtml+xml"],"cac":["chemical/x-cache"],"cab":["application/x-cab"],"deb":["application/x-debian-package"],"eps2":["application/postscript"],"eps3":["application/postscript"],"spx":["audio/ogg"],"ltx":["text/x-tex"],"xcf":["application/x-xcf"],"tar":["application/x-tar"],"dxr":["application/x-director"],"taz":["application/x-gtar-compressed"],"spl":["application/futuresplash","application/x-futuresplash"],"spc":["chemical/x-galactic-spc"],"mpc":["chemical/x-mopac-input"],"csm":["chemical/x-csml"],"chrt":["application/x-kchart"],"csh":["application/x-csh","text/x-csh"],"gcg":["chemical/x-gcg8-sequence"],"sit":["application/x-stuffit"],"csd":["audio/csound"],"csf":["chemical/x-cache-csf"],"sig":["application/pgp-signature"],"sid":["audio/prs.sid"],"sik":["application/x-trash"],"xhtml":["application/xhtml+xml"],"csv":["text/csv"],"css":["text/css"],"sis":["application/vnd.symbian.install"],"snd":["audio/basic"],"mpega":["audio/mpeg"],"fb":["application/x-maker"],"mesh":["model/mesh"],"fm":["application/x-maker"],"man":["application/x-troff-man"],"lha":["application/x-lha"],"gcf":["application/x-graphing-calculator"],"sw":["chemical/x-swissprot"],"sh":["application/x-sh","text/x-sh"],"lhs":["text/x-literate-haskell"],"sd":["chemical/x-mdl-sdfile"],"lsf":["video/x-la-asf"],"vmd":["chemical/x-vmd"],"jpeg":["image/jpeg"],"jng":["image/x-jng"],"vms":["chemical/x-vamas-iso14976"],"lsx":["video/x-la-asf"],"pcx":["image/pcx"],"djv":["image/vnd.djvu"],"wrl":["model/vrml","x-world/x-vrml"],"qgs":["application/x-qgis"],"gen":["chemical/x-genbank"],"html":["text/html"],"fig":["application/x-xfig"],"tsv":["text/tab-separated-values"],"ent":["chemical/x-ncbi-asn1-ascii","chemical/x-pdb"],"pcf":["application/x-font"],"tsp":["application/dsptype"],"ly":["text/x-lilypond"],"pptx":["application/vnd.openxmlformats-officedocument.presentationml.presentation"],"lzx":["application/x-lzx"],"docx":["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],"mxu":["video/vnd.mpegurl"],"dat":["application/x-ns-proxy-autoconfig"],"lzh":["application/x-lzh"],"pptm":["application/vnd.ms-powerpoint.presentation.macroEnabled.12"],"docm":["application/vnd.ms-word.document.macroEnabled.12"],"mxf":["application/mxf"],"qt":["video/quicktime"],"hqx":["application/mac-binhex40"],"kpr":["application/x-kpresenter"],"kpt":["application/x-kpresenter"],"xlb":["application/vnd.ms-excel"],"h":["text/x-chdr"],"xlt":["application/vnd.ms-excel"],"xls":["application/vnd.ms-excel"],"atomcat":["application/atomcat+xml"],"mdb":["application/msaccess"],"gtar":["application/x-gtar"],"ez":["application/andrew-inset"],"es":["application/ecmascript"],"vcd":["application/x-cdlink"],"vcf":["text/x-vcard"],"rd":["chemical/x-mdl-rdfile"],"vcs":["text/x-vcalendar"],"ra":["audio/x-pn-realaudio","audio/x-realaudio"],"rb":["application/x-ruby"],"rm":["audio/x-pn-realaudio"],"asx":["video/x-ms-asf"],"gnumeric":["application/x-gnumeric"],"mml":["text/mathml"],"asf":["video/x-ms-asf"],"orf":["image/x-olympus-orf"],"mmd":["chemical/x-macromodel-input"],"mmf":["application/vnd.smaf"],"aso":["chemical/x-ncbi-asn1-binary"],"orc":["audio/csound"],"cxx":["text/x-c++src"],"md5":["application/x-md5"],"xpm":["image/x-xpixmap"],"midi":["audio/midi"],"c3d":["chemical/x-chem3d"],"isp":["application/x-internet-signup"],"swfl":["application/x-shockwave-flash"],"ist":["chemical/x-isostar"],"mvb":["chemical/x-mopac-vib"],"iso":["application/x-iso9660-image"],"xul":["application/vnd.mozilla.xul+xml"],"pgn":["application/x-chess-pgn"],"pgm":["image/x-portable-graymap"],"one":["application/onenote"],"pgp":["application/pgp-encrypted"],"potx":["application/vnd.openxmlformats-officedocument.presentationml.template"],"x3dv":["model/x3d+vrml"],"potm":["application/vnd.ms-powerpoint.template.macroEnabled.12"],"gpt":["chemical/x-mopac-graph"],"x3db":["model/x3d+binary"],"phtml":["application/x-httpd-php"],"ods":["application/vnd.oasis.opendocument.spreadsheet"],"ogx":["application/ogg"],"wax":["audio/x-ms-wax"],"onetoc2":["application/onenote"],"pnm":["image/x-portable-anymap"],"cmdf":["chemical/x-cmdf"],"oga":["audio/ogg"],"png":["image/png"],"rss":["application/x-rss+xml"],"std":["application/vnd.sun.xml.draw.template"],"onetmp":["application/onenote"],"b":["chemical/x-molconn-Z"],"stc":["application/vnd.sun.xml.calc.template"],"stl":["application/sla","application/vnd.ms-pki.stl"],"ogg":["audio/ogg"],"sti":["application/vnd.sun.xml.impress.template"],"stw":["application/vnd.sun.xml.writer.template"],"torrent":["application/x-bittorrent"],"sldm":["application/vnd.ms-powerpoint.slide.macroEnabled.12"],"prf":["application/pics-rules"],"php3p":["application/x-httpd-php3-preprocessed"],"ram":["audio/x-pn-realaudio"],"prt":["chemical/x-ncbi-asn1-ascii"],"rar":["application/rar"],"ras":["image/x-cmu-raster"],"anx":["application/annodex"],"7z":["application/x-7z-compressed"],"shtml":["text/html"],"lin":["application/bbolin"],"mid":["audio/midi"],"mif":["application/x-mif","chemical/x-mif"],"323":["text/h323"],"istr":["chemical/x-isostar"],"csml":["chemical/x-csml"],"ogv":["video/ogg"],"sfv":["text/x-sfv"],"zmt":["chemical/x-mopac-input"],"mkv":["video/x-matroska"],"kar":["audio/midi"],"mpeg":["video/mpeg"],"sisx":["x-epoc/x-sisx-app"],"pyo":["application/x-python-code"],"bsd":["chemical/x-crossfire"],"pyc":["application/x-python-code"],"awb":["audio/amr-wb","audio/amr-wb"],"cc":["text/x-c++src"],"fbdoc":["application/x-maker"],"latex":["application/x-latex"],"exe":["application/x-msdos-program"],"axv":["video/annodex"],"doc":["application/msword"],"wmlsc":["application/vnd.wap.wmlscriptc"],"hh":["text/x-c++hdr"],"axa":["audio/annodex"],"dot":["application/msword"],"cdf":["application/x-cdf"],"rtf":["application/rtf"],"ctab":["chemical/x-cactvs-binary"],"cda":["application/x-cdf"],"text":["text/plain"],"atom":["application/atom+xml"],"cdt":["image/x-coreldrawtemplate"],"texi":["application/x-texinfo"],"cdr":["image/x-coreldraw"],"cdx":["chemical/x-cdx"],"cdy":["application/vnd.cinderella"],"xml":["application/xml"],"ksp":["application/x-kspread"],"cache":["chemical/x-cache"],"jar":["application/java-archive"],"jam":["application/x-jam"],"jad":["text/vnd.sun.j2me.app-descriptor"],"ief":["image/ief"],"dl":["video/dl"],"woff":["application/x-font-woff"],"cpio":["application/x-cpio"],"dx":["chemical/x-jcamp-dx"],"dv":["video/dv"],"xcos":["application/x-scilab-xcos"],"hin":["chemical/x-hin"],"silo":["model/mesh"],"shp":["application/x-qgis"],"bat":["application/x-msdos-program"],"crw":["image/x-canon-crw"],"crt":["application/x-x509-ca-cert"],"emb":["chemical/x-embl-dl-nucleotide"],"shx":["application/x-qgis"],"eml":["message/rfc822"],"c++":["text/x-c++src"],"patch":["text/x-diff"],"bak":["application/x-trash"],"crl":["application/x-pkcs7-crl"],"art":["image/x-jg"],"ser":["application/java-serialized-object"],"frame":["application/x-maker"],"mcif":["chemical/x-mmcif"],"qtl":["application/x-quicktimeplayer"],"movie":["video/x-sgi-movie"],"dll":["application/x-msdos-program"],"wm":["video/x-ms-wm"],"wk":["application/x-123"],"js":["application/javascript"],"key":["application/pgp-keys"],"sv4crc":["application/x-sv4crc"],"pcap":["application/vnd.tcpdump.pcap"],"wz":["application/x-wingz"],"vrm":["x-world/x-vrml"],"c":["text/x-csrc"],"etx":["text/x-setext"],"xlam":["application/vnd.ms-excel.addin.macroEnabled.12"],"sty":["text/x-tex"],"cod":["application/vnd.rim.cod"],"pdf":["application/pdf"],"com":["application/x-msdos-program"],"pdb":["chemical/x-pdb"],"xltm":["application/vnd.ms-excel.template.macroEnabled.12"],"kwd":["application/x-kword"],"tgz":["application/x-gtar-compressed"],"pot":["text/plain"],"xltx":["application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],"kwt":["application/x-kword"],"cxf":["chemical/x-cxf"],"sxd":["application/vnd.sun.xml.draw"],"rpm":["application/x-redhat-package-manager"],"cu":["application/cu-seeme"],"jnlp":["application/x-java-jnlp-file"],"ps":["application/postscript"],"mpga":["audio/mpeg"],"iges":["model/iges"],"py":["text/x-python"],"frm":["application/x-maker"],"swf":["application/x-shockwave-flash"],"json":["application/json"],"pk":["application/x-tex-pk"],"pl":["text/x-perl"],"pm":["text/x-perl"],"oth":["application/vnd.oasis.opendocument.text-web"],"xlsx":["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],"mcm":["chemical/x-macmolecule"],"lyx":["application/x-lyx"],"gau":["chemical/x-gaussian-input"],"dotx":["application/vnd.openxmlformats-officedocument.wordprocessingml.template"],"sldx":["application/vnd.openxmlformats-officedocument.presentationml.slide"],"otg":["application/vnd.oasis.opendocument.graphics-template"],"gan":["application/x-ganttproject"],"gam":["chemical/x-gamess-input"],"gal":["chemical/x-gaussian-log"],"xlsm":["application/vnd.ms-excel.sheet.macroEnabled.12"],"otp":["application/vnd.oasis.opendocument.presentation-template"],"ots":["application/vnd.oasis.opendocument.spreadsheet-template"],"ott":["application/vnd.oasis.opendocument.text-template"],"dotm":["application/vnd.ms-word.template.macroEnabled.12"],"ppsm":["application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],"mopcrt":["chemical/x-mopac-input"],"hdf":["application/x-hdf"],"atomsrv":["application/atomserv+xml"],"aif":["audio/x-aiff"],"mbox":["application/mbox"],"~":["application/x-trash"],"svgz":["image/svg+xml"],"cef":["chemical/x-cxf"],"wp5":["application/vnd.wordperfect5.1"],"jpe":["image/jpeg"],"jpg":["image/jpeg"],"sitx":["application/x-stuffit"],"avi":["video/x-msvideo"],"texinfo":["application/x-texinfo"],"shar":["application/x-shar"],"pas":["text/x-pascal"],"pat":["image/x-coreldrawpattern"],"pac":["application/x-ns-proxy-autoconfig"],"hxx":["text/x-c++hdr"],"3gp":["video/3gpp"],"kin":["chemical/x-kinemage"],"kil":["application/x-killustrator"],"wpd":["application/vnd.wordperfect"],"igs":["model/iges"],"php":["application/x-httpd-php"],"pht":["application/x-httpd-php"],"sha1":["application/x-sha1"],"gamin":["chemical/x-gamess-input"],"wmls":["text/vnd.wap.wmlscript"],"eps":["application/postscript"],"gsf":["application/x-font"],"wmlc":["application/vnd.wap.wmlc"],"gsm":["audio/x-gsm"],"cer":["chemical/x-cerius"],"hpp":["text/x-c++hdr"],"xspf":["application/xspf+xml"],"aiff":["audio/x-aiff"],"davmount":["application/davmount+xml"],"aifc":["audio/x-aiff"],"tcl":["application/x-tcl","text/x-tcl"],"cls":["text/x-tex"],"bcpio":["application/x-bcpio"],"roff":["application/x-troff"],"skt":["application/x-koan"],"skp":["application/x-koan"],"skd":["application/x-koan"],"rgb":["image/x-rgb"],"cub":["chemical/x-gaussian-cube"],"skm":["application/x-koan"],"m4a":["audio/mpeg"],"bin":["application/octet-stream"],"embl":["chemical/x-embl-dl-nucleotide"],"mop":["chemical/x-mopac-input"],"bib":["text/x-bibtex"],"mov":["video/quicktime"],"psd":["image/x-photoshop"],"moo":["chemical/x-mopac-out"],"mol":["chemical/x-mdl-molfile"],"moc":["text/x-moc"],"amr":["audio/amr","audio/amr"],"ustar":["application/x-ustar"],"d":["text/x-dsrc"],"t":["application/x-troff"],"xsd":["application/xml"],"gjf":["chemical/x-gaussian-input"],"tgf":["chemical/x-mdl-tgf"],"vrml":["model/vrml","x-world/x-vrml"],"gjc":["chemical/x-gaussian-input"],"xsl":["application/xml"],"old":["application/x-trash"],"webm":["video/webm"],"vsd":["application/vnd.visio"],"diff":["text/x-diff"],"udeb":["application/x-debian-package"],"ico":["image/vnd.microsoft.icon"],"scala":["text/x-scala"],"ica":["application/x-ica"],"kml":["application/vnd.google-earth.kml+xml"],"ice":["x-conference/x-cooltalk"],"icz":["text/calendar"],"x3d":["model/x3d+xml"],"ics":["text/calendar"],"xtel":["chemical/x-xtel"],"kmz":["application/vnd.google-earth.kmz"],"dcm":["application/dicom"],"pls":["audio/x-scpls"],"m3u8":["application/x-mpegURL"],"mmod":["chemical/x-macromodel-input"],"java":["text/x-java"],"dcr":["application/x-director"],"src":["application/x-wais-source"],"o":["application/x-object"],"srt":["text/plain"],"sd2":["audio/x-sd2"],"tiff":["image/tiff"],"xyz":["chemical/x-xyz"],"ppm":["image/x-portable-pixmap"],"pps":["application/vnd.ms-powerpoint"],"fch":["chemical/x-gaussian-checkpoint"],"ppt":["application/vnd.ms-powerpoint"],"djvu":["image/vnd.djvu"],"xpi":["application/x-xpinstall"],"val":["chemical/x-ncbi-asn1-binary"],"ppam":["application/vnd.ms-powerpoint.addin.macroEnabled.12"],"wad":["application/x-doom"],"class":["application/java-vm"],"gif":["image/gif"],"smil":["application/smil"],"wav":["audio/x-wav"],"rhtml":["application/x-httpd-eruby"],"sdw":["application/vnd.stardivision.writer"],"sds":["application/vnd.stardivision.chart"],"hs":["text/x-haskell"],"sdd":["application/vnd.stardivision.impress"],"sdf":["application/vnd.stardivision.math","chemical/x-mdl-sdfile"],"sda":["application/vnd.stardivision.draw"],"sdc":["application/vnd.stardivision.calc"],"sv4cpio":["application/x-sv4cpio"],"info":["application/x-info"],"cif":["chemical/x-cif"],"dmg":["application/x-apple-diskimage"],"dms":["application/x-dms"],"svg":["image/svg+xml"],"xwd":["image/x-xwindowdump"],"jmz":["application/x-jmol"],"sxc":["application/vnd.sun.xml.calc"],"p7r":["application/x-pkcs7-certreqresp"],"ppsx":["application/vnd.openxmlformats-officedocument.presentationml.slideshow"],"sxg":["application/vnd.sun.xml.writer.global"],"ai":["application/postscript"],"sxi":["application/vnd.sun.xml.impress"],"inp":["chemical/x-gamess-input"],"sxm":["application/vnd.sun.xml.math"],"ins":["application/x-internet-signup"],"cbr":["application/x-cbr"],"au":["audio/basic"],"sxw":["application/vnd.sun.xml.writer"],"cbz":["application/x-cbz"],"%":["application/x-trash"],"nb":["application/mathematica"],"nc":["application/x-netcdf"],"book":["application/x-maker"],"php4":["application/x-httpd-php4"],"php5":["application/x-httpd-php5"],"tif":["image/tiff"],"php3":["application/x-httpd-php3"],"mol2":["chemical/x-mol2"],"h++":["text/x-c++hdr"],"sql":["application/x-sql"],"hwp":["application/x-hwp"],"dvi":["application/x-dvi"],"pcf.Z":["application/x-font"],"rxn":["chemical/x-mdl-rxnfile"],"cpa":["chemical/x-compass"],"bmp":["image/x-ms-bmp"],"xbm":["image/x-xbitmap"],"eot":["application/vnd.ms-fontobject"],"cpp":["text/x-c++src"],"cpt":["application/mac-compactpro","image/x-corelphotopaint"],"phps":["application/x-httpd-php-source"]};jsmime.getMimesByExt=function(ext)
{return mimes[ext]||["application/octet-stream","text/plain"];}
jsmime.getMimesByPath=function(path)
{var ext=path.substring(path.lastIndexOf(".")+1);return jsmime.getMimesByExt(ext);}
jsmime.pathIsMime=function(path,mime)
{var mimes=jsmime.getMimesByPath(path);for(var i=0;i<mimes.length;i++)
if(mime==mimes[i])
return true;return false;}})();!function($){"use strict";var toggle='[data-toggle=dropdown]',Dropdown=function(element){var $el=$(element).on('click.dropdown.data-api',this.toggle)
$('html').on('click.dropdown.data-api',function(){$el.parent().removeClass('open')})}
Dropdown.prototype={constructor:Dropdown,toggle:function(e){var $this=$(this),$parent,isActive
if($this.is('.disabled, :disabled'))return
$parent=getParent($this)
isActive=$parent.hasClass('open')
clearMenus()
if(!isActive){$parent.toggleClass('open')}
$this.focus()
return false},keydown:function(e){var $this,$items,$active,$parent,isActive,index
if(!/(38|40|27)/.test(e.keyCode))return
$this=$(this)
e.preventDefault()
e.stopPropagation()
if($this.is('.disabled, :disabled'))return
$parent=getParent($this)
isActive=$parent.hasClass('open')
if(!isActive||(isActive&&e.keyCode==27)){if(e.which==27)$parent.find(toggle).focus()
return $this.click()}
$items=$('[role=menu] li:not(.divider):visible a',$parent)
if(!$items.length)return
index=$items.index($items.filter(':focus'))
if(e.keyCode==38&&index>0)index--
if(e.keyCode==40&&index<$items.length-1)index++
if(!~index)index=0
$items.eq(index).focus()}}
function clearMenus(){$(toggle).each(function(){getParent($(this)).removeClass('open')})}
function getParent($this){var selector=$this.attr('data-target'),$parent
if(!selector){selector=$this.attr('href')
selector=selector&&/#/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,'')}
$parent=selector&&$(selector)
if(!$parent||!$parent.length)$parent=$this.parent()
return $parent}
var old=$.fn.dropdown
$.fn.dropdown=function(option){return this.each(function(){var $this=$(this),data=$this.data('dropdown')
if(!data)$this.data('dropdown',(data=new Dropdown(this)))
if(typeof option=='string')data[option].call($this)})}
$.fn.dropdown.Constructor=Dropdown
$.fn.dropdown.noConflict=function(){$.fn.dropdown=old
return this}
$(document).on('click.dropdown.data-api',clearMenus).on('click.dropdown.data-api','.dropdown form',function(e){e.stopPropagation()}).on('click.dropdown-menu',function(e){e.stopPropagation()}).on('click.dropdown.data-api',toggle,Dropdown.prototype.toggle).on('keydown.dropdown.data-api',toggle+', [role=menu]',Dropdown.prototype.keydown)}(window.jQuery);!function($){"use strict";var Collapse=function(element,options){this.$element=$(element)
this.options=$.extend({},$.fn.collapse.defaults,options)
if(this.options.parent){this.$parent=$(this.options.parent)}
this.options.toggle&&this.toggle()}
Collapse.prototype={constructor:Collapse,dimension:function(){var hasWidth=this.$element.hasClass('width')
return hasWidth?'width':'height'},show:function(){var dimension,scroll,actives,hasData
if(this.transitioning||this.$element.hasClass('in'))return
dimension=this.dimension()
scroll=$.camelCase(['scroll',dimension].join('-'))
actives=this.$parent&&this.$parent.find('> .accordion-group > .in')
if(actives&&actives.length){hasData=actives.data('collapse')
if(hasData&&hasData.transitioning)return
actives.collapse('hide')
hasData||actives.data('collapse',null)}
this.$element[dimension](0)
this.transition('addClass',$.Event('show'),'shown')
$.support.transition&&this.$element[dimension](this.$element[0][scroll])},hide:function(){var dimension
if(this.transitioning||!this.$element.hasClass('in'))return
dimension=this.dimension()
this.reset(this.$element[dimension]())
this.transition('removeClass',$.Event('hide'),'hidden')
this.$element[dimension](0)},reset:function(size){var dimension=this.dimension()
this.$element.removeClass('collapse')
[dimension](size||'auto')
[0].offsetWidth
this.$element[size!==null?'addClass':'removeClass']('collapse')
return this},transition:function(method,startEvent,completeEvent){var that=this,complete=function(){if(startEvent.type=='show')that.reset()
that.transitioning=0
that.$element.trigger(completeEvent)}
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented())return
this.transitioning=1
this.$element[method]('in')
$.support.transition&&this.$element.hasClass('collapse')?this.$element.one($.support.transition.end,complete):complete()},toggle:function(){this[this.$element.hasClass('in')?'hide':'show']()}}
var old=$.fn.collapse
$.fn.collapse=function(option){return this.each(function(){var $this=$(this),data=$this.data('collapse'),options=$.extend({},$.fn.collapse.defaults,$this.data(),typeof option=='object'&&option)
if(!data)$this.data('collapse',(data=new Collapse(this,options)))
if(typeof option=='string')data[option]()})}
$.fn.collapse.defaults={toggle:true}
$.fn.collapse.Constructor=Collapse
$.fn.collapse.noConflict=function(){$.fn.collapse=old
return this}
$(document).on('click.collapse.data-api','[data-toggle=collapse]',function(e){var $this=$(this),href,target=$this.attr('data-target')||e.preventDefault()||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,''),option=$(target).data('collapse')?'toggle':$this.data()
$this[$(target).hasClass('in')?'addClass':'removeClass']('collapsed')
$(target).collapse(option)})}(window.jQuery);!function($){"use strict";var Tab=function(element){this.element=$(element)}
Tab.prototype={constructor:Tab,show:function(){var $this=this.element,$ul=$this.closest('ul:not(.dropdown-menu)'),selector=$this.attr('data-target'),previous,$target,e
if(!selector){selector=$this.attr('href')
selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'')}
if($this.parent('li').hasClass('active'))return
previous=$ul.find('.active:last a')[0]
e=$.Event('show',{relatedTarget:previous})
$this.trigger(e)
if(e.isDefaultPrevented())return
$target=$(selector)
this.activate($this.parent('li'),$ul)
this.activate($target,$target.parent(),function(){$this.trigger({type:'shown',relatedTarget:previous})})},activate:function(element,container,callback){var $active=container.find('> .active'),transition=callback&&$.support.transition&&$active.hasClass('fade')
function next(){$active.removeClass('active').find('> .dropdown-menu > .active').removeClass('active')
element.addClass('active')
if(transition){element[0].offsetWidth
element.addClass('in')}else{element.removeClass('fade')}
if(element.parent('.dropdown-menu')){element.closest('li.dropdown').addClass('active')}
callback&&callback()}
transition?$active.one($.support.transition.end,next):next()
$active.removeClass('in')}}
var old=$.fn.tab
$.fn.tab=function(option){return this.each(function(){var $this=$(this),data=$this.data('tab')
if(!data)$this.data('tab',(data=new Tab(this)))
if(typeof option=='string')data[option]()})}
$.fn.tab.Constructor=Tab
$.fn.tab.noConflict=function(){$.fn.tab=old
return this}
$(document).on('click.tab.data-api','[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault()
$(this).tab('show')})}(window.jQuery);!function($){"use strict";var Tooltip=function(element,options){this.init('tooltip',element,options)}
Tooltip.prototype={constructor:Tooltip,init:function(type,element,options){var eventIn,eventOut,triggers,trigger,i
this.type=type
this.$element=$(element)
this.options=this.getOptions(options)
this.enabled=true
triggers=this.options.trigger.split(' ')
for(i=triggers.length;i--;){trigger=triggers[i]
if(trigger=='click'){this.$element.on('click.'+this.type,this.options.selector,$.proxy(this.toggle,this))}else if(trigger!='manual'){eventIn=trigger=='hover'?'mouseenter':'focus'
eventOut=trigger=='hover'?'mouseleave':'blur'
this.$element.on(eventIn+'.'+this.type,this.options.selector,$.proxy(this.enter,this))
this.$element.on(eventOut+'.'+this.type,this.options.selector,$.proxy(this.leave,this))}}
this.options.selector?(this._options=$.extend({},this.options,{trigger:'manual',selector:''})):this.fixTitle()},getOptions:function(options){options=$.extend({},$.fn[this.type].defaults,this.$element.data(),options)
if(options.delay&&typeof options.delay=='number'){options.delay={show:options.delay,hide:options.delay}}
return options},enter:function(e){var defaults=$.fn[this.type].defaults,options={},self
this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value},this)
self=$(e.currentTarget)[this.type](options).data(this.type)
if(!self.options.delay||!self.options.delay.show)return self.show()
clearTimeout(this.timeout)
self.hoverState='in'
this.timeout=setTimeout(function(){if(self.hoverState=='in')self.show()},self.options.delay.show)},leave:function(e){var self=$(e.currentTarget)[this.type](this._options).data(this.type)
if(this.timeout)clearTimeout(this.timeout)
if(!self.options.delay||!self.options.delay.hide)return self.hide()
self.hoverState='out'
this.timeout=setTimeout(function(){if(self.hoverState=='out')self.hide()},self.options.delay.hide)},show:function(){var $tip,pos,actualWidth,actualHeight,placement,tp,e=$.Event('show')
if(this.hasContent()&&this.enabled){this.$element.trigger(e)
if(e.isDefaultPrevented())return
$tip=this.tip()
this.setContent()
if(this.options.animation){$tip.addClass('fade')}
placement=typeof this.options.placement=='function'?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement
$tip.detach().css({top:0,left:0,display:'block'})
this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element)
pos=this.getPosition()
actualWidth=$tip[0].offsetWidth
actualHeight=$tip[0].offsetHeight
switch(placement){case'bottom':tp={top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2}
break
case'top':tp={top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2}
break
case'left':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth}
break
case'right':tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width}
break}
this.applyPlacement(tp,placement)
this.$element.trigger('shown')}},applyPlacement:function(offset,placement){var $tip=this.tip(),width=$tip[0].offsetWidth,height=$tip[0].offsetHeight,actualWidth,actualHeight,delta,replace
$tip.offset(offset).addClass(placement).addClass('in')
actualWidth=$tip[0].offsetWidth
actualHeight=$tip[0].offsetHeight
if(placement=='top'&&actualHeight!=height){offset.top=offset.top+height-actualHeight
replace=true}
if(placement=='bottom'||placement=='top'){delta=0
if(offset.left<0){delta=offset.left*-2
offset.left=0
$tip.offset(offset)
actualWidth=$tip[0].offsetWidth
actualHeight=$tip[0].offsetHeight}
this.replaceArrow(delta-width+actualWidth,actualWidth,'left')}else{this.replaceArrow(actualHeight-height,actualHeight,'top')}
if(replace)$tip.offset(offset)},replaceArrow:function(delta,dimension,position){this.arrow().css(position,delta?(50*(1-delta/dimension)+"%"):'')},setContent:function(){var $tip=this.tip(),title=this.getTitle()
$tip.find('.tooltip-inner')[this.options.html?'html':'text'](title)
$tip.removeClass('fade in top bottom left right')},hide:function(){var that=this,$tip=this.tip(),e=$.Event('hide')
this.$element.trigger(e)
if(e.isDefaultPrevented())return
$tip.removeClass('in')
function removeWithAnimation(){var timeout=setTimeout(function(){$tip.off($.support.transition.end).detach()},500)
$tip.one($.support.transition.end,function(){clearTimeout(timeout)
$tip.detach()})}
$.support.transition&&this.$tip.hasClass('fade')?removeWithAnimation():$tip.detach()
this.$element.trigger('hidden')
return this},fixTitle:function(){var $e=this.$element
if($e.attr('title')||typeof($e.attr('data-original-title'))!='string'){$e.attr('data-original-title',$e.attr('title')||'').attr('title','')}},hasContent:function(){return this.getTitle()},getPosition:function(){var el=this.$element[0]
return $.extend({},(typeof el.getBoundingClientRect=='function')?el.getBoundingClientRect():{width:el.offsetWidth,height:el.offsetHeight},this.$element.offset())},getTitle:function(){var title,$e=this.$element,o=this.options
title=$e.attr('data-original-title')||(typeof o.title=='function'?o.title.call($e[0]):o.title)
return title},tip:function(){return this.$tip=this.$tip||$(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){if(!this.$element[0].parentNode){this.hide()
this.$element=null
this.options=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var self=e?$(e.currentTarget)[this.type](this._options).data(this.type):this
self.tip().hasClass('in')?self.hide():self.show()},destroy:function(){this.hide().$element.off('.'+this.type).removeData(this.type)}}
var old=$.fn.tooltip
$.fn.tooltip=function(option){return this.each(function(){var $this=$(this),data=$this.data('tooltip'),options=typeof option=='object'&&option
if(!data)$this.data('tooltip',(data=new Tooltip(this,options)))
if(typeof option=='string')data[option]()})}
$.fn.tooltip.Constructor=Tooltip
$.fn.tooltip.defaults={animation:true,placement:'top',selector:false,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:'hover focus',title:'',delay:0,html:false,container:false}
$.fn.tooltip.noConflict=function(){$.fn.tooltip=old
return this}}(window.jQuery);!function($){"use strict";var Popover=function(element,options){this.init('popover',element,options)}
Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype,{constructor:Popover,setContent:function(){var $tip=this.tip(),title=this.getTitle(),content=this.getContent()
$tip.find('.popover-title')[this.options.html?'html':'text'](title)
$tip.find('.popover-content')[this.options.html?'html':'text'](content)
$tip.removeClass('fade top bottom left right in')},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var content,$e=this.$element,o=this.options
content=(typeof o.content=='function'?o.content.call($e[0]):o.content)||$e.attr('data-content')
return content},tip:function(){if(!this.$tip){this.$tip=$(this.options.template)}
return this.$tip},destroy:function(){this.hide().$element.off('.'+this.type).removeData(this.type)}})
var old=$.fn.popover
$.fn.popover=function(option){return this.each(function(){var $this=$(this),data=$this.data('popover'),options=typeof option=='object'&&option
if(!data)$this.data('popover',(data=new Popover(this,options)))
if(typeof option=='string')data[option]()})}
$.fn.popover.Constructor=Popover
$.fn.popover.defaults=$.extend({},$.fn.tooltip.defaults,{placement:'right',trigger:'click',content:'',template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'})
$.fn.popover.noConflict=function(){$.fn.popover=old
return this}}(window.jQuery);!function($){"use strict";var Modal=function(element,options){this.options=options
this.$element=$(element).delegate('[data-dismiss="modal"]','click.dismiss.modal',$.proxy(this.hide,this))
this.options.remote&&this.$element.find('.modal-body').load(this.options.remote)}
Modal.prototype={constructor:Modal,toggle:function(){return this[!this.isShown?'show':'hide']()},show:function(){var that=this,e=$.Event('show')
this.$element.trigger(e)
if(this.isShown||e.isDefaultPrevented())return
this.isShown=true
this.escape()
this.backdrop(function(){var transition=$.support.transition&&that.$element.hasClass('fade')
if(!that.$element.parent().length){that.$element.appendTo(document.body)}
that.$element.show()
if(transition){that.$element[0].offsetWidth}
that.$element.addClass('in').attr('aria-hidden',false)
that.enforceFocus()
transition?that.$element.one($.support.transition.end,function(){that.$element.focus().trigger('shown')}):that.$element.focus().trigger('shown')})},hide:function(e){e&&e.preventDefault()
var that=this
e=$.Event('hide')
this.$element.trigger(e)
if(!this.isShown||e.isDefaultPrevented())return
this.isShown=false
this.escape()
$(document).off('focusin.modal')
this.$element.removeClass('in').attr('aria-hidden',true)
$.support.transition&&this.$element.hasClass('fade')?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var that=this
$(document).on('focusin.modal',function(e){if(that.$element[0]!==e.target&&!that.$element.has(e.target).length){that.$element.focus()}})},escape:function(){var that=this
if(this.isShown&&this.options.keyboard){this.$element.on('keyup.dismiss.modal',function(e){e.which==27&&that.hide()})}else if(!this.isShown){this.$element.off('keyup.dismiss.modal')}},hideWithTransition:function(){var that=this,timeout=setTimeout(function(){that.$element.off($.support.transition.end)
that.hideModal()},500)
this.$element.one($.support.transition.end,function(){clearTimeout(timeout)
that.hideModal()})},hideModal:function(){var that=this
this.$element.hide()
this.backdrop(function(){that.removeBackdrop()
that.$element.trigger('hidden')})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove()
this.$backdrop=null},backdrop:function(callback){var that=this,animate=this.$element.hasClass('fade')?'fade':''
if(this.isShown&&this.options.backdrop){var doAnimate=$.support.transition&&animate
this.$backdrop=$('<div class="modal-backdrop '+animate+'" />').appendTo(document.body)
this.$backdrop.click(this.options.backdrop=='static'?$.proxy(this.$element[0].focus,this.$element[0]):$.proxy(this.hide,this))
if(doAnimate)this.$backdrop[0].offsetWidth
this.$backdrop.addClass('in')
if(!callback)return
doAnimate?this.$backdrop.one($.support.transition.end,callback):callback()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass('in')
$.support.transition&&this.$element.hasClass('fade')?this.$backdrop.one($.support.transition.end,callback):callback()}else if(callback){callback()}}}
var old=$.fn.modal
$.fn.modal=function(option){return this.each(function(){var $this=$(this),data=$this.data('modal'),options=$.extend({},$.fn.modal.defaults,$this.data(),typeof option=='object'&&option)
if(!data)$this.data('modal',(data=new Modal(this,options)))
if(typeof option=='string')data[option]()
else if(options.show)data.show()})}
$.fn.modal.defaults={backdrop:true,keyboard:true,show:true}
$.fn.modal.Constructor=Modal
$.fn.modal.noConflict=function(){$.fn.modal=old
return this}
$(document).on('click.modal.data-api','[data-toggle="modal"]',function(e){var $this=$(this),href=$this.attr('href'),$target=$($this.attr('data-target')||(href&&href.replace(/.*(?=#[^\s]+$)/,''))),option=$target.data('modal')?'toggle':$.extend({remote:!/#/.test(href)&&href},$target.data(),$this.data())
e.preventDefault()
$target.modal(option).one('hide',function(){$this.focus()})})}(window.jQuery);!function($){"use strict";var dismiss='[data-dismiss="alert"]',Alert=function(el){$(el).on('click',dismiss,this.close)}
Alert.prototype.close=function(e){var $this=$(this),selector=$this.attr('data-target'),$parent
if(!selector){selector=$this.attr('href')
selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'')}
$parent=$(selector)
e&&e.preventDefault()
$parent.length||($parent=$this.hasClass('alert')?$this:$this.parent())
$parent.trigger(e=$.Event('close'))
if(e.isDefaultPrevented())return
$parent.removeClass('in')
function removeElement(){$parent.trigger('closed').remove()}
$.support.transition&&$parent.hasClass('fade')?$parent.on($.support.transition.end,removeElement):removeElement()}
var old=$.fn.alert
$.fn.alert=function(option){return this.each(function(){var $this=$(this),data=$this.data('alert')
if(!data)$this.data('alert',(data=new Alert(this)))
if(typeof option=='string')data[option].call($this)})}
$.fn.alert.Constructor=Alert
$.fn.alert.noConflict=function(){$.fn.alert=old
return this}
$(document).on('click.alert.data-api',dismiss,Alert.prototype.close)}(window.jQuery);(function($,undefined){var uuid=0,runiqueId=/^ui-id-\d+$/;$.ui=$.ui||{};$.extend($.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});$.fn.extend({focus:(function(orig){return function(delay,fn){return typeof delay==="number"?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();if(fn){fn.call(elem);}},delay);}):orig.apply(this,arguments);};})($.fn.focus),scrollParent:function(){var scrollParent;if(($.ui.ie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.css(this,"position"))&&(/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));}).eq(0);}
return(/fixed/).test(this.css("position"))||!scrollParent.length?$(document):scrollParent;},zIndex:function(zIndex){if(zIndex!==undefined){return this.css("zIndex",zIndex);}
if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css("position");if(position==="absolute"||position==="relative"||position==="fixed"){value=parseInt(elem.css("zIndex"),10);if(!isNaN(value)&&value!==0){return value;}}
elem=elem.parent();}}
return 0;},uniqueId:function(){return this.each(function(){if(!this.id){this.id="ui-id-"+(++uuid);}});},removeUniqueId:function(){return this.each(function(){if(runiqueId.test(this.id)){$(this).removeAttr("id");}});}});function focusable(element,isTabIndexNotNaN){var map,mapName,img,nodeName=element.nodeName.toLowerCase();if("area"===nodeName){map=element.parentNode;mapName=map.name;if(!element.href||!mapName||map.nodeName.toLowerCase()!=="map"){return false;}
img=$("img[usemap=#"+mapName+"]")[0];return!!img&&visible(img);}
return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:"a"===nodeName?element.href||isTabIndexNotNaN:isTabIndexNotNaN)&&visible(element);}
function visible(element){return $.expr.filters.visible(element)&&!$(element).parents().addBack().filter(function(){return $.css(this,"visibility")==="hidden";}).length;}
$.extend($.expr[":"],{data:$.expr.createPseudo?$.expr.createPseudo(function(dataName){return function(elem){return!!$.data(elem,dataName);};}):function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){return focusable(element,!isNaN($.attr(element,"tabindex")));},tabbable:function(element){var tabIndex=$.attr(element,"tabindex"),isTabIndexNaN=isNaN(tabIndex);return(isTabIndexNaN||tabIndex>=0)&&focusable(element,!isTabIndexNaN);}});if(!$("<a>").outerWidth(1).jquery){$.each(["Width","Height"],function(i,name){var side=name==="Width"?["Left","Right"]:["Top","Bottom"],type=name.toLowerCase(),orig={innerWidth:$.fn.innerWidth,innerHeight:$.fn.innerHeight,outerWidth:$.fn.outerWidth,outerHeight:$.fn.outerHeight};function reduce(elem,size,border,margin){$.each(side,function(){size-=parseFloat($.css(elem,"padding"+this))||0;if(border){size-=parseFloat($.css(elem,"border"+this+"Width"))||0;}
if(margin){size-=parseFloat($.css(elem,"margin"+this))||0;}});return size;}
$.fn["inner"+name]=function(size){if(size===undefined){return orig["inner"+name].call(this);}
return this.each(function(){$(this).css(type,reduce(this,size)+"px");});};$.fn["outer"+name]=function(size,margin){if(typeof size!=="number"){return orig["outer"+name].call(this,size);}
return this.each(function(){$(this).css(type,reduce(this,size,true,margin)+"px");});};});}
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));};}
if($("<a>").data("a-b","a").removeData("a-b").data("a-b")){$.fn.removeData=(function(removeData){return function(key){if(arguments.length){return removeData.call(this,$.camelCase(key));}else{return removeData.call(this);}};})($.fn.removeData);}
$.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());$.support.selectstart="onselectstart"in document.createElement("div");$.fn.extend({disableSelection:function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(event){event.preventDefault();});},enableSelection:function(){return this.unbind(".ui-disableSelection");}});$.extend($.ui,{plugin:{add:function(module,option,set){var i,proto=$.ui[module].prototype;for(i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var i,set=instance.plugins[name];if(!set||!instance.element[0].parentNode||instance.element[0].parentNode.nodeType===11){return;}
for(i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},hasScroll:function(el,a){if($(el).css("overflow")==="hidden"){return false;}
var scroll=(a&&a==="left")?"scrollLeft":"scrollTop",has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;}});})(jQuery);(function($,undefined){var uuid=0,slice=Array.prototype.slice,_cleanData=$.cleanData;$.cleanData=function(elems){for(var i=0,elem;(elem=elems[i])!=null;i++){try{$(elem).triggerHandler("remove");}catch(e){}}
_cleanData(elems);};$.widget=function(name,base,prototype){var fullName,existingConstructor,constructor,basePrototype,proxiedPrototype={},namespace=name.split(".")[0];name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget;}
$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName);};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this._createWidget){return new constructor(options,element);}
if(arguments.length){this._createWidget(options,element);}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base();basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return;}
proxiedPrototype[prop]=(function(){var _super=function(){return base.prototype[prop].apply(this,arguments);},_superApply=function(args){return base.prototype[prop].apply(this,args);};return function(){var __super=this._super,__superApply=this._superApply,returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue;};})();});constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?(basePrototype.widgetEventPrefix||name):name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto);});delete existingConstructor._childConstructors;}else{base._childConstructors.push(constructor);}
$.widget.bridge(name,constructor);};$.widget.extend=function(target){var input=slice.call(arguments,1),inputIndex=0,inputLength=input.length,key,value;for(;inputIndex<inputLength;inputIndex++){for(key in input[inputIndex]){value=input[inputIndex][key];if(input[inputIndex].hasOwnProperty(key)&&value!==undefined){if($.isPlainObject(value)){target[key]=$.isPlainObject(target[key])?$.widget.extend({},target[key],value):$.widget.extend({},value);}else{target[key]=value;}}}}
return target;};$.widget.bridge=function(name,object){var fullName=object.prototype.widgetFullName||name;$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.widget.extend.apply(null,[options].concat(args)):options;if(isMethodCall){this.each(function(){var methodValue,instance=$.data(this,fullName);if(!instance){return $.error("cannot call methods on "+name+" prior to initialization; "+"attempted to call method '"+options+"'");}
if(!$.isFunction(instance[options])||options.charAt(0)==="_"){return $.error("no such method '"+options+"' for "+name+" widget instance");}
methodValue=instance[options].apply(instance,args);if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue&&methodValue.jquery?returnValue.pushStack(methodValue.get()):methodValue;return false;}});}else{this.each(function(){var instance=$.data(this,fullName);if(instance){instance.option(options||{})._init();}else{$.data(this,fullName,new object(options,this));}});}
return returnValue;};};$.Widget=function(){};$.Widget._childConstructors=[];$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:false,create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=uuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this.bindings=$();this.hoverable=$();this.focusable=$();if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy();}}});this.document=$(element.style?element.ownerDocument:element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow);}
this._create();this._trigger("create",null,this._getCreateEventData());this._init();},_getCreateOptions:$.noop,_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData($.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus");},_destroy:$.noop,widget:function(){return this.element;},option:function(key,value){var options=key,parts,curOption,i;if(arguments.length===0){return $.widget.extend({},this.options);}
if(typeof key==="string"){options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i<parts.length-1;i++){curOption[parts[i]]=curOption[parts[i]]||{};curOption=curOption[parts[i]];}
key=parts.pop();if(arguments.length===1){return curOption[key]===undefined?null:curOption[key];}
curOption[key]=value;}else{if(arguments.length===1){return this.options[key]===undefined?null:this.options[key];}
options[key]=value;}}
this._setOptions(options);return this;},_setOptions:function(options){var key;for(key in options){this._setOption(key,options[key]);}
return this;},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!value).attr("aria-disabled",value);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus");}
return this;},enable:function(){return this._setOption("disabled",false);},disable:function(){return this._setOption("disabled",true);},_on:function(suppressDisabledCheck,element,handlers){var delegateElement,instance=this;if(typeof suppressDisabledCheck!=="boolean"){handlers=element;element=suppressDisabledCheck;suppressDisabledCheck=false;}
if(!handlers){handlers=element;element=this.element;delegateElement=this.widget();}else{element=delegateElement=$(element);this.bindings=this.bindings.add(element);}
$.each(handlers,function(event,handler){function handlerProxy(){if(!suppressDisabledCheck&&(instance.options.disabled===true||$(this).hasClass("ui-state-disabled"))){return;}
return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments);}
if(typeof handler!=="string"){handlerProxy.guid=handler.guid=handler.guid||handlerProxy.guid||$.guid++;}
var match=event.match(/^(\w+)\s*(.*)$/),eventName=match[1]+instance.eventNamespace,selector=match[2];if(selector){delegateElement.delegate(selector,eventName,handlerProxy);}else{element.bind(eventName,handlerProxy);}});},_off:function(element,eventName){eventName=(eventName||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;element.unbind(eventName).undelegate(eventName);},_delay:function(handler,delay){function handlerProxy(){return(typeof handler==="string"?instance[handler]:handler).apply(instance,arguments);}
var instance=this;return setTimeout(handlerProxy,delay||0);},_hoverable:function(element){this.hoverable=this.hoverable.add(element);this._on(element,{mouseenter:function(event){$(event.currentTarget).addClass("ui-state-hover");},mouseleave:function(event){$(event.currentTarget).removeClass("ui-state-hover");}});},_focusable:function(element){this.focusable=this.focusable.add(element);this._on(element,{focusin:function(event){$(event.currentTarget).addClass("ui-state-focus");},focusout:function(event){$(event.currentTarget).removeClass("ui-state-focus");}});},_trigger:function(type,event,data){var prop,orig,callback=this.options[type];data=data||{};event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();event.target=this.element[0];orig=event.originalEvent;if(orig){for(prop in orig){if(!(prop in event)){event[prop]=orig[prop];}}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.apply(this.element[0],[event].concat(data))===false||event.isDefaultPrevented());}};$.each({show:"fadeIn",hide:"fadeOut"},function(method,defaultEffect){$.Widget.prototype["_"+method]=function(element,options,callback){if(typeof options==="string"){options={effect:options};}
var hasOptions,effectName=!options?method:options===true||typeof options==="number"?defaultEffect:options.effect||defaultEffect;options=options||{};if(typeof options==="number"){options={duration:options};}
hasOptions=!$.isEmptyObject(options);options.complete=callback;if(options.delay){element.delay(options.delay);}
if(hasOptions&&$.effects&&$.effects.effect[effectName]){element[method](options);}else if(effectName!==method&&element[effectName]){element[effectName](options.duration,options.easing,callback);}else{element.queue(function(next){$(this)[method]();if(callback){callback.call(element[0]);}
next();});}};});})(jQuery);(function($,undefined){var mouseHandled=false;$(document).mouseup(function(){mouseHandled=false;});$.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var that=this;this.element.bind("mousedown."+this.widgetName,function(event){return that._mouseDown(event);}).bind("click."+this.widgetName,function(event){if(true===$.data(event.target,that.widgetName+".preventClickEvent")){$.removeData(event.target,that.widgetName+".preventClickEvent");event.stopImmediatePropagation();return false;}});this.started=false;},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);if(this._mouseMoveDelegate){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);}},_mouseDown:function(event){if(mouseHandled){return;}
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var that=this,btnIsLeft=(event.which===1),elIsCancel=(typeof this.options.cancel==="string"&&event.target.nodeName?$(event.target).closest(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){that.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
if(true===$.data(event.target,this.widgetName+".preventClickEvent")){$.removeData(event.target,this.widgetName+".preventClickEvent");}
this._mouseMoveDelegate=function(event){return that._mouseMove(event);};this._mouseUpDelegate=function(event){return that._mouseUp(event);};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);event.preventDefault();mouseHandled=true;return true;},_mouseMove:function(event){if($.ui.ie&&(!document.documentMode||document.documentMode<9)&&!event.button){return this._mouseUp(event);}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(event.target===this._mouseDownEvent.target){$.data(event.target,this.widgetName+".preventClickEvent",true);}
this._mouseStop(event);}
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(){return this.mouseDelayMet;},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true;}});})(jQuery);(function($,undefined){$.ui=$.ui||{};var cachedScrollbarWidth,max=Math.max,abs=Math.abs,round=Math.round,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position;function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)];}
function parseCss(element,property){return parseInt($.css(element,property),10)||0;}
function getDimensions(elem){var raw=elem[0];if(raw.nodeType===9){return{width:elem.width(),height:elem.height(),offset:{top:0,left:0}};}
if($.isWindow(raw)){return{width:elem.width(),height:elem.height(),offset:{top:elem.scrollTop(),left:elem.scrollLeft()}};}
if(raw.preventDefault){return{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}};}
return{width:elem.outerWidth(),height:elem.outerHeight(),offset:elem.offset()};}
$.position={scrollbarWidth:function(){if(cachedScrollbarWidth!==undefined){return cachedScrollbarWidth;}
var w1,w2,div=$("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),innerDiv=div.children()[0];$("body").append(div);w1=innerDiv.offsetWidth;div.css("overflow","scroll");w2=innerDiv.offsetWidth;if(w1===w2){w2=div[0].clientWidth;}
div.remove();return(cachedScrollbarWidth=w1-w2);},getScrollInfo:function(within){var overflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX=overflowX==="scroll"||(overflowX==="auto"&&within.width<within.element[0].scrollWidth),hasOverflowY=overflowY==="scroll"||(overflowY==="auto"&&within.height<within.element[0].scrollHeight);return{width:hasOverflowY?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0};},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&withinElement[0].nodeType===9;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:withinElement.offset()||{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:isWindow?withinElement.width():withinElement.outerWidth(),height:isWindow?withinElement.height():withinElement.outerHeight()};}};$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments);}
options=$.extend({},options);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,dimensions,target=$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={};dimensions=getDimensions(target);if(target[0].preventDefault){options.at="left top";}
targetWidth=dimensions.width;targetHeight=dimensions.height;targetOffset=dimensions.offset;basePosition=$.extend({},targetOffset);$.each(["my","at"],function(){var pos=(options[this]||"").split(" "),horizontalOffset,verticalOffset;if(pos.length===1){pos=rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"];}
pos[0]=rhorizontal.test(pos[0])?pos[0]:"center";pos[1]=rvertical.test(pos[1])?pos[1]:"center";horizontalOffset=roffset.exec(pos[0]);verticalOffset=roffset.exec(pos[1]);offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0];options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]];});if(collision.length===1){collision[1]=collision[0];}
if(options.at[0]==="right"){basePosition.left+=targetWidth;}else if(options.at[0]==="center"){basePosition.left+=targetWidth/2;}
if(options.at[1]==="bottom"){basePosition.top+=targetHeight;}else if(options.at[1]==="center"){basePosition.top+=targetHeight/2;}
atOffset=getOffsets(offsets.at,targetWidth,targetHeight);basePosition.left+=atOffset[0];basePosition.top+=atOffset[1];return this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());if(options.my[0]==="right"){position.left-=elemWidth;}else if(options.my[0]==="center"){position.left-=elemWidth/2;}
if(options.my[1]==="bottom"){position.top-=elemHeight;}else if(options.my[1]==="center"){position.top-=elemHeight/2;}
position.left+=myOffset[0];position.top+=myOffset[1];if(!$.support.offsetFractions){position.left=round(position.left);position.top=round(position.top);}
collisionPosition={marginLeft:marginLeft,marginTop:marginTop};$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem});}});if(options.using){using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":left>0?"right":"center",vertical:bottom<0?"top":top>0?"bottom":"middle"};if(targetWidth<elemWidth&&abs(left+right)<targetWidth){feedback.horizontal="center";}
if(targetHeight<elemHeight&&abs(top+bottom)<targetHeight){feedback.vertical="middle";}
if(max(abs(left),abs(right))>max(abs(top),abs(bottom))){feedback.important="horizontal";}else{feedback.important="vertical";}
options.using.call(this,props,feedback);};}
elem.offset($.extend(position,{using:using}));});};$.ui.position={fit:{left:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollLeft:within.offset.left,outerWidth=within.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset,newOverRight;if(data.collisionWidth>outerWidth){if(overLeft>0&&overRight<=0){newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset;position.left+=overLeft-newOverRight;}else if(overRight>0&&overLeft<=0){position.left=withinOffset;}else{if(overLeft>overRight){position.left=withinOffset+outerWidth-data.collisionWidth;}else{position.left=withinOffset;}}}else if(overLeft>0){position.left+=overLeft;}else if(overRight>0){position.left-=overRight;}else{position.left=max(position.left-collisionPosLeft,position.left);}},top:function(position,data){var within=data.within,withinOffset=within.isWindow?within.scrollTop:within.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset,newOverBottom;if(data.collisionHeight>outerHeight){if(overTop>0&&overBottom<=0){newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset;position.top+=overTop-newOverBottom;}else if(overBottom>0&&overTop<=0){position.top=withinOffset;}else{if(overTop>overBottom){position.top=withinOffset+outerHeight-data.collisionHeight;}else{position.top=withinOffset;}}}else if(overTop>0){position.top+=overTop;}else if(overBottom>0){position.top-=overBottom;}else{position.top=max(position.top-collisionPosTop,position.top);}}},flip:{left:function(position,data){var within=data.within,withinOffset=within.offset.left+within.scrollLeft,outerWidth=within.width,offsetLeft=within.isWindow?within.scrollLeft:within.offset.left,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=collisionPosLeft-offsetLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-offsetLeft,myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,atOffset=data.at[0]==="left"?data.targetWidth:data.at[0]==="right"?-data.targetWidth:0,offset=-2*data.offset[0],newOverRight,newOverLeft;if(overLeft<0){newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-withinOffset;if(newOverRight<0||newOverRight<abs(overLeft)){position.left+=myOffset+atOffset+offset;}}
else if(overRight>0){newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-offsetLeft;if(newOverLeft>0||abs(newOverLeft)<overRight){position.left+=myOffset+atOffset+offset;}}},top:function(position,data){var within=data.within,withinOffset=within.offset.top+within.scrollTop,outerHeight=within.height,offsetTop=within.isWindow?within.scrollTop:within.offset.top,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=collisionPosTop-offsetTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-offsetTop,top=data.my[1]==="top",myOffset=top?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:data.at[1]==="bottom"?-data.targetHeight:0,offset=-2*data.offset[1],newOverTop,newOverBottom;if(overTop<0){newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-withinOffset;if((position.top+myOffset+atOffset+offset)>overTop&&(newOverBottom<0||newOverBottom<abs(overTop))){position.top+=myOffset+atOffset+offset;}}
else if(overBottom>0){newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-offsetTop;if((position.top+myOffset+atOffset+offset)>overBottom&&(newOverTop>0||abs(newOverTop)<overBottom)){position.top+=myOffset+atOffset+offset;}}}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments);$.ui.position.fit.left.apply(this,arguments);},top:function(){$.ui.position.flip.top.apply(this,arguments);$.ui.position.fit.top.apply(this,arguments);}}};(function(){var testElement,testElementParent,testElementStyle,offsetLeft,i,body=document.getElementsByTagName("body")[0],div=document.createElement("div");testElement=document.createElement(body?"div":"body");testElementStyle={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(body){$.extend(testElementStyle,{position:"absolute",left:"-1000px",top:"-1000px"});}
for(i in testElementStyle){testElement.style[i]=testElementStyle[i];}
testElement.appendChild(div);testElementParent=body||document.documentElement;testElementParent.insertBefore(testElement,testElementParent.firstChild);div.style.cssText="position: absolute; left: 10.7432222px;";offsetLeft=$(div).offset().left;$.support.offsetFractions=offsetLeft>10&&offsetLeft<11;testElement.innerHTML="";testElementParent.removeChild(testElement);})();}(jQuery));(function($,undefined){$.widget("ui.draggable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"&&!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative";}
if(this.options.addClasses){this.element.addClass("ui-draggable");}
if(this.options.disabled){this.element.addClass("ui-draggable-disabled");}
this._mouseInit();},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).closest(".ui-resizable-handle").length>0){return false;}
this.handle=this._getHandle(event);if(!this.handle){return false;}
$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this.helper.addClass("ui-draggable-dragging");this._cacheHelperProportions();if($.ui.ddmanager){$.ui.ddmanager.current=this;}
this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offsetParent=this.helper.offsetParent();this.offsetParentCssPosition=this.offsetParent.css("position");this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.offset.scroll=false;$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this._setContainment();if(this._trigger("start",event)===false){this._clear();return false;}
this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}
this._mouseDrag(event,true);if($.ui.ddmanager){$.ui.ddmanager.dragStart(this,event);}
return true;},_mouseDrag:function(event,noPropagation){if(this.offsetParentCssPosition==="fixed"){this.offset.parent=this._getParentOffset();}
this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger("drag",event,ui)===false){this._mouseUp({});return false;}
this.position=ui.position;}
if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px";}
if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px";}
if($.ui.ddmanager){$.ui.ddmanager.drag(this,event);}
return false;},_mouseStop:function(event){var that=this,dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour){dropped=$.ui.ddmanager.drop(this,event);}
if(this.dropped){dropped=this.dropped;this.dropped=false;}
if(this.options.helper==="original"&&!$.contains(this.element[0].ownerDocument,this.element[0])){return false;}
if((this.options.revert==="invalid"&&!dropped)||(this.options.revert==="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(that._trigger("stop",event)!==false){that._clear();}});}else{if(this._trigger("stop",event)!==false){this._clear();}}
return false;},_mouseUp:function(event){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});if($.ui.ddmanager){$.ui.ddmanager.dragStop(this,event);}
return $.ui.mouse.prototype._mouseUp.call(this,event);},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({});}else{this._clear();}
return this;},_getHandle:function(event){return this.options.handle?!!$(event.target).closest(this.element.find(this.options.handle)).length:true;},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper==="clone"?this.element.clone().removeAttr("id"):this.element);if(!helper.parents("body").length){helper.appendTo((o.appendTo==="parent"?this.element[0].parentNode:o.appendTo));}
if(helper[0]!==this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position"))){helper.css("position","absolute");}
return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ");}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if("left"in obj){this.offset.click.left=obj.left+this.margins.left;}
if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if("top"in obj){this.offset.click.top=obj.top+this.margins.top;}
if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){var po=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if((this.offsetParent[0]===document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie)){po={top:0,left:0};}
return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0),right:(parseInt(this.element.css("marginRight"),10)||0),bottom:(parseInt(this.element.css("marginBottom"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var over,c,ce,o=this.options;if(!o.containment){this.containment=null;return;}
if(o.containment==="window"){this.containment=[$(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,$(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,$(window).scrollLeft()+$(window).width()-this.helperProportions.width-this.margins.left,$(window).scrollTop()+($(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return;}
if(o.containment==="document"){this.containment=[0,0,$(document).width()-this.helperProportions.width-this.margins.left,($(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return;}
if(o.containment.constructor===Array){this.containment=o.containment;return;}
if(o.containment==="parent"){o.containment=this.helper[0].parentNode;}
c=$(o.containment);ce=c[0];if(!ce){return;}
over=c.css("overflow")!=="hidden";this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=c;},_convertPositionTo:function(d,pos){if(!pos){pos=this.position;}
var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent;if(!this.offset.scroll){this.offset.scroll={top:scroll.scrollTop(),left:scroll.scrollLeft()};}
return{top:(pos.top+
this.offset.relative.top*mod+
this.offset.parent.top*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():this.offset.scroll.top)*mod)),left:(pos.left+
this.offset.relative.left*mod+
this.offset.parent.left*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():this.offset.scroll.left)*mod))};},_generatePosition:function(event){var containment,co,top,left,o=this.options,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,pageX=event.pageX,pageY=event.pageY;if(!this.offset.scroll){this.offset.scroll={top:scroll.scrollTop(),left:scroll.scrollLeft()};}
if(this.originalPosition){if(this.containment){if(this.relative_container){co=this.relative_container.offset();containment=[this.containment[0]+co.left,this.containment[1]+co.top,this.containment[2]+co.left,this.containment[3]+co.top];}
else{containment=this.containment;}
if(event.pageX-this.offset.click.left<containment[0]){pageX=containment[0]+this.offset.click.left;}
if(event.pageY-this.offset.click.top<containment[1]){pageY=containment[1]+this.offset.click.top;}
if(event.pageX-this.offset.click.left>containment[2]){pageX=containment[2]+this.offset.click.left;}
if(event.pageY-this.offset.click.top>containment[3]){pageY=containment[3]+this.offset.click.top;}}
if(o.grid){top=o.grid[1]?this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY;pageY=containment?((top-this.offset.click.top>=containment[1]||top-this.offset.click.top>containment[3])?top:((top-this.offset.click.top>=containment[1])?top-o.grid[1]:top+o.grid[1])):top;left=o.grid[0]?this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX;pageX=containment?((left-this.offset.click.left>=containment[0]||left-this.offset.click.left>containment[2])?left:((left-this.offset.click.left>=containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY-
this.offset.click.top-
this.offset.relative.top-
this.offset.parent.top+
(this.cssPosition==="fixed"?-this.scrollParent.scrollTop():this.offset.scroll.top)),left:(pageX-
this.offset.click.left-
this.offset.relative.left-
this.offset.parent.left+
(this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():this.offset.scroll.left))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove();}
this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type==="drag"){this.positionAbs=this._convertPositionTo("absolute");}
return $.Widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs};}});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("ui-draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,"ui-sortable");if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable.refreshPositions();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui){var inst=$(this).data("ui-draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert){this.instance.options.revert=this.shouldRevert;}
this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper==="original"){this.instance.currentItem.css({top:"auto",left:"auto"});}}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui){var inst=$(this).data("ui-draggable"),that=this;$.each(inst.sortables,function(){var innermostIntersecting=false,thisSortable=this;this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){innermostIntersecting=true;$.each(inst.sortables,function(){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this!==thisSortable&&this.instance._intersectsWith(this.instance.containerCache)&&$.contains(thisSortable.instance.element[0],this.instance.element[0])){innermostIntersecting=false;}
return innermostIntersecting;});}
if(innermostIntersecting){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst;}
if(this.instance.currentItem){this.instance._mouseDrag(event);}}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder){this.instance.placeholder.remove();}
inst._trigger("fromSortable",event);inst.dropped=false;}}});}});$.ui.plugin.add("draggable","cursor",{start:function(){var t=$("body"),o=$(this).data("ui-draggable").options;if(t.css("cursor")){o._cursor=t.css("cursor");}
t.css("cursor",o.cursor);},stop:function(){var o=$(this).data("ui-draggable").options;if(o._cursor){$("body").css("cursor",o._cursor);}}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("ui-draggable").options;if(t.css("opacity")){o._opacity=t.css("opacity");}
t.css("opacity",o.opacity);},stop:function(event,ui){var o=$(this).data("ui-draggable").options;if(o._opacity){$(ui.helper).css("opacity",o._opacity);}}});$.ui.plugin.add("draggable","scroll",{start:function(){var i=$(this).data("ui-draggable");if(i.scrollParent[0]!==document&&i.scrollParent[0].tagName!=="HTML"){i.overflowOffset=i.scrollParent.offset();}},drag:function(event){var i=$(this).data("ui-draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!==document&&i.scrollParent[0].tagName!=="HTML"){if(!o.axis||o.axis!=="x"){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;}else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity){i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed;}}
if(!o.axis||o.axis!=="y"){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;}else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity){i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed;}}}else{if(!o.axis||o.axis!=="x"){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}}
if(!o.axis||o.axis!=="y"){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(i,event);}}});$.ui.plugin.add("draggable","snap",{start:function(){var i=$(this).data("ui-draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!==String?(o.snap.items||":data(ui-draggable)"):o.snap).each(function(){var $t=$(this),$o=$t.offset();if(this!==i.element[0]){i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});}});},drag:function(event,ui){var ts,bs,ls,rs,l,r,t,b,i,first,inst=$(this).data("ui-draggable"),o=inst.options,d=o.snapTolerance,x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(i=inst.snapElements.length-1;i>=0;i--){l=inst.snapElements[i].left;r=l+inst.snapElements[i].width;t=inst.snapElements[i].top;b=t+inst.snapElements[i].height;if(x2<l-d||x1>r+d||y2<t-d||y1>b+d||!$.contains(inst.snapElements[i].item.ownerDocument,inst.snapElements[i].item)){if(inst.snapElements[i].snapping){(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));}
inst.snapElements[i].snapping=false;continue;}
if(o.snapMode!=="inner"){ts=Math.abs(t-y2)<=d;bs=Math.abs(b-y1)<=d;ls=Math.abs(l-x2)<=d;rs=Math.abs(r-x1)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;}
if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;}
if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;}
if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;}}
first=(ts||bs||ls||rs);if(o.snapMode!=="outer"){ts=Math.abs(t-y1)<=d;bs=Math.abs(b-y2)<=d;ls=Math.abs(l-x1)<=d;rs=Math.abs(r-x2)<=d;if(ts){ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;}
if(bs){ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;}
if(ls){ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;}
if(rs){ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;}}
if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first)){(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));}
inst.snapElements[i].snapping=(ts||bs||ls||rs||first);}}});$.ui.plugin.add("draggable","stack",{start:function(){var min,o=this.data("ui-draggable").options,group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0);});if(!group.length){return;}
min=parseInt($(group[0]).css("zIndex"),10)||0;$(group).each(function(i){$(this).css("zIndex",min+i);});this.css("zIndex",(min+group.length));}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("ui-draggable").options;if(t.css("zIndex")){o._zIndex=t.css("zIndex");}
t.css("zIndex",o.zIndex);},stop:function(event,ui){var o=$(this).data("ui-draggable").options;if(o._zIndex){$(ui.helper).css("zIndex",o._zIndex);}}});})(jQuery);(function($,undefined){function isOverAxis(x,reference,size){return(x>reference)&&(x<(reference+size));}
$.widget("ui.droppable",{version:"1.10.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var proportions,o=this.options,accept=o.accept;this.isover=false;this.isout=true;this.accept=$.isFunction(accept)?accept:function(d){return d.is(accept);};this.proportions=function(){if(arguments.length){proportions=arguments[0];}else{return proportions?proportions:proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};}};$.ui.ddmanager.droppables[o.scope]=$.ui.ddmanager.droppables[o.scope]||[];$.ui.ddmanager.droppables[o.scope].push(this);(o.addClasses&&this.element.addClass("ui-droppable"));},_destroy:function(){var i=0,drop=$.ui.ddmanager.droppables[this.options.scope];for(;i<drop.length;i++){if(drop[i]===this){drop.splice(i,1);}}
this.element.removeClass("ui-droppable ui-droppable-disabled");},_setOption:function(key,value){if(key==="accept"){this.accept=$.isFunction(value)?value:function(d){return d.is(value);};}
$.Widget.prototype._setOption.apply(this,arguments);},_activate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.addClass(this.options.activeClass);}
if(draggable){this._trigger("activate",event,this.ui(draggable));}},_deactivate:function(event){var draggable=$.ui.ddmanager.current;if(this.options.activeClass){this.element.removeClass(this.options.activeClass);}
if(draggable){this._trigger("deactivate",event,this.ui(draggable));}},_over:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass){this.element.addClass(this.options.hoverClass);}
this._trigger("over",event,this.ui(draggable));}},_out:function(event){var draggable=$.ui.ddmanager.current;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass);}
this._trigger("out",event,this.ui(draggable));}},_drop:function(event,custom){var draggable=custom||$.ui.ddmanager.current,childrenIntersection=false;if(!draggable||(draggable.currentItem||draggable.element)[0]===this.element[0]){return false;}
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,"ui-droppable");if(inst.options.greedy&&!inst.options.disabled&&inst.options.scope===draggable.options.scope&&inst.accept.call(inst.element[0],(draggable.currentItem||draggable.element))&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection){return false;}
if(this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){if(this.options.activeClass){this.element.removeClass(this.options.activeClass);}
if(this.options.hoverClass){this.element.removeClass(this.options.hoverClass);}
this._trigger("drop",event,this.ui(draggable));return this.element;}
return false;},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,offset:c.positionAbs};}});$.ui.intersect=function(draggable,droppable,toleranceMode){if(!droppable.offset){return false;}
var draggableLeft,draggableTop,x1=(draggable.positionAbs||draggable.position.absolute).left,y1=(draggable.positionAbs||draggable.position.absolute).top,x2=x1+draggable.helperProportions.width,y2=y1+draggable.helperProportions.height,l=droppable.offset.left,t=droppable.offset.top,r=l+droppable.proportions().width,b=t+droppable.proportions().height;switch(toleranceMode){case"fit":return(l<=x1&&x2<=r&&t<=y1&&y2<=b);case"intersect":return(l<x1+(draggable.helperProportions.width/2)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);case"pointer":draggableLeft=((draggable.positionAbs||draggable.position.absolute).left+(draggable.clickOffset||draggable.offset.click).left);draggableTop=((draggable.positionAbs||draggable.position.absolute).top+(draggable.clickOffset||draggable.offset.click).top);return isOverAxis(draggableTop,t,droppable.proportions().height)&&isOverAxis(draggableLeft,l,droppable.proportions().width);case"touch":return((y1>=t&&y1<=b)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));default:return false;}};$.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,event){var i,j,m=$.ui.ddmanager.droppables[t.options.scope]||[],type=event?event.type:null,list=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();droppablesLoop:for(i=0;i<m.length;i++){if(m[i].options.disabled||(t&&!m[i].accept.call(m[i].element[0],(t.currentItem||t.element)))){continue;}
for(j=0;j<list.length;j++){if(list[j]===m[i].element[0]){m[i].proportions().height=0;continue droppablesLoop;}}
m[i].visible=m[i].element.css("display")!=="none";if(!m[i].visible){continue;}
if(type==="mousedown"){m[i]._activate.call(m[i],event);}
m[i].offset=m[i].element.offset();m[i].proportions({width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight});}},drop:function(draggable,event){var dropped=false;$.each(($.ui.ddmanager.droppables[draggable.options.scope]||[]).slice(),function(){if(!this.options){return;}
if(!this.options.disabled&&this.visible&&$.ui.intersect(draggable,this,this.options.tolerance)){dropped=this._drop.call(this,event)||dropped;}
if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=true;this.isover=false;this._deactivate.call(this,event);}});return dropped;},dragStart:function(draggable,event){draggable.element.parentsUntil("body").bind("scroll.droppable",function(){if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}});},drag:function(draggable,event){if(draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}
$.each($.ui.ddmanager.droppables[draggable.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible){return;}
var parentInstance,scope,parent,intersects=$.ui.intersect(draggable,this,this.options.tolerance),c=!intersects&&this.isover?"isout":(intersects&&!this.isover?"isover":null);if(!c){return;}
if(this.options.greedy){scope=this.options.scope;parent=this.element.parents(":data(ui-droppable)").filter(function(){return $.data(this,"ui-droppable").options.scope===scope;});if(parent.length){parentInstance=$.data(parent[0],"ui-droppable");parentInstance.greedyChild=(c==="isover");}}
if(parentInstance&&c==="isover"){parentInstance.isover=false;parentInstance.isout=true;parentInstance._out.call(parentInstance,event);}
this[c]=true;this[c==="isout"?"isover":"isout"]=false;this[c==="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c==="isout"){parentInstance.isout=false;parentInstance.isover=true;parentInstance._over.call(parentInstance,event);}});},dragStop:function(draggable,event){draggable.element.parentsUntil("body").unbind("scroll.droppable");if(!draggable.options.refreshPositions){$.ui.ddmanager.prepareOffsets(draggable,event);}}};})(jQuery);(function($,undefined){function num(v){return parseInt(v,10)||0;}
function isNumber(value){return!isNaN(parseInt(value,10));}
$.widget("ui.resizable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var n,i,handle,axis,hname,that=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap($("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize();}
this.handles=o.handles||(!$(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor===String){if(this.handles==="all"){this.handles="n,e,s,w,se,sw,ne,nw";}
n=this.handles.split(",");this.handles={};for(i=0;i<n.length;i++){handle=$.trim(n[i]);hname="ui-resizable-"+handle;axis=$("<div class='ui-resizable-handle "+hname+"'></div>");axis.css({zIndex:o.zIndex});if("se"===handle){axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");}
this.handles[handle]=".ui-resizable-"+handle;this.element.append(axis);}}
this._renderAxis=function(target){var i,axis,padPos,padWrapper;target=target||this.element;for(i in this.handles){if(this.handles[i].constructor===String){this.handles[i]=$(this.handles[i],this.element).show();}
if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){axis=$(this.handles[i],this.element);padWrapper=/sw|ne|nw|se|n|s/.test(i)?axis.outerHeight():axis.outerWidth();padPos=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");target.css(padPos,padWrapper);this._proportionallyResize();}
if(!$(this.handles[i]).length){continue;}}};this._renderAxis(this.element);this._handles=$(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!that.resizing){if(this.className){axis=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);}
that.axis=axis&&axis[1]?axis[1]:"se";}});if(o.autoHide){this._handles.hide();$(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(o.disabled){return;}
$(this).removeClass("ui-resizable-autohide");that._handles.show();}).mouseleave(function(){if(o.disabled){return;}
if(!that.resizing){$(this).addClass("ui-resizable-autohide");that._handles.hide();}});}
this._mouseInit();},_destroy:function(){this._mouseDestroy();var wrapper,_destroy=function(exp){$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();};if(this.elementIsWrapper){_destroy(this.element);wrapper=this.element;this.originalElement.css({position:wrapper.css("position"),width:wrapper.outerWidth(),height:wrapper.outerHeight(),top:wrapper.css("top"),left:wrapper.css("left")}).insertAfter(wrapper);wrapper.remove();}
this.originalElement.css("resize",this.originalResizeStyle);_destroy(this.originalElement);return this;},_mouseCapture:function(event){var i,handle,capture=false;for(i in this.handles){handle=$(this.handles[i])[0];if(handle===event.target||$.contains(handle,event.target)){capture=true;}}
return!this.options.disabled&&capture;},_mouseStart:function(event){var curleft,curtop,cursor,o=this.options,iniPos=this.element.position(),el=this.element;this.resizing=true;if((/absolute/).test(el.css("position"))){el.css({position:"absolute",top:el.css("top"),left:el.css("left")});}else if(el.is(".ui-draggable")){el.css({position:"absolute",top:iniPos.top,left:iniPos.left});}
this._renderProxy();curleft=num(this.helper.css("left"));curtop=num(this.helper.css("top"));if(o.containment){curleft+=$(o.containment).scrollLeft()||0;curtop+=$(o.containment).scrollTop()||0;}
this.offset=this.helper.offset();this.position={left:curleft,top:curtop};this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:el.width(),height:el.height()};this.originalSize=this._helper?{width:el.outerWidth(),height:el.outerHeight()}:{width:el.width(),height:el.height()};this.originalPosition={left:curleft,top:curtop};this.sizeDiff={width:el.outerWidth()-el.width(),height:el.outerHeight()-el.height()};this.originalMousePosition={left:event.pageX,top:event.pageY};this.aspectRatio=(typeof o.aspectRatio==="number")?o.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);cursor=$(".ui-resizable-"+this.axis).css("cursor");$("body").css("cursor",cursor==="auto"?this.axis+"-resize":cursor);el.addClass("ui-resizable-resizing");this._propagate("start",event);return true;},_mouseDrag:function(event){var data,el=this.helper,props={},smp=this.originalMousePosition,a=this.axis,prevTop=this.position.top,prevLeft=this.position.left,prevWidth=this.size.width,prevHeight=this.size.height,dx=(event.pageX-smp.left)||0,dy=(event.pageY-smp.top)||0,trigger=this._change[a];if(!trigger){return false;}
data=trigger.apply(this,[event,dx,dy]);this._updateVirtualBoundaries(event.shiftKey);if(this._aspectRatio||event.shiftKey){data=this._updateRatio(data,event);}
data=this._respectSize(data,event);this._updateCache(data);this._propagate("resize",event);if(this.position.top!==prevTop){props.top=this.position.top+"px";}
if(this.position.left!==prevLeft){props.left=this.position.left+"px";}
if(this.size.width!==prevWidth){props.width=this.size.width+"px";}
if(this.size.height!==prevHeight){props.height=this.size.height+"px";}
el.css(props);if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize();}
if(!$.isEmptyObject(props)){this._trigger("resize",event,this.ui());}
return false;},_mouseStop:function(event){this.resizing=false;var pr,ista,soffseth,soffsetw,s,left,top,o=this.options,that=this;if(this._helper){pr=this._proportionallyResizeElements;ista=pr.length&&(/textarea/i).test(pr[0].nodeName);soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:that.sizeDiff.height;soffsetw=ista?0:that.sizeDiff.width;s={width:(that.helper.width()-soffsetw),height:(that.helper.height()-soffseth)};left=(parseInt(that.element.css("left"),10)+(that.position.left-that.originalPosition.left))||null;top=(parseInt(that.element.css("top"),10)+(that.position.top-that.originalPosition.top))||null;if(!o.animate){this.element.css($.extend(s,{top:top,left:left}));}
that.helper.height(that.size.height);that.helper.width(that.size.width);if(this._helper&&!o.animate){this._proportionallyResize();}}
$("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",event);if(this._helper){this.helper.remove();}
return false;},_updateVirtualBoundaries:function(forceAspectRatio){var pMinWidth,pMaxWidth,pMinHeight,pMaxHeight,b,o=this.options;b={minWidth:isNumber(o.minWidth)?o.minWidth:0,maxWidth:isNumber(o.maxWidth)?o.maxWidth:Infinity,minHeight:isNumber(o.minHeight)?o.minHeight:0,maxHeight:isNumber(o.maxHeight)?o.maxHeight:Infinity};if(this._aspectRatio||forceAspectRatio){pMinWidth=b.minHeight*this.aspectRatio;pMinHeight=b.minWidth/this.aspectRatio;pMaxWidth=b.maxHeight*this.aspectRatio;pMaxHeight=b.maxWidth/this.aspectRatio;if(pMinWidth>b.minWidth){b.minWidth=pMinWidth;}
if(pMinHeight>b.minHeight){b.minHeight=pMinHeight;}
if(pMaxWidth<b.maxWidth){b.maxWidth=pMaxWidth;}
if(pMaxHeight<b.maxHeight){b.maxHeight=pMaxHeight;}}
this._vBoundaries=b;},_updateCache:function(data){this.offset=this.helper.offset();if(isNumber(data.left)){this.position.left=data.left;}
if(isNumber(data.top)){this.position.top=data.top;}
if(isNumber(data.height)){this.size.height=data.height;}
if(isNumber(data.width)){this.size.width=data.width;}},_updateRatio:function(data){var cpos=this.position,csize=this.size,a=this.axis;if(isNumber(data.height)){data.width=(data.height*this.aspectRatio);}else if(isNumber(data.width)){data.height=(data.width/this.aspectRatio);}
if(a==="sw"){data.left=cpos.left+(csize.width-data.width);data.top=null;}
if(a==="nw"){data.top=cpos.top+(csize.height-data.height);data.left=cpos.left+(csize.width-data.width);}
return data;},_respectSize:function(data){var o=this._vBoundaries,a=this.axis,ismaxw=isNumber(data.width)&&o.maxWidth&&(o.maxWidth<data.width),ismaxh=isNumber(data.height)&&o.maxHeight&&(o.maxHeight<data.height),isminw=isNumber(data.width)&&o.minWidth&&(o.minWidth>data.width),isminh=isNumber(data.height)&&o.minHeight&&(o.minHeight>data.height),dw=this.originalPosition.left+this.originalSize.width,dh=this.position.top+this.size.height,cw=/sw|nw|w/.test(a),ch=/nw|ne|n/.test(a);if(isminw){data.width=o.minWidth;}
if(isminh){data.height=o.minHeight;}
if(ismaxw){data.width=o.maxWidth;}
if(ismaxh){data.height=o.maxHeight;}
if(isminw&&cw){data.left=dw-o.minWidth;}
if(ismaxw&&cw){data.left=dw-o.maxWidth;}
if(isminh&&ch){data.top=dh-o.minHeight;}
if(ismaxh&&ch){data.top=dh-o.maxHeight;}
if(!data.width&&!data.height&&!data.left&&data.top){data.top=null;}else if(!data.width&&!data.height&&!data.top&&data.left){data.left=null;}
return data;},_proportionallyResize:function(){if(!this._proportionallyResizeElements.length){return;}
var i,j,borders,paddings,prel,element=this.helper||this.element;for(i=0;i<this._proportionallyResizeElements.length;i++){prel=this._proportionallyResizeElements[i];if(!this.borderDif){this.borderDif=[];borders=[prel.css("borderTopWidth"),prel.css("borderRightWidth"),prel.css("borderBottomWidth"),prel.css("borderLeftWidth")];paddings=[prel.css("paddingTop"),prel.css("paddingRight"),prel.css("paddingBottom"),prel.css("paddingLeft")];for(j=0;j<borders.length;j++){this.borderDif[j]=(parseInt(borders[j],10)||0)+(parseInt(paddings[j],10)||0);}}
prel.css({height:(element.height()-this.borderDif[0]-this.borderDif[2])||0,width:(element.width()-this.borderDif[1]-this.borderDif[3])||0});}},_renderProxy:function(){var el=this.element,o=this.options;this.elementOffset=el.offset();if(this._helper){this.helper=this.helper||$("<div style='overflow:hidden;'></div>");this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++o.zIndex});this.helper.appendTo("body").disableSelection();}else{this.helper=this.element;}},_change:{e:function(event,dx){return{width:this.originalSize.width+dx};},w:function(event,dx){var cs=this.originalSize,sp=this.originalPosition;return{left:sp.left+dx,width:cs.width-dx};},n:function(event,dx,dy){var cs=this.originalSize,sp=this.originalPosition;return{top:sp.top+dy,height:cs.height-dy};},s:function(event,dx,dy){return{height:this.originalSize.height+dy};},se:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},sw:function(event,dx,dy){return $.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));},ne:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[event,dx,dy]));},nw:function(event,dx,dy){return $.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[event,dx,dy]));}},_propagate:function(n,event){$.ui.plugin.call(this,n,[event,this.ui()]);(n!=="resize"&&this._trigger(n,event,this.ui()));},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}});$.ui.plugin.add("resizable","animate",{stop:function(event){var that=$(this).data("ui-resizable"),o=that.options,pr=that._proportionallyResizeElements,ista=pr.length&&(/textarea/i).test(pr[0].nodeName),soffseth=ista&&$.ui.hasScroll(pr[0],"left")?0:that.sizeDiff.height,soffsetw=ista?0:that.sizeDiff.width,style={width:(that.size.width-soffsetw),height:(that.size.height-soffseth)},left=(parseInt(that.element.css("left"),10)+(that.position.left-that.originalPosition.left))||null,top=(parseInt(that.element.css("top"),10)+(that.position.top-that.originalPosition.top))||null;that.element.animate($.extend(style,top&&left?{top:top,left:left}:{}),{duration:o.animateDuration,easing:o.animateEasing,step:function(){var data={width:parseInt(that.element.css("width"),10),height:parseInt(that.element.css("height"),10),top:parseInt(that.element.css("top"),10),left:parseInt(that.element.css("left"),10)};if(pr&&pr.length){$(pr[0]).css({width:data.width,height:data.height});}
that._updateCache(data);that._propagate("resize",event);}});}});$.ui.plugin.add("resizable","containment",{start:function(){var element,p,co,ch,cw,width,height,that=$(this).data("ui-resizable"),o=that.options,el=that.element,oc=o.containment,ce=(oc instanceof $)?oc.get(0):(/parent/.test(oc))?el.parent().get(0):oc;if(!ce){return;}
that.containerElement=$(ce);if(/document/.test(oc)||oc===document){that.containerOffset={left:0,top:0};that.containerPosition={left:0,top:0};that.parentData={element:$(document),left:0,top:0,width:$(document).width(),height:$(document).height()||document.body.parentNode.scrollHeight};}
else{element=$(ce);p=[];$(["Top","Right","Left","Bottom"]).each(function(i,name){p[i]=num(element.css("padding"+name));});that.containerOffset=element.offset();that.containerPosition=element.position();that.containerSize={height:(element.innerHeight()-p[3]),width:(element.innerWidth()-p[1])};co=that.containerOffset;ch=that.containerSize.height;cw=that.containerSize.width;width=($.ui.hasScroll(ce,"left")?ce.scrollWidth:cw);height=($.ui.hasScroll(ce)?ce.scrollHeight:ch);that.parentData={element:ce,left:co.left,top:co.top,width:width,height:height};}},resize:function(event){var woset,hoset,isParent,isOffsetRelative,that=$(this).data("ui-resizable"),o=that.options,co=that.containerOffset,cp=that.position,pRatio=that._aspectRatio||event.shiftKey,cop={top:0,left:0},ce=that.containerElement;if(ce[0]!==document&&(/static/).test(ce.css("position"))){cop=co;}
if(cp.left<(that._helper?co.left:0)){that.size.width=that.size.width+(that._helper?(that.position.left-co.left):(that.position.left-cop.left));if(pRatio){that.size.height=that.size.width/that.aspectRatio;}
that.position.left=o.helper?co.left:0;}
if(cp.top<(that._helper?co.top:0)){that.size.height=that.size.height+(that._helper?(that.position.top-co.top):that.position.top);if(pRatio){that.size.width=that.size.height*that.aspectRatio;}
that.position.top=that._helper?co.top:0;}
that.offset.left=that.parentData.left+that.position.left;that.offset.top=that.parentData.top+that.position.top;woset=Math.abs((that._helper?that.offset.left-cop.left:(that.offset.left-cop.left))+that.sizeDiff.width);hoset=Math.abs((that._helper?that.offset.top-cop.top:(that.offset.top-co.top))+that.sizeDiff.height);isParent=that.containerElement.get(0)===that.element.parent().get(0);isOffsetRelative=/relative|absolute/.test(that.containerElement.css("position"));if(isParent&&isOffsetRelative){woset-=Math.abs(that.parentData.left);}
if(woset+that.size.width>=that.parentData.width){that.size.width=that.parentData.width-woset;if(pRatio){that.size.height=that.size.width/that.aspectRatio;}}
if(hoset+that.size.height>=that.parentData.height){that.size.height=that.parentData.height-hoset;if(pRatio){that.size.width=that.size.height*that.aspectRatio;}}},stop:function(){var that=$(this).data("ui-resizable"),o=that.options,co=that.containerOffset,cop=that.containerPosition,ce=that.containerElement,helper=$(that.helper),ho=helper.offset(),w=helper.outerWidth()-that.sizeDiff.width,h=helper.outerHeight()-that.sizeDiff.height;if(that._helper&&!o.animate&&(/relative/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}
if(that._helper&&!o.animate&&(/static/).test(ce.css("position"))){$(this).css({left:ho.left-cop.left-co.left,width:w,height:h});}}});$.ui.plugin.add("resizable","alsoResize",{start:function(){var that=$(this).data("ui-resizable"),o=that.options,_store=function(exp){$(exp).each(function(){var el=$(this);el.data("ui-resizable-alsoresize",{width:parseInt(el.width(),10),height:parseInt(el.height(),10),left:parseInt(el.css("left"),10),top:parseInt(el.css("top"),10)});});};if(typeof(o.alsoResize)==="object"&&!o.alsoResize.parentNode){if(o.alsoResize.length){o.alsoResize=o.alsoResize[0];_store(o.alsoResize);}
else{$.each(o.alsoResize,function(exp){_store(exp);});}}else{_store(o.alsoResize);}},resize:function(event,ui){var that=$(this).data("ui-resizable"),o=that.options,os=that.originalSize,op=that.originalPosition,delta={height:(that.size.height-os.height)||0,width:(that.size.width-os.width)||0,top:(that.position.top-op.top)||0,left:(that.position.left-op.left)||0},_alsoResize=function(exp,c){$(exp).each(function(){var el=$(this),start=$(this).data("ui-resizable-alsoresize"),style={},css=c&&c.length?c:el.parents(ui.originalElement[0]).length?["width","height"]:["width","height","top","left"];$.each(css,function(i,prop){var sum=(start[prop]||0)+(delta[prop]||0);if(sum&&sum>=0){style[prop]=sum||null;}});el.css(style);});};if(typeof(o.alsoResize)==="object"&&!o.alsoResize.nodeType){$.each(o.alsoResize,function(exp,c){_alsoResize(exp,c);});}else{_alsoResize(o.alsoResize);}},stop:function(){$(this).removeData("resizable-alsoresize");}});$.ui.plugin.add("resizable","ghost",{start:function(){var that=$(this).data("ui-resizable"),o=that.options,cs=that.size;that.ghost=that.originalElement.clone();that.ghost.css({opacity:0.25,display:"block",position:"relative",height:cs.height,width:cs.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof o.ghost==="string"?o.ghost:"");that.ghost.appendTo(that.helper);},resize:function(){var that=$(this).data("ui-resizable");if(that.ghost){that.ghost.css({position:"relative",height:that.size.height,width:that.size.width});}},stop:function(){var that=$(this).data("ui-resizable");if(that.ghost&&that.helper){that.helper.get(0).removeChild(that.ghost.get(0));}}});$.ui.plugin.add("resizable","grid",{resize:function(){var that=$(this).data("ui-resizable"),o=that.options,cs=that.size,os=that.originalSize,op=that.originalPosition,a=that.axis,grid=typeof o.grid==="number"?[o.grid,o.grid]:o.grid,gridX=(grid[0]||1),gridY=(grid[1]||1),ox=Math.round((cs.width-os.width)/gridX)*gridX,oy=Math.round((cs.height-os.height)/gridY)*gridY,newWidth=os.width+ox,newHeight=os.height+oy,isMaxWidth=o.maxWidth&&(o.maxWidth<newWidth),isMaxHeight=o.maxHeight&&(o.maxHeight<newHeight),isMinWidth=o.minWidth&&(o.minWidth>newWidth),isMinHeight=o.minHeight&&(o.minHeight>newHeight);o.grid=grid;if(isMinWidth){newWidth=newWidth+gridX;}
if(isMinHeight){newHeight=newHeight+gridY;}
if(isMaxWidth){newWidth=newWidth-gridX;}
if(isMaxHeight){newHeight=newHeight-gridY;}
if(/^(se|s|e)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;}else if(/^(ne)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.top=op.top-oy;}else if(/^(sw)$/.test(a)){that.size.width=newWidth;that.size.height=newHeight;that.position.left=op.left-ox;}else{if(newHeight-gridY>0){that.size.height=newHeight;that.position.top=op.top-oy;}else{that.size.height=gridY;that.position.top=op.top+os.height-gridY;}
if(newWidth-gridX>0){that.size.width=newWidth;that.position.left=op.left-ox;}else{that.size.width=gridX;that.position.left=op.left+os.width-gridX;}}}});})(jQuery);(function($,undefined){$.widget("ui.selectable",$.ui.mouse,{version:"1.10.4",options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var selectees,that=this;this.element.addClass("ui-selectable");this.dragged=false;this.refresh=function(){selectees=$(that.options.filter,that.element[0]);selectees.addClass("ui-selectee");selectees.each(function(){var $this=$(this),pos=$this.offset();$.data(this,"selectable-item",{element:this,$element:$this,left:pos.left,top:pos.top,right:pos.left+$this.outerWidth(),bottom:pos.top+$this.outerHeight(),startselected:false,selected:$this.hasClass("ui-selected"),selecting:$this.hasClass("ui-selecting"),unselecting:$this.hasClass("ui-unselecting")});});};this.refresh();this.selectees=selectees.addClass("ui-selectee");this._mouseInit();this.helper=$("<div class='ui-selectable-helper'></div>");},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled");this._mouseDestroy();},_mouseStart:function(event){var that=this,options=this.options;this.opos=[event.pageX,event.pageY];if(this.options.disabled){return;}
this.selectees=$(options.filter,this.element[0]);this._trigger("start",event);$(options.appendTo).append(this.helper);this.helper.css({"left":event.pageX,"top":event.pageY,"width":0,"height":0});if(options.autoRefresh){this.refresh();}
this.selectees.filter(".ui-selected").each(function(){var selectee=$.data(this,"selectable-item");selectee.startselected=true;if(!event.metaKey&&!event.ctrlKey){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element});}});$(event.target).parents().addBack().each(function(){var doSelect,selectee=$.data(this,"selectable-item");if(selectee){doSelect=(!event.metaKey&&!event.ctrlKey)||!selectee.$element.hasClass("ui-selected");selectee.$element.removeClass(doSelect?"ui-unselecting":"ui-selected").addClass(doSelect?"ui-selecting":"ui-unselecting");selectee.unselecting=!doSelect;selectee.selecting=doSelect;selectee.selected=doSelect;if(doSelect){that._trigger("selecting",event,{selecting:selectee.element});}else{that._trigger("unselecting",event,{unselecting:selectee.element});}
return false;}});},_mouseDrag:function(event){this.dragged=true;if(this.options.disabled){return;}
var tmp,that=this,options=this.options,x1=this.opos[0],y1=this.opos[1],x2=event.pageX,y2=event.pageY;if(x1>x2){tmp=x2;x2=x1;x1=tmp;}
if(y1>y2){tmp=y2;y2=y1;y1=tmp;}
this.helper.css({left:x1,top:y1,width:x2-x1,height:y2-y1});this.selectees.each(function(){var selectee=$.data(this,"selectable-item"),hit=false;if(!selectee||selectee.element===that.element[0]){return;}
if(options.tolerance==="touch"){hit=(!(selectee.left>x2||selectee.right<x1||selectee.top>y2||selectee.bottom<y1));}else if(options.tolerance==="fit"){hit=(selectee.left>x1&&selectee.right<x2&&selectee.top>y1&&selectee.bottom<y2);}
if(hit){if(selectee.selected){selectee.$element.removeClass("ui-selected");selectee.selected=false;}
if(selectee.unselecting){selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false;}
if(!selectee.selecting){selectee.$element.addClass("ui-selecting");selectee.selecting=true;that._trigger("selecting",event,{selecting:selectee.element});}}else{if(selectee.selecting){if((event.metaKey||event.ctrlKey)&&selectee.startselected){selectee.$element.removeClass("ui-selecting");selectee.selecting=false;selectee.$element.addClass("ui-selected");selectee.selected=true;}else{selectee.$element.removeClass("ui-selecting");selectee.selecting=false;if(selectee.startselected){selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;}
that._trigger("unselecting",event,{unselecting:selectee.element});}}
if(selectee.selected){if(!event.metaKey&&!event.ctrlKey&&!selectee.startselected){selectee.$element.removeClass("ui-selected");selectee.selected=false;selectee.$element.addClass("ui-unselecting");selectee.unselecting=true;that._trigger("unselecting",event,{unselecting:selectee.element});}}}});return false;},_mouseStop:function(event){var that=this;this.dragged=false;$(".ui-unselecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-unselecting");selectee.unselecting=false;selectee.startselected=false;that._trigger("unselected",event,{unselected:selectee.element});});$(".ui-selecting",this.element[0]).each(function(){var selectee=$.data(this,"selectable-item");selectee.$element.removeClass("ui-selecting").addClass("ui-selected");selectee.selecting=false;selectee.selected=true;selectee.startselected=true;that._trigger("selected",event,{selected:selectee.element});});this._trigger("stop",event);this.helper.remove();return false;}});})(jQuery);(function($,undefined){function isOverAxis(x,reference,size){return(x>reference)&&(x<(reference+size));}
function isFloating(item){return(/left|right/).test(item.css("float"))||(/inline|table-cell/).test(item.css("display"));}
$.widget("ui.sortable",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"sort",ready:false,options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?o.axis==="x"||isFloating(this.items[0].item):false;this.offset=this.element.offset();this._mouseInit();this.ready=true;},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--){this.items[i].item.removeData(this.widgetName+"-item");}
return this;},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget().toggleClass("ui-sortable-disabled",!!value);}else{$.Widget.prototype._setOption.apply(this,arguments);}},_mouseCapture:function(event,overrideHandle){var currentItem=null,validHandle=false,that=this;if(this.reverting){return false;}
if(this.options.disabled||this.options.type==="static"){return false;}
this._refreshItems(event);$(event.target).parents().each(function(){if($.data(this,that.widgetName+"-item")===that){currentItem=$(this);return false;}});if($.data(event.target,that.widgetName+"-item")===that){currentItem=$(event.target);}
if(!currentItem){return false;}
if(this.options.handle&&!overrideHandle){$(this.options.handle,currentItem).find("*").addBack().each(function(){if(this===event.target){validHandle=true;}});if(!validHandle){return false;}}
this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var i,body,o=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!==this.currentItem[0]){this.currentItem.hide();}
this._createPlaceholder();if(o.containment){this._setContainment();}
if(o.cursor&&o.cursor!=="auto"){body=this.document.find("body");this.storedCursor=body.css("cursor");body.css("cursor",o.cursor);this.storedStylesheet=$("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(body);}
if(o.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity");}
this.helper.css("opacity",o.opacity);}
if(o.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex");}
this.helper.css("zIndex",o.zIndex);}
if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){this.overflowOffset=this.scrollParent.offset();}
this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions();}
if(!noActivation){for(i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,this._uiHash(this));}}
if($.ui.ddmanager){$.ui.ddmanager.current=this;}
if($.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}
this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){var i,item,itemElement,intersection,o=this.options,scrolled=false;this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}
if(this.options.scroll){if(this.scrollParent[0]!==document&&this.scrollParent[0].tagName!=="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;}else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity){this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;}
if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;}else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity){this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);}else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity){scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);}else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity){scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour){$.ui.ddmanager.prepareOffsets(this,event);}}
this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!=="y"){this.helper[0].style.left=this.position.left+"px";}
if(!this.options.axis||this.options.axis!=="x"){this.helper[0].style.top=this.position.top+"px";}
for(i=this.items.length-1;i>=0;i--){item=this.items[i];itemElement=item.item[0];intersection=this._intersectsWithPointer(item);if(!intersection){continue;}
if(item.instance!==this.currentContainer){continue;}
if(itemElement!==this.currentItem[0]&&this.placeholder[intersection===1?"next":"prev"]()[0]!==itemElement&&!$.contains(this.placeholder[0],itemElement)&&(this.options.type==="semi-dynamic"?!$.contains(this.element[0],itemElement):true)){this.direction=intersection===1?"down":"up";if(this.options.tolerance==="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
this._trigger("change",event,this._uiHash());break;}}
this._contactContainers(event);if($.ui.ddmanager){$.ui.ddmanager.drag(this,event);}
this._trigger("sort",event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event){return;}
if($.ui.ddmanager&&!this.options.dropBehaviour){$.ui.ddmanager.drop(this,event);}
if(this.options.revert){var that=this,cur=this.placeholder.offset(),axis=this.options.axis,animation={};if(!axis||axis==="x"){animation.left=cur.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft);}
if(!axis||axis==="y"){animation.top=cur.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop);}
this.reverting=true;$(this.helper).animate(animation,parseInt(this.options.revert,10)||500,function(){that._clear(event);});}else{this._clear(event,noPropagation);}
return false;},cancel:function(){if(this.dragging){this._mouseUp({target:null});if(this.options.helper==="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,this._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(this.placeholder){if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0]);}
if(this.options.helper!=="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove();}
$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}}
return this;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected),str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||"id")||"").match(o.expression||(/(.+)[\-=_](.+)/));if(res){str.push((o.key||res[1]+"[]")+"="+(o.key&&o.expression?res[1]:res[2]));}});if(!str.length&&o.key){str.push(o.key+"=");}
return str.join("&");},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected),ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||"id")||"");});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height,l=item.left,r=l+item.width,t=item.top,b=t+item.height,dyClick=this.offset.click.top,dxClick=this.offset.click.left,isOverElementHeight=(this.options.axis==="x")||((y1+dyClick)>t&&(y1+dyClick)<b),isOverElementWidth=(this.options.axis==="y")||((x1+dxClick)>l&&(x1+dxClick)<r),isOverElement=isOverElementHeight&&isOverElementWidth;if(this.options.tolerance==="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!=="pointer"&&this.helperProportions[this.floating?"width":"height"]>item[this.floating?"width":"height"])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var isOverElementHeight=(this.options.axis==="x")||isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=(this.options.axis==="y")||isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement){return false;}
return this.floating?(((horizontalDirection&&horizontalDirection==="right")||verticalDirection==="down")?2:1):(verticalDirection&&(verticalDirection==="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return((horizontalDirection==="right"&&isOverRightHalf)||(horizontalDirection==="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection==="down"&&isOverBottomHalf)||(verticalDirection==="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!==0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!==0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this;},_connectWith:function(){var options=this.options;return options.connectWith.constructor===String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var i,j,cur,inst,items=[],queries=[],connectWith=this._connectWith();if(connectWith&&connected){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),inst]);}}}}
queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);function addItems(){items.push(this);}
for(i=queries.length-1;i>=0;i--){queries[i][0].each(addItems);}
return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=$.grep(this.items,function(item){for(var j=0;j<list.length;j++){if(list[j]===item.item[0]){return false;}}
return true;});},_refreshItems:function(event){this.items=[];this.containers=[this];var i,j,cur,inst,targetData,_queries,item,queriesLength,items=this.items,queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]],connectWith=this._connectWith();if(connectWith&&this.ready){for(i=connectWith.length-1;i>=0;i--){cur=$(connectWith[i]);for(j=cur.length-1;j>=0;j--){inst=$.data(cur[j],this.widgetFullName);if(inst&&inst!==this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}}}}
for(i=queries.length-1;i>=0;i--){targetData=queries[i][1];_queries=queries[i][0];for(j=0,queriesLength=_queries.length;j<queriesLength;j++){item=$(_queries[j]);item.data(this.widgetName+"-item",targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});}}},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
var i,item,t,p;for(i=this.items.length-1;i>=0;i--){item=this.items[i];if(item.instance!==this.currentContainer&&this.currentContainer&&item.item[0]!==this.currentItem[0]){continue;}
t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
p=t.offset();item.left=p.left;item.top=p.top;}
if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(i=this.containers.length-1;i>=0;i--){p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();}}
return this;},_createPlaceholder:function(that){that=that||this;var className,o=that.options;if(!o.placeholder||o.placeholder.constructor===String){className=o.placeholder;o.placeholder={element:function(){var nodeName=that.currentItem[0].nodeName.toLowerCase(),element=$("<"+nodeName+">",that.document[0]).addClass(className||that.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");if(nodeName==="tr"){that.currentItem.children().each(function(){$("<td>&#160;</td>",that.document[0]).attr("colspan",$(this).attr("colspan")||1).appendTo(element);});}else if(nodeName==="img"){element.attr("src",that.currentItem.attr("src"));}
if(!className){element.css("visibility","hidden");}
return element;},update:function(container,p){if(className&&!o.forcePlaceholderSize){return;}
if(!p.height()){p.height(that.currentItem.innerHeight()-parseInt(that.currentItem.css("paddingTop")||0,10)-parseInt(that.currentItem.css("paddingBottom")||0,10));}
if(!p.width()){p.width(that.currentItem.innerWidth()-parseInt(that.currentItem.css("paddingLeft")||0,10)-parseInt(that.currentItem.css("paddingRight")||0,10));}}};}
that.placeholder=$(o.placeholder.element.call(that.element,that.currentItem));that.currentItem.after(that.placeholder);o.placeholder.update(that,that.placeholder);},_contactContainers:function(event){var i,j,dist,itemWithLeastDistance,posProperty,sizeProperty,base,cur,nearBottom,floating,innermostContainer=null,innermostIndex=null;for(i=this.containers.length-1;i>=0;i--){if($.contains(this.currentItem[0],this.containers[i].element[0])){continue;}
if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.contains(this.containers[i].element[0],innermostContainer.element[0])){continue;}
innermostContainer=this.containers[i];innermostIndex=i;}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(!innermostContainer){return;}
if(this.containers.length===1){if(!this.containers[innermostIndex].containerCache.over){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}}else{dist=10000;itemWithLeastDistance=null;floating=innermostContainer.floating||isFloating(this.currentItem);posProperty=floating?"left":"top";sizeProperty=floating?"width":"height";base=this.positionAbs[posProperty]+this.offset.click[posProperty];for(j=this.items.length-1;j>=0;j--){if(!$.contains(this.containers[innermostIndex].element[0],this.items[j].item[0])){continue;}
if(this.items[j].item[0]===this.currentItem[0]){continue;}
if(floating&&!isOverAxis(this.positionAbs.top+this.offset.click.top,this.items[j].top,this.items[j].height)){continue;}
cur=this.items[j].item.offset()[posProperty];nearBottom=false;if(Math.abs(cur-base)>Math.abs(cur+this.items[j][sizeProperty]-base)){nearBottom=true;cur+=this.items[j][sizeProperty];}
if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];this.direction=nearBottom?"up":"down";}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty){return;}
if(this.currentContainer===this.containers[innermostIndex]){return;}
itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.currentContainer=this.containers[innermostIndex];this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}},_createHelper:function(event){var o=this.options,helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper==="clone"?this.currentItem.clone():this.currentItem);if(!helper.parents("body").length){$(o.appendTo!=="parent"?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);}
if(helper[0]===this.currentItem[0]){this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};}
if(!helper[0].style.width||o.forceHelperSize){helper.width(this.currentItem.width());}
if(!helper[0].style.height||o.forceHelperSize){helper.height(this.currentItem.height());}
return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj==="string"){obj=obj.split(" ");}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if("left"in obj){this.offset.click.left=obj.left+this.margins.left;}
if("right"in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if("top"in obj){this.offset.click.top=obj.top+this.margins.top;}
if("bottom"in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition==="absolute"&&this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if(this.offsetParent[0]===document.body||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()==="html"&&$.ui.ie)){po={top:0,left:0};}
return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition==="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var ce,co,over,o=this.options;if(o.containment==="parent"){o.containment=this.helper[0].parentNode;}
if(o.containment==="document"||o.containment==="window"){this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment==="document"?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment==="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];}
if(!(/^(document|window|parent)$/).test(o.containment)){ce=$(o.containment)[0];co=$(o.containment).offset();over=($(ce).css("overflow")!=="hidden");this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos){pos=this.position;}
var mod=d==="absolute"?1:-1,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top+
this.offset.relative.top*mod+
this.offset.parent.top*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left+
this.offset.relative.left*mod+
this.offset.parent.left*mod-
((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var top,left,o=this.options,pageX=event.pageX,pageY=event.pageY,scroll=this.cssPosition==="absolute"&&!(this.scrollParent[0]!==document&&$.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition==="relative"&&!(this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0]){pageX=this.containment[0]+this.offset.click.left;}
if(event.pageY-this.offset.click.top<this.containment[1]){pageY=this.containment[1]+this.offset.click.top;}
if(event.pageX-this.offset.click.left>this.containment[2]){pageX=this.containment[2]+this.offset.click.left;}
if(event.pageY-this.offset.click.top>this.containment[3]){pageY=this.containment[3]+this.offset.click.top;}}
if(o.grid){top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?((top-this.offset.click.top>=this.containment[1]&&top-this.offset.click.top<=this.containment[3])?top:((top-this.offset.click.top>=this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?((left-this.offset.click.left>=this.containment[0]&&left-this.offset.click.left<=this.containment[2])?left:((left-this.offset.click.left>=this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY-
this.offset.click.top-
this.offset.relative.top-
this.offset.parent.top+
((this.cssPosition==="fixed"?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX-
this.offset.click.left-
this.offset.relative.left-
this.offset.parent.left+
((this.cssPosition==="fixed"?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction==="down"?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var counter=this.counter;this._delay(function(){if(counter===this.counter){this.refreshPositions(!hardRefresh);}});},_clear:function(event,noPropagation){this.reverting=false;var i,delayedTriggers=[];if(!this._noFinalSort&&this.currentItem.parent().length){this.placeholder.before(this.currentItem);}
this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){if(this._storedCSS[i]==="auto"||this._storedCSS[i]==="static"){this._storedCSS[i]="";}}
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
if(this.fromOutside&&!noPropagation){delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});}
if((this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!noPropagation){delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});}
if(this!==this.currentContainer){if(!noPropagation){delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.currentContainer));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.currentContainer));}}
function delayEvent(type,instance,container){return function(event){container._trigger(type,event,instance._uiHash(instance));};}
for(i=this.containers.length-1;i>=0;i--){if(!noPropagation){delayedTriggers.push(delayEvent("deactivate",this,this.containers[i]));}
if(this.containers[i].containerCache.over){delayedTriggers.push(delayEvent("out",this,this.containers[i]));this.containers[i].containerCache.over=0;}}
if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove();}
if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity);}
if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex==="auto"?"":this._storedZIndex);}
this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);}
this._trigger("stop",event,this._uiHash());}
this.fromOutside=false;return false;}
if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());}
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!==this.currentItem[0]){this.helper.remove();}
this.helper=null;if(!noPropagation){for(i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);}
this._trigger("stop",event,this._uiHash());}
this.fromOutside=false;return true;},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(_inst){var inst=_inst||this;return{helper:inst.helper,placeholder:inst.placeholder||$([]),position:inst.position,originalPosition:inst.originalPosition,offset:inst.positionAbs,item:inst.currentItem,sender:_inst?_inst.element:null};}});})(jQuery);(function($,undefined){var uid=0,hideProps={},showProps={};hideProps.height=hideProps.paddingTop=hideProps.paddingBottom=hideProps.borderTopWidth=hideProps.borderBottomWidth="hide";showProps.height=showProps.paddingTop=showProps.paddingBottom=showProps.borderTopWidth=showProps.borderBottomWidth="show";$.widget("ui.accordion",{version:"1.10.4",options:{active:0,animate:{},collapsible:false,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var options=this.options;this.prevShow=this.prevHide=$();this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist");if(!options.collapsible&&(options.active===false||options.active==null)){options.active=0;}
this._processPanels();if(options.active<0){options.active+=this.headers.length;}
this._refresh();},_getCreateEventData:function(){return{header:this.active,panel:!this.active.length?$():this.active.next(),content:!this.active.length?$():this.active.next()};},_createIcons:function(){var icons=this.options.icons;if(icons){$("<span>").addClass("ui-accordion-header-icon ui-icon "+icons.header).prependTo(this.headers);this.active.children(".ui-accordion-header-icon").removeClass(icons.header).addClass(icons.activeHeader);this.headers.addClass("ui-accordion-icons");}},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove();},_destroy:function(){var contents;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){if(/^ui-accordion/.test(this.id)){this.removeAttribute("id");}});this._destroyIcons();contents=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){if(/^ui-accordion/.test(this.id)){this.removeAttribute("id");}});if(this.options.heightStyle!=="content"){contents.css("height","");}},_setOption:function(key,value){if(key==="active"){this._activate(value);return;}
if(key==="event"){if(this.options.event){this._off(this.headers,this.options.event);}
this._setupEvents(value);}
this._super(key,value);if(key==="collapsible"&&!value&&this.options.active===false){this._activate(0);}
if(key==="icons"){this._destroyIcons();if(value){this._createIcons();}}
if(key==="disabled"){this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!value);}},_keydown:function(event){if(event.altKey||event.ctrlKey){return;}
var keyCode=$.ui.keyCode,length=this.headers.length,currentIndex=this.headers.index(event.target),toFocus=false;switch(event.keyCode){case keyCode.RIGHT:case keyCode.DOWN:toFocus=this.headers[(currentIndex+1)%length];break;case keyCode.LEFT:case keyCode.UP:toFocus=this.headers[(currentIndex-1+length)%length];break;case keyCode.SPACE:case keyCode.ENTER:this._eventHandler(event);break;case keyCode.HOME:toFocus=this.headers[0];break;case keyCode.END:toFocus=this.headers[length-1];break;}
if(toFocus){$(event.target).attr("tabIndex",-1);$(toFocus).attr("tabIndex",0);toFocus.focus();event.preventDefault();}},_panelKeyDown:function(event){if(event.keyCode===$.ui.keyCode.UP&&event.ctrlKey){$(event.currentTarget).prev().focus();}},refresh:function(){var options=this.options;this._processPanels();if((options.active===false&&options.collapsible===true)||!this.headers.length){options.active=false;this.active=$();}else if(options.active===false){this._activate(0);}else if(this.active.length&&!$.contains(this.element[0],this.active[0])){if(this.headers.length===this.headers.find(".ui-state-disabled").length){options.active=false;this.active=$();}else{this._activate(Math.max(0,options.active-1));}}else{options.active=this.headers.index(this.active);}
this._destroyIcons();this._refresh();},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all");this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide();},_refresh:function(){var maxHeight,options=this.options,heightStyle=options.heightStyle,parent=this.element.parent(),accordionId=this.accordionId="ui-accordion-"+
(this.element.attr("id")||++uid);this.active=this._findActive(options.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all");this.active.next().addClass("ui-accordion-content-active").show();this.headers.attr("role","tab").each(function(i){var header=$(this),headerId=header.attr("id"),panel=header.next(),panelId=panel.attr("id");if(!headerId){headerId=accordionId+"-header-"+i;header.attr("id",headerId);}
if(!panelId){panelId=accordionId+"-panel-"+i;panel.attr("id",panelId);}
header.attr("aria-controls",panelId);panel.attr("aria-labelledby",headerId);}).next().attr("role","tabpanel");this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex",0);}else{this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"});}
this._createIcons();this._setupEvents(options.event);if(heightStyle==="fill"){maxHeight=parent.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return;}
maxHeight-=elem.outerHeight(true);});this.headers.each(function(){maxHeight-=$(this).outerHeight(true);});this.headers.next().each(function(){$(this).height(Math.max(0,maxHeight-
$(this).innerHeight()+$(this).height()));}).css("overflow","auto");}else if(heightStyle==="auto"){maxHeight=0;this.headers.next().each(function(){maxHeight=Math.max(maxHeight,$(this).css("height","").height());}).height(maxHeight);}},_activate:function(index){var active=this._findActive(index)[0];if(active===this.active[0]){return;}
active=active||this.active[0];this._eventHandler({target:active,currentTarget:active,preventDefault:$.noop});},_findActive:function(selector){return typeof selector==="number"?this.headers.eq(selector):$();},_setupEvents:function(event){var events={keydown:"_keydown"};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler";});}
this._off(this.headers.add(this.headers.next()));this._on(this.headers,events);this._on(this.headers.next(),{keydown:"_panelKeyDown"});this._hoverable(this.headers);this._focusable(this.headers);},_eventHandler:function(event){var options=this.options,active=this.active,clicked=$(event.currentTarget),clickedIsActive=clicked[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():clicked.next(),toHide=active.next(),eventData={oldHeader:active,oldPanel:toHide,newHeader:collapsing?$():clicked,newPanel:toShow};event.preventDefault();if((clickedIsActive&&!options.collapsible)||(this._trigger("beforeActivate",event,eventData)===false)){return;}
options.active=collapsing?false:this.headers.index(clicked);this.active=clickedIsActive?$():clicked;this._toggle(eventData);active.removeClass("ui-accordion-header-active ui-state-active");if(options.icons){active.children(".ui-accordion-header-icon").removeClass(options.icons.activeHeader).addClass(options.icons.header);}
if(!clickedIsActive){clicked.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top");if(options.icons){clicked.children(".ui-accordion-header-icon").removeClass(options.icons.header).addClass(options.icons.activeHeader);}
clicked.next().addClass("ui-accordion-content-active");}},_toggle:function(data){var toShow=data.newPanel,toHide=this.prevShow.length?this.prevShow:data.oldPanel;this.prevShow.add(this.prevHide).stop(true,true);this.prevShow=toShow;this.prevHide=toHide;if(this.options.animate){this._animate(toShow,toHide,data);}else{toHide.hide();toShow.show();this._toggleComplete(data);}
toHide.attr({"aria-hidden":"true"});toHide.prev().attr("aria-selected","false");if(toShow.length&&toHide.length){toHide.prev().attr({"tabIndex":-1,"aria-expanded":"false"});}else if(toShow.length){this.headers.filter(function(){return $(this).attr("tabIndex")===0;}).attr("tabIndex",-1);}
toShow.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"});},_animate:function(toShow,toHide,data){var total,easing,duration,that=this,adjust=0,down=toShow.length&&(!toHide.length||(toShow.index()<toHide.index())),animate=this.options.animate||{},options=down&&animate.down||animate,complete=function(){that._toggleComplete(data);};if(typeof options==="number"){duration=options;}
if(typeof options==="string"){easing=options;}
easing=easing||options.easing||animate.easing;duration=duration||options.duration||animate.duration;if(!toHide.length){return toShow.animate(showProps,duration,easing,complete);}
if(!toShow.length){return toHide.animate(hideProps,duration,easing,complete);}
total=toShow.show().outerHeight();toHide.animate(hideProps,{duration:duration,easing:easing,step:function(now,fx){fx.now=Math.round(now);}});toShow.hide().animate(showProps,{duration:duration,easing:easing,complete:complete,step:function(now,fx){fx.now=Math.round(now);if(fx.prop!=="height"){adjust+=fx.now;}else if(that.options.heightStyle!=="content"){fx.now=Math.round(total-toHide.outerHeight()-adjust);adjust=0;}}});},_toggleComplete:function(data){var toHide=data.oldPanel;toHide.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all");if(toHide.length){toHide.parent()[0].className=toHide.parent()[0].className;}
this._trigger("activate",null,data);}});})(jQuery);(function($,undefined){$.widget("ui.autocomplete",{version:"1.10.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var suppressKeyPress,suppressKeyPressRepeat,suppressInput,nodeName=this.element[0].nodeName.toLowerCase(),isTextarea=nodeName==="textarea",isInput=nodeName==="input";this.isMultiLine=isTextarea?true:isInput?false:this.element.prop("isContentEditable");this.valueMethod=this.element[isTextarea||isInput?"val":"text"];this.isNewMenu=true;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off");this._on(this.element,{keydown:function(event){if(this.element.prop("readOnly")){suppressKeyPress=true;suppressInput=true;suppressKeyPressRepeat=true;return;}
suppressKeyPress=false;suppressInput=false;suppressKeyPressRepeat=false;var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:suppressKeyPress=true;this._move("previousPage",event);break;case keyCode.PAGE_DOWN:suppressKeyPress=true;this._move("nextPage",event);break;case keyCode.UP:suppressKeyPress=true;this._keyEvent("previous",event);break;case keyCode.DOWN:suppressKeyPress=true;this._keyEvent("next",event);break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(this.menu.active){suppressKeyPress=true;event.preventDefault();this.menu.select(event);}
break;case keyCode.TAB:if(this.menu.active){this.menu.select(event);}
break;case keyCode.ESCAPE:if(this.menu.element.is(":visible")){this._value(this.term);this.close(event);event.preventDefault();}
break;default:suppressKeyPressRepeat=true;this._searchTimeout(event);break;}},keypress:function(event){if(suppressKeyPress){suppressKeyPress=false;if(!this.isMultiLine||this.menu.element.is(":visible")){event.preventDefault();}
return;}
if(suppressKeyPressRepeat){return;}
var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:this._move("previousPage",event);break;case keyCode.PAGE_DOWN:this._move("nextPage",event);break;case keyCode.UP:this._keyEvent("previous",event);break;case keyCode.DOWN:this._keyEvent("next",event);break;}},input:function(event){if(suppressInput){suppressInput=false;event.preventDefault();return;}
this._searchTimeout(event);},focus:function(){this.selectedItem=null;this.previous=this._value();},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return;}
clearTimeout(this.searching);this.close(event);this._change(event);}});this._initSource();this.menu=$("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu");this._on(this.menu.element,{mousedown:function(event){event.preventDefault();this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;});var menuElement=this.menu.element[0];if(!$(event.target).closest(".ui-menu-item").length){this._delay(function(){var that=this;this.document.one("mousedown",function(event){if(event.target!==that.element[0]&&event.target!==menuElement&&!$.contains(menuElement,event.target)){that.close();}});});}},menufocus:function(event,ui){if(this.isNewMenu){this.isNewMenu=false;if(event.originalEvent&&/^mouse/.test(event.originalEvent.type)){this.menu.blur();this.document.one("mousemove",function(){$(event.target).trigger(event.originalEvent);});return;}}
var item=ui.item.data("ui-autocomplete-item");if(false!==this._trigger("focus",event,{item:item})){if(event.originalEvent&&/^key/.test(event.originalEvent.type)){this._value(item.value);}}else{this.liveRegion.text(item.value);}},menuselect:function(event,ui){var item=ui.item.data("ui-autocomplete-item"),previous=this.previous;if(this.element[0]!==this.document[0].activeElement){this.element.focus();this.previous=previous;this._delay(function(){this.previous=previous;this.selectedItem=item;});}
if(false!==this._trigger("select",event,{item:item})){this._value(item.value);}
this.term=this._value();this.close(event);this.selectedItem=item;}});this.liveRegion=$("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element);this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete");}});},_destroy:function(){clearTimeout(this.searching);this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete");this.menu.element.remove();this.liveRegion.remove();},_setOption:function(key,value){this._super(key,value);if(key==="source"){this._initSource();}
if(key==="appendTo"){this.menu.element.appendTo(this._appendTo());}
if(key==="disabled"&&value&&this.xhr){this.xhr.abort();}},_appendTo:function(){var element=this.options.appendTo;if(element){element=element.jquery||element.nodeType?$(element):this.document.find(element).eq(0);}
if(!element){element=this.element.closest(".ui-front");}
if(!element.length){element=this.document[0].body;}
return element;},_initSource:function(){var array,url,that=this;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term));};}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){if(that.xhr){that.xhr.abort();}
that.xhr=$.ajax({url:url,data:request,dataType:"json",success:function(data){response(data);},error:function(){response([]);}});};}else{this.source=this.options.source;}},_searchTimeout:function(event){clearTimeout(this.searching);this.searching=this._delay(function(){if(this.term!==this._value()){this.selectedItem=null;this.search(null,event);}},this.options.delay);},search:function(value,event){value=value!=null?value:this._value();this.term=this._value();if(value.length<this.options.minLength){return this.close(event);}
if(this._trigger("search",event)===false){return;}
return this._search(value);},_search:function(value){this.pending++;this.element.addClass("ui-autocomplete-loading");this.cancelSearch=false;this.source({term:value},this._response());},_response:function(){var index=++this.requestIndex;return $.proxy(function(content){if(index===this.requestIndex){this.__response(content);}
this.pending--;if(!this.pending){this.element.removeClass("ui-autocomplete-loading");}},this);},__response:function(content){if(content){content=this._normalize(content);}
this._trigger("response",null,{content:content});if(!this.options.disabled&&content&&content.length&&!this.cancelSearch){this._suggest(content);this._trigger("open");}else{this._close();}},close:function(event){this.cancelSearch=true;this._close(event);},_close:function(event){if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.blur();this.isNewMenu=true;this._trigger("close",event);}},_change:function(event){if(this.previous!==this._value()){this._trigger("change",event,{item:this.selectedItem});}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items;}
return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item};}
return $.extend({label:item.label||item.value,value:item.value||item.label},item);});},_suggest:function(items){var ul=this.menu.element.empty();this._renderMenu(ul,items);this.isNewMenu=true;this.menu.refresh();ul.show();this._resizeMenu();ul.position($.extend({of:this.element},this.options.position));if(this.options.autoFocus){this.menu.next();}},_resizeMenu:function(){var ul=this.menu.element;ul.outerWidth(Math.max(ul.width("").outerWidth()+1,this.element.outerWidth()));},_renderMenu:function(ul,items){var that=this;$.each(items,function(index,item){that._renderItemData(ul,item);});},_renderItemData:function(ul,item){return this._renderItem(ul,item).data("ui-autocomplete-item",item);},_renderItem:function(ul,item){return $("<li>").append($("<a>").text(item.label)).appendTo(ul);},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return;}
if(this.menu.isFirstItem()&&/^previous/.test(direction)||this.menu.isLastItem()&&/^next/.test(direction)){this._value(this.term);this.menu.blur();return;}
this.menu[direction](event);},widget:function(){return this.menu.element;},_value:function(){return this.valueMethod.apply(this.element,arguments);},_keyEvent:function(keyEvent,event){if(!this.isMultiLine||this.menu.element.is(":visible")){this._move(keyEvent,event);event.preventDefault();}}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value);});}});$.widget("ui.autocomplete",$.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(amount){return amount+(amount>1?" results are":" result is")+" available, use up and down arrow keys to navigate.";}}},__response:function(content){var message;this._superApply(arguments);if(this.options.disabled||this.cancelSearch){return;}
if(content&&content.length){message=this.options.messages.results(content.length);}else{message=this.options.messages.noResults;}
this.liveRegion.text(message);}});}(jQuery));(function($,undefined){var lastActive,baseClasses="ui-button ui-widget ui-state-default ui-corner-all",typeClasses="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",formResetHandler=function(){var form=$(this);setTimeout(function(){form.find(":ui-button").button("refresh");},1);},radioGroup=function(radio){var name=radio.name,form=radio.form,radios=$([]);if(name){name=name.replace(/'/g,"\\'");if(form){radios=$(form).find("[name='"+name+"']");}else{radios=$("[name='"+name+"']",radio.ownerDocument).filter(function(){return!this.form;});}}
return radios;};$.widget("ui.button",{version:"1.10.4",defaultElement:"<button>",options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,formResetHandler);if(typeof this.options.disabled!=="boolean"){this.options.disabled=!!this.element.prop("disabled");}else{this.element.prop("disabled",this.options.disabled);}
this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var that=this,options=this.options,toggleButton=this.type==="checkbox"||this.type==="radio",activeClass=!toggleButton?"ui-state-active":"";if(options.label===null){options.label=(this.type==="input"?this.buttonElement.val():this.buttonElement.html());}
this._hoverable(this.buttonElement);this.buttonElement.addClass(baseClasses).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(options.disabled){return;}
if(this===lastActive){$(this).addClass("ui-state-active");}}).bind("mouseleave"+this.eventNamespace,function(){if(options.disabled){return;}
$(this).removeClass(activeClass);}).bind("click"+this.eventNamespace,function(event){if(options.disabled){event.preventDefault();event.stopImmediatePropagation();}});this._on({focus:function(){this.buttonElement.addClass("ui-state-focus");},blur:function(){this.buttonElement.removeClass("ui-state-focus");}});if(toggleButton){this.element.bind("change"+this.eventNamespace,function(){that.refresh();});}
if(this.type==="checkbox"){this.buttonElement.bind("click"+this.eventNamespace,function(){if(options.disabled){return false;}});}else if(this.type==="radio"){this.buttonElement.bind("click"+this.eventNamespace,function(){if(options.disabled){return false;}
$(this).addClass("ui-state-active");that.buttonElement.attr("aria-pressed","true");var radio=that.element[0];radioGroup(radio).not(radio).map(function(){return $(this).button("widget")[0];}).removeClass("ui-state-active").attr("aria-pressed","false");});}else{this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(options.disabled){return false;}
$(this).addClass("ui-state-active");lastActive=this;that.document.one("mouseup",function(){lastActive=null;});}).bind("mouseup"+this.eventNamespace,function(){if(options.disabled){return false;}
$(this).removeClass("ui-state-active");}).bind("keydown"+this.eventNamespace,function(event){if(options.disabled){return false;}
if(event.keyCode===$.ui.keyCode.SPACE||event.keyCode===$.ui.keyCode.ENTER){$(this).addClass("ui-state-active");}}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){$(this).removeClass("ui-state-active");});if(this.buttonElement.is("a")){this.buttonElement.keyup(function(event){if(event.keyCode===$.ui.keyCode.SPACE){$(this).click();}});}}
this._setOption("disabled",options.disabled);this._resetButton();},_determineButtonType:function(){var ancestor,labelSelector,checked;if(this.element.is("[type=checkbox]")){this.type="checkbox";}else if(this.element.is("[type=radio]")){this.type="radio";}else if(this.element.is("input")){this.type="input";}else{this.type="button";}
if(this.type==="checkbox"||this.type==="radio"){ancestor=this.element.parents().last();labelSelector="label[for='"+this.element.attr("id")+"']";this.buttonElement=ancestor.find(labelSelector);if(!this.buttonElement.length){ancestor=ancestor.length?ancestor.siblings():this.element.siblings();this.buttonElement=ancestor.filter(labelSelector);if(!this.buttonElement.length){this.buttonElement=ancestor.find(labelSelector);}}
this.element.addClass("ui-helper-hidden-accessible");checked=this.element.is(":checked");if(checked){this.buttonElement.addClass("ui-state-active");}
this.buttonElement.prop("aria-pressed",checked);}else{this.buttonElement=this.element;}},widget:function(){return this.buttonElement;},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass(baseClasses+" ui-state-active "+typeClasses).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());if(!this.hasTitle){this.buttonElement.removeAttr("title");}},_setOption:function(key,value){this._super(key,value);if(key==="disabled"){this.element.prop("disabled",!!value);if(value){this.buttonElement.removeClass("ui-state-focus");}
return;}
this._resetButton();},refresh:function(){var isDisabled=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");if(isDisabled!==this.options.disabled){this._setOption("disabled",isDisabled);}
if(this.type==="radio"){radioGroup(this.element[0]).each(function(){if($(this).is(":checked")){$(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true");}else{$(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false");}});}else if(this.type==="checkbox"){if(this.element.is(":checked")){this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true");}else{this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false");}}},_resetButton:function(){if(this.type==="input"){if(this.options.label){this.element.val(this.options.label);}
return;}
var buttonElement=this.buttonElement.removeClass(typeClasses),buttonText=$("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(buttonElement.empty()).text(),icons=this.options.icons,multipleIcons=icons.primary&&icons.secondary,buttonClasses=[];if(icons.primary||icons.secondary){if(this.options.text){buttonClasses.push("ui-button-text-icon"+(multipleIcons?"s":(icons.primary?"-primary":"-secondary")));}
if(icons.primary){buttonElement.prepend("<span class='ui-button-icon-primary ui-icon "+icons.primary+"'></span>");}
if(icons.secondary){buttonElement.append("<span class='ui-button-icon-secondary ui-icon "+icons.secondary+"'></span>");}
if(!this.options.text){buttonClasses.push(multipleIcons?"ui-button-icons-only":"ui-button-icon-only");if(!this.hasTitle){buttonElement.attr("title",$.trim(buttonText));}}}else{buttonClasses.push("ui-button-text-only");}
buttonElement.addClass(buttonClasses.join(" "));}});$.widget("ui.buttonset",{version:"1.10.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset");},_init:function(){this.refresh();},_setOption:function(key,value){if(key==="disabled"){this.buttons.button("option",key,value);}
this._super(key,value);},refresh:function(){var rtl=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return $(this).button("widget")[0];}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(rtl?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(rtl?"ui-corner-left":"ui-corner-right").end().end();},_destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return $(this).button("widget")[0];}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");}});}(jQuery));(function($,undefined){$.extend($.ui,{datepicker:{version:"1.10.4"}});var PROP_NAME="datepicker",instActive;function Datepicker(){this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=bindHover($("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));}
$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv;},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_attachDatepicker:function(target,settings){var nodeName,inline,inst;nodeName=target.nodeName.toLowerCase();inline=(nodeName==="div"||nodeName==="span");if(!target.id){this.uuid+=1;target.id="dp"+this.uuid;}
inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{});if(nodeName==="input"){this._connectDatepicker(target,inst);}else if(inline){this._inlineDatepicker(target,inst);}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:bindHover($("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return;}
this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp);this._autoSize(inst);$.data(target,PROP_NAME,inst);if(inst.settings.disabled){this._disableDatepicker(target);}},_attachments:function(input,inst){var showOn,buttonText,buttonImage,appendText=this._get(inst,"appendText"),isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove();}
if(appendText){inst.append=$("<span class='"+this._appendClass+"'>"+appendText+"</span>");input[isRTL?"before":"after"](inst.append);}
input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove();}
showOn=this._get(inst,"showOn");if(showOn==="focus"||showOn==="both"){input.focus(this._showDatepicker);}
if(showOn==="button"||showOn==="both"){buttonText=this._get(inst,"buttonText");buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput===input[0]){$.datepicker._hideDatepicker();}else if($.datepicker._datepickerShowing&&$.datepicker._lastInput!==input[0]){$.datepicker._hideDatepicker();$.datepicker._showDatepicker(input[0]);}else{$.datepicker._showDatepicker(input[0]);}
return false;});}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var findMax,max,maxI,i,date=new Date(2009,12-1,20),dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){findMax=function(names){max=0;maxI=0;for(i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i;}}
return maxI;};date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay());}
inst.input.attr("size",this._formatDate(inst,date).length);}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return;}
divSpan.addClass(this.markerClassName).append(inst.dpDiv);$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);if(inst.settings.disabled){this._disableDatepicker(target);}
inst.dpDiv.css("display","block");},_dialogDatepicker:function(input,date,onSelect,settings,pos){var id,browserWidth,browserHeight,scrollX,scrollY,inst=this._dialogInst;if(!inst){this.uuid+=1;id="dp"+this.uuid;this._dialogInput=$("<input type='text' id='"+id+"' style='position: absolute; top: -100px; width: 0px;'/>");this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst);}
extendRemove(inst.settings,settings||{});date=(date&&date.constructor===Date?this._formatDate(inst,date):date);this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){browserWidth=document.documentElement.clientWidth;browserHeight=document.documentElement.clientHeight;scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY];}
this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv);}
$.data(this._dialogInput[0],PROP_NAME,inst);return this;},_destroyDatepicker:function(target){var nodeName,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName==="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp);}else if(nodeName==="div"||nodeName==="span"){$target.removeClass(this.markerClassName).empty();}},_enableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false;}).end().filter("img").css({opacity:"1.0",cursor:""});}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",false);}
this._disabledInputs=$.map(this._disabledInputs,function(value){return(value===target?null:value);});},_disableDatepicker:function(target){var nodeName,inline,$target=$(target),inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return;}
nodeName=target.nodeName.toLowerCase();if(nodeName==="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true;}).end().filter("img").css({opacity:"0.5",cursor:"default"});}else if(nodeName==="div"||nodeName==="span"){inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",true);}
this._disabledInputs=$.map(this._disabledInputs,function(value){return(value===target?null:value);});this._disabledInputs[this._disabledInputs.length]=target;},_isDisabledDatepicker:function(target){if(!target){return false;}
for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]===target){return true;}}
return false;},_getInst:function(target){try{return $.data(target,PROP_NAME);}
catch(err){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(target,name,value){var settings,date,minDate,maxDate,inst=this._getInst(target);if(arguments.length===2&&typeof name==="string"){return(name==="defaults"?$.extend({},$.datepicker._defaults):(inst?(name==="all"?$.extend({},inst.settings):this._get(inst,name)):null));}
settings=name||{};if(typeof name==="string"){settings={};settings[name]=value;}
if(inst){if(this._curInst===inst){this._hideDatepicker();}
date=this._getDateDatepicker(target,true);minDate=this._getMinMaxDate(inst,"min");maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate);}
if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate);}
if("disabled"in settings){if(settings.disabled){this._disableDatepicker(target);}else{this._enableDatepicker(target);}}
this._attachments($(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst);}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value);},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst);}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst);}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault);}
return(inst?this._getDate(inst):null);},_doKeyDown:function(event){var onSelect,dateStr,sel,inst=$.datepicker._getInst(event.target),handled=true,isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker();handled=false;break;case 13:sel=$("td."+$.datepicker._dayOverClass+":not(."+
$.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0]);}
onSelect=$.datepicker._get(inst,"onSelect");if(onSelect){dateStr=$.datepicker._formatDate(inst);onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);}else{$.datepicker._hideDatepicker();}
return false;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target);}
handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target);}
handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D");}
handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");}
break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D");}
handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D");}
handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");}
break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D");}
handled=event.ctrlKey||event.metaKey;break;default:handled=false;}}else if(event.keyCode===36&&event.ctrlKey){$.datepicker._showDatepicker(this);}else{handled=false;}
if(handled){event.preventDefault();event.stopPropagation();}},_doKeyPress:function(event){var chars,chr,inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));chr=String.fromCharCode(event.charCode==null?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1);}},_doKeyUp:function(event){var date,inst=$.datepicker._getInst(event.target);if(inst.input.val()!==inst.lastVal){try{date=$.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),$.datepicker._getFormatConfig(inst));if(date){$.datepicker._setDateFromField(inst);$.datepicker._updateAlternate(inst);$.datepicker._updateDatepicker(inst);}}
catch(err){}}
return true;},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!=="input"){input=$("input",input.parentNode)[0];}
if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput===input){return;}
var inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration;inst=$.datepicker._getInst(input);if($.datepicker._curInst&&$.datepicker._curInst!==inst){$.datepicker._curInst.dpDiv.stop(true,true);if(inst&&$.datepicker._datepickerShowing){$.datepicker._hideDatepicker($.datepicker._curInst.input[0]);}}
beforeShow=$.datepicker._get(inst,"beforeShow");beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{};if(beforeShowSettings===false){return;}
extendRemove(inst.settings,beforeShowSettings);inst.lastVal=null;$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value="";}
if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight;}
isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")==="fixed";return!isFixed;});offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){showAnim=$.datepicker._get(inst,"showAnim");duration=$.datepicker._get(inst,"duration");inst.dpDiv.zIndex($(input).zIndex()+1);$.datepicker._datepickerShowing=true;if($.effects&&$.effects.effect[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration);}else{inst.dpDiv[showAnim||"show"](showAnim?duration:null);}
if($.datepicker._shouldFocusInput(inst)){inst.input.focus();}
$.datepicker._curInst=inst;}},_updateDatepicker:function(inst){this.maxRows=4;instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));this._attachHandlers(inst);inst.dpDiv.find("."+this._dayOverClass+" a").mouseover();var origyearshtml,numMonths=this._getNumberOfMonths(inst),cols=numMonths[1],width=17;inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em");}
inst.dpDiv[(numMonths[0]!==1||numMonths[1]!==1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst===$.datepicker._curInst&&$.datepicker._datepickerShowing&&$.datepicker._shouldFocusInput(inst)){inst.input.focus();}
if(inst.yearshtml){origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);}
origyearshtml=inst.yearshtml=null;},0);}},_shouldFocusInput:function(inst){return inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&!inst.input.is(":focus");},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth(),dpHeight=inst.dpDiv.outerHeight(),inputWidth=inst.input?inst.input.outerWidth():0,inputHeight=inst.input?inst.input.outerHeight():0,viewWidth=document.documentElement.clientWidth+(isFixed?0:$(document).scrollLeft()),viewHeight=document.documentElement.clientHeight+(isFixed?0:$(document).scrollTop());offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left===inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top===(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset;},_findPos:function(obj){var position,inst=this._getInst(obj),isRTL=this._get(inst,"isRTL");while(obj&&(obj.type==="hidden"||obj.nodeType!==1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"];}
position=$(obj).offset();return[position.left,position.top];},_hideDatepicker:function(input){var showAnim,duration,postProcess,onClose,inst=this._curInst;if(!inst||(input&&inst!==$.data(input,PROP_NAME))){return;}
if(this._datepickerShowing){showAnim=this._get(inst,"showAnim");duration=this._get(inst,"duration");postProcess=function(){$.datepicker._tidyDialog(inst);};if($.effects&&($.effects.effect[showAnim]||$.effects[showAnim])){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess);}else{inst.dpDiv[(showAnim==="slideDown"?"slideUp":(showAnim==="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess);}
if(!showAnim){postProcess();}
this._datepickerShowing=false;onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst]);}
this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv);}}
this._inDialog=false;}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");},_checkExternalClick:function(event){if(!$.datepicker._curInst){return;}
var $target=$(event.target),inst=$.datepicker._getInst($target[0]);if((($target[0].id!==$.datepicker._mainDivId&&$target.parents("#"+$.datepicker._mainDivId).length===0&&!$target.hasClass($.datepicker.markerClassName)&&!$target.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)))||($target.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!==inst)){$.datepicker._hideDatepicker();}},_adjustDate:function(id,offset,period){var target=$(id),inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return;}
this._adjustInstDate(inst,offset+
(period==="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst);},_gotoToday:function(id){var date,target=$(id),inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear;}else{date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();}
this._notifyChange(inst);this._adjustDate(target);},_selectMonthYear:function(id,select,period){var target=$(id),inst=this._getInst(target[0]);inst["selected"+(period==="M"?"Month":"Year")]=inst["draw"+(period==="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target);},_selectDay:function(id,month,year,td){var inst,target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return;}
inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));},_clearDate:function(id){var target=$(id);this._selectDate(target,"");},_selectDate:function(id,dateStr){var onSelect,target=$(id),inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr);}
this._updateAlternate(inst);onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst]);}else if(inst.input){inst.input.trigger("change");}
if(inst.inline){this._updateDatepicker(inst);}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof(inst.input[0])!=="object"){inst.input.focus();}
this._lastInput=null;}},_updateAlternate:function(inst){var altFormat,date,dateStr,altField=this._get(inst,"altField");if(altField){altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr);});}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""];},iso8601Week:function(date){var time,checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1;},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments";}
value=(typeof value==="object"?value.toString():value+"");if(value===""){return null;}
var iFormat,dim,extra,iValue=0,shortYearCutoffTemp=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff,shortYearCutoff=(typeof shortYearCutoffTemp!=="string"?shortYearCutoffTemp:new Date().getFullYear()%100+parseInt(shortYearCutoffTemp,10)),dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,year=-1,month=-1,day=-1,doy=-1,literal=false,date,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;},getNumber=function(match){var isDoubled=lookAhead(match),size=(match==="@"?14:(match==="!"?20:(match==="y"&&isDoubled?4:(match==="o"?3:2)))),digits=new RegExp("^\\d{1,"+size+"}"),num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue;}
iValue+=num[0].length;return parseInt(num[0],10);},getName=function(match,shortNames,longNames){var index=-1,names=$.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]];}).sort(function(a,b){return-(a[1].length-b[1].length);});$.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()===name.toLowerCase()){index=pair[0];iValue+=name.length;return false;}});if(index!==-1){return index+1;}else{throw"Unknown name at position "+iValue;}},checkLiteral=function(){if(value.charAt(iValue)!==format.charAt(iFormat)){throw"Unexpected literal at position "+iValue;}
iValue++;};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{checkLiteral();}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral();}else{literal=true;}
break;default:checkLiteral();}}}
if(iValue<value.length){extra=value.substr(iValue);if(!/^\s+/.test(extra)){throw"Extra/unparsed characters found in date: "+extra;}}
if(year===-1){year=new Date().getFullYear();}else if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+
(year<=shortYearCutoff?0:-100);}
if(doy>-1){month=1;day=doy;do{dim=this._getDaysInMonth(year,month-1);if(day<=dim){break;}
month++;day-=dim;}while(true);}
date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!==year||date.getMonth()+1!==month||date.getDate()!==day){throw"Invalid date";}
return date;},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+
Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return"";}
var iFormat,dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort,dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames,monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort,monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;},formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num;}}
return num;},formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value]);},output="",literal=false;if(date){for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{output+=format.charAt(iFormat);}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new Date(date.getFullYear(),0,0).getTime())/86400000),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'";}else{literal=true;}
break;default:output+=format.charAt(iFormat);}}}}
return output;},_possibleChars:function(format){var iFormat,chars="",literal=false,lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)===match);if(matches){iFormat++;}
return matches;};for(iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)==="'"&&!lookAhead("'")){literal=false;}else{chars+=format.charAt(iFormat);}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'";}else{literal=true;}
break;default:chars+=format.charAt(iFormat);}}}
return chars;},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name];},_setDateFromField:function(inst,noDefault){if(inst.input.val()===inst.lastVal){return;}
var dateFormat=this._get(inst,"dateFormat"),dates=inst.lastVal=inst.input?inst.input.val():null,defaultDate=this._getDefaultDate(inst),date=defaultDate,settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate;}catch(event){dates=(noDefault?"":dates);}
inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst);},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date()));},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;},offsetString=function(offset){try{return $.datepicker.parseDate($.datepicker._get(inst,"dateFormat"),offset,$.datepicker._getFormatConfig(inst));}
catch(e){}
var date=(offset.toLowerCase().match(/^c/)?$.datepicker._getDate(inst):null)||new Date(),year=date.getFullYear(),month=date.getMonth(),day=date.getDate(),pattern=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,$.datepicker._getDaysInMonth(year,month));break;}
matches=pattern.exec(offset);}
return new Date(year,month,day);},newDate=(date==null||date===""?defaultDate:(typeof date==="string"?offsetString(date):(typeof date==="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):new Date(date.getTime()))));newDate=(newDate&&newDate.toString()==="Invalid Date"?defaultDate:newDate);if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0);}
return this._daylightSavingAdjust(newDate);},_daylightSavingAdjust:function(date){if(!date){return null;}
date.setHours(date.getHours()>12?date.getHours()+2:0);return date;},_setDate:function(inst,date,noChange){var clear=!date,origMonth=inst.selectedMonth,origYear=inst.selectedYear,newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!==inst.selectedMonth||origYear!==inst.selectedYear)&&!noChange){this._notifyChange(inst);}
this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst));}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()==="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate;},_attachHandlers:function(inst){var stepMonths=this._get(inst,"stepMonths"),id="#"+inst.id.replace(/\\\\/g,"\\");inst.dpDiv.find("[data-handler]").map(function(){var handler={prev:function(){$.datepicker._adjustDate(id,-stepMonths,"M");},next:function(){$.datepicker._adjustDate(id,+stepMonths,"M");},hide:function(){$.datepicker._hideDatepicker();},today:function(){$.datepicker._gotoToday(id);},selectDay:function(){$.datepicker._selectDay(id,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this);return false;},selectMonth:function(){$.datepicker._selectMonthYear(id,this,"M");return false;},selectYear:function(){$.datepicker._selectMonthYear(id,this,"Y");return false;}};$(this).bind(this.getAttribute("data-event"),handler[this.getAttribute("data-handler")]);});},_generateHTML:function(inst){var maxDraw,prevText,prev,nextText,next,currentText,gotoDate,controls,buttonPanel,firstDay,showWeek,dayNames,dayNamesMin,monthNames,monthNamesShort,beforeShowDay,showOtherMonths,selectOtherMonths,defaultDate,html,dow,row,group,col,selectedDate,cornerClass,calender,thead,day,daysInMonth,leadDays,curRows,numRows,printDate,dRow,tbody,daySettings,otherMonth,unselectable,tempDate=new Date(),today=this._daylightSavingAdjust(new Date(tempDate.getFullYear(),tempDate.getMonth(),tempDate.getDate())),isRTL=this._get(inst,"isRTL"),showButtonPanel=this._get(inst,"showButtonPanel"),hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext"),navigationAsDateFormat=this._get(inst,"navigationAsDateFormat"),numMonths=this._getNumberOfMonths(inst),showCurrentAtPos=this._get(inst,"showCurrentAtPos"),stepMonths=this._get(inst,"stepMonths"),isMultiMonth=(numMonths[0]!==1||numMonths[1]!==1),currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay))),minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),drawMonth=inst.drawMonth-showCurrentAtPos,drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--;}
if(maxDate){maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--;}}}
inst.drawMonth=drawMonth;inst.drawYear=drawYear;prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'"+" title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>":(hideIfNoPrevNext?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+prevText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"e":"w")+"'>"+prevText+"</span></a>"));nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'"+" title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>":(hideIfNoPrevNext?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+nextText+"'><span class='ui-icon ui-icon-circle-triangle-"+(isRTL?"w":"e")+"'>"+nextText+"</span></a>"));currentText=this._get(inst,"currentText");gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));controls=(!inst.inline?"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+
this._get(inst,"closeText")+"</button>":"");buttonPanel=(showButtonPanel)?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(isRTL?controls:"")+
(this._isInRange(inst,gotoDate)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'"+">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);showWeek=this._get(inst,"showWeek");dayNames=this._get(inst,"dayNames");dayNamesMin=this._get(inst,"dayNamesMin");monthNames=this._get(inst,"monthNames");monthNamesShort=this._get(inst,"monthNamesShort");beforeShowDay=this._get(inst,"beforeShowDay");showOtherMonths=this._get(inst,"showOtherMonths");selectOtherMonths=this._get(inst,"selectOtherMonths");defaultDate=this._getDefaultDate(inst);html="";dow;for(row=0;row<numMonths[0];row++){group="";this.maxRows=4;for(col=0;col<numMonths[1];col++){selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));cornerClass=" ui-corner-all";calender="";if(isMultiMonth){calender+="<div class='ui-datepicker-group";if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break;}}
calender+="'>";}
calender+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+cornerClass+"'>"+
(/all|left/.test(cornerClass)&&row===0?(isRTL?next:prev):"")+
(/all|right/.test(cornerClass)&&row===0?(isRTL?prev:next):"")+
this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>";thead=(showWeek?"<th class='ui-datepicker-week-col'>"+this._get(inst,"weekHeader")+"</th>":"");for(dow=0;dow<7;dow++){day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+dayNames[day]+"'>"+dayNamesMin[day]+"</span></th>";}
calender+=thead+"</tr></thead><tbody>";daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear===inst.selectedYear&&drawMonth===inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth);}
leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;curRows=Math.ceil((leadDays+daysInMonth)/7);numRows=(isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows);this.maxRows=numRows;printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(dRow=0;dRow<numRows;dRow++){calender+="<tr>";tbody=(!showWeek?"":"<td class='ui-datepicker-week-col'>"+
this._get(inst,"calculateWeek")(printDate)+"</td>");for(dow=0;dow<7;dow++){daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);otherMonth=(printDate.getMonth()!==drawMonth);unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+="<td class='"+
((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+
(otherMonth?" ui-datepicker-other-month":"")+
((printDate.getTime()===selectedDate.getTime()&&drawMonth===inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()===printDate.getTime()&&defaultDate.getTime()===selectedDate.getTime())?" "+this._dayOverClass:"")+
(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+
(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+
(printDate.getTime()===currentDate.getTime()?" "+this._currentClass:"")+
(printDate.getTime()===today.getTime()?" ui-datepicker-today":""))+"'"+
((!otherMonth||showOtherMonths)&&daySettings[2]?" title='"+daySettings[2].replace(/'/g,"&#39;")+"'":"")+
(unselectable?"":" data-handler='selectDay' data-event='click' data-month='"+printDate.getMonth()+"' data-year='"+printDate.getFullYear()+"'")+">"+
(otherMonth&&!showOtherMonths?"&#xa0;":(unselectable?"<span class='ui-state-default'>"+printDate.getDate()+"</span>":"<a class='ui-state-default"+
(printDate.getTime()===today.getTime()?" ui-state-highlight":"")+
(printDate.getTime()===currentDate.getTime()?" ui-state-active":"")+
(otherMonth?" ui-priority-secondary":"")+"' href='#'>"+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate);}
calender+=tbody+"</tr>";}
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}
calender+="</tbody></table>"+(isMultiMonth?"</div>"+
((numMonths[0]>0&&col===numMonths[1]-1)?"<div class='ui-datepicker-row-break'></div>":""):"");group+=calender;}
html+=group;}
html+=buttonPanel;inst._keyEvent=false;return html;},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var inMinYear,inMaxYear,month,years,thisYear,determineYear,year,endYear,changeMonth=this._get(inst,"changeMonth"),changeYear=this._get(inst,"changeYear"),showMonthAfterYear=this._get(inst,"showMonthAfterYear"),html="<div class='ui-datepicker-title'>",monthHtml="";if(secondary||!changeMonth){monthHtml+="<span class='ui-datepicker-month'>"+monthNames[drawMonth]+"</span>";}else{inMinYear=(minDate&&minDate.getFullYear()===drawYear);inMaxYear=(maxDate&&maxDate.getFullYear()===drawYear);monthHtml+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for(month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+="<option value='"+month+"'"+
(month===drawMonth?" selected='selected'":"")+">"+monthNamesShort[month]+"</option>";}}
monthHtml+="</select>";}
if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"");}
if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+="<span class='ui-datepicker-year'>"+drawYear+"</span>";}else{years=this._get(inst,"yearRange").split(":");thisYear=new Date().getFullYear();determineYear=function(value){var year=(value.match(/c[+\-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+\-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year);};year=determineYear(years[0]);endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for(;year<=endYear;year++){inst.yearshtml+="<option value='"+year+"'"+
(year===drawYear?" selected='selected'":"")+">"+year+"</option>";}
inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null;}}
html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml;}
html+="</div>";return html;},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period==="Y"?offset:0),month=inst.drawMonth+(period==="M"?offset:0),day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period==="D"?offset:0),date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period==="M"||period==="Y"){this._notifyChange(inst);}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),newDate=(minDate&&date<minDate?minDate:date);return(maxDate&&newDate>maxDate?maxDate:newDate);},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst]);}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths==="number"?[1,numMonths]:numMonths));},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null);},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst),date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));}
return this._isInRange(inst,date);},_isInRange:function(inst,date){var yearSplit,currentYear,minDate=this._getMinMaxDate(inst,"min"),maxDate=this._getMinMaxDate(inst,"max"),minYear=null,maxYear=null,years=this._get(inst,"yearRange");if(years){yearSplit=years.split(":");currentYear=new Date().getFullYear();minYear=parseInt(yearSplit[0],10);maxYear=parseInt(yearSplit[1],10);if(yearSplit[0].match(/[+\-].*/)){minYear+=currentYear;}
if(yearSplit[1].match(/[+\-].*/)){maxYear+=currentYear;}}
return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime())&&(!minYear||date.getFullYear()>=minYear)&&(!maxYear||date.getFullYear()<=maxYear));},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!=="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")};},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear;}
var date=(day?(typeof day==="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst));}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.delegate(selector,"mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).removeClass("ui-datepicker-prev-hover");}
if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).removeClass("ui-datepicker-next-hover");}}).delegate(selector,"mouseover",function(){if(!$.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!==-1){$(this).addClass("ui-datepicker-prev-hover");}
if(this.className.indexOf("ui-datepicker-next")!==-1){$(this).addClass("ui-datepicker-next-hover");}}});}
function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null){target[name]=props[name];}}
return target;}
$.fn.datepicker=function(options){if(!this.length){return this;}
if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick);$.datepicker.initialized=true;}
if($("#"+$.datepicker._mainDivId).length===0){$("body").append($.datepicker.dpDiv);}
var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options==="string"&&(options==="isDisabled"||options==="getDate"||options==="widget")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));}
if(options==="option"&&arguments.length===2&&typeof arguments[1]==="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs));}
return this.each(function(){typeof options==="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options);});};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.10.4";})(jQuery);(function($,undefined){var sizeRelatedOptions={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},resizableRelatedOptions={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};$.widget("ui.dialog",{version:"1.10.4",options:{appendTo:"body",autoOpen:true,buttons:[],closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css("top",pos.top-topOffset);}}},resizable:true,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height};this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;this._createWrapper();this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog);this._createTitlebar();this._createButtonPane();if(this.options.draggable&&$.fn.draggable){this._makeDraggable();}
if(this.options.resizable&&$.fn.resizable){this._makeResizable();}
this._isOpen=false;},_init:function(){if(this.options.autoOpen){this.open();}},_appendTo:function(){var element=this.options.appendTo;if(element&&(element.jquery||element.nodeType)){return $(element);}
return this.document.find(element||"body").eq(0);},_destroy:function(){var next,originalPosition=this.originalPosition;this._destroyOverlay();this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach();this.uiDialog.stop(true,true).remove();if(this.originalTitle){this.element.attr("title",this.originalTitle);}
next=originalPosition.parent.children().eq(originalPosition.index);if(next.length&&next[0]!==this.element[0]){next.before(this.element);}else{originalPosition.parent.append(this.element);}},widget:function(){return this.uiDialog;},disable:$.noop,enable:$.noop,close:function(event){var activeElement,that=this;if(!this._isOpen||this._trigger("beforeClose",event)===false){return;}
this._isOpen=false;this._destroyOverlay();if(!this.opener.filter(":focusable").focus().length){try{activeElement=this.document[0].activeElement;if(activeElement&&activeElement.nodeName.toLowerCase()!=="body"){$(activeElement).blur();}}catch(error){}}
this._hide(this.uiDialog,this.options.hide,function(){that._trigger("close",event);});},isOpen:function(){return this._isOpen;},moveToTop:function(){this._moveToTop();},_moveToTop:function(event,silent){var moved=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;if(moved&&!silent){this._trigger("focus",event);}
return moved;},open:function(){var that=this;if(this._isOpen){if(this._moveToTop()){this._focusTabbable();}
return;}
this._isOpen=true;this.opener=$(this.document[0].activeElement);this._size();this._position();this._createOverlay();this._moveToTop(null,true);this._show(this.uiDialog,this.options.show,function(){that._focusTabbable();that._trigger("focus");});this._trigger("open");},_focusTabbable:function(){var hasFocus=this.element.find("[autofocus]");if(!hasFocus.length){hasFocus=this.element.find(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialogButtonPane.find(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialogTitlebarClose.filter(":tabbable");}
if(!hasFocus.length){hasFocus=this.uiDialog;}
hasFocus.eq(0).focus();},_keepFocus:function(event){function checkFocus(){var activeElement=this.document[0].activeElement,isActive=this.uiDialog[0]===activeElement||$.contains(this.uiDialog[0],activeElement);if(!isActive){this._focusTabbable();}}
event.preventDefault();checkFocus.call(this);this._delay(checkFocus);},_createWrapper:function(){this.uiDialog=$("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+
this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo());this._on(this.uiDialog,{keydown:function(event){if(this.options.closeOnEscape&&!event.isDefaultPrevented()&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){event.preventDefault();this.close(event);return;}
if(event.keyCode!==$.ui.keyCode.TAB){return;}
var tabbables=this.uiDialog.find(":tabbable"),first=tabbables.filter(":first"),last=tabbables.filter(":last");if((event.target===last[0]||event.target===this.uiDialog[0])&&!event.shiftKey){first.focus(1);event.preventDefault();}else if((event.target===first[0]||event.target===this.uiDialog[0])&&event.shiftKey){last.focus(1);event.preventDefault();}},mousedown:function(event){if(this._moveToTop(event)){this._focusTabbable();}}});if(!this.element.find("[aria-describedby]").length){this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")});}},_createTitlebar:function(){var uiDialogTitle;this.uiDialogTitlebar=$("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog);this._on(this.uiDialogTitlebar,{mousedown:function(event){if(!$(event.target).closest(".ui-dialog-titlebar-close")){this.uiDialog.focus();}}});this.uiDialogTitlebarClose=$("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:false}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar);this._on(this.uiDialogTitlebarClose,{click:function(event){event.preventDefault();this.close(event);}});uiDialogTitle=$("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar);this._title(uiDialogTitle);this.uiDialog.attr({"aria-labelledby":uiDialogTitle.attr("id")});},_title:function(title){if(!this.options.title){title.html("&#160;");}
title.text(this.options.title);},_createButtonPane:function(){this.uiDialogButtonPane=$("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiButtonSet=$("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane);this._createButtons();},_createButtons:function(){var that=this,buttons=this.options.buttons;this.uiDialogButtonPane.remove();this.uiButtonSet.empty();if($.isEmptyObject(buttons)||($.isArray(buttons)&&!buttons.length)){this.uiDialog.removeClass("ui-dialog-buttons");return;}
$.each(buttons,function(name,props){var click,buttonOptions;props=$.isFunction(props)?{click:props,text:name}:props;props=$.extend({type:"button"},props);click=props.click;props.click=function(){click.apply(that.element[0],arguments);};buttonOptions={icons:props.icons,text:props.showText};delete props.icons;delete props.showText;$("<button></button>",props).button(buttonOptions).appendTo(that.uiButtonSet);});this.uiDialog.addClass("ui-dialog-buttons");this.uiDialogButtonPane.appendTo(this.uiDialog);},_makeDraggable:function(){var that=this,options=this.options;function filteredUi(ui){return{position:ui.position,offset:ui.offset};}
this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(event,ui){$(this).addClass("ui-dialog-dragging");that._blockFrames();that._trigger("dragStart",event,filteredUi(ui));},drag:function(event,ui){that._trigger("drag",event,filteredUi(ui));},stop:function(event,ui){options.position=[ui.position.left-that.document.scrollLeft(),ui.position.top-that.document.scrollTop()];$(this).removeClass("ui-dialog-dragging");that._unblockFrames();that._trigger("dragStop",event,filteredUi(ui));}});},_makeResizable:function(){var that=this,options=this.options,handles=options.resizable,position=this.uiDialog.css("position"),resizeHandles=typeof handles==="string"?handles:"n,e,s,w,se,sw,ne,nw";function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size};}
this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:this._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");that._blockFrames();that._trigger("resizeStart",event,filteredUi(ui));},resize:function(event,ui){that._trigger("resize",event,filteredUi(ui));},stop:function(event,ui){options.height=$(this).height();options.width=$(this).width();$(this).removeClass("ui-dialog-resizing");that._unblockFrames();that._trigger("resizeStop",event,filteredUi(ui));}}).css("position",position);},_minHeight:function(){var options=this.options;return options.height==="auto"?options.minHeight:Math.min(options.minHeight,options.height);},_position:function(){var isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show();}
this.uiDialog.position(this.options.position);if(!isVisible){this.uiDialog.hide();}},_setOptions:function(options){var that=this,resize=false,resizableOptions={};$.each(options,function(key,value){that._setOption(key,value);if(key in sizeRelatedOptions){resize=true;}
if(key in resizableRelatedOptions){resizableOptions[key]=value;}});if(resize){this._size();this._position();}
if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option",resizableOptions);}},_setOption:function(key,value){var isDraggable,isResizable,uiDialog=this.uiDialog;if(key==="dialogClass"){uiDialog.removeClass(this.options.dialogClass).addClass(value);}
if(key==="disabled"){return;}
this._super(key,value);if(key==="appendTo"){this.uiDialog.appendTo(this._appendTo());}
if(key==="buttons"){this._createButtons();}
if(key==="closeText"){this.uiDialogTitlebarClose.button({label:""+value});}
if(key==="draggable"){isDraggable=uiDialog.is(":data(ui-draggable)");if(isDraggable&&!value){uiDialog.draggable("destroy");}
if(!isDraggable&&value){this._makeDraggable();}}
if(key==="position"){this._position();}
if(key==="resizable"){isResizable=uiDialog.is(":data(ui-resizable)");if(isResizable&&!value){uiDialog.resizable("destroy");}
if(isResizable&&typeof value==="string"){uiDialog.resizable("option","handles",value);}
if(!isResizable&&value!==false){this._makeResizable();}}
if(key==="title"){this._title(this.uiDialogTitlebar.find(".ui-dialog-title"));}},_size:function(){var nonContentHeight,minContentHeight,maxContentHeight,options=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0});if(options.minWidth>options.width){options.width=options.minWidth;}
nonContentHeight=this.uiDialog.css({height:"auto",width:options.width}).outerHeight();minContentHeight=Math.max(0,options.minHeight-nonContentHeight);maxContentHeight=typeof options.maxHeight==="number"?Math.max(0,options.maxHeight-nonContentHeight):"none";if(options.height==="auto"){this.element.css({minHeight:minContentHeight,maxHeight:maxContentHeight,height:"auto"});}else{this.element.height(Math.max(0,options.height-nonContentHeight));}
if(this.uiDialog.is(":data(ui-resizable)")){this.uiDialog.resizable("option","minHeight",this._minHeight());}},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var iframe=$(this);return $("<div>").css({position:"absolute",width:iframe.outerWidth(),height:iframe.outerHeight()}).appendTo(iframe.parent()).offset(iframe.offset())[0];});},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks;}},_allowInteraction:function(event){if($(event.target).closest(".ui-dialog").length){return true;}
return!!$(event.target).closest(".ui-datepicker").length;},_createOverlay:function(){if(!this.options.modal){return;}
var that=this,widgetFullName=this.widgetFullName;if(!$.ui.dialog.overlayInstances){this._delay(function(){if($.ui.dialog.overlayInstances){this.document.bind("focusin.dialog",function(event){if(!that._allowInteraction(event)){event.preventDefault();$(".ui-dialog:visible:last .ui-dialog-content").data(widgetFullName)._focusTabbable();}});}});}
this.overlay=$("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo());this._on(this.overlay,{mousedown:"_keepFocus"});$.ui.dialog.overlayInstances++;},_destroyOverlay:function(){if(!this.options.modal){return;}
if(this.overlay){$.ui.dialog.overlayInstances--;if(!$.ui.dialog.overlayInstances){this.document.unbind("focusin.dialog");}
this.overlay.remove();this.overlay=null;}}});$.ui.dialog.overlayInstances=0;if($.uiBackCompat!==false){$.widget("ui.dialog",$.ui.dialog,{_position:function(){var position=this.options.position,myAt=[],offset=[0,0],isVisible;if(position){if(typeof position==="string"||(typeof position==="object"&&"0"in position)){myAt=position.split?position.split(" "):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0];}
$.each(["left","top"],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition;}});position={my:myAt[0]+(offset[0]<0?offset[0]:"+"+offset[0])+" "+
myAt[1]+(offset[1]<0?offset[1]:"+"+offset[1]),at:myAt.join(" ")};}
position=$.extend({},$.ui.dialog.prototype.options.position,position);}else{position=$.ui.dialog.prototype.options.position;}
isVisible=this.uiDialog.is(":visible");if(!isVisible){this.uiDialog.show();}
this.uiDialog.position(position);if(!isVisible){this.uiDialog.hide();}}});}}(jQuery));(function($,undefined){$.widget("ui.menu",{version:"1.10.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element;this.mouseHandled=false;this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,$.proxy(function(event){if(this.options.disabled){event.preventDefault();}},this));if(this.options.disabled){this.element.addClass("ui-state-disabled").attr("aria-disabled","true");}
this._on({"mousedown .ui-menu-item > a":function(event){event.preventDefault();},"click .ui-state-disabled > a":function(event){event.preventDefault();},"click .ui-menu-item:has(a)":function(event){var target=$(event.target).closest(".ui-menu-item");if(!this.mouseHandled&&target.not(".ui-state-disabled").length){this.select(event);if(!event.isPropagationStopped()){this.mouseHandled=true;}
if(target.has(".ui-menu").length){this.expand(event);}else if(!this.element.is(":focus")&&$(this.document[0].activeElement).closest(".ui-menu").length){this.element.trigger("focus",[true]);if(this.active&&this.active.parents(".ui-menu").length===1){clearTimeout(this.timer);}}}},"mouseenter .ui-menu-item":function(event){var target=$(event.currentTarget);target.siblings().children(".ui-state-active").removeClass("ui-state-active");this.focus(event,target);},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(event,keepActiveItem){var item=this.active||this.element.children(".ui-menu-item").eq(0);if(!keepActiveItem){this.focus(event,item);}},blur:function(event){this._delay(function(){if(!$.contains(this.element[0],this.document[0].activeElement)){this.collapseAll(event);}});},keydown:"_keydown"});this.refresh();this._on(this.document,{click:function(event){if(!$(event.target).closest(".ui-menu").length){this.collapseAll(event);}
this.mouseHandled=false;}});},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show();this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var elem=$(this);if(elem.data("ui-menu-submenu-carat")){elem.remove();}});this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content");},_keydown:function(event){var match,prev,character,skip,regex,preventDefault=true;function escape(value){return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");}
switch(event.keyCode){case $.ui.keyCode.PAGE_UP:this.previousPage(event);break;case $.ui.keyCode.PAGE_DOWN:this.nextPage(event);break;case $.ui.keyCode.HOME:this._move("first","first",event);break;case $.ui.keyCode.END:this._move("last","last",event);break;case $.ui.keyCode.UP:this.previous(event);break;case $.ui.keyCode.DOWN:this.next(event);break;case $.ui.keyCode.LEFT:this.collapse(event);break;case $.ui.keyCode.RIGHT:if(this.active&&!this.active.is(".ui-state-disabled")){this.expand(event);}
break;case $.ui.keyCode.ENTER:case $.ui.keyCode.SPACE:this._activate(event);break;case $.ui.keyCode.ESCAPE:this.collapse(event);break;default:preventDefault=false;prev=this.previousFilter||"";character=String.fromCharCode(event.keyCode);skip=false;clearTimeout(this.filterTimer);if(character===prev){skip=true;}else{character=prev+character;}
regex=new RegExp("^"+escape(character),"i");match=this.activeMenu.children(".ui-menu-item").filter(function(){return regex.test($(this).children("a").text());});match=skip&&match.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):match;if(!match.length){character=String.fromCharCode(event.keyCode);regex=new RegExp("^"+escape(character),"i");match=this.activeMenu.children(".ui-menu-item").filter(function(){return regex.test($(this).children("a").text());});}
if(match.length){this.focus(event,match);if(match.length>1){this.previousFilter=character;this.filterTimer=this._delay(function(){delete this.previousFilter;},1000);}else{delete this.previousFilter;}}else{delete this.previousFilter;}}
if(preventDefault){event.preventDefault();}},_activate:function(event){if(!this.active.is(".ui-state-disabled")){if(this.active.children("a[aria-haspopup='true']").length){this.expand(event);}else{this.select(event);}}},refresh:function(){var menus,icon=this.options.icons.submenu,submenus=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length);submenus.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var menu=$(this),item=menu.prev("a"),submenuCarat=$("<span>").addClass("ui-menu-icon ui-icon "+icon).data("ui-menu-submenu-carat",true);item.attr("aria-haspopup","true").prepend(submenuCarat);menu.attr("aria-labelledby",item.attr("id"));});menus=submenus.add(this.element);menus.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()});menus.children(":not(.ui-menu-item)").each(function(){var item=$(this);if(!/[^\-\u2014\u2013\s]/.test(item.text())){item.addClass("ui-widget-content ui-menu-divider");}});menus.children(".ui-state-disabled").attr("aria-disabled","true");if(this.active&&!$.contains(this.element[0],this.active[0])){this.blur();}},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role];},_setOption:function(key,value){if(key==="icons"){this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(value.submenu);}
this._super(key,value);},focus:function(event,item){var nested,focused;this.blur(event,event&&event.type==="focus");this._scrollIntoView(item);this.active=item.first();focused=this.active.children("a").addClass("ui-state-focus");if(this.options.role){this.element.attr("aria-activedescendant",focused.attr("id"));}
this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");if(event&&event.type==="keydown"){this._close();}else{this.timer=this._delay(function(){this._close();},this.delay);}
nested=item.children(".ui-menu");if(nested.length&&event&&(/^mouse/.test(event.type))){this._startOpening(nested);}
this.activeMenu=item.parent();this._trigger("focus",event,{item:item});},_scrollIntoView:function(item){var borderTop,paddingTop,offset,scroll,elementHeight,itemHeight;if(this._hasScroll()){borderTop=parseFloat($.css(this.activeMenu[0],"borderTopWidth"))||0;paddingTop=parseFloat($.css(this.activeMenu[0],"paddingTop"))||0;offset=item.offset().top-this.activeMenu.offset().top-borderTop-paddingTop;scroll=this.activeMenu.scrollTop();elementHeight=this.activeMenu.height();itemHeight=item.height();if(offset<0){this.activeMenu.scrollTop(scroll+offset);}else if(offset+itemHeight>elementHeight){this.activeMenu.scrollTop(scroll+offset-elementHeight+itemHeight);}}},blur:function(event,fromFocus){if(!fromFocus){clearTimeout(this.timer);}
if(!this.active){return;}
this.active.children("a").removeClass("ui-state-focus");this.active=null;this._trigger("blur",event,{item:this.active});},_startOpening:function(submenu){clearTimeout(this.timer);if(submenu.attr("aria-hidden")!=="true"){return;}
this.timer=this._delay(function(){this._close();this._open(submenu);},this.delay);},_open:function(submenu){var position=$.extend({of:this.active},this.options.position);clearTimeout(this.timer);this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden","true");submenu.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(position);},collapseAll:function(event,all){clearTimeout(this.timer);this.timer=this._delay(function(){var currentMenu=all?this.element:$(event&&event.target).closest(this.element.find(".ui-menu"));if(!currentMenu.length){currentMenu=this.element;}
this._close(currentMenu);this.blur(event);this.activeMenu=currentMenu;},this.delay);},_close:function(startMenu){if(!startMenu){startMenu=this.active?this.active.parent():this.element;}
startMenu.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active");},collapse:function(event){var newItem=this.active&&this.active.parent().closest(".ui-menu-item",this.element);if(newItem&&newItem.length){this._close();this.focus(event,newItem);}},expand:function(event){var newItem=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();if(newItem&&newItem.length){this._open(newItem.parent());this._delay(function(){this.focus(event,newItem);});}},next:function(event){this._move("next","first",event);},previous:function(event){this._move("prev","last",event);},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},_move:function(direction,filter,event){var next;if(this.active){if(direction==="first"||direction==="last"){next=this.active
[direction==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1);}else{next=this.active
[direction+"All"](".ui-menu-item").eq(0);}}
if(!next||!next.length||!this.active){next=this.activeMenu.children(".ui-menu-item")[filter]();}
this.focus(event,next);},nextPage:function(event){var item,base,height;if(!this.active){this.next(event);return;}
if(this.isLastItem()){return;}
if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.nextAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base-height<0;});this.focus(event,item);}else{this.focus(event,this.activeMenu.children(".ui-menu-item")
[!this.active?"first":"last"]());}},previousPage:function(event){var item,base,height;if(!this.active){this.next(event);return;}
if(this.isFirstItem()){return;}
if(this._hasScroll()){base=this.active.offset().top;height=this.element.height();this.active.prevAll(".ui-menu-item").each(function(){item=$(this);return item.offset().top-base+height>0;});this.focus(event,item);}else{this.focus(event,this.activeMenu.children(".ui-menu-item").first());}},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight");},select:function(event){this.active=this.active||$(event.target).closest(".ui-menu-item");var ui={item:this.active};if(!this.active.has(".ui-menu").length){this.collapseAll(event,true);}
this._trigger("select",event,ui);}});}(jQuery));(function($,undefined){$.widget("ui.progressbar",{version:"1.10.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue();this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min});this.valueDiv=$("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this._refreshValue();},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.valueDiv.remove();},value:function(newValue){if(newValue===undefined){return this.options.value;}
this.options.value=this._constrainedValue(newValue);this._refreshValue();},_constrainedValue:function(newValue){if(newValue===undefined){newValue=this.options.value;}
this.indeterminate=newValue===false;if(typeof newValue!=="number"){newValue=0;}
return this.indeterminate?false:Math.min(this.options.max,Math.max(this.min,newValue));},_setOptions:function(options){var value=options.value;delete options.value;this._super(options);this.options.value=this._constrainedValue(value);this._refreshValue();},_setOption:function(key,value){if(key==="max"){value=Math.max(this.min,value);}
this._super(key,value);},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min);},_refreshValue:function(){var value=this.options.value,percentage=this._percentage();this.valueDiv.toggle(this.indeterminate||value>this.min).toggleClass("ui-corner-right",value===this.options.max).width(percentage.toFixed(0)+"%");this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate);if(this.indeterminate){this.element.removeAttr("aria-valuenow");if(!this.overlayDiv){this.overlayDiv=$("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv);}}else{this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":value});if(this.overlayDiv){this.overlayDiv.remove();this.overlayDiv=null;}}
if(this.oldValue!==value){this.oldValue=value;this._trigger("change");}
if(value===this.options.max){this._trigger("complete");}}});})(jQuery);(function($,undefined){var numPages=5;$.widget("ui.slider",$.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._refresh();this._setOption("disabled",this.options.disabled);this._animateOff=false;},_refresh:function(){this._createRange();this._createHandles();this._setupEvents();this._refreshValue();},_createHandles:function(){var i,handleCount,options=this.options,existingHandles=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),handle="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",handles=[];handleCount=(options.values&&options.values.length)||1;if(existingHandles.length>handleCount){existingHandles.slice(handleCount).remove();existingHandles=existingHandles.slice(0,handleCount);}
for(i=existingHandles.length;i<handleCount;i++){handles.push(handle);}
this.handles=existingHandles.add($(handles.join("")).appendTo(this.element));this.handle=this.handles.eq(0);this.handles.each(function(i){$(this).data("ui-slider-handle-index",i);});},_createRange:function(){var options=this.options,classes="";if(options.range){if(options.range===true){if(!options.values){options.values=[this._valueMin(),this._valueMin()];}else if(options.values.length&&options.values.length!==2){options.values=[options.values[0],options.values[0]];}else if($.isArray(options.values)){options.values=options.values.slice(0);}}
if(!this.range||!this.range.length){this.range=$("<div></div>").appendTo(this.element);classes="ui-slider-range"+" ui-widget-header ui-corner-all";}else{this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({"left":"","bottom":""});}
this.range.addClass(classes+
((options.range==="min"||options.range==="max")?" ui-slider-range-"+options.range:""));}else{if(this.range){this.range.remove();}
this.range=null;}},_setupEvents:function(){var elements=this.handles.add(this.range).filter("a");this._off(elements);this._on(elements,this._handleEvents);this._hoverable(elements);this._focusable(elements);},_destroy:function(){this.handles.remove();if(this.range){this.range.remove();}
this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-widget"+" ui-widget-content"+" ui-corner-all");this._mouseDestroy();},_mouseCapture:function(event){var position,normValue,distance,closestHandle,index,allowed,offset,mouseOverHandle,that=this,o=this.options;if(o.disabled){return false;}
this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;this.handles.each(function(i){var thisDistance=Math.abs(normValue-that.values(i));if((distance>thisDistance)||(distance===thisDistance&&(i===that._lastChangedValue||that.values(i)===o.min))){distance=thisDistance;closestHandle=$(this);index=i;}});allowed=this._start(event,index);if(allowed===false){return false;}
this._mouseSliding=true;this._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().addBack().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-
(closestHandle.height()/2)-
(parseInt(closestHandle.css("borderTopWidth"),10)||0)-
(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+
(parseInt(closestHandle.css("marginTop"),10)||0)};if(!this.handles.hasClass("ui-state-hover")){this._slide(event,index,normValue);}
this._animateOff=true;return true;},_mouseStart:function(){return true;},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false;},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false;},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal";},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0);}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0);}
percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1;}
if(percentMouse<0){percentMouse=0;}
if(this.orientation==="vertical"){percentMouse=1-percentMouse;}
valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse);},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
return this._trigger("start",event,uiHash);},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal<otherVal))){newVal=otherVal;}
if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal);}}}else{if(newVal!==this.value()){allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal);}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._trigger("stop",event,uiHash);},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._lastChangedValue=index;this._trigger("change",event,uiHash);}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);return;}
return this._value();},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);return;}
if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i);}
this._refreshValue();}else{if(this.options.values&&this.options.values.length){return this._values(index);}else{return this.value();}}}else{return this._values();}},_setOption:function(key,value){var i,valsLength=0;if(key==="range"&&this.options.range===true){if(value==="min"){this.options.value=this._values(0);this.options.values=null;}else if(value==="max"){this.options.value=this._values(this.options.values.length-1);this.options.values=null;}}
if($.isArray(this.options.values)){valsLength=this.options.values.length;}
$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i);}
this._animateOff=false;break;case"min":case"max":this._animateOff=true;this._refreshValue();this._animateOff=false;break;case"range":this._animateOff=true;this._refresh();this._animateOff=false;break;}},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val;},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val;}else if(this.options.values&&this.options.values.length){vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i]);}
return vals;}else{return[];}},_trimAlignValue:function(val){if(val<=this._valueMin()){return this._valueMin();}
if(val>=this._valueMax()){return this._valueMax();}
var step=(this.options.step>0)?this.options.step:1,valModStep=(val-this._valueMin())%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step);}
return parseFloat(alignValue.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var lastValPercent,valPercent,value,valueMin,valueMax,oRange=this.options.range,o=this.options,that=this,animate=(!this._animateOff)?o.animate:false,_set={};if(this.options.values&&this.options.values.length){this.handles.each(function(i){valPercent=(that.values(i)-that._valueMin())/(that._valueMax()-that._valueMin())*100;_set[that.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(that.options.range===true){if(that.orientation==="horizontal"){if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate);}
if(i===1){that.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}else{if(i===0){that.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate);}
if(i===1){that.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}}
lastValPercent=valPercent;});}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[this.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate});}
if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate});}}},_handleEvents:{keydown:function(event){var allowed,curVal,newVal,step,index=$(event.target).data("ui-slider-handle-index");switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:event.preventDefault();if(!this._keySliding){this._keySliding=true;$(event.target).addClass("ui-state-active");allowed=this._start(event,index);if(allowed===false){return;}}
break;}
step=this.options.step;if(this.options.values&&this.options.values.length){curVal=newVal=this.values(index);}else{curVal=newVal=this.value();}
switch(event.keyCode){case $.ui.keyCode.HOME:newVal=this._valueMin();break;case $.ui.keyCode.END:newVal=this._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=this._trimAlignValue(curVal+((this._valueMax()-this._valueMin())/numPages));break;case $.ui.keyCode.PAGE_DOWN:newVal=this._trimAlignValue(curVal-((this._valueMax()-this._valueMin())/numPages));break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===this._valueMax()){return;}
newVal=this._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===this._valueMin()){return;}
newVal=this._trimAlignValue(curVal-step);break;}
this._slide(event,index,newVal);},click:function(event){event.preventDefault();},keyup:function(event){var index=$(event.target).data("ui-slider-handle-index");if(this._keySliding){this._keySliding=false;this._stop(event,index);this._change(event,index);$(event.target).removeClass("ui-state-active");}}}});}(jQuery));(function($){function modifier(fn){return function(){var previous=this.element.val();fn.apply(this,arguments);this._refresh();if(previous!==this.element.val()){this._trigger("change");}};}
$.widget("ui.spinner",{version:"1.10.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:true,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max);this._setOption("min",this.options.min);this._setOption("step",this.options.step);if(this.value()!==""){this._value(this.element.val(),true);}
this._draw();this._on(this._events);this._refresh();this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete");}});},_getCreateOptions:function(){var options={},element=this.element;$.each(["min","max","step"],function(i,option){var value=element.attr(option);if(value!==undefined&&value.length){options[option]=value;}});return options;},_events:{keydown:function(event){if(this._start(event)&&this._keydown(event)){event.preventDefault();}},keyup:"_stop",focus:function(){this.previous=this.element.val();},blur:function(event){if(this.cancelBlur){delete this.cancelBlur;return;}
this._stop();this._refresh();if(this.previous!==this.element.val()){this._trigger("change",event);}},mousewheel:function(event,delta){if(!delta){return;}
if(!this.spinning&&!this._start(event)){return false;}
this._spin((delta>0?1:-1)*this.options.step,event);clearTimeout(this.mousewheelTimer);this.mousewheelTimer=this._delay(function(){if(this.spinning){this._stop(event);}},100);event.preventDefault();},"mousedown .ui-spinner-button":function(event){var previous;previous=this.element[0]===this.document[0].activeElement?this.previous:this.element.val();function checkFocus(){var isActive=this.element[0]===this.document[0].activeElement;if(!isActive){this.element.focus();this.previous=previous;this._delay(function(){this.previous=previous;});}}
event.preventDefault();checkFocus.call(this);this.cancelBlur=true;this._delay(function(){delete this.cancelBlur;checkFocus.call(this);});if(this._start(event)===false){return;}
this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event);},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(event){if(!$(event.currentTarget).hasClass("ui-state-active")){return;}
if(this._start(event)===false){return false;}
this._repeat(null,$(event.currentTarget).hasClass("ui-spinner-up")?1:-1,event);},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var uiSpinner=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton");this.buttons=uiSpinner.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all");if(this.buttons.height()>Math.ceil(uiSpinner.height()*0.5)&&uiSpinner.height()>0){uiSpinner.height(uiSpinner.height());}
if(this.options.disabled){this.disable();}},_keydown:function(event){var options=this.options,keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.UP:this._repeat(null,1,event);return true;case keyCode.DOWN:this._repeat(null,-1,event);return true;case keyCode.PAGE_UP:this._repeat(null,options.page,event);return true;case keyCode.PAGE_DOWN:this._repeat(null,-options.page,event);return true;}
return false;},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";},_buttonHtml:function(){return""+"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>"+"<span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>";},_start:function(event){if(!this.spinning&&this._trigger("start",event)===false){return false;}
if(!this.counter){this.counter=1;}
this.spinning=true;return true;},_repeat:function(i,steps,event){i=i||500;clearTimeout(this.timer);this.timer=this._delay(function(){this._repeat(40,steps,event);},i);this._spin(steps*this.options.step,event);},_spin:function(step,event){var value=this.value()||0;if(!this.counter){this.counter=1;}
value=this._adjustValue(value+step*this._increment(this.counter));if(!this.spinning||this._trigger("spin",event,{value:value})!==false){this._value(value);this.counter++;}},_increment:function(i){var incremental=this.options.incremental;if(incremental){return $.isFunction(incremental)?incremental(i):Math.floor(i*i*i/50000-i*i/500+17*i/200+1);}
return 1;},_precision:function(){var precision=this._precisionOf(this.options.step);if(this.options.min!==null){precision=Math.max(precision,this._precisionOf(this.options.min));}
return precision;},_precisionOf:function(num){var str=num.toString(),decimal=str.indexOf(".");return decimal===-1?0:str.length-decimal-1;},_adjustValue:function(value){var base,aboveMin,options=this.options;base=options.min!==null?options.min:0;aboveMin=value-base;aboveMin=Math.round(aboveMin/options.step)*options.step;value=base+aboveMin;value=parseFloat(value.toFixed(this._precision()));if(options.max!==null&&value>options.max){return options.max;}
if(options.min!==null&&value<options.min){return options.min;}
return value;},_stop:function(event){if(!this.spinning){return;}
clearTimeout(this.timer);clearTimeout(this.mousewheelTimer);this.counter=0;this.spinning=false;this._trigger("stop",event);},_setOption:function(key,value){if(key==="culture"||key==="numberFormat"){var prevValue=this._parse(this.element.val());this.options[key]=value;this.element.val(this._format(prevValue));return;}
if(key==="max"||key==="min"||key==="step"){if(typeof value==="string"){value=this._parse(value);}}
if(key==="icons"){this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(value.up);this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(value.down);}
this._super(key,value);if(key==="disabled"){if(value){this.element.prop("disabled",true);this.buttons.button("disable");}else{this.element.prop("disabled",false);this.buttons.button("enable");}}},_setOptions:modifier(function(options){this._super(options);this._value(this.element.val());}),_parse:function(val){if(typeof val==="string"&&val!==""){val=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(val,10,this.options.culture):+val;}
return val===""||isNaN(val)?null:val;},_format:function(value){if(value===""){return"";}
return window.Globalize&&this.options.numberFormat?Globalize.format(value,this.options.numberFormat,this.options.culture):value;},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())});},_value:function(value,allowAny){var parsed;if(value!==""){parsed=this._parse(value);if(parsed!==null){if(!allowAny){parsed=this._adjustValue(parsed);}
value=this._format(parsed);}}
this.element.val(value);this._refresh();},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",false).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");this.uiSpinner.replaceWith(this.element);},stepUp:modifier(function(steps){this._stepUp(steps);}),_stepUp:function(steps){if(this._start()){this._spin((steps||1)*this.options.step);this._stop();}},stepDown:modifier(function(steps){this._stepDown(steps);}),_stepDown:function(steps){if(this._start()){this._spin((steps||1)*-this.options.step);this._stop();}},pageUp:modifier(function(pages){this._stepUp((pages||1)*this.options.page);}),pageDown:modifier(function(pages){this._stepDown((pages||1)*this.options.page);}),value:function(newVal){if(!arguments.length){return this._parse(this.element.val());}
modifier(this._value).call(this,newVal);},widget:function(){return this.uiSpinner;}});}(jQuery));(function($,undefined){var tabId=0,rhash=/#.*$/;function getNextTabId(){return++tabId;}
function isLocal(anchor){anchor=anchor.cloneNode(false);return anchor.hash.length>1&&decodeURIComponent(anchor.href.replace(rhash,""))===decodeURIComponent(location.href.replace(rhash,""));}
$.widget("ui.tabs",{version:"1.10.4",delay:300,options:{active:null,collapsible:false,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var that=this,options=this.options;this.running=false;this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",options.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(event){if($(this).is(".ui-state-disabled")){event.preventDefault();}}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){if($(this).closest("li").is(".ui-state-disabled")){this.blur();}});this._processTabs();options.active=this._initialActive();if($.isArray(options.disabled)){options.disabled=$.unique(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"),function(li){return that.tabs.index(li);}))).sort();}
if(this.options.active!==false&&this.anchors.length){this.active=this._findActive(options.active);}else{this.active=$();}
this._refresh();if(this.active.length){this.load(options.active);}},_initialActive:function(){var active=this.options.active,collapsible=this.options.collapsible,locationHash=location.hash.substring(1);if(active===null){if(locationHash){this.tabs.each(function(i,tab){if($(tab).attr("aria-controls")===locationHash){active=i;return false;}});}
if(active===null){active=this.tabs.index(this.tabs.filter(".ui-tabs-active"));}
if(active===null||active===-1){active=this.tabs.length?0:false;}}
if(active!==false){active=this.tabs.index(this.tabs.eq(active));if(active===-1){active=collapsible?false:0;}}
if(!collapsible&&active===false&&this.anchors.length){active=0;}
return active;},_getCreateEventData:function(){return{tab:this.active,panel:!this.active.length?$():this._getPanelForTab(this.active)};},_tabKeydown:function(event){var focusedTab=$(this.document[0].activeElement).closest("li"),selectedIndex=this.tabs.index(focusedTab),goingForward=true;if(this._handlePageNav(event)){return;}
switch(event.keyCode){case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:selectedIndex++;break;case $.ui.keyCode.UP:case $.ui.keyCode.LEFT:goingForward=false;selectedIndex--;break;case $.ui.keyCode.END:selectedIndex=this.anchors.length-1;break;case $.ui.keyCode.HOME:selectedIndex=0;break;case $.ui.keyCode.SPACE:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex);return;case $.ui.keyCode.ENTER:event.preventDefault();clearTimeout(this.activating);this._activate(selectedIndex===this.options.active?false:selectedIndex);return;default:return;}
event.preventDefault();clearTimeout(this.activating);selectedIndex=this._focusNextTab(selectedIndex,goingForward);if(!event.ctrlKey){focusedTab.attr("aria-selected","false");this.tabs.eq(selectedIndex).attr("aria-selected","true");this.activating=this._delay(function(){this.option("active",selectedIndex);},this.delay);}},_panelKeydown:function(event){if(this._handlePageNav(event)){return;}
if(event.ctrlKey&&event.keyCode===$.ui.keyCode.UP){event.preventDefault();this.active.focus();}},_handlePageNav:function(event){if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_UP){this._activate(this._focusNextTab(this.options.active-1,false));return true;}
if(event.altKey&&event.keyCode===$.ui.keyCode.PAGE_DOWN){this._activate(this._focusNextTab(this.options.active+1,true));return true;}},_findNextTab:function(index,goingForward){var lastTabIndex=this.tabs.length-1;function constrain(){if(index>lastTabIndex){index=0;}
if(index<0){index=lastTabIndex;}
return index;}
while($.inArray(constrain(),this.options.disabled)!==-1){index=goingForward?index+1:index-1;}
return index;},_focusNextTab:function(index,goingForward){index=this._findNextTab(index,goingForward);this.tabs.eq(index).focus();return index;},_setOption:function(key,value){if(key==="active"){this._activate(value);return;}
if(key==="disabled"){this._setupDisabled(value);return;}
this._super(key,value);if(key==="collapsible"){this.element.toggleClass("ui-tabs-collapsible",value);if(!value&&this.options.active===false){this._activate(0);}}
if(key==="event"){this._setupEvents(value);}
if(key==="heightStyle"){this._setupHeightStyle(value);}},_tabId:function(tab){return tab.attr("aria-controls")||"ui-tabs-"+getNextTabId();},_sanitizeSelector:function(hash){return hash?hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):"";},refresh:function(){var options=this.options,lis=this.tablist.children(":has(a[href])");options.disabled=$.map(lis.filter(".ui-state-disabled"),function(tab){return lis.index(tab);});this._processTabs();if(options.active===false||!this.anchors.length){options.active=false;this.active=$();}else if(this.active.length&&!$.contains(this.tablist[0],this.active[0])){if(this.tabs.length===options.disabled.length){options.active=false;this.active=$();}else{this._activate(this._findNextTab(Math.max(0,options.active-1),false));}}else{options.active=this.tabs.index(this.active);}
this._refresh();},_refresh:function(){this._setupDisabled(this.options.disabled);this._setupEvents(this.options.event);this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"});if(!this.active.length){this.tabs.eq(0).attr("tabIndex",0);}else{this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0});this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"});}},_processTabs:function(){var that=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist");this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1});this.anchors=this.tabs.map(function(){return $("a",this)[0];}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1});this.panels=$();this.anchors.each(function(i,anchor){var selector,panel,panelId,anchorId=$(anchor).uniqueId().attr("id"),tab=$(anchor).closest("li"),originalAriaControls=tab.attr("aria-controls");if(isLocal(anchor)){selector=anchor.hash;panel=that.element.find(that._sanitizeSelector(selector));}else{panelId=that._tabId(tab);selector="#"+panelId;panel=that.element.find(selector);if(!panel.length){panel=that._createPanel(panelId);panel.insertAfter(that.panels[i-1]||that.tablist);}
panel.attr("aria-live","polite");}
if(panel.length){that.panels=that.panels.add(panel);}
if(originalAriaControls){tab.data("ui-tabs-aria-controls",originalAriaControls);}
tab.attr({"aria-controls":selector.substring(1),"aria-labelledby":anchorId});panel.attr("aria-labelledby",anchorId);});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel");},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0);},_createPanel:function(id){return $("<div>").attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",true);},_setupDisabled:function(disabled){if($.isArray(disabled)){if(!disabled.length){disabled=false;}else if(disabled.length===this.anchors.length){disabled=true;}}
for(var i=0,li;(li=this.tabs[i]);i++){if(disabled===true||$.inArray(i,disabled)!==-1){$(li).addClass("ui-state-disabled").attr("aria-disabled","true");}else{$(li).removeClass("ui-state-disabled").removeAttr("aria-disabled");}}
this.options.disabled=disabled;},_setupEvents:function(event){var events={click:function(event){event.preventDefault();}};if(event){$.each(event.split(" "),function(index,eventName){events[eventName]="_eventHandler";});}
this._off(this.anchors.add(this.tabs).add(this.panels));this._on(this.anchors,events);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs);},_setupHeightStyle:function(heightStyle){var maxHeight,parent=this.element.parent();if(heightStyle==="fill"){maxHeight=parent.height();maxHeight-=this.element.outerHeight()-this.element.height();this.element.siblings(":visible").each(function(){var elem=$(this),position=elem.css("position");if(position==="absolute"||position==="fixed"){return;}
maxHeight-=elem.outerHeight(true);});this.element.children().not(this.panels).each(function(){maxHeight-=$(this).outerHeight(true);});this.panels.each(function(){$(this).height(Math.max(0,maxHeight-
$(this).innerHeight()+$(this).height()));}).css("overflow","auto");}else if(heightStyle==="auto"){maxHeight=0;this.panels.each(function(){maxHeight=Math.max(maxHeight,$(this).height("").height());}).height(maxHeight);}},_eventHandler:function(event){var options=this.options,active=this.active,anchor=$(event.currentTarget),tab=anchor.closest("li"),clickedIsActive=tab[0]===active[0],collapsing=clickedIsActive&&options.collapsible,toShow=collapsing?$():this._getPanelForTab(tab),toHide=!active.length?$():this._getPanelForTab(active),eventData={oldTab:active,oldPanel:toHide,newTab:collapsing?$():tab,newPanel:toShow};event.preventDefault();if(tab.hasClass("ui-state-disabled")||tab.hasClass("ui-tabs-loading")||this.running||(clickedIsActive&&!options.collapsible)||(this._trigger("beforeActivate",event,eventData)===false)){return;}
options.active=collapsing?false:this.tabs.index(tab);this.active=clickedIsActive?$():tab;if(this.xhr){this.xhr.abort();}
if(!toHide.length&&!toShow.length){$.error("jQuery UI Tabs: Mismatching fragment identifier.");}
if(toShow.length){this.load(this.tabs.index(tab),event);}
this._toggle(event,eventData);},_toggle:function(event,eventData){var that=this,toShow=eventData.newPanel,toHide=eventData.oldPanel;this.running=true;function complete(){that.running=false;that._trigger("activate",event,eventData);}
function show(){eventData.newTab.closest("li").addClass("ui-tabs-active ui-state-active");if(toShow.length&&that.options.show){that._show(toShow,that.options.show,complete);}else{toShow.show();complete();}}
if(toHide.length&&this.options.hide){this._hide(toHide,this.options.hide,function(){eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");show();});}else{eventData.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");toHide.hide();show();}
toHide.attr({"aria-expanded":"false","aria-hidden":"true"});eventData.oldTab.attr("aria-selected","false");if(toShow.length&&toHide.length){eventData.oldTab.attr("tabIndex",-1);}else if(toShow.length){this.tabs.filter(function(){return $(this).attr("tabIndex")===0;}).attr("tabIndex",-1);}
toShow.attr({"aria-expanded":"true","aria-hidden":"false"});eventData.newTab.attr({"aria-selected":"true",tabIndex:0});},_activate:function(index){var anchor,active=this._findActive(index);if(active[0]===this.active[0]){return;}
if(!active.length){active=this.active;}
anchor=active.find(".ui-tabs-anchor")[0];this._eventHandler({target:anchor,currentTarget:anchor,preventDefault:$.noop});},_findActive:function(index){return index===false?$():this.tabs.eq(index);},_getIndex:function(index){if(typeof index==="string"){index=this.anchors.index(this.anchors.filter("[href$='"+index+"']"));}
return index;},_destroy:function(){if(this.xhr){this.xhr.abort();}
this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible");this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role");this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId();this.tabs.add(this.panels).each(function(){if($.data(this,"ui-tabs-destroy")){$(this).remove();}else{$(this).removeClass("ui-state-default ui-state-active ui-state-disabled "+"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role");}});this.tabs.each(function(){var li=$(this),prev=li.data("ui-tabs-aria-controls");if(prev){li.attr("aria-controls",prev).removeData("ui-tabs-aria-controls");}else{li.removeAttr("aria-controls");}});this.panels.show();if(this.options.heightStyle!=="content"){this.panels.css("height","");}},enable:function(index){var disabled=this.options.disabled;if(disabled===false){return;}
if(index===undefined){disabled=false;}else{index=this._getIndex(index);if($.isArray(disabled)){disabled=$.map(disabled,function(num){return num!==index?num:null;});}else{disabled=$.map(this.tabs,function(li,num){return num!==index?num:null;});}}
this._setupDisabled(disabled);},disable:function(index){var disabled=this.options.disabled;if(disabled===true){return;}
if(index===undefined){disabled=true;}else{index=this._getIndex(index);if($.inArray(index,disabled)!==-1){return;}
if($.isArray(disabled)){disabled=$.merge([index],disabled).sort();}else{disabled=[index];}}
this._setupDisabled(disabled);},load:function(index,event){index=this._getIndex(index);var that=this,tab=this.tabs.eq(index),anchor=tab.find(".ui-tabs-anchor"),panel=this._getPanelForTab(tab),eventData={tab:tab,panel:panel};if(isLocal(anchor[0])){return;}
this.xhr=$.ajax(this._ajaxSettings(anchor,event,eventData));if(this.xhr&&this.xhr.statusText!=="canceled"){tab.addClass("ui-tabs-loading");panel.attr("aria-busy","true");this.xhr.success(function(response){setTimeout(function(){panel.html(response);that._trigger("load",event,eventData);},1);}).complete(function(jqXHR,status){setTimeout(function(){if(status==="abort"){that.panels.stop(false,true);}
tab.removeClass("ui-tabs-loading");panel.removeAttr("aria-busy");if(jqXHR===that.xhr){delete that.xhr;}},1);});}},_ajaxSettings:function(anchor,event,eventData){var that=this;return{url:anchor.attr("href"),beforeSend:function(jqXHR,settings){return that._trigger("beforeLoad",event,$.extend({jqXHR:jqXHR,ajaxSettings:settings},eventData));}};},_getPanelForTab:function(tab){var id=$(tab).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+id));}});})(jQuery);(function($){var increments=0;function addDescribedBy(elem,id){var describedby=(elem.attr("aria-describedby")||"").split(/\s+/);describedby.push(id);elem.data("ui-tooltip-id",id).attr("aria-describedby",$.trim(describedby.join(" ")));}
function removeDescribedBy(elem){var id=elem.data("ui-tooltip-id"),describedby=(elem.attr("aria-describedby")||"").split(/\s+/),index=$.inArray(id,describedby);if(index!==-1){describedby.splice(index,1);}
elem.removeData("ui-tooltip-id");describedby=$.trim(describedby.join(" "));if(describedby){elem.attr("aria-describedby",describedby);}else{elem.removeAttr("aria-describedby");}}
$.widget("ui.tooltip",{version:"1.10.4",options:{content:function(){var title=$(this).attr("title")||"";return $("<a>").text(title).html();},hide:true,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:true,tooltipClass:null,track:false,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"});this.tooltips={};this.parents={};if(this.options.disabled){this._disable();}},_setOption:function(key,value){var that=this;if(key==="disabled"){this[value?"_disable":"_enable"]();this.options[key]=value;return;}
this._super(key,value);if(key==="content"){$.each(this.tooltips,function(id,element){that._updateContent(element);});}},_disable:function(){var that=this;$.each(this.tooltips,function(id,element){var event=$.Event("blur");event.target=event.currentTarget=element[0];that.close(event,true);});this.element.find(this.options.items).addBack().each(function(){var element=$(this);if(element.is("[title]")){element.data("ui-tooltip-title",element.attr("title")).attr("title","");}});},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var element=$(this);if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"));}});},open:function(event){var that=this,target=$(event?event.target:this.element).closest(this.options.items);if(!target.length||target.data("ui-tooltip-id")){return;}
if(target.attr("title")){target.data("ui-tooltip-title",target.attr("title"));}
target.data("ui-tooltip-open",true);if(event&&event.type==="mouseover"){target.parents().each(function(){var parent=$(this),blurEvent;if(parent.data("ui-tooltip-open")){blurEvent=$.Event("blur");blurEvent.target=blurEvent.currentTarget=this;that.close(blurEvent,true);}
if(parent.attr("title")){parent.uniqueId();that.parents[this.id]={element:this,title:parent.attr("title")};parent.attr("title","");}});}
this._updateContent(target,event);},_updateContent:function(target,event){var content,contentOption=this.options.content,that=this,eventType=event?event.type:null;if(typeof contentOption==="string"){return this._open(event,target,contentOption);}
content=contentOption.call(target[0],function(response){if(!target.data("ui-tooltip-open")){return;}
that._delay(function(){if(event){event.type=eventType;}
this._open(event,target,response);});});if(content){this._open(event,target,content);}},_open:function(event,target,content){var tooltip,events,delayedShow,positionOption=$.extend({},this.options.position);if(!content){return;}
tooltip=this._find(target);if(tooltip.length){tooltip.find(".ui-tooltip-content").html(content);return;}
if(target.is("[title]")){if(event&&event.type==="mouseover"){target.attr("title","");}else{target.removeAttr("title");}}
tooltip=this._tooltip(target);addDescribedBy(target,tooltip.attr("id"));tooltip.find(".ui-tooltip-content").html(content);function position(event){positionOption.of=event;if(tooltip.is(":hidden")){return;}
tooltip.position(positionOption);}
if(this.options.track&&event&&/^mouse/.test(event.type)){this._on(this.document,{mousemove:position});position(event);}else{tooltip.position($.extend({of:target},this.options.position));}
tooltip.hide();this._show(tooltip,this.options.show);if(this.options.show&&this.options.show.delay){delayedShow=this.delayedShow=setInterval(function(){if(tooltip.is(":visible")){position(positionOption.of);clearInterval(delayedShow);}},$.fx.interval);}
this._trigger("open",event,{tooltip:tooltip});events={keyup:function(event){if(event.keyCode===$.ui.keyCode.ESCAPE){var fakeEvent=$.Event(event);fakeEvent.currentTarget=target[0];this.close(fakeEvent,true);}},remove:function(){this._removeTooltip(tooltip);}};if(!event||event.type==="mouseover"){events.mouseleave="close";}
if(!event||event.type==="focusin"){events.focusout="close";}
this._on(true,target,events);},close:function(event){var that=this,target=$(event?event.currentTarget:this.element),tooltip=this._find(target);if(this.closing){return;}
clearInterval(this.delayedShow);if(target.data("ui-tooltip-title")){target.attr("title",target.data("ui-tooltip-title"));}
removeDescribedBy(target);tooltip.stop(true);this._hide(tooltip,this.options.hide,function(){that._removeTooltip($(this));});target.removeData("ui-tooltip-open");this._off(target,"mouseleave focusout keyup");if(target[0]!==this.element[0]){this._off(target,"remove");}
this._off(this.document,"mousemove");if(event&&event.type==="mouseleave"){$.each(this.parents,function(id,parent){$(parent.element).attr("title",parent.title);delete that.parents[id];});}
this.closing=true;this._trigger("close",event,{tooltip:tooltip});this.closing=false;},_tooltip:function(element){var id="ui-tooltip-"+increments++,tooltip=$("<div>").attr({id:id,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+
(this.options.tooltipClass||""));$("<div>").addClass("ui-tooltip-content").appendTo(tooltip);tooltip.appendTo(this.document[0].body);this.tooltips[id]=element;return tooltip;},_find:function(target){var id=target.data("ui-tooltip-id");return id?$("#"+id):$();},_removeTooltip:function(tooltip){tooltip.remove();delete this.tooltips[tooltip.attr("id")];},_destroy:function(){var that=this;$.each(this.tooltips,function(id,element){var event=$.Event("blur");event.target=event.currentTarget=element[0];that.close(event,true);$("#"+id).remove();if(element.data("ui-tooltip-title")){element.attr("title",element.data("ui-tooltip-title"));element.removeData("ui-tooltip-title");}});}});}(jQuery));(function($,undefined){var dataSpace="ui-effects-";$.effects={effect:{}};(function(jQuery,undefined){var stepHooks="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",rplusequals=/^([\-+])=\s*(\d+\.?\d*)/,stringParsers=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1],execResult[2],execResult[3],execResult[4]];}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(execResult){return[execResult[1]*2.55,execResult[2]*2.55,execResult[3]*2.55,execResult[4]];}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(execResult){return[parseInt(execResult[1],16),parseInt(execResult[2],16),parseInt(execResult[3],16)];}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(execResult){return[parseInt(execResult[1]+execResult[1],16),parseInt(execResult[2]+execResult[2],16),parseInt(execResult[3]+execResult[3],16)];}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(execResult){return[execResult[1],execResult[2]/100,execResult[3]/100,execResult[4]];}}],color=jQuery.Color=function(color,green,blue,alpha){return new jQuery.Color.fn.parse(color,green,blue,alpha);},spaces={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},propTypes={"byte":{floor:true,max:255},"percent":{max:1},"degrees":{mod:360,floor:true}},support=color.support={},supportElem=jQuery("<p>")[0],colors,each=jQuery.each;supportElem.style.cssText="background-color:rgba(1,1,1,.5)";support.rgba=supportElem.style.backgroundColor.indexOf("rgba")>-1;each(spaces,function(spaceName,space){space.cache="_"+spaceName;space.props.alpha={idx:3,type:"percent",def:1};});function clamp(value,prop,allowEmpty){var type=propTypes[prop.type]||{};if(value==null){return(allowEmpty||!prop.def)?null:prop.def;}
value=type.floor?~~value:parseFloat(value);if(isNaN(value)){return prop.def;}
if(type.mod){return(value+type.mod)%type.mod;}
return 0>value?0:type.max<value?type.max:value;}
function stringParse(string){var inst=color(),rgba=inst._rgba=[];string=string.toLowerCase();each(stringParsers,function(i,parser){var parsed,match=parser.re.exec(string),values=match&&parser.parse(match),spaceName=parser.space||"rgba";if(values){parsed=inst[spaceName](values);inst[spaces[spaceName].cache]=parsed[spaces[spaceName].cache];rgba=inst._rgba=parsed._rgba;return false;}});if(rgba.length){if(rgba.join()==="0,0,0,0"){jQuery.extend(rgba,colors.transparent);}
return inst;}
return colors[string];}
color.fn=jQuery.extend(color.prototype,{parse:function(red,green,blue,alpha){if(red===undefined){this._rgba=[null,null,null,null];return this;}
if(red.jquery||red.nodeType){red=jQuery(red).css(green);green=undefined;}
var inst=this,type=jQuery.type(red),rgba=this._rgba=[];if(green!==undefined){red=[red,green,blue,alpha];type="array";}
if(type==="string"){return this.parse(stringParse(red)||colors._default);}
if(type==="array"){each(spaces.rgba.props,function(key,prop){rgba[prop.idx]=clamp(red[prop.idx],prop);});return this;}
if(type==="object"){if(red instanceof color){each(spaces,function(spaceName,space){if(red[space.cache]){inst[space.cache]=red[space.cache].slice();}});}else{each(spaces,function(spaceName,space){var cache=space.cache;each(space.props,function(key,prop){if(!inst[cache]&&space.to){if(key==="alpha"||red[key]==null){return;}
inst[cache]=space.to(inst._rgba);}
inst[cache][prop.idx]=clamp(red[key],prop,true);});if(inst[cache]&&jQuery.inArray(null,inst[cache].slice(0,3))<0){inst[cache][3]=1;if(space.from){inst._rgba=space.from(inst[cache]);}}});}
return this;}},is:function(compare){var is=color(compare),same=true,inst=this;each(spaces,function(_,space){var localCache,isCache=is[space.cache];if(isCache){localCache=inst[space.cache]||space.to&&space.to(inst._rgba)||[];each(space.props,function(_,prop){if(isCache[prop.idx]!=null){same=(isCache[prop.idx]===localCache[prop.idx]);return same;}});}
return same;});return same;},_space:function(){var used=[],inst=this;each(spaces,function(spaceName,space){if(inst[space.cache]){used.push(spaceName);}});return used.pop();},transition:function(other,distance){var end=color(other),spaceName=end._space(),space=spaces[spaceName],startColor=this.alpha()===0?color("transparent"):this,start=startColor[space.cache]||space.to(startColor._rgba),result=start.slice();end=end[space.cache];each(space.props,function(key,prop){var index=prop.idx,startValue=start[index],endValue=end[index],type=propTypes[prop.type]||{};if(endValue===null){return;}
if(startValue===null){result[index]=endValue;}else{if(type.mod){if(endValue-startValue>type.mod/2){startValue+=type.mod;}else if(startValue-endValue>type.mod/2){startValue-=type.mod;}}
result[index]=clamp((endValue-startValue)*distance+startValue,prop);}});return this[spaceName](result);},blend:function(opaque){if(this._rgba[3]===1){return this;}
var rgb=this._rgba.slice(),a=rgb.pop(),blend=color(opaque)._rgba;return color(jQuery.map(rgb,function(v,i){return(1-a)*blend[i]+a*v;}));},toRgbaString:function(){var prefix="rgba(",rgba=jQuery.map(this._rgba,function(v,i){return v==null?(i>2?1:0):v;});if(rgba[3]===1){rgba.pop();prefix="rgb(";}
return prefix+rgba.join()+")";},toHslaString:function(){var prefix="hsla(",hsla=jQuery.map(this.hsla(),function(v,i){if(v==null){v=i>2?1:0;}
if(i&&i<3){v=Math.round(v*100)+"%";}
return v;});if(hsla[3]===1){hsla.pop();prefix="hsl(";}
return prefix+hsla.join()+")";},toHexString:function(includeAlpha){var rgba=this._rgba.slice(),alpha=rgba.pop();if(includeAlpha){rgba.push(~~(alpha*255));}
return"#"+jQuery.map(rgba,function(v){v=(v||0).toString(16);return v.length===1?"0"+v:v;}).join("");},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString();}});color.fn.parse.prototype=color.fn;function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}
if(h*2<1){return q;}
if(h*3<2){return p+(q-p)*((2/3)-h)*6;}
return p;}
spaces.hsla.to=function(rgba){if(rgba[0]==null||rgba[1]==null||rgba[2]==null){return[null,null,null,rgba[3]];}
var r=rgba[0]/255,g=rgba[1]/255,b=rgba[2]/255,a=rgba[3],max=Math.max(r,g,b),min=Math.min(r,g,b),diff=max-min,add=max+min,l=add*0.5,h,s;if(min===max){h=0;}else if(r===max){h=(60*(g-b)/diff)+360;}else if(g===max){h=(60*(b-r)/diff)+120;}else{h=(60*(r-g)/diff)+240;}
if(diff===0){s=0;}else if(l<=0.5){s=diff/add;}else{s=diff/(2-add);}
return[Math.round(h)%360,s,l,a==null?1:a];};spaces.hsla.from=function(hsla){if(hsla[0]==null||hsla[1]==null||hsla[2]==null){return[null,null,null,hsla[3]];}
var h=hsla[0]/360,s=hsla[1],l=hsla[2],a=hsla[3],q=l<=0.5?l*(1+s):l+s-l*s,p=2*l-q;return[Math.round(hue2rgb(p,q,h+(1/3))*255),Math.round(hue2rgb(p,q,h)*255),Math.round(hue2rgb(p,q,h-(1/3))*255),a];};each(spaces,function(spaceName,space){var props=space.props,cache=space.cache,to=space.to,from=space.from;color.fn[spaceName]=function(value){if(to&&!this[cache]){this[cache]=to(this._rgba);}
if(value===undefined){return this[cache].slice();}
var ret,type=jQuery.type(value),arr=(type==="array"||type==="object")?value:arguments,local=this[cache].slice();each(props,function(key,prop){var val=arr[type==="object"?key:prop.idx];if(val==null){val=local[prop.idx];}
local[prop.idx]=clamp(val,prop);});if(from){ret=color(from(local));ret[cache]=local;return ret;}else{return color(local);}};each(props,function(key,prop){if(color.fn[key]){return;}
color.fn[key]=function(value){var vtype=jQuery.type(value),fn=(key==="alpha"?(this._hsla?"hsla":"rgba"):spaceName),local=this[fn](),cur=local[prop.idx],match;if(vtype==="undefined"){return cur;}
if(vtype==="function"){value=value.call(this,cur);vtype=jQuery.type(value);}
if(value==null&&prop.empty){return this;}
if(vtype==="string"){match=rplusequals.exec(value);if(match){value=cur+parseFloat(match[2])*(match[1]==="+"?1:-1);}}
local[prop.idx]=value;return this[fn](local);};});});color.hook=function(hook){var hooks=hook.split(" ");each(hooks,function(i,hook){jQuery.cssHooks[hook]={set:function(elem,value){var parsed,curElem,backgroundColor="";if(value!=="transparent"&&(jQuery.type(value)!=="string"||(parsed=stringParse(value)))){value=color(parsed||value);if(!support.rgba&&value._rgba[3]!==1){curElem=hook==="backgroundColor"?elem.parentNode:elem;while((backgroundColor===""||backgroundColor==="transparent")&&curElem&&curElem.style){try{backgroundColor=jQuery.css(curElem,"backgroundColor");curElem=curElem.parentNode;}catch(e){}}
value=value.blend(backgroundColor&&backgroundColor!=="transparent"?backgroundColor:"_default");}
value=value.toRgbaString();}
try{elem.style[hook]=value;}catch(e){}}};jQuery.fx.step[hook]=function(fx){if(!fx.colorInit){fx.start=color(fx.elem,hook);fx.end=color(fx.end);fx.colorInit=true;}
jQuery.cssHooks[hook].set(fx.elem,fx.start.transition(fx.end,fx.pos));};});};color.hook(stepHooks);jQuery.cssHooks.borderColor={expand:function(value){var expanded={};each(["Top","Right","Bottom","Left"],function(i,part){expanded["border"+part+"Color"]=value;});return expanded;}};colors=jQuery.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"};})(jQuery);(function(){var classAnimationActions=["add","remove","toggle"],shorthandStyles={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};$.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(_,prop){$.fx.step[prop]=function(fx){if(fx.end!=="none"&&!fx.setAttr||fx.pos===1&&!fx.setAttr){jQuery.style(fx.elem,prop,fx.end);fx.setAttr=true;}};});function getElementStyles(elem){var key,len,style=elem.ownerDocument.defaultView?elem.ownerDocument.defaultView.getComputedStyle(elem,null):elem.currentStyle,styles={};if(style&&style.length&&style[0]&&style[style[0]]){len=style.length;while(len--){key=style[len];if(typeof style[key]==="string"){styles[$.camelCase(key)]=style[key];}}}else{for(key in style){if(typeof style[key]==="string"){styles[key]=style[key];}}}
return styles;}
function styleDifference(oldStyle,newStyle){var diff={},name,value;for(name in newStyle){value=newStyle[name];if(oldStyle[name]!==value){if(!shorthandStyles[name]){if($.fx.step[name]||!isNaN(parseFloat(value))){diff[name]=value;}}}}
return diff;}
if(!$.fn.addBack){$.fn.addBack=function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));};}
$.effects.animateClass=function(value,duration,easing,callback){var o=$.speed(duration,easing,callback);return this.queue(function(){var animated=$(this),baseClass=animated.attr("class")||"",applyClassChange,allAnimations=o.children?animated.find("*").addBack():animated;allAnimations=allAnimations.map(function(){var el=$(this);return{el:el,start:getElementStyles(this)};});applyClassChange=function(){$.each(classAnimationActions,function(i,action){if(value[action]){animated[action+"Class"](value[action]);}});};applyClassChange();allAnimations=allAnimations.map(function(){this.end=getElementStyles(this.el[0]);this.diff=styleDifference(this.start,this.end);return this;});animated.attr("class",baseClass);allAnimations=allAnimations.map(function(){var styleInfo=this,dfd=$.Deferred(),opts=$.extend({},o,{queue:false,complete:function(){dfd.resolve(styleInfo);}});this.el.animate(this.diff,opts);return dfd.promise();});$.when.apply($,allAnimations.get()).done(function(){applyClassChange();$.each(arguments,function(){var el=this.el;$.each(this.diff,function(key){el.css(key,"");});});o.complete.call(animated[0]);});});};$.fn.extend({addClass:(function(orig){return function(classNames,speed,easing,callback){return speed?$.effects.animateClass.call(this,{add:classNames},speed,easing,callback):orig.apply(this,arguments);};})($.fn.addClass),removeClass:(function(orig){return function(classNames,speed,easing,callback){return arguments.length>1?$.effects.animateClass.call(this,{remove:classNames},speed,easing,callback):orig.apply(this,arguments);};})($.fn.removeClass),toggleClass:(function(orig){return function(classNames,force,speed,easing,callback){if(typeof force==="boolean"||force===undefined){if(!speed){return orig.apply(this,arguments);}else{return $.effects.animateClass.call(this,(force?{add:classNames}:{remove:classNames}),speed,easing,callback);}}else{return $.effects.animateClass.call(this,{toggle:classNames},force,speed,easing);}};})($.fn.toggleClass),switchClass:function(remove,add,speed,easing,callback){return $.effects.animateClass.call(this,{add:add,remove:remove},speed,easing,callback);}});})();(function(){$.extend($.effects,{version:"1.10.4",save:function(element,set){for(var i=0;i<set.length;i++){if(set[i]!==null){element.data(dataSpace+set[i],element[0].style[set[i]]);}}},restore:function(element,set){var val,i;for(i=0;i<set.length;i++){if(set[i]!==null){val=element.data(dataSpace+set[i]);if(val===undefined){val="";}
element.css(set[i],val);}}},setMode:function(el,mode){if(mode==="toggle"){mode=el.is(":hidden")?"show":"hide";}
return mode;},getBaseline:function(origin,original){var y,x;switch(origin[0]){case"top":y=0;break;case"middle":y=0.5;break;case"bottom":y=1;break;default:y=origin[0]/original.height;}
switch(origin[1]){case"left":x=0;break;case"center":x=0.5;break;case"right":x=1;break;default:x=origin[1]/original.width;}
return{x:x,y:y};},createWrapper:function(element){if(element.parent().is(".ui-effects-wrapper")){return element.parent();}
var props={width:element.outerWidth(true),height:element.outerHeight(true),"float":element.css("float")},wrapper=$("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),size={width:element.width(),height:element.height()},active=document.activeElement;try{active.id;}catch(e){active=document.body;}
element.wrap(wrapper);if(element[0]===active||$.contains(element[0],active)){$(active).focus();}
wrapper=element.parent();if(element.css("position")==="static"){wrapper.css({position:"relative"});element.css({position:"relative"});}else{$.extend(props,{position:element.css("position"),zIndex:element.css("z-index")});$.each(["top","left","bottom","right"],function(i,pos){props[pos]=element.css(pos);if(isNaN(parseInt(props[pos],10))){props[pos]="auto";}});element.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"});}
element.css(size);return wrapper.css(props).show();},removeWrapper:function(element){var active=document.activeElement;if(element.parent().is(".ui-effects-wrapper")){element.parent().replaceWith(element);if(element[0]===active||$.contains(element[0],active)){$(active).focus();}}
return element;},setTransition:function(element,list,factor,value){value=value||{};$.each(list,function(i,x){var unit=element.cssUnit(x);if(unit[0]>0){value[x]=unit[0]*factor+unit[1];}});return value;}});function _normalizeArguments(effect,options,speed,callback){if($.isPlainObject(effect)){options=effect;effect=effect.effect;}
effect={effect:effect};if(options==null){options={};}
if($.isFunction(options)){callback=options;speed=null;options={};}
if(typeof options==="number"||$.fx.speeds[options]){callback=speed;speed=options;options={};}
if($.isFunction(speed)){callback=speed;speed=null;}
if(options){$.extend(effect,options);}
speed=speed||options.duration;effect.duration=$.fx.off?0:typeof speed==="number"?speed:speed in $.fx.speeds?$.fx.speeds[speed]:$.fx.speeds._default;effect.complete=callback||options.complete;return effect;}
function standardAnimationOption(option){if(!option||typeof option==="number"||$.fx.speeds[option]){return true;}
if(typeof option==="string"&&!$.effects.effect[option]){return true;}
if($.isFunction(option)){return true;}
if(typeof option==="object"&&!option.effect){return true;}
return false;}
$.fn.extend({effect:function(){var args=_normalizeArguments.apply(this,arguments),mode=args.mode,queue=args.queue,effectMethod=$.effects.effect[args.effect];if($.fx.off||!effectMethod){if(mode){return this[mode](args.duration,args.complete);}else{return this.each(function(){if(args.complete){args.complete.call(this);}});}}
function run(next){var elem=$(this),complete=args.complete,mode=args.mode;function done(){if($.isFunction(complete)){complete.call(elem[0]);}
if($.isFunction(next)){next();}}
if(elem.is(":hidden")?mode==="hide":mode==="show"){elem[mode]();done();}else{effectMethod.call(elem[0],args,done);}}
return queue===false?this.each(run):this.queue(queue||"fx",run);},show:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="show";return this.effect.call(this,args);}};})($.fn.show),hide:(function(orig){return function(option){if(standardAnimationOption(option)){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="hide";return this.effect.call(this,args);}};})($.fn.hide),toggle:(function(orig){return function(option){if(standardAnimationOption(option)||typeof option==="boolean"){return orig.apply(this,arguments);}else{var args=_normalizeArguments.apply(this,arguments);args.mode="toggle";return this.effect.call(this,args);}};})($.fn.toggle),cssUnit:function(key){var style=this.css(key),val=[];$.each(["em","px","%","pt"],function(i,unit){if(style.indexOf(unit)>0){val=[parseFloat(style),unit];}});return val;}});})();(function(){var baseEasings={};$.each(["Quad","Cubic","Quart","Quint","Expo"],function(i,name){baseEasings[name]=function(p){return Math.pow(p,i+2);};});$.extend(baseEasings,{Sine:function(p){return 1-Math.cos(p*Math.PI/2);},Circ:function(p){return 1-Math.sqrt(1-p*p);},Elastic:function(p){return p===0||p===1?p:-Math.pow(2,8*(p-1))*Math.sin(((p-1)*80-7.5)*Math.PI/15);},Back:function(p){return p*p*(3*p-2);},Bounce:function(p){var pow2,bounce=4;while(p<((pow2=Math.pow(2,--bounce))-1)/11){}
return 1/Math.pow(4,3-bounce)-7.5625*Math.pow((pow2*3-2)/22-p,2);}});$.each(baseEasings,function(name,easeIn){$.easing["easeIn"+name]=easeIn;$.easing["easeOut"+name]=function(p){return 1-easeIn(1-p);};$.easing["easeInOut"+name]=function(p){return p<0.5?easeIn(p*2)/2:1-easeIn(p*-2+2)/2;};});})();})(jQuery);(function($,undefined){var rvertical=/up|down|vertical/,rpositivemotion=/up|left|vertical|horizontal/;$.effects.effect.blind=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),direction=o.direction||"up",vertical=rvertical.test(direction),ref=vertical?"height":"width",ref2=vertical?"top":"left",motion=rpositivemotion.test(direction),animation={},show=mode==="show",wrapper,distance,margin;if(el.parent().is(".ui-effects-wrapper")){$.effects.save(el.parent(),props);}else{$.effects.save(el,props);}
el.show();wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});distance=wrapper[ref]();margin=parseFloat(wrapper.css(ref2))||0;animation[ref]=show?distance:0;if(!motion){el.css(vertical?"bottom":"right",0).css(vertical?"top":"left","auto").css({position:"absolute"});animation[ref2]=show?margin:distance+margin;}
if(show){wrapper.css(ref,0);if(!motion){wrapper.css(ref2,margin+distance);}}
wrapper.animate(animation,{duration:o.duration,easing:o.easing,queue:false,complete:function(){if(mode==="hide"){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();}});};})(jQuery);(function($,undefined){$.effects.effect.bounce=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"effect"),hide=mode==="hide",show=mode==="show",direction=o.direction||"up",distance=o.distance,times=o.times||5,anims=times*2+(show||hide?1:0),speed=o.duration/anims,easing=o.easing,ref=(direction==="up"||direction==="down")?"top":"left",motion=(direction==="up"||direction==="left"),i,upAnim,downAnim,queue=el.queue(),queuelen=queue.length;if(show||hide){props.push("opacity");}
$.effects.save(el,props);el.show();$.effects.createWrapper(el);if(!distance){distance=el[ref==="top"?"outerHeight":"outerWidth"]()/3;}
if(show){downAnim={opacity:1};downAnim[ref]=0;el.css("opacity",0).css(ref,motion?-distance*2:distance*2).animate(downAnim,speed,easing);}
if(hide){distance=distance/Math.pow(2,times-1);}
downAnim={};downAnim[ref]=0;for(i=0;i<times;i++){upAnim={};upAnim[ref]=(motion?"-=":"+=")+distance;el.animate(upAnim,speed,easing).animate(downAnim,speed,easing);distance=hide?distance*2:distance/2;}
if(hide){upAnim={opacity:0};upAnim[ref]=(motion?"-=":"+=")+distance;el.animate(upAnim,speed,easing);}
el.queue(function(){if(hide){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();});if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)));}
el.dequeue();};})(jQuery);(function($,undefined){$.effects.effect.clip=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",direction=o.direction||"vertical",vert=direction==="vertical",size=vert?"height":"width",position=vert?"top":"left",animation={},wrapper,animate,distance;$.effects.save(el,props);el.show();wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});animate=(el[0].tagName==="IMG")?wrapper:el;distance=animate[size]();if(show){animate.css(size,0);animate.css(position,distance/2);}
animation[size]=show?distance:0;animation[position]=show?0:distance/2;animate.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(!show){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();}});};})(jQuery);(function($,undefined){$.effects.effect.drop=function(o,done){var el=$(this),props=["position","top","bottom","left","right","opacity","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",direction=o.direction||"left",ref=(direction==="up"||direction==="down")?"top":"left",motion=(direction==="up"||direction==="left")?"pos":"neg",animation={opacity:show?1:0},distance;$.effects.save(el,props);el.show();$.effects.createWrapper(el);distance=o.distance||el[ref==="top"?"outerHeight":"outerWidth"](true)/2;if(show){el.css("opacity",0).css(ref,motion==="pos"?-distance:distance);}
animation[ref]=(show?(motion==="pos"?"+=":"-="):(motion==="pos"?"-=":"+="))+
distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();}});};})(jQuery);(function($,undefined){$.effects.effect.explode=function(o,done){var rows=o.pieces?Math.round(Math.sqrt(o.pieces)):3,cells=rows,el=$(this),mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",offset=el.show().css("visibility","hidden").offset(),width=Math.ceil(el.outerWidth()/cells),height=Math.ceil(el.outerHeight()/rows),pieces=[],i,j,left,top,mx,my;function childComplete(){pieces.push(this);if(pieces.length===rows*cells){animComplete();}}
for(i=0;i<rows;i++){top=offset.top+i*height;my=i-(rows-1)/2;for(j=0;j<cells;j++){left=offset.left+j*width;mx=j-(cells-1)/2;el.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*width,top:-i*height}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:width,height:height,left:left+(show?mx*width:0),top:top+(show?my*height:0),opacity:show?0:1}).animate({left:left+(show?0:mx*width),top:top+(show?0:my*height),opacity:show?1:0},o.duration||500,o.easing,childComplete);}}
function animComplete(){el.css({visibility:"visible"});$(pieces).remove();if(!show){el.hide();}
done();}};})(jQuery);(function($,undefined){$.effects.effect.fade=function(o,done){var el=$(this),mode=$.effects.setMode(el,o.mode||"toggle");el.animate({opacity:mode},{queue:false,duration:o.duration,easing:o.easing,complete:done});};})(jQuery);(function($,undefined){$.effects.effect.fold=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"hide"),show=mode==="show",hide=mode==="hide",size=o.size||15,percent=/([0-9]+)%/.exec(size),horizFirst=!!o.horizFirst,widthFirst=show!==horizFirst,ref=widthFirst?["width","height"]:["height","width"],duration=o.duration/2,wrapper,distance,animation1={},animation2={};$.effects.save(el,props);el.show();wrapper=$.effects.createWrapper(el).css({overflow:"hidden"});distance=widthFirst?[wrapper.width(),wrapper.height()]:[wrapper.height(),wrapper.width()];if(percent){size=parseInt(percent[1],10)/100*distance[hide?0:1];}
if(show){wrapper.css(horizFirst?{height:0,width:size}:{height:size,width:0});}
animation1[ref[0]]=show?distance[0]:size;animation2[ref[1]]=show?distance[1]:0;wrapper.animate(animation1,duration,o.easing).animate(animation2,duration,o.easing,function(){if(hide){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();});};})(jQuery);(function($,undefined){$.effects.effect.highlight=function(o,done){var elem=$(this),props=["backgroundImage","backgroundColor","opacity"],mode=$.effects.setMode(elem,o.mode||"show"),animation={backgroundColor:elem.css("backgroundColor")};if(mode==="hide"){animation.opacity=0;}
$.effects.save(elem,props);elem.show().css({backgroundImage:"none",backgroundColor:o.color||"#ffff99"}).animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){elem.hide();}
$.effects.restore(elem,props);done();}});};})(jQuery);(function($,undefined){$.effects.effect.pulsate=function(o,done){var elem=$(this),mode=$.effects.setMode(elem,o.mode||"show"),show=mode==="show",hide=mode==="hide",showhide=(show||mode==="hide"),anims=((o.times||5)*2)+(showhide?1:0),duration=o.duration/anims,animateTo=0,queue=elem.queue(),queuelen=queue.length,i;if(show||!elem.is(":visible")){elem.css("opacity",0).show();animateTo=1;}
for(i=1;i<anims;i++){elem.animate({opacity:animateTo},duration,o.easing);animateTo=1-animateTo;}
elem.animate({opacity:animateTo},duration,o.easing);elem.queue(function(){if(hide){elem.hide();}
done();});if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)));}
elem.dequeue();};})(jQuery);(function($,undefined){$.effects.effect.puff=function(o,done){var elem=$(this),mode=$.effects.setMode(elem,o.mode||"hide"),hide=mode==="hide",percent=parseInt(o.percent,10)||150,factor=percent/100,original={height:elem.height(),width:elem.width(),outerHeight:elem.outerHeight(),outerWidth:elem.outerWidth()};$.extend(o,{effect:"scale",queue:false,fade:true,mode:mode,complete:done,percent:hide?percent:100,from:hide?original:{height:original.height*factor,width:original.width*factor,outerHeight:original.outerHeight*factor,outerWidth:original.outerWidth*factor}});elem.effect(o);};$.effects.effect.scale=function(o,done){var el=$(this),options=$.extend(true,{},o),mode=$.effects.setMode(el,o.mode||"effect"),percent=parseInt(o.percent,10)||(parseInt(o.percent,10)===0?0:(mode==="hide"?0:100)),direction=o.direction||"both",origin=o.origin,original={height:el.height(),width:el.width(),outerHeight:el.outerHeight(),outerWidth:el.outerWidth()},factor={y:direction!=="horizontal"?(percent/100):1,x:direction!=="vertical"?(percent/100):1};options.effect="size";options.queue=false;options.complete=done;if(mode!=="effect"){options.origin=origin||["middle","center"];options.restore=true;}
options.from=o.from||(mode==="show"?{height:0,width:0,outerHeight:0,outerWidth:0}:original);options.to={height:original.height*factor.y,width:original.width*factor.x,outerHeight:original.outerHeight*factor.y,outerWidth:original.outerWidth*factor.x};if(options.fade){if(mode==="show"){options.from.opacity=0;options.to.opacity=1;}
if(mode==="hide"){options.from.opacity=1;options.to.opacity=0;}}
el.effect(options);};$.effects.effect.size=function(o,done){var original,baseline,factor,el=$(this),props0=["position","top","bottom","left","right","width","height","overflow","opacity"],props1=["position","top","bottom","left","right","overflow","opacity"],props2=["width","height","overflow"],cProps=["fontSize"],vProps=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],hProps=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],mode=$.effects.setMode(el,o.mode||"effect"),restore=o.restore||mode!=="effect",scale=o.scale||"both",origin=o.origin||["middle","center"],position=el.css("position"),props=restore?props0:props1,zero={height:0,width:0,outerHeight:0,outerWidth:0};if(mode==="show"){el.show();}
original={height:el.height(),width:el.width(),outerHeight:el.outerHeight(),outerWidth:el.outerWidth()};if(o.mode==="toggle"&&mode==="show"){el.from=o.to||zero;el.to=o.from||original;}else{el.from=o.from||(mode==="show"?zero:original);el.to=o.to||(mode==="hide"?zero:original);}
factor={from:{y:el.from.height/original.height,x:el.from.width/original.width},to:{y:el.to.height/original.height,x:el.to.width/original.width}};if(scale==="box"||scale==="both"){if(factor.from.y!==factor.to.y){props=props.concat(vProps);el.from=$.effects.setTransition(el,vProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,vProps,factor.to.y,el.to);}
if(factor.from.x!==factor.to.x){props=props.concat(hProps);el.from=$.effects.setTransition(el,hProps,factor.from.x,el.from);el.to=$.effects.setTransition(el,hProps,factor.to.x,el.to);}}
if(scale==="content"||scale==="both"){if(factor.from.y!==factor.to.y){props=props.concat(cProps).concat(props2);el.from=$.effects.setTransition(el,cProps,factor.from.y,el.from);el.to=$.effects.setTransition(el,cProps,factor.to.y,el.to);}}
$.effects.save(el,props);el.show();$.effects.createWrapper(el);el.css("overflow","hidden").css(el.from);if(origin){baseline=$.effects.getBaseline(origin,original);el.from.top=(original.outerHeight-el.outerHeight())*baseline.y;el.from.left=(original.outerWidth-el.outerWidth())*baseline.x;el.to.top=(original.outerHeight-el.to.outerHeight)*baseline.y;el.to.left=(original.outerWidth-el.to.outerWidth)*baseline.x;}
el.css(el.from);if(scale==="content"||scale==="both"){vProps=vProps.concat(["marginTop","marginBottom"]).concat(cProps);hProps=hProps.concat(["marginLeft","marginRight"]);props2=props0.concat(vProps).concat(hProps);el.find("*[width]").each(function(){var child=$(this),c_original={height:child.height(),width:child.width(),outerHeight:child.outerHeight(),outerWidth:child.outerWidth()};if(restore){$.effects.save(child,props2);}
child.from={height:c_original.height*factor.from.y,width:c_original.width*factor.from.x,outerHeight:c_original.outerHeight*factor.from.y,outerWidth:c_original.outerWidth*factor.from.x};child.to={height:c_original.height*factor.to.y,width:c_original.width*factor.to.x,outerHeight:c_original.height*factor.to.y,outerWidth:c_original.width*factor.to.x};if(factor.from.y!==factor.to.y){child.from=$.effects.setTransition(child,vProps,factor.from.y,child.from);child.to=$.effects.setTransition(child,vProps,factor.to.y,child.to);}
if(factor.from.x!==factor.to.x){child.from=$.effects.setTransition(child,hProps,factor.from.x,child.from);child.to=$.effects.setTransition(child,hProps,factor.to.x,child.to);}
child.css(child.from);child.animate(child.to,o.duration,o.easing,function(){if(restore){$.effects.restore(child,props2);}});});}
el.animate(el.to,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(el.to.opacity===0){el.css("opacity",el.from.opacity);}
if(mode==="hide"){el.hide();}
$.effects.restore(el,props);if(!restore){if(position==="static"){el.css({position:"relative",top:el.to.top,left:el.to.left});}else{$.each(["top","left"],function(idx,pos){el.css(pos,function(_,str){var val=parseInt(str,10),toRef=idx?el.to.left:el.to.top;if(str==="auto"){return toRef+"px";}
return val+toRef+"px";});});}}
$.effects.removeWrapper(el);done();}});};})(jQuery);(function($,undefined){$.effects.effect.shake=function(o,done){var el=$(this),props=["position","top","bottom","left","right","height","width"],mode=$.effects.setMode(el,o.mode||"effect"),direction=o.direction||"left",distance=o.distance||20,times=o.times||3,anims=times*2+1,speed=Math.round(o.duration/anims),ref=(direction==="up"||direction==="down")?"top":"left",positiveMotion=(direction==="up"||direction==="left"),animation={},animation1={},animation2={},i,queue=el.queue(),queuelen=queue.length;$.effects.save(el,props);el.show();$.effects.createWrapper(el);animation[ref]=(positiveMotion?"-=":"+=")+distance;animation1[ref]=(positiveMotion?"+=":"-=")+distance*2;animation2[ref]=(positiveMotion?"-=":"+=")+distance*2;el.animate(animation,speed,o.easing);for(i=1;i<times;i++){el.animate(animation1,speed,o.easing).animate(animation2,speed,o.easing);}
el.animate(animation1,speed,o.easing).animate(animation,speed/2,o.easing).queue(function(){if(mode==="hide"){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();});if(queuelen>1){queue.splice.apply(queue,[1,0].concat(queue.splice(queuelen,anims+1)));}
el.dequeue();};})(jQuery);(function($,undefined){$.effects.effect.slide=function(o,done){var el=$(this),props=["position","top","bottom","left","right","width","height"],mode=$.effects.setMode(el,o.mode||"show"),show=mode==="show",direction=o.direction||"left",ref=(direction==="up"||direction==="down")?"top":"left",positiveMotion=(direction==="up"||direction==="left"),distance,animation={};$.effects.save(el,props);el.show();distance=o.distance||el[ref==="top"?"outerHeight":"outerWidth"](true);$.effects.createWrapper(el).css({overflow:"hidden"});if(show){el.css(ref,positiveMotion?(isNaN(distance)?"-"+distance:-distance):distance);}
animation[ref]=(show?(positiveMotion?"+=":"-="):(positiveMotion?"-=":"+="))+
distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.easing,complete:function(){if(mode==="hide"){el.hide();}
$.effects.restore(el,props);$.effects.removeWrapper(el);done();}});};})(jQuery);(function($,undefined){$.effects.effect.transfer=function(o,done){var elem=$(this),target=$(o.to),targetFixed=target.css("position")==="fixed",body=$("body"),fixTop=targetFixed?body.scrollTop():0,fixLeft=targetFixed?body.scrollLeft():0,endPosition=target.offset(),animation={top:endPosition.top-fixTop,left:endPosition.left-fixLeft,height:target.innerHeight(),width:target.innerWidth()},startPosition=elem.offset(),transfer=$("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(o.className).css({top:startPosition.top-fixTop,left:startPosition.left-fixLeft,height:elem.innerHeight(),width:elem.innerWidth(),position:targetFixed?"fixed":"absolute"}).animate(animation,o.duration,o.easing,function(){transfer.remove();done();});};})(jQuery);var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r={b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b==="string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();(function(e){var t=!1,i=!1,o={isUrl:function(e){var t=RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return t.test(e)?!0:!1},loadContent:function(e,t){e.html(t)},addPrefix:function(e){var t=e.attr("id"),i=e.attr("class");"string"==typeof t&&""!==t&&e.attr("id",t.replace(/([A-Za-z0-9_.\-]+)/g,"sidr-id-$1")),"string"==typeof i&&""!==i&&"sidr-inner"!==i&&e.attr("class",i.replace(/([A-Za-z0-9_.\-]+)/g,"sidr-class-$1")),e.removeAttr("style")},execute:function(o,n,s){"function"==typeof n?(s=n,n="sidr"):n||(n="sidr");var a,d,l,c=e("#"+n),f=e(c.data("body")),u=e("html"),p=c.outerWidth(!0),y=c.data("speed"),v=c.data("side");if("open"===o||"toogle"===o&&!c.is(":visible")){if(c.is(":visible")||t)return;if(i!==!1)return r.close(i,function(){r.open(n)}),void 0;t=!0,"left"===v?(a={left:p+"px"},d={left:"0px"}):(a={right:p+"px"},d={right:"0px"}),l=u.scrollTop(),u.css("overflow-x","hidden").scrollTop(l),f.css({width:f.width(),position:"absolute"}).animate(a,y),c.css("display","block").animate(d,y,function(){t=!1,i=n,"function"==typeof s&&s(n)})}else{if(!c.is(":visible")||t)return;t=!0,"left"===v?(a={left:0},d={left:"-"+p+"px"}):(a={right:0},d={right:"-"+p+"px"}),l=u.scrollTop(),u.removeAttr("style").scrollTop(l),f.animate(a,y),c.animate(d,y,function(){c.removeAttr("style"),f.removeAttr("style"),e("html").removeAttr("style"),t=!1,i=!1,"function"==typeof s&&s(n)})}}},r={open:function(e,t){o.execute("open",e,t)},close:function(e,t){o.execute("close",e,t)},toogle:function(e,t){o.execute("toogle",e,t)}};e.sidr=function(t){return r[t]?r[t].apply(this,Array.prototype.slice.call(arguments,1)):"function"!=typeof t&&"string"!=typeof t&&t?(e.error("Method "+t+" does not exist on jQuery.sidr"),void 0):r.toogle.apply(this,arguments)},e.fn.sidr=function(t){var i=e.extend({name:"sidr",speed:200,side:"left",source:null,renaming:!0,body:"body"},t),n=i.name,s=e("#"+n);if(0===s.length&&(s=e("<div />").attr("id",n).appendTo(e("body"))),s.addClass("sidr").addClass(i.side).data({speed:i.speed,side:i.side,body:i.body}),"function"==typeof i.source){var a=i.source(n);o.loadContent(s,a)}else if("string"==typeof i.source&&o.isUrl(i.source))e.get(i.source,function(e){o.loadContent(s,e)});else if("string"==typeof i.source){var d="",l=i.source.split(",");if(e.each(l,function(t,i){d+='<div class="sidr-inner">'+e(i).html()+"</div>"}),i.renaming){var c=e("<div />").html(d);c.find("*").each(function(t,i){var r=e(i);o.addPrefix(r)}),d=c.html()}o.loadContent(s,d)}else null!==i.source&&e.error("Invalid Sidr Source");return this.each(function(){var t=e(this),i=t.data("sidr");i||(t.data("sidr",n),t.click(function(e){e.preventDefault(),r.toogle(n)}))})}})(jQuery);!function(a){"use strict";function b(a,b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):void 0}function c(a,b){var c,d;for(c=0,d=a.length;d>c;c++)if(a[c]===b)return!0;return!1}function d(a,b){var c;a.createTextRange?(c=a.createTextRange(),c.move("character",b),c.select()):a.selectionStart&&(a.focus(),a.setSelectionRange(b,b))}function e(a,b){try{return a.type=b,!0}catch(c){return!1}}a.Placeholders={Utils:{addEventListener:b,inArray:c,moveCaret:d,changeType:e}}}(this),function(a){"use strict";function b(){}function c(a){var b;return a.value===a.getAttribute(G)&&"true"===a.getAttribute(H)?(a.setAttribute(H,"false"),a.value="",a.className=a.className.replace(F,""),b=a.getAttribute(I),b&&(a.type=b),!0):!1}function d(a){var b,c=a.getAttribute(G);return""===a.value&&c?(a.setAttribute(H,"true"),a.value=c,a.className+=" "+E,b=a.getAttribute(I),b?a.type="text":"password"===a.type&&R.changeType(a,"text")&&a.setAttribute(I,"password"),!0):!1}function e(a,b){var c,d,e,f,g;if(a&&a.getAttribute(G))b(a);else for(c=a?a.getElementsByTagName("input"):o,d=a?a.getElementsByTagName("textarea"):p,g=0,f=c.length+d.length;f>g;g++)e=g<c.length?c[g]:d[g-c.length],b(e)}function f(a){e(a,c)}function g(a){e(a,d)}function h(a){return function(){q&&a.value===a.getAttribute(G)&&"true"===a.getAttribute(H)?R.moveCaret(a,0):c(a)}}function i(a){return function(){d(a)}}function j(a){return function(b){return s=a.value,"true"===a.getAttribute(H)&&s===a.getAttribute(G)&&R.inArray(C,b.keyCode)?(b.preventDefault&&b.preventDefault(),!1):void 0}}function k(a){return function(){var b;"true"===a.getAttribute(H)&&a.value!==s&&(a.className=a.className.replace(F,""),a.value=a.value.replace(a.getAttribute(G),""),a.setAttribute(H,!1),b=a.getAttribute(I),b&&(a.type=b)),""===a.value&&(a.blur(),R.moveCaret(a,0))}}function l(a){return function(){a===document.activeElement&&a.value===a.getAttribute(G)&&"true"===a.getAttribute(H)&&R.moveCaret(a,0)}}function m(a){return function(){f(a)}}function n(a){a.form&&(x=a.form,x.getAttribute(J)||(R.addEventListener(x,"submit",m(x)),x.setAttribute(J,"true"))),R.addEventListener(a,"focus",h(a)),R.addEventListener(a,"blur",i(a)),q&&(R.addEventListener(a,"keydown",j(a)),R.addEventListener(a,"keyup",k(a)),R.addEventListener(a,"click",l(a))),a.setAttribute(K,"true"),a.setAttribute(G,v),d(a)}var o,p,q,r,s,t,u,v,w,x,y,z,A,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],D="#ccc",E="placeholdersjs",F=new RegExp("(?:^|\\s)"+E+"(?!\\S)"),G="data-placeholder-value",H="data-placeholder-active",I="data-placeholder-type",J="data-placeholder-submit",K="data-placeholder-bound",L="data-placeholder-focus",M="data-placeholder-live",N=document.createElement("input"),O=document.getElementsByTagName("head")[0],P=document.documentElement,Q=a.Placeholders,R=Q.Utils;if(Q.nativeSupport=void 0!==N.placeholder,!Q.nativeSupport){for(o=document.getElementsByTagName("input"),p=document.getElementsByTagName("textarea"),q="false"===P.getAttribute(L),r="false"!==P.getAttribute(M),t=document.createElement("style"),t.type="text/css",u=document.createTextNode("."+E+" { color:"+D+"; }"),t.styleSheet?t.styleSheet.cssText=u.nodeValue:t.appendChild(u),O.insertBefore(t,O.firstChild),A=0,z=o.length+p.length;z>A;A++)y=A<o.length?o[A]:p[A-o.length],v=y.attributes.placeholder,v&&(v=v.nodeValue,v&&R.inArray(B,y.type)&&n(y));w=setInterval(function(){for(A=0,z=o.length+p.length;z>A;A++)y=A<o.length?o[A]:p[A-o.length],v=y.attributes.placeholder,v&&(v=v.nodeValue,v&&R.inArray(B,y.type)&&(y.getAttribute(K)||n(y),(v!==y.getAttribute(G)||"password"===y.type&&!y.getAttribute(I))&&("password"===y.type&&!y.getAttribute(I)&&R.changeType(y,"text")&&y.setAttribute(I,"password"),y.value===y.getAttribute(G)&&(y.value=v),y.setAttribute(G,v))));r||clearInterval(w)},100)}Q.disable=Q.nativeSupport?b:f,Q.enable=Q.nativeSupport?b:g}(this);register_command('likeComment',{onSuccess:function(data){commandUtils.updatePostScore(this.nodeId,data.result.score,true);}});register_command('share',{execute:function(evt){var $comment=$('#comment-'+this.nodeId);var ctx;if($comment.length>0){ctx=$.extend({shareURL:this.getParsedUrl('comment-url')},this.messages);ctx.description=this.getMessage("comment-description");ctx.title=this.getMessage("comment-title");}else{ctx=$.extend({shareURL:this.getParsedUrl('answer-url')},this.messages);}
var doptions={nodes:commandUtils.renderTemplate("share-dialog",ctx),shareURL:ctx.shareURL,title:ctx.title,yes_callback:function($dialog,close){close();},show_no:false,close_on_clickoutside:true,centered:false,event:ctx};return commandUtils.showDialog(doptions);}});register_command('deleteComment',{onSuccess:function(data){var $comment=$('#comment-'+this.nodeId);$comment.css('background','red');$comment.fadeOut('slow',function(){$comment.remove();});var post_id=data.result.firstNonCommentAncestor?data.result.firstNonCommentAncestor.id:data.result.parentNode.id;var fullCommentCount=data.result.firstNonCommentAncestor?data.result.firstNonCommentAncestor.fullCommentCount:data.result.parentNode.fullCommentCount;var $showCommentsLink=$("#"+post_id+"-show-comments-container");var $commentsContainer=$("#comments-container-"+post_id);var $commentFormContainer=$("#comment-"+post_id+"-form-container");$commentsContainer.append($commentFormContainer);$showCommentsLink.attr("commentCount",fullCommentCount);if(fullCommentCount===1){$commentsContainer.css("display")==="none"?$showCommentsLink.html("&middot; "+pageContext.i18n.showOneComment):$showCommentsLink.html("&middot; "+pageContext.i18n.hideOneComment);}else{if(fullCommentCount===0){$showCommentsLink.hide();}else{$commentsContainer.css("display")==="none"?$showCommentsLink.html("&middot; "+pageContext.i18n.showNComments.replace("$n",fullCommentCount)):$showCommentsLink.html("&middot; "+pageContext.i18n.hideNComments.replace("$n",fullCommentCount));}}}});register_command('voteUp',{onSuccess:function(data){if(data.result.cancelVoteAction!=undefined){commandUtils.updatePostScore(this.nodeId,data.result.score,false);}
else{var oldScore=parseInt($("#post-"+this.nodeId+"-score").text());if(oldScore==-1&&data.result.score==1){oldScore=0;}
commandUtils.updatePostScore(this.nodeId,oldScore+1,false);}
var voteDown=commandUtils.findAndExtractCommand(this.nodeId,'voteDown');if(voteDown.getStatus()=='on'){voteDown.onCompleted(true);}},updateLinkText:function(data){if(!this.element.hasClass("votes")){if(this.element.hasClass("on")){this.element.html(pageContext.i18n.unlike);}else{this.element.html(pageContext.i18n.like);}}}});register_command('voteDown',{onSuccess:function(data){commandUtils.updatePostScore(this.nodeId,data.result.score,false);var voteUp=commandUtils.findAndExtractCommand(this.nodeId,'voteUp');if(voteUp.getStatus()=='on'){voteUp.onCompleted(true);}}});register_command('acceptAnswer',{onSuccess:function(data){if(data.result.acceptAction.canceled){this.nodeElement.find('.labels .label-success').remove();this.nodeElement.find('.post-controls .accept-answer').text(pageContext.i18n.answer.controlBar.accept);this.nodeElement.find('.post-controls .accept-answer').prepend('<i class="icon-ok"></i> ');this.nodeElement.find('.post-controls .accept-answer').attr('title',pageContext.i18n.answer.controlBar.acceptCommand);this.nodeElement.removeClass('accepted-answer');}else{this.nodeElement.find('.labels').prepend('<span class="label label-success">'.concat(pageContext.i18n.answer.bestAnswer).concat('</span>'));this.nodeElement.find('.post-controls .accept-answer').text(pageContext.i18n.answer.controlBar.unaccept);this.nodeElement.find('.post-controls .accept-answer').prepend('<i class="icon-ok"></i> ');this.nodeElement.find('.post-controls .accept-answer').attr('title',pageContext.i18n.answer.controlBar.cancelAcceptedCommand);this.nodeElement.addClass('accepted-answer');}}});register_command('markFavorite',{onSuccess:function(data){var canceled;try{canceled=data.result.favoriteAction.canceled;}catch(e){console.log(e);return;}
if(canceled){$('#favorite-mark-'+this.nodeId+' i').removeClass('icon-star').addClass('icon-star-empty');}else{$('#favorite-mark-'+this.nodeId+' i').removeClass('icon-star-empty').addClass('icon-star');}
if(data.result.favoriteCount==0){$('#favorite-count-'+this.nodeId).html('');}else{$('#favorite-count-'+this.nodeId).html(data.result.favoriteCount);}}});register_command('reportPost',{execute:function(evt){if(this.getStatus()=="off"){var parser=this;commandUtils.showPrompt(evt,'flag-or-close-post-dialog',this.messages,{title:pageContext.i18n.reportQuestionModalTitle,beforeShow:function($dialog){$dialog.find('.prompt-examples').change(function(){$('textarea[name=prompt]').val($(this).val());});},onOk:function(data){parser.executeRequest(data);}});}else{this.confirm(evt,pageContext.i18n.confirmModalTitle,pageContext.i18n.cancelReportModalText);}},onSuccess:function(data){if(data.result.reportCount!=undefined){this.element.attr('reportCount',data.result.reportCount);}else{this.element.removeAttr('reportCount');}
this.updateLinkText();$(".alert").hide();if(this.getStatus()=="off"){$(".post-container[nodeid="+this.nodeId+"]").before("<div class='alert'>"+pageContext.i18n.reportSuccessText+"</div>");}else{$(".post-container[nodeid="+this.nodeId+"]").before("<div class='alert'>"+pageContext.i18n.reportCancelText+"</div>");}},updateLinkText:function(){var newLink=this.getMessage('link.'+(this.element.hasClass('on')?'on':'off'));if(this.element.attr('reportCount')!=null){newLink+=('('+this.element.attr('reportCount')+')');}
this.element.html(newLink);}});register_command('publishPost',{onSuccess:function(data){commandUtils.reloadPage();}});register_command('sendToMod',{onSuccess:function(data){commandUtils.reloadPage();}});register_command('deletePost',{onSuccess:function(data){var targetNode=this.nodeElement;if(!targetNode.is('.post-container')){targetNode=targetNode.parents('.post-container');}
if(data.result.deleteAction.canceled){targetNode.removeClass("deleted")}else{targetNode.addClass('deleted');}}});register_command('closeQuestion',{execute:function(evt){if(this.getStatus()=="off"){var parser=this;commandUtils.showPrompt(evt,'flag-or-close-post-dialog',this.messages,{title:pageContext.i18n.closeQuestionTitle,beforeShow:function($dialog){$dialog.find('.prompt-examples').change(function(){$('textarea[name=prompt]').val($(this).val());}).change();},onOk:function(data){parser.executeRequest(data);}});}else{this.confirm(evt,null,null);}},onSuccess:function(data){commandUtils.reloadPage();}});register_command('lockPost',{execute:function(evt){if(this.getStatus()=="off"){var parser=this;commandUtils.showPrompt(evt,'flag-or-close-post-dialog',this.messages,{title:pageContext.i18n.lockPostModalTitle,beforeShow:function($dialog){$dialog.find('.prompt-examples').change(function(){$('textarea[name=prompt]').val($(this).val());}).change();},onOk:function(data){parser.executeRequest(data);}});}else{this.confirm(evt,pageContext.i18n.confirmModalTitle,pageContext.i18n.unlockPostModalText);}},onSuccess:function(data){commandUtils.reloadPage();}});register_command('wikifyPost',{onSuccess:function(data){if(data.result.wikifyAction.canceled){this.nodeElement.find('.labels .label-info.label-wiki').remove();}else{this.nodeElement.find('.labels').prepend('<span class="label label-info label-wiki">'.concat(pageContext.i18n.wiki).concat('</span>'));}
commandUtils.reloadPage();}});register_command('convertToComment',{execute:function(evt){var parser=this;$.getJSON(this.getParsedUrl('candidates'),function(data){$.each(data.result.parentCandidates,function(i,post){if(post.type=="question"){post.summary=parser.getMessage('question');}else{var postAuthor=(pageContext.userRealName&&post.author.realname)?post.author.realname:post.author.username;post.summary=parser.getMessage('answer')+' ('+pageContext.i18n.by+' '+postAuthor+', '+
commandUtils.friendlyDate(new Date(post.creationDate))+')';}});$.extend(data.result,parser.messages);parser.dialog(evt,'convert-to-comment-dialog',data.result,pageContext.i18n.commandsConvertToCommentTitle);});},onSuccess:function(data){commandUtils.reloadPage();}});register_command('convertToAnswer',{execute:function(evt){this.confirm(evt,pageContext.i18n.confirmModalTitle,pageContext.i18n.convertToAnswerText);},onSuccess:function(data){commandUtils.reloadPage();}});register_command('redirectQuestion',{execute:function(evt){if(this.getStatus()=="off"){var parser=this;commandUtils.showPrompt(evt,'redirect-question-dialog',this.messages,{extra_class:"redirectDialog",title:pageContext.i18n.postControlsRedirectTitle,beforeShow:function($dialog){var $searchQuestion=$dialog.find('.textInput');$searchQuestion.autocomplete({minLength:0,appendTo:"#results",highlight:function(match,keywords){keywords=keywords.split(' ').join('|');return match.replace(new RegExp("("+keywords+")","gi"),'<b>$1</b>');},source:function(request,response){$.ajax({url:parser.getParsedUrl('search'),dataType:'json',minLength:0,delay:30,data:{q:request.term,page:1,pageSize:5,type:"question"},success:function(data){response($.map(data.searchResults.results,function(item,index){if(item!=null){return{desc:item.title,label:item.title.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+
$.ui.autocomplete.escapeRegex(request.term)+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>"),value:item.id};}}));}});},change:function(event,ui){var _autocomplete_value=$(this).val();if($('.ui-autocomplete li a').filter(function(){return $(this).text().trim()==_autocomplete_value;}).size()==0){$dialog.find('.textInput').val('');$dialog.find("input[name=to]").val('');}},select:function(event,ui){$dialog.find('.textInput').val(ui.item.desc);$dialog.find("input[name=to]").val(ui.item.value);return false;}});if($searchQuestion.length){$searchQuestion.data("ui-autocomplete")._renderItem=function(ul,item){ul.addClass("redirect-autocomplete-ul");return $("<li></li>").data("ui-autocomplete-item",item).append("<a>"+item.label+"</a>").appendTo(ul);};}},onOk:function(data){if(data.to){parser.executeRequest(data);}}});}else{this.confirm(evt,null,null);}},onSuccess:function(data){if(this.getStatus()=="off"){commandUtils.reloadPage();}else{$(".alert").hide();if(window.history.replaceState){var uri=window.location.toString();if(uri.indexOf("?")>0){var clean_uri=uri.substring(0,uri.indexOf("?")).replace(/#[^#]*$/,'');window.history.replaceState({},document.title,clean_uri);}}}}});register_command('moveToSpace',{execute:function(evt){var parser=this;$.getJSON(this.getParsedUrl('candidates'),function(data){$.extend(data.result,parser.messages);parser.dialog(evt,'move-to-space-dialog',data.result,pageContext.i18n.commandsMoveToSpace);});},onSuccess:function(data){commandUtils.reloadPage();}});register_command('switchPrivacy',{execute:function(evt){var parser=this;parser.dialog(evt,'switch-privacy-dialog',null,pageContext.i18n.confirmModalTitle);},onSuccess:function(data){commandUtils.reloadPage();}});register_command('giveReputation',{execute:function(evt){if(this.getStatus()=="off"){var parser=this;var ctx=$.extend({isAnswer:this.nodeElement.is('.answer-container')||this.nodeElement.parents('.answer-container').length,currentUserPoints:pageContext.currentUser.reputation},this.messages);commandUtils.showPrompt(evt,'give-reputation-dialog',ctx,{title:pageContext.i18n.commandsGiveReputation,onOk:function(data){data.node=parser.nodeId;if(data.points.match(/^[1-9]\d*$/)==null){$("#invaliderror").text(pageContext.i18n.invalidReputation);return false;}else{parser.executeRequest(data);}}});}},onSuccess:function(data,evt){if(data.success==false){commandUtils.showMessage(evt,data.errors.status,function(){commandUtils.reloadPage();});}
else{commandUtils.showMessage(evt,pageContext.i18n.commandsGiveReputationSuccess,function(){commandUtils.reloadPage();},pageContext.i18n.commandsGiveReputationSuccess);}}});$(document).ready(function(){$(".post-votes-modal").on("show",function(e){var $cur=$(this);var $curBody=$cur.find(".modal-body");var $curUl=$curBody.find("ul");var spinner="<li class='spinner'><i class='icon-spinner icon-spin icon-2x'></i></li>";if($cur.siblings(".post-score-wrapper").hasClass("positive")){var page=0;var pageSize=25;var updateList=function(follows){$.ajax({url:getVotesJsonUrl.replace("%7Bnode%7D",$cur.parent().attr("nodeId")),beforeSend:function(){if($curUl.find(".spinner").length==0){$curUl.append("<li class='spinner'><i class='icon-spinner icon-spin icon-2x'></i></li>");}},data:{page:page,pageSize:pageSize},success:function(data){page++;if(data.votes.length<pageSize){$curBody.unbind("scroll");}
$curUl.find(".spinner").remove();$.each(data.votes,function(i,vote){var context={user:vote.user};context.user.profileUrl=pageContext.url.profile.replace("{id}",vote.user.id).replace("{plug}",vote.user.username);context.user.displayName=(pageContext.userRealName&&vote.user.realname)?vote.user.realname:vote.user.username;context.follows=follows;$curUl.append(commandUtils.renderTemplate('user-with-follow',context));});commandUtils.initializeLabels();}});};if($cur.find("ul").children().length<1){var follows;$.ajax({url:pageContext.url.getUserFollows.replace("%7Buser%7D",pageContext.currentUser.id),beforeSend:function(){$cur.find("ul").append(spinner);},success:function(data){follows=data.follows;updateList(follows);$curBody.scroll(function(){if($curBody.scrollTop()>=$curUl.height()-$curBody.height()-10){updateList(follows);}});}});}}else{e.preventDefault();e.stopPropagation();}});});function initCommandOverrides(){function showWikiMark($el){var context={canEdit:false,isAnswer:false};var $editlink=$el.find('.node-tools-edit-link');if($editlink.length>0){if($el.parents("[nodeid]:first").is('.answer')){context.isAnswer=true;}
context.canEdit=true;context.editUrl=$editlink.attr('href');}
$el.append(commandUtils.renderTemplate('post-wiki-mark',context));}
function removeWikiMark($el){$el.find('.community-wiki').remove();}
commands.wikifyPost.showWikiMark=showWikiMark;commands.wikifyPost.removeWikiMark=removeWikiMark;commands.wikifyPost.updateLinkText=function(){var text=this.getLinkText();if(text!=null){this.element.html(text);}
if(this.getStatus()=='on'){showWikiMark(this.element.parents('.post-controls'));}else{removeWikiMark(this.element.parents('.post-controls'));}};}
var tools={roles:null,settings:null,questionAuthor:null,init:function(roles,settings){this.roles=roles;this.settings=settings;},roleOrAuthor:function(r1,isAuthor,r2){return r1||(isAuthor&&r2);},rel:function(rel){var userId=pageContext.currentUser.id;var ar=this.roles.a;var qr=this.roles.q;var cr=this.roles.c;var nr=this.roles.n;var mr=this.roles.m;for(var id in rel){var nodeRel=rel[id];var authorId=$("[nodeid="+id+"]").attr("authorId");var isAuthor=userId==authorId;var $topContainer;if(nodeRel.type=="answer"){$topContainer=$('#answer-'+id);}else{$topContainer=$('#question-container');}
setupComments($topContainer,(!nodeRel.locked&&this.roleOrAuthor(nr.c,isAuthor,nr.co)),nodeRel.locked,this.roles.pc);}}}
var setupComments=function($topContainer,canUseComments,commentsLocked,pcPermissions,defaultVisibility,autoExpandComments){if($topContainer.find('.comment-form-container').find('form').length==0){return;}
if(!defaultVisibility){defaultVisibility='full';}
if(autoExpandComments)
{var commentsContainer=$topContainer.find('.comments-container');var showCommentsContainerLink=$topContainer.find('.show-comments-container');commentsContainer.slideToggle(400,function(){updateShowComments(showCommentsContainerLink,parseInt(showCommentsContainerLink.attr('commentcount')),commentsContainer)});}
create_object(CommentsBox).initialize($topContainer,canUseComments,commentsLocked,pcPermissions,defaultVisibility);}
function updateShowComments($link,count,commentsContainer){if(count===1){commentsContainer.css("display")==="none"?$link.html(pageContext.i18n.showOneComment):$link.html(pageContext.i18n.hideOneComment);}else{commentsContainer.css("display")==="none"?$link.html(pageContext.i18n.showNComments.replace("$n",count)):$link.html(pageContext.i18n.hideNComments.replace("$n",count));}}
var CommentsBox={initialize:function($topContainer,canUseComments,commentsLocked,pcPermissions,defaultVisibility){var $container=$topContainer.find('.comment-form-container');var $comment_tools=$topContainer.find('.comment-tools');this.elements={topContainer:$topContainer,formContainer:$container,postControls:$topContainer.find('.post-controls'),commentTools:$topContainer.find('.comment-tools'),commentsContainer:$topContainer.find('.comments-container'),showCommentsContainerLink:$topContainer.find('.show-comments-container'),form:$container.find('form'),textarea:$container.find('textarea'),extraInputs:$container.find('.comment-form-extra-inputs'),submitButton:$container.find('.comment-submit'),cancelButton:$container.find('.comment-cancel'),charsLeftMessage:$container.find('.comments-chars-left-msg'),charsToGoMessage:$container.find('.comments-chars-togo-msg'),charsExceededMessage:$container.find('.comments-chars-exceeded-msg'),charsCounter:$container.find('.comments-char-left-count'),showAllCommentsLink:$comment_tools.find('.show-all-comments-link'),addCommentLink:$comment_tools.find('.add-comment-link'),commentsLockedLabel:$container.parent().find('.comments-locked'),recipientsMenu:$container.find('.comment-recipient-container'),recipientsLabel:$container.find('.comment-recipients-label'),recipientsType:$container.find('input[name="visibility"]')};var chars_limits=this.elements.charsCounter.html().split('|');this.options={'commentsLocked':commentsLocked,'canUseComments':canUseComments,'pcPermissions':pcPermissions,'defaultVisibility':defaultVisibility,minLength:parseInt(chars_limits[0]),maxLength:parseInt(chars_limits[1]),commentsEditor:pageContext.options&&pageContext.options.commentsEditor?pageContext.options.commentsEditor:null};this.options.warnLength=this.options.maxLength-30;this.state={currentLength:0,inputCheckInterval:null,editing:null,replying:null,formContext:null,inPanelsTransition:false,currentPanel:'comments',panelsContent:{}};this.setupUiMods();this.setupCallbacks();},listenToFormChanges:function(){if(this.state.inputCheckInterval){window.clearInterval(this.state.inputCheckInterval);}
var self=this;var options=self.options;var elements=self.elements;var state=self.state;this.state.inputCheckInterval=window.setInterval(function(){var tmpobj=$("<p>"+elements.textarea.val().trim().replace(/[ ]{2,}/g," ")+"</p>");var re=new RegExp(['^[\\#\\-\\>]\\s','^\\s?\\d+\\.\\s','\\*{1,3}([^\\n\\*]+)\\*{1,3}'].join('|'),'gi');var length=tmpobj.text().replace(re,'$1').length;if(state.currentLength==length)
return;if(length<options.warnLength){elements.charsCounter.removeClass('warn');}else if(length>=options.warnLength){elements.charsCounter.addClass('warn');}
if(length<options.minLength){elements.charsLeftMessage.hide();elements.charsExceededMessage.hide();elements.charsToGoMessage.show();elements.charsCounter.html(options.minLength-length);elements.charsCounter.addClass('warn');}else if(length>options.maxLength){elements.charsLeftMessage.hide();elements.charsToGoMessage.hide();elements.charsCounter.html(options.maxLength);elements.charsExceededMessage.show();elements.charsCounter.addClass('warn');}else{elements.charsToGoMessage.hide();elements.charsExceededMessage.hide();elements.charsLeftMessage.show();elements.charsCounter.html(options.maxLength-length);elements.charsCounter.removeClass('warn');}
if(length>options.maxLength||length<options.minLength){elements.submitButton.attr("disabled","disabled");}else{elements.submitButton.removeAttr("disabled");}
state.currentLength=length;},200);},cleanupForm:function(){if(this.state.inputCheckInterval){window.clearInterval(this.state.inputCheckInterval);this.state.inputCheckInterval=null;}
$(this.elements.textarea).val("");this.elements.extraInputs.html('');this.elements.textarea.css('height',200);this.elements.charsCounter.html(this.options.maxLength);this.elements.charsLeftMessage.removeClass('warn');this.state.currentLength=0;this.state.editing=null;this.state.replying=null;this.state.formContext=null;this.elements.charsLeftMessage.hide();this.elements.charsExceededMessage.hide();this.elements.charsToGoMessage.show();this.elements.charsCounter.removeClass('warn');this.elements.charsCounter.html(this.options.minLength);this.elements.submitButton.attr("disabled","disabled");if(this.elements.attachments){this.elements.attachments.img.html('');this.elements.attachments.node.html('');}},showForm:function($location){if($location){var cur=this;this.elements.formContainer.slideUp(400,function(){$location.after(cur.elements.formContainer);});}
this.elements.formContainer.slideDown('slow');this.elements.addCommentLink.find("a").attr('disabled',"true");this.elements.showAllCommentsLink.fadeOut('slow');this.elements.commentsContainer.find('.comment-reply').attr('disabled',"true");$(this.elements.textarea).focus();this.elements.extraInputs.html('');this.elements.recipientsLabel.text(pageContext.i18n.commentVisibility[this.options.defaultVisibility]);this.elements.recipientsType.val(this.options.defaultVisibility);if(this.options.pcPermissions.u){if(this.state.editing){this.elements.recipientsMenu.hide();}else{this.elements.recipientsMenu.show();}}
this.listenToFormChanges();},hideForm:function(fun){var self=this;this.elements.formContainer.slideUp('slow',function(){self.cleanupForm();if(typeof fun!=="undefined"){fun();}});this.elements.addCommentLink.find("a").removeAttr('disabled');this.elements.showAllCommentsLink.fadeIn('slow');this.elements.commentsContainer.find('.comment-reply').removeAttr('disabled');},setupUiMods:function(){var self=this;if(this.options.commentsLocked){this.elements.commentsLockedLabel.show();}
var $wmdBar=$('<div></div>');this.elements.textarea.before($wmdBar);this.elements.wmdBar=$wmdBar;var editor=createWmd({});var attachments=null;if(pageContext.options.commentsAttachmentsEnabled){var $mainAttachmentsContainer=$('<div class="comments-form-attachments"></div>');var $attachmentsContainer=$('<div></div>');var $imgAttachmentsContainer=$('<div></div>');$mainAttachmentsContainer.append($attachmentsContainer);$mainAttachmentsContainer.append($imgAttachmentsContainer);this.elements.textarea.after($mainAttachmentsContainer);this.elements.attachments={main:$mainAttachmentsContainer,node:$attachmentsContainer,img:$imgAttachmentsContainer};self.addAttachmentToForm=function(attachment){var $el=null;function createDeleteButton(){return $('<a class="node-attachment-delete" href="#">x</a>');}
if(attachment.isImage){$el=$('<div class="img-node-attachment"></div>');var $link=$('<a href="'+attachment.url+'" target="_blank"></a>');$link.append($('<img src="'+attachment.url+'" width="100" />'));$link.append($('<span>'+attachment.fileName+'('+attachment.size+')'+'</span>'));$el.append($link);$el.append($('<input type="hidden" name="attachments" value="'+attachment.fileId+'" />'));$el.append(createDeleteButton());$imgAttachmentsContainer.append($el);}else{$el=$('<div class="node-attachment"></div>');$el.append('<span class="attachment-icon"></span>');$el.append($('<a href="'+attachment.url+'" target="_blank">'+attachment.fileName+'</a>'));$el.append($('<span> ('+attachment.size+')</span>'));$el.append($('<input type="hidden" name="attachments" value="'+attachment.fileId+'" />'));$el.append(createDeleteButton());$attachmentsContainer.append($el);}};attachments={authorize:function(image){var current=[];$attachmentsContainer.find('input[name=attachments]').each(function(){current.push($(this).val());});var ret={};$.extend(ret,pageContext.authorizeUploadContext);if(current.length>0){ret.current=current;}
if(image){ret.image=image;}
return ret;},toForm:self.addAttachmentToForm};}
editor.wmd();editor.wmdBase({'buttonBar':this.elements.wmdBar.get(0),'input':this.elements.textarea.get(0)},false,attachments);editor.Util.startEditor();if(this.elements.attachments){self.attachmentsToComment=function($comment,attachments){if($comment.find('.comment-text:first').next().is('.node-attachments')){$comment.find('.comment-text:first').next().remove();}
var $attachments=$('<div class="node-attachments"></div>');$comment.find('.comment-text:first').after($attachments);$.each(attachments,function(i,attachment){var $attachment=$('<div><span></span></div>');$attachment.find('span').addClass(attachment.isImage?'img-attachment-icon':'attachment-icon');$attachment.append($('<a href="'+attachment.url+'">'+attachment.fileName+'</a>'));$attachment.append($('<span>'+'('+attachment.size+')'+'</span>'));$attachments.append($attachment);});};}
this.setupRecipientsMenu();},setupRecipientsMenu:function(){var self=this;var perm=this.options.pcPermissions;if(perm.u&&(perm.op||perm.m||perm.og||perm.as||perm.ag)){if(!perm.op){this.elements.recipientsMenu.find('.comment-recipients-selector[value=op]').parent().remove();}
if(!perm.m){this.elements.recipientsMenu.find('.comment-recipients-selector[value=mod]').parent().remove();}
if(!(perm.op&&perm.m)){this.elements.recipientsMenu.find('.comment-recipients-selector[value=opAndMod]').parent().remove();}
if(!(perm.og||perm.ag||perm.as)){this.elements.recipientsMenu.find('.comment-recipients-selector[value=recipient]').parent().remove();}
this.elements.recipientsMenu.find('.comment-recipients-selector').click(function(e){var value=$(this).attr('value');if(value!='recipient'){self.elements.recipientsLabel.text(pageContext.i18n.commentVisibility[value]);self.elements.recipientsType.val(value);}else{$.getJSON(pageContext.url.possibleCommentRecipients.replace("%ID%",self.elements.formContainer.parents("[nodeid]").attr("nodeid")),function(data){var context=data.result;context.groupsCheck=data.result.groups.length<=5;context.msg=pageContext.i18n.commentVisibility;context.perm=perm;commandUtils.showPrompt(e,"advanced-visibility-dialog",context,{title:pageContext.i18n.commentVisibility.dialogTitle,onOk:function(data){if(data.recipients||data.specialRecipients){self.elements.extraInputs.html('');if(data.recipients){if(data.recipients.constructor!=Array){data.recipients=[data.recipients];}
$.each(data.recipients,function(i,recipient){self.elements.extraInputs.append('<input type="hidden" name="recipients" value="'+recipient+'" />');});}
if(data.specialRecipients){if(data.specialRecipients.constructor!=Array){data.specialRecipients=[data.specialRecipients];}
$.each(data.specialRecipients,function(i,recipient){self.elements.extraInputs.append('<input type="hidden" name="specialRecipients" value="'+recipient+'" />');});}
self.elements.recipientsLabel.text(pageContext.i18n.commentVisibility['other']);self.elements.recipientsType.val('recipient');}},beforeShow:function($dialog){if(!context.groupsCheck){var groupsSource=[];$.each(context.groups,function(i,group){groupsSource.push({label:group.name,value:group.id})});var $autocomplete=$dialog.find('.comment-recipients-groups-autocomplete');var $selectedContainer=$dialog.find('.comment-recipients-groups-container');$autocomplete.autocomplete({source:groupsSource,select:function(e,ui){if($selectedContainer.find('span.group[name='+ui.item.value+']').length==0){var $newEl=$('<span class="group" style="margin-right: 5px;" name="'+ui.item.value+'">'+ui.item.label+' <a href="#" title="Removing tag">(x)</a>'+'<input type="hidden" name="recipients" value="'+ui.item.value+'" />'+'</span>');$selectedContainer.append($newEl);$newEl.find('a').click(function(){$newEl.remove();return false;});}
$autocomplete.val('');return false;}});}}});});}
self.elements.recipientsMenu.removeClass("open");return false;});}else{this.elements.recipientsMenu.remove();self.elements.recipientsType.val("full");}},setupCallbacks:function(){var self=this;self.elements.showAllCommentsLink.click(function(){if($(this).is('.loading')){return false;}
$(this).addClass('loading');self.loadComments(pageContext.url.getComments.replace("%25ID%25",self.elements.formContainer.parents("[nodeid]").attr("nodeid")),self.elements.commentsContainer,'',null);$(this).fadeOut('fast',function(){$(this).remove();});return false;});self.elements.showCommentsContainerLink.click(function(){self.elements.commentsContainer.slideToggle(400,function(){updateShowCommentsLink(self.elements.showCommentsContainerLink,parseInt(self.elements.showCommentsContainerLink.attr('commentcount')))});});self.elements.addCommentLink.click(function(){self.cleanupForm();if(self.elements.topContainer.attr("class")=="question-container"){self.showForm(self.elements.postControls);}else{self.showForm(self.elements.commentTools);}
return false;});self.elements.cancelButton.click(function(event){if(self.state.editing){$('#comment-'+self.state.editing).slideDown('slow');}
self.hideForm();return false;});self.elements.submitButton.click(function(evt){if(evt.handled!==true){evt.handled=true;self.elements.submitButton.attr('disabled','disabled');var post_data=commandUtils.extractFormData(self.elements.form);if(self.state.editing){post_data['edit']='true';}else{post_data['edit']='false';}
if(self.state.formContext){$.extend(post_data,self.state.formContext);}
$.ajax({'type':'POST','url':self.elements.form.attr('action'),'data':post_data,'dataType':'json','traditional':true,'success':function(data){if(data.comment!=undefined){var post_id=data['comment']['parentId'];var comment_id=data['comment']['id'];var now=Date.today().setTimeToNow();data.commentDate=now.toString("MMM dd")+", "+now.toString("h:mm tt")+new Date().getUTCOffset();data.commentDateFriendly="("+pageContext.i18n.justNow+")";data.author=pageContext.currentUser;data.parentAuthor={username:$('#comment-'+post_id+' .comment-user').html(),url:$('#comment-'+post_id+' .comment-user').attr('href'),avatar:$('#comment-'+post_id+' .comment-user-gravatar img').attr('src')};data.revisionUrl=pageContext.url.revisionView.replace('{nodeId}',data.comment.id);if($('#comment-'+post_id+' .comment-user').html()==null){data.parentAuthor={username:$('#answer-'+post_id+' .answer_author').html(),url:$('#answer-'+post_id+' .answer_author').attr('href'),avatar:$('#answer-'+post_id+' .answer-gravatar img').attr('src')};}
self.elements.commentsContainer.find('.comments-empty').remove();if(post_data['edit']=='true'){$('#comment-'+comment_id).find('.comment-text:first').html(data['comment']['bodyAsHTML']);if(self.elements.attachments){self.attachmentsToComment($('#comment-'+comment_id),data.comment.attachments?data.comment.attachments:[]);}}else{var $new_comment=commandUtils.renderTemplate('new-comment-skeleton',data);$("[rel=user]",$new_comment).each(function(){createUserPopOver($(this));});commandUtils.initializeLabelsOnElement($new_comment);if(self.state.replying){var $container=$('#comment-'+self.state.replying);$container.append($new_comment);}else{$new_comment.addClass('even');self.elements.commentsContainer.append($new_comment);}
if(self.elements.attachments&&data.comment.attachments){self.attachmentsToComment($('#comment-'+comment_id),data.comment.attachments);}}
self.hideForm(function(){self.elements.commentsContainer.slideDown("400",function(){$('#comment-'+comment_id).slideDown('slow',function(){$('html, body').animate({scrollTop:$('#comment-'+comment_id).offset().top},1000);if(data.comment.depth===0){var $showCommentsLink=$("#"+post_id+"-show-comments-container");var $commentCount=parseInt($showCommentsLink.attr("commentCount"))+1;$showCommentsLink.attr("commentCount",$commentCount);updateShowCommentsLink($showCommentsLink,$commentCount);}});});});if(data.comment.activeRevisionId){$('#comment-'+comment_id).attr('activerev',data.comment.activeRevisionId);}}else{}
self.elements.submitButton.removeAttr("disabled");self.state.submitting=false;}});}
return false;});$(document).on('click','#'+self.elements.commentsContainer.attr('id')+' .comment-edit',function(){self.cleanupForm();var $link=$(this);var $parent=$link.parents('.comment:first');var comment_id=$parent.attr('nodeid');var activerev_id=$parent.attr('activerev');var $comment=$('#comment-'+comment_id);self.state.editing=comment_id;self.state.formContext={node:comment_id,revisionId:activerev_id};$.post(pageContext.url.getRevision,{revision:activerev_id},function(revision){if(revision.body!=undefined){$(self.elements.textarea).val(revision.body);}else{}},"json");if(self.elements.attachments){$comment.find('.node-attachments:first').find('.node-attachment').each(function(){var $attachment=$(this);var attachment={};attachment.isImage=$attachment.find('.img-attachment-icon').length>0;attachment.url=$attachment.find('a').attr('href');attachment.fileName=$attachment.find('a').text();attachment.size=$attachment.find('span:last').text();attachment.size=/\(([^\)]*)\)/.exec(attachment.size)[1];attachment.fileId=/\/(\d+)\-/.exec(attachment.url)[1];self.addAttachmentToForm(attachment);});}
$comment.slideUp('slow');self.showForm($comment);return false;});function updateShowCommentsLink($link,count){if(count===1){self.elements.commentsContainer.css("display")==="none"?$link.html(pageContext.i18n.showOneComment):$link.html(pageContext.i18n.hideOneComment);}else{self.elements.commentsContainer.css("display")==="none"?$link.html(pageContext.i18n.showNComments.replace("$n",count)):$link.html(pageContext.i18n.hideNComments.replace("$n",count));}}
$(document).on('click','#'+self.elements.commentsContainer.attr('id')+' .comment-replies-show',function(){var $link=$(this);var $parent=$($link.parents('.comment')[0]);var comment_id=$parent.attr('nodeid');$link.remove();self.loadComments(pageContext.url.getComments.replace("%25ID%25",comment_id),$parent,'',null);return false;});$(document).on('click','#'+self.elements.commentsContainer.attr('id')+' .comments-expand',function(){var $link=$(this);var $parent=$link.parent("[nodeid]:first");if(!$parent[0]){$parent=$link.parent().parent().parents("[nodeid]:first");}
var comment_id=$parent.attr('nodeid');$link.remove();self.loadComments(pageContext.url.getComments.replace("%25ID%25",comment_id),$parent.is('.comment')?$parent:self.elements.commentsContainer,'',null);return false;});if(self.options.commentsLocked){$('head').append('<style type="text/css">#'+self.elements.commentsContainer.attr('id')+' .comment-reply{visibility: hidden;}</style>');}else{$(document).on('click','#'+self.elements.commentsContainer.attr('id')+' .comment-reply',function(){self.cleanupForm();var $parentContainer=$(this).parents("#"+$(this).attr("id").replace("-reply",""));var in_reply_id=$parentContainer.attr('nodeid');self.state.replying=in_reply_id;self.state.formContext={inReply:in_reply_id};self.showForm($parentContainer);return false;});}},renderLoadedComments:function($container,comments,jsonRelation){var self=this;for(var i=0;i<comments.length;i++){var comment=comments[i];var tplData={showTools:false};tplData.comment=comment;tplData.author={id:comment.author.id,username:comment.author.username,url:pageContext.url.profile.replace("{id}",comment.author.id).replace("{plug}",comment.author.username),avatar:comment.author.avatar};tplData.parentAuthor={username:$('#comment-'+comment.parentId+' .comment-user').html(),url:$('#comment-'+comment.parentId+' .comment-user').attr('href'),avatar:$('#comment-'+comment.parentId+' .comment-user-gravatar img').attr('src')}
tplData.commentDate=comment.creationDate;tplData.commentDateFriendly=commandUtils.friendlyDate(new Date(comment.creationDate));tplData.crel=jsonRelation[comment.id];tplData.revisionUrl=pageContext.url.revisionView.replace('{nodeId}',comment.id);var $el=commandUtils.renderTemplate('new-comment-skeleton',tplData);commandUtils.initializeLabelsOnElement($el);if(i>0){$container.find('#comment-'+comments[i-1].id).after($el);}else{$container.append($el);}
if(self.elements.attachments&&comment.attachments){self.attachmentsToComment($el,comment.attachments);}
if(comment.replies&&comment.replies.comments){self.renderLoadedComments($el,comment.replies.comments,comment.replies.jsonRelation?comment.replies.jsonRelation:null);}}
if(jsonRelation){tools.rel(jsonRelation);}},loadComments:function(url,$container,no_comments_text,callback){var self=this;$.getJSON(url,function(data){if(data.success){if($container.is('.comment')){$container.find('.comment').remove();}else{$container.html('');}
if(data.result.comments&&data.result.comments.length==0){self.elements.commentsContainer.html('<span class="comments-empty">'+no_comments_text+'</span>');}else{if(data.result.replies){self.renderLoadedComments($container,data.result.replies.comments,data.result.replies.jsonRelation);}else{self.renderLoadedComments($container,data.result.comments,data.result.jsonRelation);}}
self.elements.commentTools.find('.comments-showing').fadeOut('slow');if(callback){callback();}}});}}
window['rangy']=(function(){var OBJECT="object",FUNCTION="function",UNDEFINED="undefined";var domRangeProperties=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"];var domRangeMethods=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"];var textRangeProperties=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"];var textRangeMethods=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint","getBoundingClientRect"];function isHostMethod(o,p){var t=typeof o[p];return t==FUNCTION||(!!(t==OBJECT&&o[p]))||t=="unknown";}
function isHostObject(o,p){return!!(typeof o[p]==OBJECT&&o[p]);}
function isHostProperty(o,p){return typeof o[p]!=UNDEFINED;}
function createMultiplePropertyTest(testFunc){return function(o,props){var i=props.length;while(i--){if(!testFunc(o,props[i])){return false;}}
return true;};}
var areHostMethods=createMultiplePropertyTest(isHostMethod);var areHostObjects=createMultiplePropertyTest(isHostObject);var areHostProperties=createMultiplePropertyTest(isHostProperty);function isTextRange(range){return range&&areHostMethods(range,textRangeMethods)&&areHostProperties(range,textRangeProperties);}
var api={version:"1.2.3",initialized:false,supported:true,util:{isHostMethod:isHostMethod,isHostObject:isHostObject,isHostProperty:isHostProperty,areHostMethods:areHostMethods,areHostObjects:areHostObjects,areHostProperties:areHostProperties,isTextRange:isTextRange},features:{},modules:{},config:{alertOnWarn:false,preferTextRange:false}};function fail(reason){window.alert("Rangy not supported in your browser. Reason: "+reason);api.initialized=true;api.supported=false;}
api.fail=fail;function warn(msg){var warningMessage="Rangy warning: "+msg;if(api.config.alertOnWarn){window.alert(warningMessage);}else if(typeof window.console!=UNDEFINED&&typeof window.console.log!=UNDEFINED){window.console.log(warningMessage);}}
api.warn=warn;if({}.hasOwnProperty){api.util.extend=function(o,props){for(var i in props){if(props.hasOwnProperty(i)){o[i]=props[i];}}};}else{fail("hasOwnProperty not supported");}
var initListeners=[];var moduleInitializers=[];function init(){if(api.initialized){return;}
var testRange;var implementsDomRange=false,implementsTextRange=false;if(isHostMethod(document,"createRange")){testRange=document.createRange();if(areHostMethods(testRange,domRangeMethods)&&areHostProperties(testRange,domRangeProperties)){implementsDomRange=true;}
testRange.detach();}
var body=isHostObject(document,"body")?document.body:document.getElementsByTagName("body")[0];if(body&&isHostMethod(body,"createTextRange")){testRange=body.createTextRange();if(isTextRange(testRange)){implementsTextRange=true;}}
if(!implementsDomRange&&!implementsTextRange){fail("Neither Range nor TextRange are implemented");}
api.initialized=true;api.features={implementsDomRange:implementsDomRange,implementsTextRange:implementsTextRange};var allListeners=moduleInitializers.concat(initListeners);for(var i=0,len=allListeners.length;i<len;++i){try{allListeners[i](api);}catch(ex){if(isHostObject(window,"console")&&isHostMethod(window.console,"log")){window.console.log("Init listener threw an exception. Continuing.",ex);}}}}
api.init=init;api.addInitListener=function(listener){if(api.initialized){listener(api);}else{initListeners.push(listener);}};var createMissingNativeApiListeners=[];api.addCreateMissingNativeApiListener=function(listener){createMissingNativeApiListeners.push(listener);};function createMissingNativeApi(win){win=win||window;init();for(var i=0,len=createMissingNativeApiListeners.length;i<len;++i){createMissingNativeApiListeners[i](win);}}
api.createMissingNativeApi=createMissingNativeApi;function Module(name){this.name=name;this.initialized=false;this.supported=false;}
Module.prototype.fail=function(reason){this.initialized=true;this.supported=false;throw new Error("Module '"+this.name+"' failed to load: "+reason);};Module.prototype.warn=function(msg){api.warn("Module "+this.name+": "+msg);};Module.prototype.createError=function(msg){return new Error("Error in Rangy "+this.name+" module: "+msg);};api.createModule=function(name,initFunc){var module=new Module(name);api.modules[name]=module;moduleInitializers.push(function(api){initFunc(api,module);module.initialized=true;module.supported=true;});};api.requireModules=function(modules){for(var i=0,len=modules.length,module,moduleName;i<len;++i){moduleName=modules[i];module=api.modules[moduleName];if(!module||!(module instanceof Module)){throw new Error("Module '"+moduleName+"' not found");}
if(!module.supported){throw new Error("Module '"+moduleName+"' not supported");}}};var docReady=false;var loadHandler=function(e){if(!docReady){docReady=true;if(!api.initialized){init();}}};if(typeof window==UNDEFINED){fail("No window found");return;}
if(typeof document==UNDEFINED){fail("No document found");return;}
if(isHostMethod(document,"addEventListener")){document.addEventListener("DOMContentLoaded",loadHandler,false);}
if(isHostMethod(window,"addEventListener")){window.addEventListener("load",loadHandler,false);}else if(isHostMethod(window,"attachEvent")){window.attachEvent("onload",loadHandler);}else{fail("Window does not have required addEventListener or attachEvent method");}
return api;})();rangy.createModule("DomUtil",function(api,module){var UNDEF="undefined";var util=api.util;if(!util.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])){module.fail("document missing a Node creation method");}
if(!util.isHostMethod(document,"getElementsByTagName")){module.fail("document missing getElementsByTagName method");}
var el=document.createElement("div");if(!util.areHostMethods(el,["insertBefore","appendChild","cloneNode"]||!util.areHostObjects(el,["previousSibling","nextSibling","childNodes","parentNode"]))){module.fail("Incomplete Element implementation");}
if(!util.isHostProperty(el,"innerHTML")){module.fail("Element is missing innerHTML property");}
var textNode=document.createTextNode("test");if(!util.areHostMethods(textNode,["splitText","deleteData","insertData","appendData","cloneNode"]||!util.areHostObjects(el,["previousSibling","nextSibling","childNodes","parentNode"])||!util.areHostProperties(textNode,["data"]))){module.fail("Incomplete Text Node implementation");}
var arrayContains=function(arr,val){var i=arr.length;while(i--){if(arr[i]===val){return true;}}
return false;};function isHtmlNamespace(node){var ns;return typeof node.namespaceURI==UNDEF||((ns=node.namespaceURI)===null||ns=="http://www.w3.org/1999/xhtml");}
function parentElement(node){var parent=node.parentNode;return(parent.nodeType==1)?parent:null;}
function getNodeIndex(node){var i=0;while((node=node.previousSibling)){i++;}
return i;}
function getNodeLength(node){var childNodes;return isCharacterDataNode(node)?node.length:((childNodes=node.childNodes)?childNodes.length:0);}
function getCommonAncestor(node1,node2){var ancestors=[],n;for(n=node1;n;n=n.parentNode){ancestors.push(n);}
for(n=node2;n;n=n.parentNode){if(arrayContains(ancestors,n)){return n;}}
return null;}
function isAncestorOf(ancestor,descendant,selfIsAncestor){var n=selfIsAncestor?descendant:descendant.parentNode;while(n){if(n===ancestor){return true;}else{n=n.parentNode;}}
return false;}
function getClosestAncestorIn(node,ancestor,selfIsAncestor){var p,n=selfIsAncestor?node:node.parentNode;while(n){p=n.parentNode;if(p===ancestor){return n;}
n=p;}
return null;}
function isCharacterDataNode(node){var t=node.nodeType;return t==3||t==4||t==8;}
function insertAfter(node,precedingNode){var nextNode=precedingNode.nextSibling,parent=precedingNode.parentNode;if(nextNode){parent.insertBefore(node,nextNode);}else{parent.appendChild(node);}
return node;}
function splitDataNode(node,index){var newNode=node.cloneNode(false);newNode.deleteData(0,index);node.deleteData(index,node.length-index);insertAfter(newNode,node);return newNode;}
function getDocument(node){if(node.nodeType==9){return node;}else if(typeof node.ownerDocument!=UNDEF){return node.ownerDocument;}else if(typeof node.document!=UNDEF){return node.document;}else if(node.parentNode){return getDocument(node.parentNode);}else{throw new Error("getDocument: no document found for node");}}
function getWindow(node){var doc=getDocument(node);if(typeof doc.defaultView!=UNDEF){return doc.defaultView;}else if(typeof doc.parentWindow!=UNDEF){return doc.parentWindow;}else{throw new Error("Cannot get a window object for node");}}
function getIframeDocument(iframeEl){if(typeof iframeEl.contentDocument!=UNDEF){return iframeEl.contentDocument;}else if(typeof iframeEl.contentWindow!=UNDEF){return iframeEl.contentWindow.document;}else{throw new Error("getIframeWindow: No Document object found for iframe element");}}
function getIframeWindow(iframeEl){if(typeof iframeEl.contentWindow!=UNDEF){return iframeEl.contentWindow;}else if(typeof iframeEl.contentDocument!=UNDEF){return iframeEl.contentDocument.defaultView;}else{throw new Error("getIframeWindow: No Window object found for iframe element");}}
function getBody(doc){return util.isHostObject(doc,"body")?doc.body:doc.getElementsByTagName("body")[0];}
function getRootContainer(node){var parent;while((parent=node.parentNode)){node=parent;}
return node;}
function comparePoints(nodeA,offsetA,nodeB,offsetB){var nodeC,root,childA,childB,n;if(nodeA==nodeB){return offsetA===offsetB?0:(offsetA<offsetB)?-1:1;}else if((nodeC=getClosestAncestorIn(nodeB,nodeA,true))){return offsetA<=getNodeIndex(nodeC)?-1:1;}else if((nodeC=getClosestAncestorIn(nodeA,nodeB,true))){return getNodeIndex(nodeC)<offsetB?-1:1;}else{root=getCommonAncestor(nodeA,nodeB);childA=(nodeA===root)?root:getClosestAncestorIn(nodeA,root,true);childB=(nodeB===root)?root:getClosestAncestorIn(nodeB,root,true);if(childA===childB){throw new Error("comparePoints got to case 4 and childA and childB are the same!");}else{n=root.firstChild;while(n){if(n===childA){return-1;}else if(n===childB){return 1;}
n=n.nextSibling;}
throw new Error("Should not be here!");}}}
function fragmentFromNodeChildren(node){var fragment=getDocument(node).createDocumentFragment(),child;while((child=node.firstChild)){fragment.appendChild(child);}
return fragment;}
function inspectNode(node){if(!node){return"[No node]";}
if(isCharacterDataNode(node)){return'"'+node.data+'"';}else if(node.nodeType==1){var idAttr=node.id?' id="'+node.id+'"':"";return"<"+node.nodeName+idAttr+">["+node.childNodes.length+"]";}else{return node.nodeName;}}
function NodeIterator(root){this.root=root;this._next=root;}
NodeIterator.prototype={_current:null,hasNext:function(){return!!this._next;},next:function(){var n=this._current=this._next;var child,next;if(this._current){child=n.firstChild;if(child){this._next=child;}else{next=null;while((n!==this.root)&&!(next=n.nextSibling)){n=n.parentNode;}
this._next=next;}}
return this._current;},detach:function(){this._current=this._next=this.root=null;}};function createIterator(root){return new NodeIterator(root);}
function DomPosition(node,offset){this.node=node;this.offset=offset;}
DomPosition.prototype={equals:function(pos){return this.node===pos.node&this.offset==pos.offset;},inspect:function(){return"[DomPosition("+inspectNode(this.node)+":"+this.offset+")]";}};function DOMException(codeName){this.code=this[codeName];this.codeName=codeName;this.message="DOMException: "+this.codeName;}
DOMException.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};DOMException.prototype.toString=function(){return this.message;};api.dom={arrayContains:arrayContains,isHtmlNamespace:isHtmlNamespace,parentElement:parentElement,getNodeIndex:getNodeIndex,getNodeLength:getNodeLength,getCommonAncestor:getCommonAncestor,isAncestorOf:isAncestorOf,getClosestAncestorIn:getClosestAncestorIn,isCharacterDataNode:isCharacterDataNode,insertAfter:insertAfter,splitDataNode:splitDataNode,getDocument:getDocument,getWindow:getWindow,getIframeWindow:getIframeWindow,getIframeDocument:getIframeDocument,getBody:getBody,getRootContainer:getRootContainer,comparePoints:comparePoints,inspectNode:inspectNode,fragmentFromNodeChildren:fragmentFromNodeChildren,createIterator:createIterator,DomPosition:DomPosition};api.DOMException=DOMException;});rangy.createModule("DomRange",function(api,module){api.requireModules(["DomUtil"]);var dom=api.dom;var DomPosition=dom.DomPosition;var DOMException=api.DOMException;function isNonTextPartiallySelected(node,range){return(node.nodeType!=3)&&(dom.isAncestorOf(node,range.startContainer,true)||dom.isAncestorOf(node,range.endContainer,true));}
function getRangeDocument(range){return dom.getDocument(range.startContainer);}
function dispatchEvent(range,type,args){var listeners=range._listeners[type];if(listeners){for(var i=0,len=listeners.length;i<len;++i){listeners[i].call(range,{target:range,args:args});}}}
function getBoundaryBeforeNode(node){return new DomPosition(node.parentNode,dom.getNodeIndex(node));}
function getBoundaryAfterNode(node){return new DomPosition(node.parentNode,dom.getNodeIndex(node)+1);}
function insertNodeAtPosition(node,n,o){var firstNodeInserted=node.nodeType==11?node.firstChild:node;if(dom.isCharacterDataNode(n)){if(o==n.length){dom.insertAfter(node,n);}else{n.parentNode.insertBefore(node,o==0?n:dom.splitDataNode(n,o));}}else if(o>=n.childNodes.length){n.appendChild(node);}else{n.insertBefore(node,n.childNodes[o]);}
return firstNodeInserted;}
function cloneSubtree(iterator){var partiallySelected;for(var node,frag=getRangeDocument(iterator.range).createDocumentFragment(),subIterator;node=iterator.next();){partiallySelected=iterator.isPartiallySelectedSubtree();node=node.cloneNode(!partiallySelected);if(partiallySelected){subIterator=iterator.getSubtreeIterator();node.appendChild(cloneSubtree(subIterator));subIterator.detach(true);}
if(node.nodeType==10){throw new DOMException("HIERARCHY_REQUEST_ERR");}
frag.appendChild(node);}
return frag;}
function iterateSubtree(rangeIterator,func,iteratorState){var it,n;iteratorState=iteratorState||{stop:false};for(var node,subRangeIterator;node=rangeIterator.next();){if(rangeIterator.isPartiallySelectedSubtree()){if(func(node)===false){iteratorState.stop=true;return;}else{subRangeIterator=rangeIterator.getSubtreeIterator();iterateSubtree(subRangeIterator,func,iteratorState);subRangeIterator.detach(true);if(iteratorState.stop){return;}}}else{it=dom.createIterator(node);while((n=it.next())){if(func(n)===false){iteratorState.stop=true;return;}}}}}
function deleteSubtree(iterator){var subIterator;while(iterator.next()){if(iterator.isPartiallySelectedSubtree()){subIterator=iterator.getSubtreeIterator();deleteSubtree(subIterator);subIterator.detach(true);}else{iterator.remove();}}}
function extractSubtree(iterator){for(var node,frag=getRangeDocument(iterator.range).createDocumentFragment(),subIterator;node=iterator.next();){if(iterator.isPartiallySelectedSubtree()){node=node.cloneNode(false);subIterator=iterator.getSubtreeIterator();node.appendChild(extractSubtree(subIterator));subIterator.detach(true);}else{iterator.remove();}
if(node.nodeType==10){throw new DOMException("HIERARCHY_REQUEST_ERR");}
frag.appendChild(node);}
return frag;}
function getNodesInRange(range,nodeTypes,filter){var filterNodeTypes=!!(nodeTypes&&nodeTypes.length),regex;var filterExists=!!filter;if(filterNodeTypes){regex=new RegExp("^("+nodeTypes.join("|")+")$");}
var nodes=[];iterateSubtree(new RangeIterator(range,false),function(node){if((!filterNodeTypes||regex.test(node.nodeType))&&(!filterExists||filter(node))){nodes.push(node);}});return nodes;}
function inspect(range){var name=(typeof range.getName=="undefined")?"Range":range.getName();return"["+name+"("+dom.inspectNode(range.startContainer)+":"+range.startOffset+", "+
dom.inspectNode(range.endContainer)+":"+range.endOffset+")]";}
function RangeIterator(range,clonePartiallySelectedTextNodes){this.range=range;this.clonePartiallySelectedTextNodes=clonePartiallySelectedTextNodes;if(!range.collapsed){this.sc=range.startContainer;this.so=range.startOffset;this.ec=range.endContainer;this.eo=range.endOffset;var root=range.commonAncestorContainer;if(this.sc===this.ec&&dom.isCharacterDataNode(this.sc)){this.isSingleCharacterDataNode=true;this._first=this._last=this._next=this.sc;}else{this._first=this._next=(this.sc===root&&!dom.isCharacterDataNode(this.sc))?this.sc.childNodes[this.so]:dom.getClosestAncestorIn(this.sc,root,true);this._last=(this.ec===root&&!dom.isCharacterDataNode(this.ec))?this.ec.childNodes[this.eo-1]:dom.getClosestAncestorIn(this.ec,root,true);}}}
RangeIterator.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:false,reset:function(){this._current=null;this._next=this._first;},hasNext:function(){return!!this._next;},next:function(){var current=this._current=this._next;if(current){this._next=(current!==this._last)?current.nextSibling:null;if(dom.isCharacterDataNode(current)&&this.clonePartiallySelectedTextNodes){if(current===this.ec){(current=current.cloneNode(true)).deleteData(this.eo,current.length-this.eo);}
if(this._current===this.sc){(current=current.cloneNode(true)).deleteData(0,this.so);}}}
return current;},remove:function(){var current=this._current,start,end;if(dom.isCharacterDataNode(current)&&(current===this.sc||current===this.ec)){start=(current===this.sc)?this.so:0;end=(current===this.ec)?this.eo:current.length;if(start!=end){current.deleteData(start,end-start);}}else{if(current.parentNode){current.parentNode.removeChild(current);}else{}}},isPartiallySelectedSubtree:function(){var current=this._current;return isNonTextPartiallySelected(current,this.range);},getSubtreeIterator:function(){var subRange;if(this.isSingleCharacterDataNode){subRange=this.range.cloneRange();subRange.collapse();}else{subRange=new Range(getRangeDocument(this.range));var current=this._current;var startContainer=current,startOffset=0,endContainer=current,endOffset=dom.getNodeLength(current);if(dom.isAncestorOf(current,this.sc,true)){startContainer=this.sc;startOffset=this.so;}
if(dom.isAncestorOf(current,this.ec,true)){endContainer=this.ec;endOffset=this.eo;}
updateBoundaries(subRange,startContainer,startOffset,endContainer,endOffset);}
return new RangeIterator(subRange,this.clonePartiallySelectedTextNodes);},detach:function(detachRange){if(detachRange){this.range.detach();}
this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null;}};function RangeException(codeName){this.code=this[codeName];this.codeName=codeName;this.message="RangeException: "+this.codeName;}
RangeException.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};RangeException.prototype.toString=function(){return this.message;};function RangeNodeIterator(range,nodeTypes,filter){this.nodes=getNodesInRange(range,nodeTypes,filter);this._next=this.nodes[0];this._position=0;}
RangeNodeIterator.prototype={_current:null,hasNext:function(){return!!this._next;},next:function(){this._current=this._next;this._next=this.nodes[++this._position];return this._current;},detach:function(){this._current=this._next=this.nodes=null;}};var beforeAfterNodeTypes=[1,3,4,5,7,8,10];var rootContainerNodeTypes=[2,9,11];var readonlyNodeTypes=[5,6,10,12];var insertableNodeTypes=[1,3,4,5,7,8,10,11];var surroundNodeTypes=[1,3,4,5,7,8];function createAncestorFinder(nodeTypes){return function(node,selfIsAncestor){var t,n=selfIsAncestor?node:node.parentNode;while(n){t=n.nodeType;if(dom.arrayContains(nodeTypes,t)){return n;}
n=n.parentNode;}
return null;};}
var getRootContainer=dom.getRootContainer;var getDocumentOrFragmentContainer=createAncestorFinder([9,11]);var getReadonlyAncestor=createAncestorFinder(readonlyNodeTypes);var getDocTypeNotationEntityAncestor=createAncestorFinder([6,10,12]);function assertNoDocTypeNotationEntityAncestor(node,allowSelf){if(getDocTypeNotationEntityAncestor(node,allowSelf)){throw new RangeException("INVALID_NODE_TYPE_ERR");}}
function assertNotDetached(range){if(!range.startContainer){throw new DOMException("INVALID_STATE_ERR");}}
function assertValidNodeType(node,invalidTypes){if(!dom.arrayContains(invalidTypes,node.nodeType)){throw new RangeException("INVALID_NODE_TYPE_ERR");}}
function assertValidOffset(node,offset){if(offset<0||offset>(dom.isCharacterDataNode(node)?node.length:node.childNodes.length)){throw new DOMException("INDEX_SIZE_ERR");}}
function assertSameDocumentOrFragment(node1,node2){if(getDocumentOrFragmentContainer(node1,true)!==getDocumentOrFragmentContainer(node2,true)){throw new DOMException("WRONG_DOCUMENT_ERR");}}
function assertNodeNotReadOnly(node){if(getReadonlyAncestor(node,true)){throw new DOMException("NO_MODIFICATION_ALLOWED_ERR");}}
function assertNode(node,codeName){if(!node){throw new DOMException(codeName);}}
function isOrphan(node){return!dom.arrayContains(rootContainerNodeTypes,node.nodeType)&&!getDocumentOrFragmentContainer(node,true);}
function isValidOffset(node,offset){return offset<=(dom.isCharacterDataNode(node)?node.length:node.childNodes.length);}
function isRangeValid(range){return(!!range.startContainer&&!!range.endContainer&&!isOrphan(range.startContainer)&&!isOrphan(range.endContainer)&&isValidOffset(range.startContainer,range.startOffset)&&isValidOffset(range.endContainer,range.endOffset));}
function assertRangeValid(range){assertNotDetached(range);if(!isRangeValid(range)){throw new Error("Range error: Range is no longer valid after DOM mutation ("+range.inspect()+")");}}
var styleEl=document.createElement("style");var htmlParsingConforms=false;try{styleEl.innerHTML="<b>x</b>";htmlParsingConforms=(styleEl.firstChild.nodeType==3);}catch(e){}
api.features.htmlParsingConforms=htmlParsingConforms;var createContextualFragment=htmlParsingConforms?function(fragmentStr){var node=this.startContainer;var doc=dom.getDocument(node);if(!node){throw new DOMException("INVALID_STATE_ERR");}
var el=null;if(node.nodeType==1){el=node;}else if(dom.isCharacterDataNode(node)){el=dom.parentElement(node);}
if(el===null||(el.nodeName=="HTML"&&dom.isHtmlNamespace(dom.getDocument(el).documentElement)&&dom.isHtmlNamespace(el))){el=doc.createElement("body");}else{el=el.cloneNode(false);}
el.innerHTML=fragmentStr;return dom.fragmentFromNodeChildren(el);}:function(fragmentStr){assertNotDetached(this);var doc=getRangeDocument(this);var el=doc.createElement("body");el.innerHTML=fragmentStr;return dom.fragmentFromNodeChildren(el);};var rangeProperties=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"];var s2s=0,s2e=1,e2e=2,e2s=3;var n_b=0,n_a=1,n_b_a=2,n_i=3;function RangePrototype(){}
RangePrototype.prototype={attachListener:function(type,listener){this._listeners[type].push(listener);},compareBoundaryPoints:function(how,range){assertRangeValid(this);assertSameDocumentOrFragment(this.startContainer,range.startContainer);var nodeA,offsetA,nodeB,offsetB;var prefixA=(how==e2s||how==s2s)?"start":"end";var prefixB=(how==s2e||how==s2s)?"start":"end";nodeA=this[prefixA+"Container"];offsetA=this[prefixA+"Offset"];nodeB=range[prefixB+"Container"];offsetB=range[prefixB+"Offset"];return dom.comparePoints(nodeA,offsetA,nodeB,offsetB);},insertNode:function(node){assertRangeValid(this);assertValidNodeType(node,insertableNodeTypes);assertNodeNotReadOnly(this.startContainer);if(dom.isAncestorOf(node,this.startContainer,true)){throw new DOMException("HIERARCHY_REQUEST_ERR");}
var firstNodeInserted=insertNodeAtPosition(node,this.startContainer,this.startOffset);this.setStartBefore(firstNodeInserted);},cloneContents:function(){assertRangeValid(this);var clone,frag;if(this.collapsed){return getRangeDocument(this).createDocumentFragment();}else{if(this.startContainer===this.endContainer&&dom.isCharacterDataNode(this.startContainer)){clone=this.startContainer.cloneNode(true);clone.data=clone.data.slice(this.startOffset,this.endOffset);frag=getRangeDocument(this).createDocumentFragment();frag.appendChild(clone);return frag;}else{var iterator=new RangeIterator(this,true);clone=cloneSubtree(iterator);iterator.detach();}
return clone;}},canSurroundContents:function(){assertRangeValid(this);assertNodeNotReadOnly(this.startContainer);assertNodeNotReadOnly(this.endContainer);var iterator=new RangeIterator(this,true);var boundariesInvalid=(iterator._first&&(isNonTextPartiallySelected(iterator._first,this))||(iterator._last&&isNonTextPartiallySelected(iterator._last,this)));iterator.detach();return!boundariesInvalid;},surroundContents:function(node){assertValidNodeType(node,surroundNodeTypes);if(!this.canSurroundContents()){throw new RangeException("BAD_BOUNDARYPOINTS_ERR");}
var content=this.extractContents();if(node.hasChildNodes()){while(node.lastChild){node.removeChild(node.lastChild);}}
insertNodeAtPosition(node,this.startContainer,this.startOffset);node.appendChild(content);this.selectNode(node);},cloneRange:function(){assertRangeValid(this);var range=new Range(getRangeDocument(this));var i=rangeProperties.length,prop;while(i--){prop=rangeProperties[i];range[prop]=this[prop];}
return range;},toString:function(){assertRangeValid(this);var sc=this.startContainer;if(sc===this.endContainer&&dom.isCharacterDataNode(sc)){return(sc.nodeType==3||sc.nodeType==4)?sc.data.slice(this.startOffset,this.endOffset):"";}else{var textBits=[],iterator=new RangeIterator(this,true);iterateSubtree(iterator,function(node){if(node.nodeType==3||node.nodeType==4){textBits.push(node.data);}});iterator.detach();return textBits.join("");}},compareNode:function(node){assertRangeValid(this);var parent=node.parentNode;var nodeIndex=dom.getNodeIndex(node);if(!parent){throw new DOMException("NOT_FOUND_ERR");}
var startComparison=this.comparePoint(parent,nodeIndex),endComparison=this.comparePoint(parent,nodeIndex+1);if(startComparison<0){return(endComparison>0)?n_b_a:n_b;}else{return(endComparison>0)?n_a:n_i;}},comparePoint:function(node,offset){assertRangeValid(this);assertNode(node,"HIERARCHY_REQUEST_ERR");assertSameDocumentOrFragment(node,this.startContainer);if(dom.comparePoints(node,offset,this.startContainer,this.startOffset)<0){return-1;}else if(dom.comparePoints(node,offset,this.endContainer,this.endOffset)>0){return 1;}
return 0;},createContextualFragment:createContextualFragment,toHtml:function(){assertRangeValid(this);var container=getRangeDocument(this).createElement("div");container.appendChild(this.cloneContents());return container.innerHTML;},intersectsNode:function(node,touchingIsIntersecting){assertRangeValid(this);assertNode(node,"NOT_FOUND_ERR");if(dom.getDocument(node)!==getRangeDocument(this)){return false;}
var parent=node.parentNode,offset=dom.getNodeIndex(node);assertNode(parent,"NOT_FOUND_ERR");var startComparison=dom.comparePoints(parent,offset,this.endContainer,this.endOffset),endComparison=dom.comparePoints(parent,offset+1,this.startContainer,this.startOffset);return touchingIsIntersecting?startComparison<=0&&endComparison>=0:startComparison<0&&endComparison>0;},isPointInRange:function(node,offset){assertRangeValid(this);assertNode(node,"HIERARCHY_REQUEST_ERR");assertSameDocumentOrFragment(node,this.startContainer);return(dom.comparePoints(node,offset,this.startContainer,this.startOffset)>=0)&&(dom.comparePoints(node,offset,this.endContainer,this.endOffset)<=0);},intersectsRange:function(range,touchingIsIntersecting){assertRangeValid(this);if(getRangeDocument(range)!=getRangeDocument(this)){throw new DOMException("WRONG_DOCUMENT_ERR");}
var startComparison=dom.comparePoints(this.startContainer,this.startOffset,range.endContainer,range.endOffset),endComparison=dom.comparePoints(this.endContainer,this.endOffset,range.startContainer,range.startOffset);return touchingIsIntersecting?startComparison<=0&&endComparison>=0:startComparison<0&&endComparison>0;},intersection:function(range){if(this.intersectsRange(range)){var startComparison=dom.comparePoints(this.startContainer,this.startOffset,range.startContainer,range.startOffset),endComparison=dom.comparePoints(this.endContainer,this.endOffset,range.endContainer,range.endOffset);var intersectionRange=this.cloneRange();if(startComparison==-1){intersectionRange.setStart(range.startContainer,range.startOffset);}
if(endComparison==1){intersectionRange.setEnd(range.endContainer,range.endOffset);}
return intersectionRange;}
return null;},union:function(range){if(this.intersectsRange(range,true)){var unionRange=this.cloneRange();if(dom.comparePoints(range.startContainer,range.startOffset,this.startContainer,this.startOffset)==-1){unionRange.setStart(range.startContainer,range.startOffset);}
if(dom.comparePoints(range.endContainer,range.endOffset,this.endContainer,this.endOffset)==1){unionRange.setEnd(range.endContainer,range.endOffset);}
return unionRange;}else{throw new RangeException("Ranges do not intersect");}},containsNode:function(node,allowPartial){if(allowPartial){return this.intersectsNode(node,false);}else{return this.compareNode(node)==n_i;}},containsNodeContents:function(node){return this.comparePoint(node,0)>=0&&this.comparePoint(node,dom.getNodeLength(node))<=0;},containsRange:function(range){return this.intersection(range).equals(range);},containsNodeText:function(node){var nodeRange=this.cloneRange();nodeRange.selectNode(node);var textNodes=nodeRange.getNodes([3]);if(textNodes.length>0){nodeRange.setStart(textNodes[0],0);var lastTextNode=textNodes.pop();nodeRange.setEnd(lastTextNode,lastTextNode.length);var contains=this.containsRange(nodeRange);nodeRange.detach();return contains;}else{return this.containsNodeContents(node);}},createNodeIterator:function(nodeTypes,filter){assertRangeValid(this);return new RangeNodeIterator(this,nodeTypes,filter);},getNodes:function(nodeTypes,filter){assertRangeValid(this);return getNodesInRange(this,nodeTypes,filter);},getDocument:function(){return getRangeDocument(this);},collapseBefore:function(node){assertNotDetached(this);this.setEndBefore(node);this.collapse(false);},collapseAfter:function(node){assertNotDetached(this);this.setStartAfter(node);this.collapse(true);},getName:function(){return"DomRange";},equals:function(range){return Range.rangesEqual(this,range);},isValid:function(){return isRangeValid(this);},inspect:function(){return inspect(this);}};function copyComparisonConstantsToObject(obj){obj.START_TO_START=s2s;obj.START_TO_END=s2e;obj.END_TO_END=e2e;obj.END_TO_START=e2s;obj.NODE_BEFORE=n_b;obj.NODE_AFTER=n_a;obj.NODE_BEFORE_AND_AFTER=n_b_a;obj.NODE_INSIDE=n_i;}
function copyComparisonConstants(constructor){copyComparisonConstantsToObject(constructor);copyComparisonConstantsToObject(constructor.prototype);}
function createRangeContentRemover(remover,boundaryUpdater){return function(){assertRangeValid(this);var sc=this.startContainer,so=this.startOffset,root=this.commonAncestorContainer;var iterator=new RangeIterator(this,true);var node,boundary;if(sc!==root){node=dom.getClosestAncestorIn(sc,root,true);boundary=getBoundaryAfterNode(node);sc=boundary.node;so=boundary.offset;}
iterateSubtree(iterator,assertNodeNotReadOnly);iterator.reset();var returnValue=remover(iterator);iterator.detach();boundaryUpdater(this,sc,so,sc,so);return returnValue;};}
function createPrototypeRange(constructor,boundaryUpdater,detacher){function createBeforeAfterNodeSetter(isBefore,isStart){return function(node){assertNotDetached(this);assertValidNodeType(node,beforeAfterNodeTypes);assertValidNodeType(getRootContainer(node),rootContainerNodeTypes);var boundary=(isBefore?getBoundaryBeforeNode:getBoundaryAfterNode)(node);(isStart?setRangeStart:setRangeEnd)(this,boundary.node,boundary.offset);};}
function setRangeStart(range,node,offset){var ec=range.endContainer,eo=range.endOffset;if(node!==range.startContainer||offset!==range.startOffset){if(getRootContainer(node)!=getRootContainer(ec)||dom.comparePoints(node,offset,ec,eo)==1){ec=node;eo=offset;}
boundaryUpdater(range,node,offset,ec,eo);}}
function setRangeEnd(range,node,offset){var sc=range.startContainer,so=range.startOffset;if(node!==range.endContainer||offset!==range.endOffset){if(getRootContainer(node)!=getRootContainer(sc)||dom.comparePoints(node,offset,sc,so)==-1){sc=node;so=offset;}
boundaryUpdater(range,sc,so,node,offset);}}
function setRangeStartAndEnd(range,node,offset){if(node!==range.startContainer||offset!==range.startOffset||node!==range.endContainer||offset!==range.endOffset){boundaryUpdater(range,node,offset,node,offset);}}
constructor.prototype=new RangePrototype();api.util.extend(constructor.prototype,{setStart:function(node,offset){assertNotDetached(this);assertNoDocTypeNotationEntityAncestor(node,true);assertValidOffset(node,offset);setRangeStart(this,node,offset);},setEnd:function(node,offset){assertNotDetached(this);assertNoDocTypeNotationEntityAncestor(node,true);assertValidOffset(node,offset);setRangeEnd(this,node,offset);},setStartBefore:createBeforeAfterNodeSetter(true,true),setStartAfter:createBeforeAfterNodeSetter(false,true),setEndBefore:createBeforeAfterNodeSetter(true,false),setEndAfter:createBeforeAfterNodeSetter(false,false),collapse:function(isStart){assertRangeValid(this);if(isStart){boundaryUpdater(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset);}else{boundaryUpdater(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset);}},selectNodeContents:function(node){assertNotDetached(this);assertNoDocTypeNotationEntityAncestor(node,true);boundaryUpdater(this,node,0,node,dom.getNodeLength(node));},selectNode:function(node){assertNotDetached(this);assertNoDocTypeNotationEntityAncestor(node,false);assertValidNodeType(node,beforeAfterNodeTypes);var start=getBoundaryBeforeNode(node),end=getBoundaryAfterNode(node);boundaryUpdater(this,start.node,start.offset,end.node,end.offset);},extractContents:createRangeContentRemover(extractSubtree,boundaryUpdater),deleteContents:createRangeContentRemover(deleteSubtree,boundaryUpdater),canSurroundContents:function(){assertRangeValid(this);assertNodeNotReadOnly(this.startContainer);assertNodeNotReadOnly(this.endContainer);var iterator=new RangeIterator(this,true);var boundariesInvalid=(iterator._first&&(isNonTextPartiallySelected(iterator._first,this))||(iterator._last&&isNonTextPartiallySelected(iterator._last,this)));iterator.detach();return!boundariesInvalid;},detach:function(){detacher(this);},splitBoundaries:function(){assertRangeValid(this);var sc=this.startContainer,so=this.startOffset,ec=this.endContainer,eo=this.endOffset;var startEndSame=(sc===ec);if(dom.isCharacterDataNode(ec)&&eo>0&&eo<ec.length){dom.splitDataNode(ec,eo);}
if(dom.isCharacterDataNode(sc)&&so>0&&so<sc.length){sc=dom.splitDataNode(sc,so);if(startEndSame){eo-=so;ec=sc;}else if(ec==sc.parentNode&&eo>=dom.getNodeIndex(sc)){eo++;}
so=0;}
boundaryUpdater(this,sc,so,ec,eo);},normalizeBoundaries:function(){assertRangeValid(this);var sc=this.startContainer,so=this.startOffset,ec=this.endContainer,eo=this.endOffset;var mergeForward=function(node){var sibling=node.nextSibling;if(sibling&&sibling.nodeType==node.nodeType){ec=node;eo=node.length;node.appendData(sibling.data);sibling.parentNode.removeChild(sibling);}};var mergeBackward=function(node){var sibling=node.previousSibling;if(sibling&&sibling.nodeType==node.nodeType){sc=node;var nodeLength=node.length;so=sibling.length;node.insertData(0,sibling.data);sibling.parentNode.removeChild(sibling);if(sc==ec){eo+=so;ec=sc;}else if(ec==node.parentNode){var nodeIndex=dom.getNodeIndex(node);if(eo==nodeIndex){ec=node;eo=nodeLength;}else if(eo>nodeIndex){eo--;}}}};var normalizeStart=true;if(dom.isCharacterDataNode(ec)){if(ec.length==eo){mergeForward(ec);}}else{if(eo>0){var endNode=ec.childNodes[eo-1];if(endNode&&dom.isCharacterDataNode(endNode)){mergeForward(endNode);}}
normalizeStart=!this.collapsed;}
if(normalizeStart){if(dom.isCharacterDataNode(sc)){if(so==0){mergeBackward(sc);}}else{if(so<sc.childNodes.length){var startNode=sc.childNodes[so];if(startNode&&dom.isCharacterDataNode(startNode)){mergeBackward(startNode);}}}}else{sc=ec;so=eo;}
boundaryUpdater(this,sc,so,ec,eo);},collapseToPoint:function(node,offset){assertNotDetached(this);assertNoDocTypeNotationEntityAncestor(node,true);assertValidOffset(node,offset);setRangeStartAndEnd(this,node,offset);}});copyComparisonConstants(constructor);}
function updateCollapsedAndCommonAncestor(range){range.collapsed=(range.startContainer===range.endContainer&&range.startOffset===range.endOffset);range.commonAncestorContainer=range.collapsed?range.startContainer:dom.getCommonAncestor(range.startContainer,range.endContainer);}
function updateBoundaries(range,startContainer,startOffset,endContainer,endOffset){var startMoved=(range.startContainer!==startContainer||range.startOffset!==startOffset);var endMoved=(range.endContainer!==endContainer||range.endOffset!==endOffset);range.startContainer=startContainer;range.startOffset=startOffset;range.endContainer=endContainer;range.endOffset=endOffset;updateCollapsedAndCommonAncestor(range);dispatchEvent(range,"boundarychange",{startMoved:startMoved,endMoved:endMoved});}
function detach(range){assertNotDetached(range);range.startContainer=range.startOffset=range.endContainer=range.endOffset=null;range.collapsed=range.commonAncestorContainer=null;dispatchEvent(range,"detach",null);range._listeners=null;}
function Range(doc){this.startContainer=doc;this.startOffset=0;this.endContainer=doc;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};updateCollapsedAndCommonAncestor(this);}
createPrototypeRange(Range,updateBoundaries,detach);api.rangePrototype=RangePrototype.prototype;Range.rangeProperties=rangeProperties;Range.RangeIterator=RangeIterator;Range.copyComparisonConstants=copyComparisonConstants;Range.createPrototypeRange=createPrototypeRange;Range.inspect=inspect;Range.getRangeDocument=getRangeDocument;Range.rangesEqual=function(r1,r2){return r1.startContainer===r2.startContainer&&r1.startOffset===r2.startOffset&&r1.endContainer===r2.endContainer&&r1.endOffset===r2.endOffset;};api.DomRange=Range;api.RangeException=RangeException;});rangy.createModule("WrappedRange",function(api,module){api.requireModules(["DomUtil","DomRange"]);var WrappedRange;var dom=api.dom;var DomPosition=dom.DomPosition;var DomRange=api.DomRange;function getTextRangeContainerElement(textRange){var parentEl=textRange.parentElement();var range=textRange.duplicate();range.collapse(true);var startEl=range.parentElement();range=textRange.duplicate();range.collapse(false);var endEl=range.parentElement();var startEndContainer=(startEl==endEl)?startEl:dom.getCommonAncestor(startEl,endEl);return startEndContainer==parentEl?startEndContainer:dom.getCommonAncestor(parentEl,startEndContainer);}
function textRangeIsCollapsed(textRange){return textRange.compareEndPoints("StartToEnd",textRange)==0;}
function getTextRangeBoundaryPosition(textRange,wholeRangeContainerElement,isStart,isCollapsed){var workingRange=textRange.duplicate();workingRange.collapse(isStart);var containerElement=workingRange.parentElement();if(!dom.isAncestorOf(wholeRangeContainerElement,containerElement,true)){containerElement=wholeRangeContainerElement;}
if(!containerElement.canHaveHTML){return new DomPosition(containerElement.parentNode,dom.getNodeIndex(containerElement));}
var workingNode=dom.getDocument(containerElement).createElement("span");var comparison,workingComparisonType=isStart?"StartToStart":"StartToEnd";var previousNode,nextNode,boundaryPosition,boundaryNode;do{containerElement.insertBefore(workingNode,workingNode.previousSibling);workingRange.moveToElementText(workingNode);}while((comparison=workingRange.compareEndPoints(workingComparisonType,textRange))>0&&workingNode.previousSibling);boundaryNode=workingNode.nextSibling;if(comparison==-1&&boundaryNode&&dom.isCharacterDataNode(boundaryNode)){workingRange.setEndPoint(isStart?"EndToStart":"EndToEnd",textRange);var offset;if(/[\r\n]/.test(boundaryNode.data)){var tempRange=workingRange.duplicate();var rangeLength=tempRange.text.replace(/\r\n/g,"\r").length;offset=tempRange.moveStart("character",rangeLength);while((comparison=tempRange.compareEndPoints("StartToEnd",tempRange))==-1){offset++;tempRange.moveStart("character",1);}}else{offset=workingRange.text.length;}
boundaryPosition=new DomPosition(boundaryNode,offset);}else{previousNode=(isCollapsed||!isStart)&&workingNode.previousSibling;nextNode=(isCollapsed||isStart)&&workingNode.nextSibling;if(nextNode&&dom.isCharacterDataNode(nextNode)){boundaryPosition=new DomPosition(nextNode,0);}else if(previousNode&&dom.isCharacterDataNode(previousNode)){boundaryPosition=new DomPosition(previousNode,previousNode.length);}else{boundaryPosition=new DomPosition(containerElement,dom.getNodeIndex(workingNode));}}
workingNode.parentNode.removeChild(workingNode);return boundaryPosition;}
function createBoundaryTextRange(boundaryPosition,isStart){var boundaryNode,boundaryParent,boundaryOffset=boundaryPosition.offset;var doc=dom.getDocument(boundaryPosition.node);var workingNode,childNodes,workingRange=doc.body.createTextRange();var nodeIsDataNode=dom.isCharacterDataNode(boundaryPosition.node);if(nodeIsDataNode){boundaryNode=boundaryPosition.node;boundaryParent=boundaryNode.parentNode;}else{childNodes=boundaryPosition.node.childNodes;boundaryNode=(boundaryOffset<childNodes.length)?childNodes[boundaryOffset]:null;boundaryParent=boundaryPosition.node;}
workingNode=doc.createElement("span");workingNode.innerHTML="&#feff;";if(boundaryNode){boundaryParent.insertBefore(workingNode,boundaryNode);}else{boundaryParent.appendChild(workingNode);}
workingRange.moveToElementText(workingNode);workingRange.collapse(!isStart);boundaryParent.removeChild(workingNode);if(nodeIsDataNode){workingRange[isStart?"moveStart":"moveEnd"]("character",boundaryOffset);}
return workingRange;}
if(api.features.implementsDomRange&&(!api.features.implementsTextRange||!api.config.preferTextRange)){(function(){var rangeProto;var rangeProperties=DomRange.rangeProperties;var canSetRangeStartAfterEnd;function updateRangeProperties(range){var i=rangeProperties.length,prop;while(i--){prop=rangeProperties[i];range[prop]=range.nativeRange[prop];}}
function updateNativeRange(range,startContainer,startOffset,endContainer,endOffset){var startMoved=(range.startContainer!==startContainer||range.startOffset!=startOffset);var endMoved=(range.endContainer!==endContainer||range.endOffset!=endOffset);if(startMoved||endMoved){range.setEnd(endContainer,endOffset);range.setStart(startContainer,startOffset);}}
function detach(range){range.nativeRange.detach();range.detached=true;var i=rangeProperties.length,prop;while(i--){prop=rangeProperties[i];range[prop]=null;}}
var createBeforeAfterNodeSetter;WrappedRange=function(range){if(!range){throw new Error("Range must be specified");}
this.nativeRange=range;updateRangeProperties(this);};DomRange.createPrototypeRange(WrappedRange,updateNativeRange,detach);rangeProto=WrappedRange.prototype;rangeProto.selectNode=function(node){this.nativeRange.selectNode(node);updateRangeProperties(this);};rangeProto.deleteContents=function(){this.nativeRange.deleteContents();updateRangeProperties(this);};rangeProto.extractContents=function(){var frag=this.nativeRange.extractContents();updateRangeProperties(this);return frag;};rangeProto.cloneContents=function(){return this.nativeRange.cloneContents();};rangeProto.surroundContents=function(node){this.nativeRange.surroundContents(node);updateRangeProperties(this);};rangeProto.collapse=function(isStart){this.nativeRange.collapse(isStart);updateRangeProperties(this);};rangeProto.cloneRange=function(){return new WrappedRange(this.nativeRange.cloneRange());};rangeProto.refresh=function(){updateRangeProperties(this);};rangeProto.toString=function(){return this.nativeRange.toString();};var testTextNode=document.createTextNode("test");dom.getBody(document).appendChild(testTextNode);var range=document.createRange();range.setStart(testTextNode,0);range.setEnd(testTextNode,0);try{range.setStart(testTextNode,1);canSetRangeStartAfterEnd=true;rangeProto.setStart=function(node,offset){this.nativeRange.setStart(node,offset);updateRangeProperties(this);};rangeProto.setEnd=function(node,offset){this.nativeRange.setEnd(node,offset);updateRangeProperties(this);};createBeforeAfterNodeSetter=function(name){return function(node){this.nativeRange[name](node);updateRangeProperties(this);};};}catch(ex){canSetRangeStartAfterEnd=false;rangeProto.setStart=function(node,offset){try{this.nativeRange.setStart(node,offset);}catch(ex){this.nativeRange.setEnd(node,offset);this.nativeRange.setStart(node,offset);}
updateRangeProperties(this);};rangeProto.setEnd=function(node,offset){try{this.nativeRange.setEnd(node,offset);}catch(ex){this.nativeRange.setStart(node,offset);this.nativeRange.setEnd(node,offset);}
updateRangeProperties(this);};createBeforeAfterNodeSetter=function(name,oppositeName){return function(node){try{this.nativeRange[name](node);}catch(ex){this.nativeRange[oppositeName](node);this.nativeRange[name](node);}
updateRangeProperties(this);};};}
rangeProto.setStartBefore=createBeforeAfterNodeSetter("setStartBefore","setEndBefore");rangeProto.setStartAfter=createBeforeAfterNodeSetter("setStartAfter","setEndAfter");rangeProto.setEndBefore=createBeforeAfterNodeSetter("setEndBefore","setStartBefore");rangeProto.setEndAfter=createBeforeAfterNodeSetter("setEndAfter","setStartAfter");range.selectNodeContents(testTextNode);if(range.startContainer==testTextNode&&range.endContainer==testTextNode&&range.startOffset==0&&range.endOffset==testTextNode.length){rangeProto.selectNodeContents=function(node){this.nativeRange.selectNodeContents(node);updateRangeProperties(this);};}else{rangeProto.selectNodeContents=function(node){this.setStart(node,0);this.setEnd(node,DomRange.getEndOffset(node));};}
range.selectNodeContents(testTextNode);range.setEnd(testTextNode,3);var range2=document.createRange();range2.selectNodeContents(testTextNode);range2.setEnd(testTextNode,4);range2.setStart(testTextNode,2);if(range.compareBoundaryPoints(range.START_TO_END,range2)==-1&range.compareBoundaryPoints(range.END_TO_START,range2)==1){rangeProto.compareBoundaryPoints=function(type,range){range=range.nativeRange||range;if(type==range.START_TO_END){type=range.END_TO_START;}else if(type==range.END_TO_START){type=range.START_TO_END;}
return this.nativeRange.compareBoundaryPoints(type,range);};}else{rangeProto.compareBoundaryPoints=function(type,range){return this.nativeRange.compareBoundaryPoints(type,range.nativeRange||range);};}
if(api.util.isHostMethod(range,"createContextualFragment")){rangeProto.createContextualFragment=function(fragmentStr){return this.nativeRange.createContextualFragment(fragmentStr);};}
dom.getBody(document).removeChild(testTextNode);range.detach();range2.detach();})();api.createNativeRange=function(doc){doc=doc||document;return doc.createRange();};}else if(api.features.implementsTextRange){WrappedRange=function(textRange){this.textRange=textRange;this.refresh();};WrappedRange.prototype=new DomRange(document);WrappedRange.prototype.refresh=function(){var start,end;var rangeContainerElement=getTextRangeContainerElement(this.textRange);if(textRangeIsCollapsed(this.textRange)){end=start=getTextRangeBoundaryPosition(this.textRange,rangeContainerElement,true,true);}else{start=getTextRangeBoundaryPosition(this.textRange,rangeContainerElement,true,false);end=getTextRangeBoundaryPosition(this.textRange,rangeContainerElement,false,false);}
this.setStart(start.node,start.offset);this.setEnd(end.node,end.offset);};DomRange.copyComparisonConstants(WrappedRange);var globalObj=(function(){return this;})();if(typeof globalObj.Range=="undefined"){globalObj.Range=WrappedRange;}
api.createNativeRange=function(doc){doc=doc||document;return doc.body.createTextRange();};}
if(api.features.implementsTextRange){WrappedRange.rangeToTextRange=function(range){if(range.collapsed){var tr=createBoundaryTextRange(new DomPosition(range.startContainer,range.startOffset),true);return tr;}else{var startRange=createBoundaryTextRange(new DomPosition(range.startContainer,range.startOffset),true);var endRange=createBoundaryTextRange(new DomPosition(range.endContainer,range.endOffset),false);var textRange=dom.getDocument(range.startContainer).body.createTextRange();textRange.setEndPoint("StartToStart",startRange);textRange.setEndPoint("EndToEnd",endRange);return textRange;}};}
WrappedRange.prototype.getName=function(){return"WrappedRange";};api.WrappedRange=WrappedRange;api.createRange=function(doc){doc=doc||document;return new WrappedRange(api.createNativeRange(doc));};api.createRangyRange=function(doc){doc=doc||document;return new DomRange(doc);};api.createIframeRange=function(iframeEl){return api.createRange(dom.getIframeDocument(iframeEl));};api.createIframeRangyRange=function(iframeEl){return api.createRangyRange(dom.getIframeDocument(iframeEl));};api.addCreateMissingNativeApiListener(function(win){var doc=win.document;if(typeof doc.createRange=="undefined"){doc.createRange=function(){return api.createRange(this);};}
doc=win=null;});});rangy.createModule("WrappedSelection",function(api,module){api.requireModules(["DomUtil","DomRange","WrappedRange"]);api.config.checkSelectionRanges=true;var BOOLEAN="boolean",windowPropertyName="_rangySelection",dom=api.dom,util=api.util,DomRange=api.DomRange,WrappedRange=api.WrappedRange,DOMException=api.DOMException,DomPosition=dom.DomPosition,getSelection,selectionIsCollapsed,CONTROL="Control";function getWinSelection(winParam){return(winParam||window).getSelection();}
function getDocSelection(winParam){return(winParam||window).document.selection;}
var implementsWinGetSelection=api.util.isHostMethod(window,"getSelection"),implementsDocSelection=api.util.isHostObject(document,"selection");var useDocumentSelection=implementsDocSelection&&(!implementsWinGetSelection||api.config.preferTextRange);if(useDocumentSelection){getSelection=getDocSelection;api.isSelectionValid=function(winParam){var doc=(winParam||window).document,nativeSel=doc.selection;return(nativeSel.type!="None"||dom.getDocument(nativeSel.createRange().parentElement())==doc);};}else if(implementsWinGetSelection){getSelection=getWinSelection;api.isSelectionValid=function(){return true;};}else{module.fail("Neither document.selection or window.getSelection() detected.");}
api.getNativeSelection=getSelection;var testSelection=getSelection();var testRange=api.createNativeRange(document);var body=dom.getBody(document);var selectionHasAnchorAndFocus=util.areHostObjects(testSelection,["anchorNode","focusNode"]&&util.areHostProperties(testSelection,["anchorOffset","focusOffset"]));api.features.selectionHasAnchorAndFocus=selectionHasAnchorAndFocus;var selectionHasExtend=util.isHostMethod(testSelection,"extend");api.features.selectionHasExtend=selectionHasExtend;var selectionHasRangeCount=(typeof testSelection.rangeCount=="number");api.features.selectionHasRangeCount=selectionHasRangeCount;var selectionSupportsMultipleRanges=false;var collapsedNonEditableSelectionsSupported=true;if(util.areHostMethods(testSelection,["addRange","getRangeAt","removeAllRanges"])&&typeof testSelection.rangeCount=="number"&&api.features.implementsDomRange){(function(){var iframe=document.createElement("iframe");iframe.frameBorder=0;iframe.style.position="absolute";iframe.style.left="-10000px";body.appendChild(iframe);var iframeDoc=dom.getIframeDocument(iframe);iframeDoc.open();iframeDoc.write("<html><head></head><body>12</body></html>");iframeDoc.close();var sel=dom.getIframeWindow(iframe).getSelection();var docEl=iframeDoc.documentElement;var iframeBody=docEl.lastChild,textNode=iframeBody.firstChild;var r1=iframeDoc.createRange();r1.setStart(textNode,1);r1.collapse(true);sel.addRange(r1);collapsedNonEditableSelectionsSupported=(sel.rangeCount==1);sel.removeAllRanges();var r2=r1.cloneRange();r1.setStart(textNode,0);r2.setEnd(textNode,2);sel.addRange(r1);sel.addRange(r2);selectionSupportsMultipleRanges=(sel.rangeCount==2);r1.detach();r2.detach();body.removeChild(iframe);})();}
api.features.selectionSupportsMultipleRanges=selectionSupportsMultipleRanges;api.features.collapsedNonEditableSelectionsSupported=collapsedNonEditableSelectionsSupported;var implementsControlRange=false,testControlRange;if(body&&util.isHostMethod(body,"createControlRange")){testControlRange=body.createControlRange();if(util.areHostProperties(testControlRange,["item","add"])){implementsControlRange=true;}}
api.features.implementsControlRange=implementsControlRange;if(selectionHasAnchorAndFocus){selectionIsCollapsed=function(sel){return sel.anchorNode===sel.focusNode&&sel.anchorOffset===sel.focusOffset;};}else{selectionIsCollapsed=function(sel){return sel.rangeCount?sel.getRangeAt(sel.rangeCount-1).collapsed:false;};}
function updateAnchorAndFocusFromRange(sel,range,backwards){var anchorPrefix=backwards?"end":"start",focusPrefix=backwards?"start":"end";sel.anchorNode=range[anchorPrefix+"Container"];sel.anchorOffset=range[anchorPrefix+"Offset"];sel.focusNode=range[focusPrefix+"Container"];sel.focusOffset=range[focusPrefix+"Offset"];}
function updateAnchorAndFocusFromNativeSelection(sel){var nativeSel=sel.nativeSelection;sel.anchorNode=nativeSel.anchorNode;sel.anchorOffset=nativeSel.anchorOffset;sel.focusNode=nativeSel.focusNode;sel.focusOffset=nativeSel.focusOffset;}
function updateEmptySelection(sel){sel.anchorNode=sel.focusNode=null;sel.anchorOffset=sel.focusOffset=0;sel.rangeCount=0;sel.isCollapsed=true;sel._ranges.length=0;}
function getNativeRange(range){var nativeRange;if(range instanceof DomRange){nativeRange=range._selectionNativeRange;if(!nativeRange){nativeRange=api.createNativeRange(dom.getDocument(range.startContainer));nativeRange.setEnd(range.endContainer,range.endOffset);nativeRange.setStart(range.startContainer,range.startOffset);range._selectionNativeRange=nativeRange;range.attachListener("detach",function(){this._selectionNativeRange=null;});}}else if(range instanceof WrappedRange){nativeRange=range.nativeRange;}else if(api.features.implementsDomRange&&(range instanceof dom.getWindow(range.startContainer).Range)){nativeRange=range;}
return nativeRange;}
function rangeContainsSingleElement(rangeNodes){if(!rangeNodes.length||rangeNodes[0].nodeType!=1){return false;}
for(var i=1,len=rangeNodes.length;i<len;++i){if(!dom.isAncestorOf(rangeNodes[0],rangeNodes[i])){return false;}}
return true;}
function getSingleElementFromRange(range){var nodes=range.getNodes();if(!rangeContainsSingleElement(nodes)){throw new Error("getSingleElementFromRange: range "+range.inspect()+" did not consist of a single element");}
return nodes[0];}
function isTextRange(range){return!!range&&typeof range.text!="undefined";}
function updateFromTextRange(sel,range){var wrappedRange=new WrappedRange(range);sel._ranges=[wrappedRange];updateAnchorAndFocusFromRange(sel,wrappedRange,false);sel.rangeCount=1;sel.isCollapsed=wrappedRange.collapsed;}
function updateControlSelection(sel){sel._ranges.length=0;if(sel.docSelection.type=="None"){updateEmptySelection(sel);}else{var controlRange=sel.docSelection.createRange();if(isTextRange(controlRange)){updateFromTextRange(sel,controlRange);}else{sel.rangeCount=controlRange.length;var range,doc=dom.getDocument(controlRange.item(0));for(var i=0;i<sel.rangeCount;++i){range=api.createRange(doc);range.selectNode(controlRange.item(i));sel._ranges.push(range);}
sel.isCollapsed=sel.rangeCount==1&&sel._ranges[0].collapsed;updateAnchorAndFocusFromRange(sel,sel._ranges[sel.rangeCount-1],false);}}}
function addRangeToControlSelection(sel,range){var controlRange=sel.docSelection.createRange();var rangeElement=getSingleElementFromRange(range);var doc=dom.getDocument(controlRange.item(0));var newControlRange=dom.getBody(doc).createControlRange();for(var i=0,len=controlRange.length;i<len;++i){newControlRange.add(controlRange.item(i));}
try{newControlRange.add(rangeElement);}catch(ex){throw new Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}
newControlRange.select();updateControlSelection(sel);}
var getSelectionRangeAt;if(util.isHostMethod(testSelection,"getRangeAt")){getSelectionRangeAt=function(sel,index){try{return sel.getRangeAt(index);}catch(ex){return null;}};}else if(selectionHasAnchorAndFocus){getSelectionRangeAt=function(sel){var doc=dom.getDocument(sel.anchorNode);var range=api.createRange(doc);range.setStart(sel.anchorNode,sel.anchorOffset);range.setEnd(sel.focusNode,sel.focusOffset);if(range.collapsed!==this.isCollapsed){range.setStart(sel.focusNode,sel.focusOffset);range.setEnd(sel.anchorNode,sel.anchorOffset);}
return range;};}
function WrappedSelection(selection,docSelection,win){this.nativeSelection=selection;this.docSelection=docSelection;this._ranges=[];this.win=win;this.refresh();}
api.getSelection=function(win){win=win||window;var sel=win[windowPropertyName];var nativeSel=getSelection(win),docSel=implementsDocSelection?getDocSelection(win):null;if(sel){sel.nativeSelection=nativeSel;sel.docSelection=docSel;sel.refresh(win);}else{sel=new WrappedSelection(nativeSel,docSel,win);win[windowPropertyName]=sel;}
return sel;};api.getIframeSelection=function(iframeEl){return api.getSelection(dom.getIframeWindow(iframeEl));};var selProto=WrappedSelection.prototype;function createControlSelection(sel,ranges){var doc=dom.getDocument(ranges[0].startContainer);var controlRange=dom.getBody(doc).createControlRange();for(var i=0,el;i<rangeCount;++i){el=getSingleElementFromRange(ranges[i]);try{controlRange.add(el);}catch(ex){throw new Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}
controlRange.select();updateControlSelection(sel);}
if(!useDocumentSelection&&selectionHasAnchorAndFocus&&util.areHostMethods(testSelection,["removeAllRanges","addRange"])){selProto.removeAllRanges=function(){this.nativeSelection.removeAllRanges();updateEmptySelection(this);};var addRangeBackwards=function(sel,range){var doc=DomRange.getRangeDocument(range);var endRange=api.createRange(doc);endRange.collapseToPoint(range.endContainer,range.endOffset);sel.nativeSelection.addRange(getNativeRange(endRange));sel.nativeSelection.extend(range.startContainer,range.startOffset);sel.refresh();};if(selectionHasRangeCount){selProto.addRange=function(range,backwards){if(implementsControlRange&&implementsDocSelection&&this.docSelection.type==CONTROL){addRangeToControlSelection(this,range);}else{if(backwards&&selectionHasExtend){addRangeBackwards(this,range);}else{var previousRangeCount;if(selectionSupportsMultipleRanges){previousRangeCount=this.rangeCount;}else{this.removeAllRanges();previousRangeCount=0;}
this.nativeSelection.addRange(getNativeRange(range));this.rangeCount=this.nativeSelection.rangeCount;if(this.rangeCount==previousRangeCount+1){if(api.config.checkSelectionRanges){var nativeRange=getSelectionRangeAt(this.nativeSelection,this.rangeCount-1);if(nativeRange&&!DomRange.rangesEqual(nativeRange,range)){range=new WrappedRange(nativeRange);}}
this._ranges[this.rangeCount-1]=range;updateAnchorAndFocusFromRange(this,range,selectionIsBackwards(this.nativeSelection));this.isCollapsed=selectionIsCollapsed(this);}else{this.refresh();}}}};}else{selProto.addRange=function(range,backwards){if(backwards&&selectionHasExtend){addRangeBackwards(this,range);}else{this.nativeSelection.addRange(getNativeRange(range));this.refresh();}};}
selProto.setRanges=function(ranges){if(implementsControlRange&&ranges.length>1){createControlSelection(this,ranges);}else{this.removeAllRanges();for(var i=0,len=ranges.length;i<len;++i){this.addRange(ranges[i]);}}};}else if(util.isHostMethod(testSelection,"empty")&&util.isHostMethod(testRange,"select")&&implementsControlRange&&useDocumentSelection){selProto.removeAllRanges=function(){try{this.docSelection.empty();if(this.docSelection.type!="None"){var doc;if(this.anchorNode){doc=dom.getDocument(this.anchorNode);}else if(this.docSelection.type==CONTROL){var controlRange=this.docSelection.createRange();if(controlRange.length){doc=dom.getDocument(controlRange.item(0)).body.createTextRange();}}
if(doc){var textRange=doc.body.createTextRange();textRange.select();this.docSelection.empty();}}}catch(ex){}
updateEmptySelection(this);};selProto.addRange=function(range){if(this.docSelection.type==CONTROL){addRangeToControlSelection(this,range);}else{WrappedRange.rangeToTextRange(range).select();this._ranges[0]=range;this.rangeCount=1;this.isCollapsed=this._ranges[0].collapsed;updateAnchorAndFocusFromRange(this,range,false);}};selProto.setRanges=function(ranges){this.removeAllRanges();var rangeCount=ranges.length;if(rangeCount>1){createControlSelection(this,ranges);}else if(rangeCount){this.addRange(ranges[0]);}};}else{module.fail("No means of selecting a Range or TextRange was found");return false;}
selProto.getRangeAt=function(index){if(index<0||index>=this.rangeCount){throw new DOMException("INDEX_SIZE_ERR");}else{return this._ranges[index];}};var refreshSelection;if(useDocumentSelection){refreshSelection=function(sel){var range;if(api.isSelectionValid(sel.win)){range=sel.docSelection.createRange();}else{range=dom.getBody(sel.win.document).createTextRange();range.collapse(true);}
if(sel.docSelection.type==CONTROL){updateControlSelection(sel);}else if(isTextRange(range)){updateFromTextRange(sel,range);}else{updateEmptySelection(sel);}};}else if(util.isHostMethod(testSelection,"getRangeAt")&&typeof testSelection.rangeCount=="number"){refreshSelection=function(sel){if(implementsControlRange&&implementsDocSelection&&sel.docSelection.type==CONTROL){updateControlSelection(sel);}else{sel._ranges.length=sel.rangeCount=sel.nativeSelection.rangeCount;if(sel.rangeCount){for(var i=0,len=sel.rangeCount;i<len;++i){sel._ranges[i]=new api.WrappedRange(sel.nativeSelection.getRangeAt(i));}
updateAnchorAndFocusFromRange(sel,sel._ranges[sel.rangeCount-1],selectionIsBackwards(sel.nativeSelection));sel.isCollapsed=selectionIsCollapsed(sel);}else{updateEmptySelection(sel);}}};}else if(selectionHasAnchorAndFocus&&typeof testSelection.isCollapsed==BOOLEAN&&typeof testRange.collapsed==BOOLEAN&&api.features.implementsDomRange){refreshSelection=function(sel){var range,nativeSel=sel.nativeSelection;if(nativeSel.anchorNode){range=getSelectionRangeAt(nativeSel,0);sel._ranges=[range];sel.rangeCount=1;updateAnchorAndFocusFromNativeSelection(sel);sel.isCollapsed=selectionIsCollapsed(sel);}else{updateEmptySelection(sel);}};}else{module.fail("No means of obtaining a Range or TextRange from the user's selection was found");return false;}
selProto.refresh=function(checkForChanges){var oldRanges=checkForChanges?this._ranges.slice(0):null;refreshSelection(this);if(checkForChanges){var i=oldRanges.length;if(i!=this._ranges.length){return false;}
while(i--){if(!DomRange.rangesEqual(oldRanges[i],this._ranges[i])){return false;}}
return true;}};var removeRangeManually=function(sel,range){var ranges=sel.getAllRanges(),removed=false;sel.removeAllRanges();for(var i=0,len=ranges.length;i<len;++i){if(removed||range!==ranges[i]){sel.addRange(ranges[i]);}else{removed=true;}}
if(!sel.rangeCount){updateEmptySelection(sel);}};if(implementsControlRange){selProto.removeRange=function(range){if(this.docSelection.type==CONTROL){var controlRange=this.docSelection.createRange();var rangeElement=getSingleElementFromRange(range);var doc=dom.getDocument(controlRange.item(0));var newControlRange=dom.getBody(doc).createControlRange();var el,removed=false;for(var i=0,len=controlRange.length;i<len;++i){el=controlRange.item(i);if(el!==rangeElement||removed){newControlRange.add(controlRange.item(i));}else{removed=true;}}
newControlRange.select();updateControlSelection(this);}else{removeRangeManually(this,range);}};}else{selProto.removeRange=function(range){removeRangeManually(this,range);};}
var selectionIsBackwards;if(!useDocumentSelection&&selectionHasAnchorAndFocus&&api.features.implementsDomRange){selectionIsBackwards=function(sel){var backwards=false;if(sel.anchorNode){backwards=(dom.comparePoints(sel.anchorNode,sel.anchorOffset,sel.focusNode,sel.focusOffset)==1);}
return backwards;};selProto.isBackwards=function(){return selectionIsBackwards(this);};}else{selectionIsBackwards=selProto.isBackwards=function(){return false;};}
selProto.toString=function(){var rangeTexts=[];for(var i=0,len=this.rangeCount;i<len;++i){rangeTexts[i]=""+this._ranges[i];}
return rangeTexts.join("");};function assertNodeInSameDocument(sel,node){if(sel.anchorNode&&(dom.getDocument(sel.anchorNode)!==dom.getDocument(node))){throw new DOMException("WRONG_DOCUMENT_ERR");}}
selProto.collapse=function(node,offset){assertNodeInSameDocument(this,node);var range=api.createRange(dom.getDocument(node));range.collapseToPoint(node,offset);this.removeAllRanges();this.addRange(range);this.isCollapsed=true;};selProto.collapseToStart=function(){if(this.rangeCount){var range=this._ranges[0];this.collapse(range.startContainer,range.startOffset);}else{throw new DOMException("INVALID_STATE_ERR");}};selProto.collapseToEnd=function(){if(this.rangeCount){var range=this._ranges[this.rangeCount-1];this.collapse(range.endContainer,range.endOffset);}else{throw new DOMException("INVALID_STATE_ERR");}};selProto.selectAllChildren=function(node){assertNodeInSameDocument(this,node);var range=api.createRange(dom.getDocument(node));range.selectNodeContents(node);this.removeAllRanges();this.addRange(range);};selProto.deleteFromDocument=function(){if(implementsControlRange&&implementsDocSelection&&this.docSelection.type==CONTROL){var controlRange=this.docSelection.createRange();var element;while(controlRange.length){element=controlRange.item(0);controlRange.remove(element);element.parentNode.removeChild(element);}
this.refresh();}else if(this.rangeCount){var ranges=this.getAllRanges();this.removeAllRanges();for(var i=0,len=ranges.length;i<len;++i){ranges[i].deleteContents();}
this.addRange(ranges[len-1]);}};selProto.getAllRanges=function(){return this._ranges.slice(0);};selProto.setSingleRange=function(range){this.setRanges([range]);};selProto.containsNode=function(node,allowPartial){for(var i=0,len=this._ranges.length;i<len;++i){if(this._ranges[i].containsNode(node,allowPartial)){return true;}}
return false;};selProto.toHtml=function(){var html="";if(this.rangeCount){var container=DomRange.getRangeDocument(this._ranges[0]).createElement("div");for(var i=0,len=this._ranges.length;i<len;++i){container.appendChild(this._ranges[i].cloneContents());}
html=container.innerHTML;}
return html;};function inspect(sel){var rangeInspects=[];var anchor=new DomPosition(sel.anchorNode,sel.anchorOffset);var focus=new DomPosition(sel.focusNode,sel.focusOffset);var name=(typeof sel.getName=="function")?sel.getName():"Selection";if(typeof sel.rangeCount!="undefined"){for(var i=0,len=sel.rangeCount;i<len;++i){rangeInspects[i]=DomRange.inspect(sel.getRangeAt(i));}}
return"["+name+"(Ranges: "+rangeInspects.join(", ")+")(anchor: "+anchor.inspect()+", focus: "+focus.inspect()+"]";}
selProto.getName=function(){return"WrappedSelection";};selProto.inspect=function(){return inspect(this);};selProto.detach=function(){this.win[windowPropertyName]=null;this.win=this.anchorNode=this.focusNode=null;};WrappedSelection.inspect=inspect;api.Selection=WrappedSelection;api.selectionPrototype=selProto;api.addCreateMissingNativeApiListener(function(win){if(typeof win.getSelection=="undefined"){win.getSelection=function(){return api.getSelection(this);};}
win=null;});});function getCharacterOffsetWithin(range,node){var treeWalker=document.createTreeWalker(node,NodeFilter.SHOW_TEXT,function(node){var nodeRange=document.createRange();nodeRange.selectNode(node);return nodeRange.compareBoundaryPoints(Range.END_TO_END,range)<1?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;},false);var charCount=0;while(treeWalker.nextNode()){charCount+=treeWalker.currentNode.length;}
if(range.startContainer.nodeType==3){charCount+=range.startOffset;}
return charCount;}
function getCaretPosition(containerEl){var range=window.getSelection().getRangeAt(0);return getCharacterOffsetWithin(range,containerEl)}
function setCaretPosition(containerEl,index){var charIndex=0,stop={};function traverseNodes(node){if(node.nodeType==3){var nextCharIndex=charIndex+node.length;if(index>=charIndex&&index<=nextCharIndex){rangy.getSelection().collapse(node,index-charIndex);throw stop;}
charIndex=nextCharIndex;}
else if(node.nodeType==1&&/^(input|br|img|col|area|link|meta|link|param|base)$/i.test(node.nodeName)){charIndex+=1;}else{var child=node.firstChild;while(child){traverseNodes(child);child=child.nextSibling;}}}
try{traverseNodes(containerEl);}catch(ex){if(ex!=stop){throw ex;}}}!function($){"use strict";var Typeahead=function(element,options){this.$element=$(element)
this.options=$.extend({},$.fn.typeahead.defaults,options)
this.matcher=this.options.matcher||this.matcher
this.sorter=this.options.sorter||this.sorter
this.highlighter=this.options.highlighter||this.highlighter
this.updater=this.options.updater||this.updater
this.source=this.options.source
this.$menu=$(this.options.menu)
this.shown=false
this.listen()}
Typeahead.prototype={constructor:Typeahead,select:function(){var val=this.$menu.find('.active').attr('data-value')
this.$element.val(this.updater(val)).text(this.updater(val)).change()
return this.hide()},updater:function(item){return item},show:function(){var pos=$.extend({},this.$element.position(),{height:this.$element[0].offsetHeight})
this.$menu.insertAfter(this.$element).css({top:pos.top+pos.height,left:pos.left}).show()
this.shown=true
return this},hide:function(){this.$menu.hide()
this.shown=false
return this},lookup:function(event){var items
this.query=this.$element.is("input")?this.$element.val():this.$element.text();if(!this.query||this.query.length<this.options.minLength){return this.shown?this.hide():this}
items=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source
return items?this.process(items):this},process:function(items){var that=this
items=$.grep(items,function(item){return that.matcher(item)})
items=this.sorter(items)
if(!items.length){return this.shown?this.hide():this}
return this.render(items.slice(0,this.options.items)).show()},matcher:function(item){return~item.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(items){var beginswith=[],caseSensitive=[],caseInsensitive=[],item
while(item=items.shift()){if(!item.toLowerCase().indexOf(this.query.toLowerCase()))beginswith.push(item)
else if(~item.indexOf(this.query))caseSensitive.push(item)
else caseInsensitive.push(item)}
return beginswith.concat(caseSensitive,caseInsensitive)},highlighter:function(item){var query=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,'\\$&')
return item.replace(new RegExp('('+query+')','ig'),function($1,match){return'<strong>'+match+'</strong>'})},render:function(items){var that=this
items=$(items).map(function(i,item){i=$(that.options.item).attr('data-value',item)
i.find('a').html(that.highlighter(item))
return i[0]})
items.first().addClass('active')
this.$menu.html(items)
return this},next:function(event){console.log(this.$menu);var active=this.$menu.find('.active').removeClass('active'),next=active.next()
console.log(next);if(!next.length){next=$(this.$menu.find('li')[0])}
next.addClass('active')},prev:function(event){var active=this.$menu.find('.active').removeClass('active'),prev=active.prev()
if(!prev.length){prev=this.$menu.find('li').last()}
console.log(prev);prev.addClass('active')},listen:function(){this.$element.on('focus',$.proxy(this.focus,this)).on('blur',$.proxy(this.blur,this)).on('keypress',$.proxy(this.keypress,this)).on('keyup',$.proxy(this.keyup,this))
if(this.eventSupported('keydown')){this.$element.on('keydown',$.proxy(this.keydown,this))}
this.$menu.on('click',$.proxy(this.click,this)).on('mouseenter','li',$.proxy(this.mouseenter,this)).on('mouseleave','li',$.proxy(this.mouseleave,this))},eventSupported:function(eventName){var isSupported=eventName in this.$element
if(!isSupported){this.$element.setAttribute(eventName,'return;')
isSupported=typeof this.$element[eventName]==='function'}
return isSupported},move:function(e){if(!this.shown)return
switch(e.keyCode){case 9:case 13:case 27:e.preventDefault()
break
case 38:e.preventDefault()
this.prev()
break
case 40:e.preventDefault()
this.next()
break}
e.stopPropagation()},keydown:function(e){this.suppressKeyPressRepeat=~$.inArray(e.keyCode,[40,38,9,13,27])
this.move(e)},keypress:function(e){if(this.suppressKeyPressRepeat)return
this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break
case 9:case 13:if(!this.shown)return
this.select()
break
case 27:if(!this.shown)return
this.hide()
break
default:this.lookup()}},focus:function(e){this.focused=true},blur:function(e){this.focused=false
if(!this.mousedover&&this.shown)this.hide()},click:function(e){e.stopPropagation()
e.preventDefault()
this.select()
this.$element.focus()},mouseenter:function(e){this.mousedover=true
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')},mouseleave:function(e){this.mousedover=false
if(!this.focused&&this.shown)this.hide()}}
var old=$.fn.typeahead
$.fn.typeahead=function(option){return this.each(function(){var $this=$(this),data=$this.data('typeahead'),options=typeof option=='object'&&option
if(!data)$this.data('typeahead',(data=new Typeahead(this,options)))
if(typeof option=='string')data[option]()})}
$.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1}
$.fn.typeahead.Constructor=Typeahead
$.fn.typeahead.noConflict=function(){$.fn.typeahead=old
return this}
$(document).on('focus.typeahead.data-api','[data-provide="typeahead"]',function(e){var $this=$(this)
if($this.data('typeahead'))return
$this.typeahead($this.data())})}(window.jQuery);!function($){"use strict";var Tagautocomplete=function(element,options){$.fn.typeahead.Constructor.call(this,element,options)
this.after=this.options.after||this.after
this.show=this.options.show||this.show}
Tagautocomplete.prototype=$.extend({},$.fn.typeahead.Constructor.prototype,{constructor:Tagautocomplete,select:function(e){var val=this.$menu.find('.active').attr('data-value')
var offset=this.updater(val).length-this.length_of_query;var position=getCaretPosition(this.$element[0])+offset
this.node.splitText(this.index_for_split);this.node.nextSibling.splitText(this.length_of_query);this.node.nextSibling.nodeValue=this.updater(val);this.$element.change();this.after();setCaretPosition(this.$element[0],position);this.isCallingInDown=false;return this.hide()},keypress:function(e){return;},after:function(){},keydown:function(e){if(e.keyCode==13)
{if(!this.shown)return
this.isCallingInDown=true;this.select();e.preventDefault();}
else
this.move(e);},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break
case 9:case 13:var val=this.$menu.find('.active').attr('data-value')
var offset=this.updater(val).length-this.length_of_query;var position=getCaretPosition(this.$element[0])+offset
setCaretPosition(this.$element[0],position);case 27:if(!this.shown)return
this.hide()
break
default:this.lookup()}},show:function(){var pos=this.$element.position();var height=this.$element[0].offsetHeight;var offset=this.$element.offset();this.$menu.appendTo('body').show().css({position:"absolute",top:(offset.top+pos.top-40)+height+"px",left:(offset.left+pos.left)+"px"});this.shown=true
return this},extractor:function(){var query=this.query;var position=getCaretPosition(this.$element[0]);query=query.substring(0,position);var regex=new RegExp("(^|\\s)(["+this.options.character+"][\\w-]*)$");var result=regex.exec(query);if(result&&result[2])
return result[2].trim();return'';},updater:function(item){return item+' ';},matcher:function(item){var tquery=this.extractor();if(!tquery)return false;this.length_of_query=tquery.length
var range=window.getSelection().getRangeAt(0);this.index_for_split=range.startOffset-this.length_of_query;this.node=range.startContainer
return~item.toLowerCase().indexOf(tquery)},highlighter:function(item){var query=this.extractor().replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,'\\$&')
return item.replace(new RegExp('('+query+')','ig'),function($1,match){return'<strong>'+match+'</strong>'})}})
var old=$.fn.tagautocomplete
$.fn.tagautocomplete=function(option){return this.each(function(){var $this=$(this),data=$this.data('tagautocomplete'),options=typeof option=='object'&&option
if(!data)$this.data('tagautocomplete',(data=new Tagautocomplete(this,options)))
if(typeof option=='string')data[option]()})}
$.fn.tagautocomplete.Constructor=Tagautocomplete
$.fn.tagautocomplete.defaults=$.extend($.fn.typeahead.defaults,{character:'@'})
$.fn.tagautocomplete.noConflict=function(){$.fn.tagautocomplete=old
return this}}(window.jQuery);var Attacklab=Attacklab||{}
Attacklab.showdown=Attacklab.showdown||{}
Attacklab.showdown.converter=function(){var SaveHash=function(){this.set=function(key,value){this["s_"+key]=value;}
this.get=function(key){return this["s_"+key];}}
var g_urls;var g_titles;var g_html_blocks;var g_list_level=0;this.makeHtml=function(text){text=text.replace(/^>/mg,'\n(!GT!)');text=text.replace(/^\(!GT!\)/mg,'\n>');g_urls=new SaveHash();g_titles=new SaveHash();g_html_blocks=new Array();text=text.replace(/~/g,"~T");text=text.replace(/\$/g,"~D");text=text.replace(/\r\n/g,"\n");text=text.replace(/\r/g,"\n");text="\n\n"+text+"\n\n";text=_Detab(text);text=text.replace(/^[ \t]+$/mg,"");text=_HashHTMLBlocks(text);text=_StripLinkDefinitions(text);text=_RunBlockGamut(text);text=_UnescapeSpecialChars(text);text=text.replace(/~D/g,"$$");text=text.replace(/~T/g,"~");return text;}
var _StripLinkDefinitions=function(text){var text=text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(wholeMatch,m1,m2,m3,m4,m5){m1=m1.toLowerCase();g_urls.set(m1,_EncodeAmpsAndAngles(m2));if(m4){return m3;}else if(m5){g_titles.set(m1,m5.replace(/"/g,"&quot;"));}
return"";});return text;}
var _HashHTMLBlocks=function(text){var block_tags_a="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"
var block_tags_b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"
text=text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,hashElement);text=text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement);text=text.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,hashElement);text=text.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g,hashElement);text=text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,hashElement);return text;}
var hashElement=function(wholeMatch,m1){var blockText=m1;blockText=blockText.replace(/^\n+/,"");blockText=blockText.replace(/\n+$/g,"");blockText="\n\n~K"+(g_html_blocks.push(blockText)-1)+"K\n\n";return blockText;};var _RunBlockGamut=function(text,doNotUnhash){text=_DoHeaders(text);var key=hashBlock("<hr />");text=text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm,key);text=text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm,key);text=_DoLists(text);text=_DoCodeBlocks(text);text=_DoBlockQuotes(text);text=_HashHTMLBlocks(text);text=_FormParagraphs(text,doNotUnhash);return text;}
var _RunSpanGamut=function(text){text=_DoCodeSpans(text);text=_EscapeSpecialCharsWithinTagAttributes(text);text=_EncodeBackslashEscapes(text);text=_DoImages(text);text=_DoAnchors(text);text=_DoAutoLinks(text);text=_EncodeAmpsAndAngles(text);text=_DoItalicsAndBold(text);text=text.replace(/  +\n/g," <br />\n");return text;}
var _EscapeSpecialCharsWithinTagAttributes=function(text){var regex=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;text=text.replace(regex,function(wholeMatch){var tag=wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`");tag=escapeCharacters(tag,"\\`*_");return tag;});return text;}
var _DoAnchors=function(text){text=text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeAnchorTag);text=text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?((?:\([^)]*\)|[^()])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);text=text.replace(/(\[([^\[\]]+)\])()()()()()/g,writeAnchorTag);return text;}
var writeAnchorTag=function(wholeMatch,m1,m2,m3,m4,m5,m6,m7){if(m7==undefined)m7="";var whole_match=m1;var link_text=m2;var link_id=m3.toLowerCase();var url=m4;var title=m7;if(url==""){if(link_id==""){link_id=link_text.toLowerCase().replace(/ ?\n/g," ");}
url="#"+link_id;if(g_urls.get(link_id)!=undefined){url=g_urls.get(link_id);if(g_titles.get(link_id)!=undefined){title=g_titles.get(link_id);}}
else{if(whole_match.search(/\(\s*\)$/m)>-1){url="";}else{return whole_match;}}}
url=escapeCharacters(url,"*_");var result="<a href=\""+url+"\"";if(title!=""){title=title.replace(/"/g,"&quot;");title=escapeCharacters(title,"*_");result+=" title=\""+title+"\"";}
result+=">"+link_text+"</a>";return result;}
var _DoImages=function(text){text=text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeImageTag);text=text.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeImageTag);return text;}
var writeImageTag=function(wholeMatch,m1,m2,m3,m4,m5,m6,m7){var whole_match=m1;var alt_text=m2;var link_id=m3.toLowerCase();var url=m4;var title=m7;if(!title)title="";if(url==""){if(link_id==""){link_id=alt_text.toLowerCase().replace(/ ?\n/g," ");}
url="#"+link_id;if(g_urls.get(link_id)!=undefined){url=g_urls.get(link_id);if(g_titles.get(link_id)!=undefined){title=g_titles.get(link_id);}}
else{return whole_match;}}
alt_text=alt_text.replace(/"/g,"&quot;");url=escapeCharacters(url,"*_");var result="<img src=\""+url+"\" alt=\""+alt_text+"\"";title=title.replace(/"/g,"&quot;");title=escapeCharacters(title,"*_");result+=" title=\""+title+"\"";result+=" />";return result;}
var _DoHeaders=function(text){text=text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(wholeMatch,m1){return"<h1>"+_RunSpanGamut(m1)+"</h1>\n\n";});text=text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(matchFound,m1){return"<h2>"+_RunSpanGamut(m1)+"</h2>\n\n";});text=text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(wholeMatch,m1,m2){var h_level=m1.length;return"<h"+h_level+">"+_RunSpanGamut(m2)+"</h"+h_level+">\n\n";});return text;}
var _ProcessListItems;var _DoLists=function(text){text+="~0";var whole_list=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;if(g_list_level){text=text.replace(whole_list,function(wholeMatch,m1,m2){var list=m1;var list_type=(m2.search(/[*+-]/g)>-1)?"ul":"ol";var result=_ProcessListItems(list,list_type);result=result.replace(/\s+$/,"");result="<"+list_type+">"+result+"</"+list_type+">\n";return result;});}else{whole_list=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;text=text.replace(whole_list,function(wholeMatch,m1,m2,m3){var runup=m1;var list=m2;var list_type=(m3.search(/[*+-]/g)>-1)?"ul":"ol";var result=_ProcessListItems(list,list_type);result=runup+"<"+list_type+">\n"+result+"</"+list_type+">\n";return result;});}
text=text.replace(/~0/,"");return text;}
var _listItemMarkers={ol:"\\d+[.]",ul:"[*+-]"};_ProcessListItems=function(list_str,list_type){g_list_level++;list_str=list_str.replace(/\n{2,}$/,"\n");list_str+="~0";var marker=_listItemMarkers[list_type];var re=new RegExp("(^[ \\t]*)("+marker+")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1("+marker+")[ \\t]+))","gm");var last_item_had_a_double_newline=false;list_str=list_str.replace(re,function(wholeMatch,m1,m2,m3){var item=m3;var leading_space=m1;var ends_with_double_newline=/\n\n$/.test(item);var contains_double_newline=ends_with_double_newline||item.search(/\n{2,}/)>-1;if(contains_double_newline||last_item_had_a_double_newline){item=_RunBlockGamut(_Outdent(item),true);}
else{item=_DoLists(_Outdent(item));item=item.replace(/\n$/,"");item=_RunSpanGamut(item);}
last_item_had_a_double_newline=ends_with_double_newline;return"<li>"+item+"</li>\n";});list_str=list_str.replace(/~0/g,"");g_list_level--;return list_str;}
var _DoCodeBlocks=function(text){text+="~0";text=text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(wholeMatch,m1,m2){var codeblock=m1;var nextChar=m2;codeblock=_EncodeCode(_Outdent(codeblock));codeblock=_Detab(codeblock);codeblock=codeblock.replace(/^\n+/g,"");codeblock=codeblock.replace(/\n+$/g,"");codeblock="<pre><code>"+codeblock+"\n</code></pre>";return"\n\n"+codeblock+"\n\n"+nextChar;});text=text.replace(/~0/,"");return text;}
var hashBlock=function(text){text=text.replace(/(^\n+|\n+$)/g,"");return"\n\n~K"+(g_html_blocks.push(text)-1)+"K\n\n";}
var _DoCodeSpans=function(text){text=text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(wholeMatch,m1,m2,m3,m4){var c=m3;c=c.replace(/^([ \t]*)/g,"");c=c.replace(/[ \t]*$/g,"");c=_EncodeCode(c);return m1+"<code>"+c+"</code>";});return text;}
var _EncodeCode=function(text){text=text.replace(/&/g,"&amp;");text=text.replace(/</g,"&lt;");text=text.replace(/>/g,"&gt;");text=escapeCharacters(text,"\*_{}[]\\",false);return text;}
var _DoItalicsAndBold=function(text){text=text.replace(/(^|\W)(\*\*|__)(?=\S)([^\r]*?\S)\2(\W|$)/g,"$1<strong>$3</strong>$4");text=text.replace(/(^|\W)(\*|_)(?=\S)([^\r]*?\S)\2(\W|$)/g,"$1<em>$3</em>$4");return text;}
var _DoBlockQuotes=function(text){text=text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(wholeMatch,m1){var bq=m1;bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0");bq=bq.replace(/~0/g,"");bq=bq.replace(/^[ \t]+$/gm,"");bq=_RunBlockGamut(bq);bq=bq.replace(/(^|\n)/g,"$1  ");bq=bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(wholeMatch,m1){var pre=m1;pre=pre.replace(/^  /mg,"~0");pre=pre.replace(/~0/g,"");return pre;});return hashBlock("<blockquote>\n"+bq+"\n</blockquote>");});return text;}
var _FormParagraphs=function(text,doNotUnhash){text=text.replace(/^\n+/g,"");text=text.replace(/\n+$/g,"");var grafs=text.split(/\n{2,}/g);var grafsOut=new Array();var end=grafs.length;for(var i=0;i<end;i++){var str=grafs[i];if(str.search(/~K(\d+)K/g)>=0){grafsOut.push(str);}
else if(str.search(/\S/)>=0){str=_RunSpanGamut(str);str=str.replace(/^([ \t]*)/g,"<p>");str+="</p>"
grafsOut.push(str);}}
if(!doNotUnhash){end=grafsOut.length;for(var i=0;i<end;i++){while(grafsOut[i].search(/~K(\d+)K/)>=0){var blockText=g_html_blocks[RegExp.$1];blockText=blockText.replace(/\$/g,"$$$$");grafsOut[i]=grafsOut[i].replace(/~K\d+K/,blockText);}}}
return grafsOut.join("\n\n");}
var _EncodeAmpsAndAngles=function(text){text=text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");text=text.replace(/<(?![a-z\/?\$!])/gi,"&lt;");return text;}
var _EncodeBackslashEscapes=function(text){text=text.replace(/\\+/g,escapeSlashes);text=text.replace(/\\([`*_{}\[\]()>#+-.!])/g,escapeCharacters_callback);return text;}
var _DoAutoLinks=function(text){text=text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"<a href=\"$1\">$1</a>");text=text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(wholeMatch,m1){return _EncodeEmailAddress(_UnescapeSpecialChars(m1));});return text;}
var _EncodeEmailAddress=function(addr){function char2hex(ch){var hexDigits='0123456789ABCDEF';var dec=ch.charCodeAt(0);return(hexDigits.charAt(dec>>4)+hexDigits.charAt(dec&15));}
var encode=[function(ch){return"&#"+ch.charCodeAt(0)+";";},function(ch){return"&#x"+char2hex(ch)+";";},function(ch){return ch;}];addr="mailto:"+addr;addr=addr.replace(/./g,function(ch){if(ch=="@"){ch=encode[Math.floor(Math.random()*2)](ch);}else if(ch!=":"){var r=Math.random();ch=(r>.9?encode[2](ch):r>.45?encode[1](ch):encode[0](ch));}
return ch;});addr="<a href=\""+addr+"\">"+addr+"</a>";addr=addr.replace(/">.+:/g,"\">");return addr;}
var _UnescapeSpecialChars=function(text){text=text.replace(/~E(\d+)E/g,function(wholeMatch,m1){var charCodeToReplace=parseInt(m1);return String.fromCharCode(charCodeToReplace);});return text;}
var _Outdent=function(text){text=text.replace(/^(\t|[ ]{1,4})/gm,"~0");text=text.replace(/~0/g,"")
return text;}
var _Detab=function(text){if(!/\t/.test(text))
return text;var spaces=["    ","   ","  "," "],skew=0,v;return text.replace(/[\n\t]/g,function(match,offset){if(match==="\n"){skew=offset+1;return match;}
v=(offset-skew)%4;skew=offset+1;return spaces[v];});}
var escapeCharacters=function(text,charsToEscape,afterBackslash){var regexString="(["+charsToEscape.replace(/([\[\]\\])/g,"\\$1")+"])";if(afterBackslash){regexString="\\\\"+regexString;}
var regex=new RegExp(regexString,"g");text=text.replace(regex,escapeCharacters_callback);return text;}
var escapeCharacters_callback=function(wholeMatch,m1){var charCodeToEscape=m1.charCodeAt(0);return"~E"+charCodeToEscape+"E";}
var escapeSlashes=function(slashes){if(slashes.length%2>0){slashes=slashes.substr(0,slashes.length-1);}
if(slashes.length>0){var ret='';for(var i=0;i<slashes.length/2;i++){ret+=escapeCharacters_callback(slashes,'\\');}
return ret;}else{return'';}}}
var Showdown=Attacklab.showdown;if(Attacklab.fileLoaded){Attacklab.fileLoaded("showdown.js");}
jQuery.extend({createUploadIframe:function(d,b){var a="jUploadFrame"+d;if(window.ActiveXObject){var c=document.createElement('<iframe id="'+a+'" name="'+a+'" />');if(typeof b=="boolean"){c.src="javascript:false"}else{if(typeof b=="string"){c.src=b}}}else{var c=document.createElement("iframe");c.id=a;c.name=a}c.style.position="absolute";c.style.top="-1000px";c.style.left="-1000px";document.body.appendChild(c);return c},createUploadForm:function(g,b){var e="jUploadForm"+g;var a="jUploadFile"+g;var d=$('<form  action="" method="POST" name="'+e+'" id="'+e+'" enctype="multipart/form-data"></form>');var c=$("#"+b);var f=$(c).clone();$(c).attr("id",a);$(c).before(f);$(c).appendTo(d);$(d).css("position","absolute");$(d).css("top","-1200px");$(d).css("left","-1200px");$(d).appendTo("body");return d},ajaxFileUpload:function(k){k=jQuery.extend({},jQuery.ajaxSettings,k);var a=new Date().getTime();var b=jQuery.createUploadForm(a,k.fileElementId);var i=jQuery.createUploadIframe(a,k.secureuri);var h="jUploadFrame"+a;var j="jUploadForm"+a;if(k.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart")}var c=false;var f={};if(k.global){jQuery.event.trigger("ajaxSend",[f,k])}var d=function(l){var p=document.getElementById(h);try{if(p.contentWindow){f.responseText=p.contentWindow.document.body?p.contentWindow.document.body.innerText:null;f.responseXML=p.contentWindow.document.XMLDocument?p.contentWindow.document.XMLDocument:p.contentWindow.document}else{if(p.contentDocument){f.responseText=p.contentDocument.document.body?p.contentDocument.document.body.textContent||document.body.innerText:null;f.responseXML=p.contentDocument.document.XMLDocument?p.contentDocument.document.XMLDocument:p.contentDocument.document}}}catch(o){jQuery.handleError(k,f,null,o)}if(f||l=="timeout"){c=true;var m;try{m=l!="timeout"?"success":"error";if(m!="error"){var n=jQuery.uploadHttpData(f,k.dataType);if(k.success){k.success(n,m)}if(k.global){jQuery.event.trigger("ajaxSuccess",[f,k])}}else{jQuery.handleError(k,f,m)}}catch(o){m="error";jQuery.handleError(k,f,m,o)}if(k.global){jQuery.event.trigger("ajaxComplete",[f,k])}if(k.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop")}if(k.complete){k.complete(f,m)}jQuery(p).unbind();setTimeout(function(){try{$(p).remove();$(b).remove()}catch(q){jQuery.handleError(k,f,null,q)}},100);f=null}};if(k.timeout>0){setTimeout(function(){if(!c){d("timeout")}},k.timeout)}try{var b=$("#"+j);$(b).attr("action",k.url);$(b).attr("method","POST");$(b).attr("target",h);if(b.encoding){b.encoding="multipart/form-data"}else{b.enctype="multipart/form-data"}$(b).submit()}catch(g){jQuery.handleError(k,f,null,g)}if(window.attachEvent){document.getElementById(h).attachEvent("onload",d)}else{document.getElementById(h).addEventListener("load",d,false)}return{abort:function(){}}},uploadHttpData:function(r,type){var data=!type;data=type=="xml"||data?r.responseXML:r.responseText;if(type=="script"){jQuery.globalEval(data)}if(type=="json"){eval("data = "+data)}if(type=="html"){jQuery("<div>").html(data).evalScripts()}return data}});function ajaxFileUpload(imageUrl)
{$("#loading").ajaxStart(function(){$(this).show();}).ajaxComplete(function(){$(this).hide();});$("#upload").ajaxStart(function(){$(this).hide();}).ajaxComplete(function(){$(this).show();});$.ajaxFileUpload
({url:'/upload/',secureuri:false,fileElementId:'file-upload',dataType:'xml',success:function(data,status)
{var fileURL=$(data).find('file_url').text();var error=$(data).find('error').text();if(error!=''){alert(error);}else{imageUrl.attr('value',fileURL);}},error:function(data,status,e)
{alert(e);}});return false;}
var d=new Date();d.setTime(d.getTime()+(1*24*60*60*1000));var expires="expires="+d.toUTCString();function createCookie(name,value,days){localStorage.setItem(name,value);}
function readCookie(name){return localStorage.getItem(name);}
function eraseCookie(name){localStorage.removeItem(name);}
function createWmd(Attacklab){Attacklab.wmdBase=function(editorElements,hideHelp,attachments){var wmd=Attacklab;var doc=top.document;var re=top.RegExp;var nav=top.navigator;wmd.Util={};wmd.Position={};wmd.Command={};wmd.Global={};var util=wmd.Util;var position=wmd.Position;var command=wmd.Command;var global=wmd.Global;global.isIE=/msie/.test(nav.userAgent.toLowerCase());global.isIE_5or6=/msie 6/.test(nav.userAgent.toLowerCase())||/msie 5/.test(nav.userAgent.toLowerCase());global.isIE_7plus=global.isIE&&!global.isIE_5or6;global.isIE_9=/msie 9/.test(nav.userAgent.toLowerCase());global.isOpera=/opera/.test(nav.userAgent.toLowerCase());global.isKonqueror=/konqueror/.test(nav.userAgent.toLowerCase());var toolbar_strong_label=$.i18n._('bold')+" <strong> Ctrl-B";var toolbar_emphasis_label=$.i18n._('italic')+" <em> Ctrl-I";var toolbar_hyperlink_label=$.i18n._('link')+" <a> Ctrl-L";var toolbar_blockquote_label=$.i18n._('quote')+" <blockquote> Ctrl-.";var toolbar_code_label=$.i18n._('preformatted text')+" <pre><code> Ctrl-K";var toolbar_image_label=$.i18n._('image')+" <img> Ctrl-G";var toolbar_numbered_label=$.i18n._('numbered list')+" <ol> Ctrl-O";var toolbar_bulleted_label=$.i18n._('bulleted list')+" <ul> Ctrl-U";var toolbar_heading_label=$.i18n._('heading')+" <h1>/<h2> Ctrl-H";var toolbar_horizontal_label=$.i18n._('horizontal bar')+" <hr> Ctrl-R";var toolbar_undo_label=$.i18n._('undo')+" Ctrl-Z";var toolbar_redo_label=$.i18n._('redo')+" Ctrl-Y";var imageDialogText=pageContext.i18n.WMDImageDialogText;var linkDialogText=pageContext.i18n.WMDLinkDialogText;var uploadImageHTML="<div>"+pageContext.i18n.WMDUploadImage+"</div>"+"<input type=\"file\" name=\"file-upload\" id=\"file-upload\" size=\"26\" "+"onchange=\"return ajaxFileUpload($('#image-url'));\"/><br>"+"<img id=\"loading\" src=\""+mediaUrl("media/images/indicator.gif")+"\" style=\"display:none;\"/>";var imageDefaultText="http://";var linkDefaultText="http://";var imageDirectory="images/";var previewPollInterval=500;var pastePollInterval=100;var helpLink=pageContext.url.markdownHelp;var helpHoverTitle=pageContext.i18n.WMDHelp;var helpTarget="_blank";if(editorElements){wmd.PanelCollection=function(){this.buttonBar=editorElements.buttonBar;this.preview=editorElements.preview;this.output=editorElements.output;this.input=editorElements.input;};}else{wmd.PanelCollection=function(){this.buttonBar=doc.getElementById("wmd-button-bar");this.preview=doc.getElementById("previewer");this.output=doc.getElementById("wmd-output");this.input=doc.getElementById("body");};}
wmd.panels=undefined;wmd.ieCachedRange=null;wmd.ieRetardedClick=false;util.isVisible=function(elem){if(window.getComputedStyle){return window.getComputedStyle(elem,null).getPropertyValue("display")!=="none";}
else if(elem.currentStyle){return elem.currentStyle["display"]!=="none";}};util.addEvent=function(elem,event,listener){if(elem.attachEvent){elem.attachEvent("on"+event,listener);}
else{elem.addEventListener(event,listener,false);}};util.removeEvent=function(elem,event,listener){if(elem.detachEvent){elem.detachEvent("on"+event,listener);}
else{elem.removeEventListener(event,listener,false);}};util.fixEolChars=function(text){text=text.replace(/\r\n/g,"\n");text=text.replace(/\r/g,"\n");return text;};util.extendRegExp=function(regex,pre,post){if(pre===null||pre===undefined)
{pre="";}
if(post===null||post===undefined)
{post="";}
var pattern=regex.toString();var flags="";var result=pattern.match(/\/([gim]*)$/);if(result===null){flags=result[0];}
else{flags="";}
pattern=pattern.replace(/(^\/|\/[gim]*$)/g,"");pattern=pre+pattern+post;return new RegExp(pattern,flags);}
util.createImage=function(img){var imgPath=imageDirectory+img;var elem=doc.createElement("img");elem.className="wmd-button";elem.src=imgPath;return elem;};util.prompt=function(text,defaultInputText,makeLinkMarkdown,isImage){var $defNodes='<span><h3>'+text+'</h3><input type="text" size="40" value="http://" /></span>';var $nodes=null;if(isImage){$nodes=commandUtils.createUploadDialogNodes();$nodes.find('h3').before($defNodes);}else{$nodes=$defNodes;}
var input=$nodes.find('input')[0];var doptions={nodes:$nodes,yes_callback:function($dialog,close){var text=$dialog.find('input').val();text=text.replace('http://http://','http://');text=text.replace('http://https://','https://');text=text.replace('http://ftp://','ftp://');if(text.indexOf('http://')===-1&&text.indexOf('ftp://')===-1&&text.indexOf('https://')===-1){text='http://'+text;}
makeLinkMarkdown(text);close();},show_no:true,onAfterShow:function(){var defTextLen=defaultInputText.length;if(input.selectionStart!==undefined){input.selectionStart=0;input.selectionEnd=defTextLen;}
else if(input.createTextRange){var range=input.createTextRange();range.collapse(false);range.moveStart("character",-defTextLen);range.moveEnd("character",defTextLen);range.select();}
input.focus();}};commandUtils.showDialog(doptions);};position.getTop=function(elem,isInner){var result=elem.offsetTop;if(!isInner){while(elem=elem.offsetParent){result+=elem.offsetTop;}}
return result;};position.getHeight=function(elem){return elem.offsetHeight||elem.scrollHeight;};position.getWidth=function(elem){return elem.offsetWidth||elem.scrollWidth;};position.getPageSize=function(){var scrollWidth,scrollHeight;var innerWidth,innerHeight;if(self.innerHeight&&self.scrollMaxY){scrollWidth=doc.body.scrollWidth;scrollHeight=self.innerHeight+self.scrollMaxY;}
else if(doc.body.scrollHeight>doc.body.offsetHeight){scrollWidth=doc.body.scrollWidth;scrollHeight=doc.body.scrollHeight;}
else{scrollWidth=doc.body.offsetWidth;scrollHeight=doc.body.offsetHeight;}
if(self.innerHeight){innerWidth=self.innerWidth;innerHeight=self.innerHeight;}
else if(doc.documentElement&&doc.documentElement.clientHeight){innerWidth=doc.documentElement.clientWidth;innerHeight=doc.documentElement.clientHeight;}
else if(doc.body){innerWidth=doc.body.clientWidth;innerHeight=doc.body.clientHeight;}
var maxWidth=Math.max(scrollWidth,innerWidth);var maxHeight=Math.max(scrollHeight,innerHeight);return[maxWidth,maxHeight,innerWidth,innerHeight];};wmd.inputPoller=function(callback,interval){var pollerObj=this;var inputArea=wmd.panels.input;var lastStart;var lastEnd;var markdown;var killHandle;this.tick=function(){if(!util.isVisible(inputArea)){return;}
if(inputArea.selectionStart||inputArea.selectionStart===0){var start=inputArea.selectionStart;var end=inputArea.selectionEnd;if(start!=lastStart||end!=lastEnd){lastStart=start;lastEnd=end;if(markdown!=inputArea.value){markdown=inputArea.value;return true;}}}
return false;};var doTickCallback=function(){if(!util.isVisible(inputArea)){return;}
if(pollerObj.tick()){callback();}};var assignInterval=function(){killHandle=top.setInterval(doTickCallback,interval);};this.destroy=function(){top.clearInterval(killHandle);};assignInterval();};wmd.undoManager=function(callback){var undoObj=this;var undoStack=[];var stackPtr=0;var mode="none";var lastState;var poller;var timer;var inputStateObj;var setMode=function(newMode,noSave){if(mode!=newMode){mode=newMode;if(!noSave){saveState();}}
if(!global.isIE||mode!="moving"){timer=top.setTimeout(refreshState,1);}
else{inputStateObj=null;}};var refreshState=function(){inputStateObj=new wmd.TextareaState();poller.tick();timer=undefined;};this.setCommandMode=function(){mode="command";saveState();timer=top.setTimeout(refreshState,0);};this.canUndo=function(){return stackPtr>1;};this.canRedo=function(){if(undoStack[stackPtr+1]){return true;}
return false;};this.undo=function(){if(undoObj.canUndo()){if(lastState){lastState.restore();lastState=null;}
else{undoStack[stackPtr]=new wmd.TextareaState();undoStack[--stackPtr].restore();if(callback){callback();}}}
mode="none";wmd.panels.input.focus();refreshState();};this.redo=function(){if(undoObj.canRedo()){undoStack[++stackPtr].restore();if(callback){callback();}}
mode="none";wmd.panels.input.focus();refreshState();};var saveState=function(){var currState=inputStateObj||new wmd.TextareaState();if(!currState){return false;}
if(mode=="moving"){if(!lastState){lastState=currState;}
return;}
if(lastState){if(undoStack[stackPtr-1].text!=lastState.text){undoStack[stackPtr++]=lastState;}
lastState=null;}
undoStack[stackPtr++]=currState;undoStack[stackPtr+1]=null;if(callback){callback();}};var handleCtrlYZ=function(event){var handled=false;if(event.ctrlKey||event.metaKey){var keyCode=event.charCode||event.keyCode;var keyCodeChar=String.fromCharCode(keyCode);switch(keyCodeChar){case"y":undoObj.redo();handled=true;break;case"z":if(!event.shiftKey){undoObj.undo();}
else{undoObj.redo();}
handled=true;break;}}
if(handled){if(event.preventDefault){event.preventDefault();}
if(top.event){top.event.returnValue=false;}
return;}};var handleModeChange=function(event){if(!event.ctrlKey&&!event.metaKey){var keyCode=event.keyCode;if((keyCode>=33&&keyCode<=40)||(keyCode>=63232&&keyCode<=63235)){setMode("moving");}
else if(keyCode==8||keyCode==46||keyCode==127){setMode("deleting");}
else if(keyCode==13){setMode("newlines");}
else if(keyCode==27){setMode("escape");}
else if((keyCode<16||keyCode>20)&&keyCode!=91){setMode("typing");}}};var setEventHandlers=function(){util.addEvent(wmd.panels.input,"keypress",function(event){if((event.ctrlKey||event.metaKey)&&(event.keyCode==89||event.keyCode==90)){event.preventDefault();}});var handlePaste=function(){if(global.isIE||(inputStateObj&&inputStateObj.text!=wmd.panels.input.value)){if(timer==undefined){mode="paste";saveState();refreshState();}}
var cname=wmd.panels.input.form.id;if(cname=='fmanswer'){cname+="-"+$('#question-table').attr('nodeid');}
eraseCookie(cname);createCookie(cname,wmd.panels.input.value,expires);};var autosaveIntervalCounter=0;var storage=$.localStorage;var autosave=function()
{var savedHtml=false;var cname=$(this).closest('form').attr('id');if(cname=='fmanswer'){cname+="-"+$('#question-table').attr('nodeid');}
eraseCookie(cname);createCookie(cname,wmd.panels.input.value,expires);};poller=new wmd.inputPoller(handlePaste,pastePollInterval);util.addEvent(wmd.panels.input,"keydown",handleCtrlYZ);util.addEvent(wmd.panels.input,"keydown",handleModeChange);util.addEvent(wmd.panels.input,"keyup",autosave);util.addEvent(wmd.panels.input,"mousedown",function(){setMode("moving");});wmd.panels.input.onpaste=handlePaste;wmd.panels.input.ondrop=handlePaste;};var init=function(){setEventHandlers();refreshState();saveState();};this.destroy=function(){if(poller){poller.destroy();}};init();};wmd.editor=function(previewRefreshCallback){if(!previewRefreshCallback){previewRefreshCallback=function(){};}
var inputBox=wmd.panels.input;var offsetHeight=0;var editObj=this;var mainDiv;var mainSpan;var div;var creationHandle;var undoMgr;var doClick=function(button){inputBox.focus();if(button.textOp){if(undoMgr){undoMgr.setCommandMode();}
var state=new wmd.TextareaState();if(!state){return;}
var chunks=state.getChunks();var fixupInputArea=function(){inputBox.focus();if(chunks){state.setChunks(chunks);}
state.restore();previewRefreshCallback();};var useDefaultText=true;var noCleanup=button.textOp(chunks,fixupInputArea,useDefaultText);if(!noCleanup){fixupInputArea();}
var cname=wmd.panels.input.form.id;if(cname=='fmanswer'){cname+="-"+$('#question-table').attr('nodeid');}
eraseCookie(cname);createCookie(cname,wmd.panels.input.value,expires);}
if(button.execute){button.execute(editObj);}};var undoButton=null;var redoButton=null;var setUndoRedoButtonStates=function(){if(undoMgr){setupButton(undoButton,undoMgr.canUndo());setupButton(redoButton,undoMgr.canRedo());}};var setupButton=function(button,isEnabled){var normalYShift="0px";var disabledYShift="-20px";var highlightYShift="-40px";if(isEnabled){button.style.backgroundPosition=button.XShift+" "+normalYShift;button.onmouseover=function(){this.style.backgroundPosition=this.XShift+" "+highlightYShift;};button.onmouseout=function(){this.style.backgroundPosition=this.XShift+" "+normalYShift;};if(global.isIE){button.onmousedown=function(){wmd.ieRetardedClick=true;wmd.ieCachedRange=document.selection.createRange();};}
if(!button.isHelp)
{button.onclick=function(){if(this.onmouseout){this.onmouseout();}
doClick(this);return false;}}}
else{button.style.backgroundPosition=button.XShift+" "+disabledYShift;button.onmouseover=button.onmouseout=button.onclick=function(){};}}
var makeSpritedButtonRow=function(){var $buttonBar=$(editorElements?editorElements.buttonBar:document.getElementById("wmd-button-bar"));$buttonBar.addClass('wmd-button-bar');var buttons={};var normalYShift="0px";var disabledYShift="-20px";var highlightYShift="-40px";var buttonRow=$("<ul></ul>");buttonRow.addClass("wmd-button-row");$buttonBar.append(buttonRow);buttonRow=buttonRow.get(0);var boldButton=document.createElement("li");boldButton.className="wmd-button wmd-bold-button";boldButton.title=pageContext.i18n.WMDBold;boldButton.XShift="0px";boldButton.textOp=command.doBold;setupButton(boldButton,true);buttonRow.appendChild(boldButton);buttons.bold=boldButton;var italicButton=document.createElement("li");italicButton.className="wmd-button wmd-italic-button";italicButton.title=pageContext.i18n.WMDItalic;italicButton.XShift="-20px";italicButton.textOp=command.doItalic;setupButton(italicButton,true);buttonRow.appendChild(italicButton);buttons.italic=italicButton;var spacer1=document.createElement("li");spacer1.className="wmd-spacer wmd-spacer1";buttonRow.appendChild(spacer1);var linkButton=document.createElement("li");linkButton.className="wmd-button wmd-link-button";linkButton.title=pageContext.i18n.WMDLink;linkButton.XShift="-40px";linkButton.textOp=function(chunk,postProcessing,useDefaultText){return command.doLinkOrImage(chunk,postProcessing,'link');};setupButton(linkButton,true);buttonRow.appendChild(linkButton);buttons.link=linkButton;var quoteButton=document.createElement("li");quoteButton.className="wmd-button wmd-quote-button";quoteButton.title=pageContext.i18n.WMDQuote;quoteButton.XShift="-60px";quoteButton.textOp=command.doBlockquote;setupButton(quoteButton,true);buttonRow.appendChild(quoteButton);buttons.quote=quoteButton;var codeButton=document.createElement("li");codeButton.className="wmd-button wmd-code-button";codeButton.title=pageContext.i18n.WMDCode;codeButton.XShift="-80px";codeButton.textOp=command.doCode;setupButton(codeButton,true);buttonRow.appendChild(codeButton);buttons.code=codeButton;var imageButton=document.createElement("li");imageButton.className="wmd-button wmd-image-button";imageButton.title=pageContext.i18n.WMDImage;imageButton.XShift="-120px";imageButton.textOp=function(chunk,postProcessing,useDefaultText){return command.doLinkOrImage(chunk,postProcessing,'image');};setupButton(imageButton,true);buttonRow.appendChild(imageButton);buttons.image=imageButton;var inputDataType=$(wmd.panels.input).attr("data-type");var removedPlugins=wmd.wmd_removed_plugins[inputDataType];removedPlugins=removedPlugins?removedPlugins:[];var isUploadEnabled=removedPlugins.indexOf('upload')==-1;if(attachments&&isUploadEnabled){var attachmentButton=document.createElement("li");attachmentButton.className="wmd-button wmd-attachment-button";attachmentButton.title=pageContext.i18n.WMDAttachment;attachmentButton.XShift="-100px";attachmentButton.textOp=function(chunk,postProcessing,useDefaultText){return command.doLinkOrImage(chunk,postProcessing,'attachment');};setupButton(attachmentButton,true);buttonRow.appendChild(attachmentButton);buttons.attachment=attachmentButton;}
var spacer2=document.createElement("li");spacer2.className="wmd-spacer wmd-spacer2";buttonRow.appendChild(spacer2);var olistButton=document.createElement("li");olistButton.className="wmd-button wmd-olist-button";olistButton.title=pageContext.i18n.WMDOrderedList;olistButton.XShift="-140px";olistButton.textOp=function(chunk,postProcessing,useDefaultText){command.doList(chunk,postProcessing,true,useDefaultText);};setupButton(olistButton,true);buttonRow.appendChild(olistButton);buttons.olist=olistButton;var ulistButton=document.createElement("li");ulistButton.className="wmd-button wmd-ulist-button";ulistButton.title=pageContext.i18n.WMDUnorderedList;ulistButton.XShift="-160px";ulistButton.textOp=function(chunk,postProcessing,useDefaultText){command.doList(chunk,postProcessing,false,useDefaultText);};setupButton(ulistButton,true);buttonRow.appendChild(ulistButton);buttons.ulist=ulistButton;var headingButton=document.createElement("li");headingButton.className="wmd-button wmd-heading-button";headingButton.title=pageContext.i18n.WMDHeading;headingButton.XShift="-180px";headingButton.textOp=command.doHeading;setupButton(headingButton,true);buttonRow.appendChild(headingButton);buttons.heading=headingButton;var hrButton=document.createElement("li");hrButton.className="wmd-button wmd-hr-button";hrButton.title=pageContext.i18n.WMDHorizontalRule;hrButton.XShift="-200px";hrButton.textOp=command.doHorizontalRule;setupButton(hrButton,true);buttonRow.appendChild(hrButton);buttons.hr=hrButton;var spacer3=document.createElement("li");spacer3.className="wmd-spacer wmd-spacer3";buttonRow.appendChild(spacer3);undoButton=document.createElement("li");undoButton.className="wmd-button wmd-undo-button";undoButton.title=pageContext.i18n.WMDUndo;undoButton.XShift="-220px";undoButton.execute=function(manager){manager.undo();};setupButton(undoButton,true);buttonRow.appendChild(undoButton);buttons.undo=undoButton;redoButton=document.createElement("li");redoButton.className="wmd-button wmd-redo-button";redoButton.title=pageContext.i18n.WMDRedoWin;if(/win/.test(nav.platform.toLowerCase())){redoButton.title=pageContext.i18n.WMDRedoWin;}
else{redoButton.title=pageContext.i18n.WMDRedoOther;}
redoButton.XShift="-240px";redoButton.execute=function(manager){manager.redo();};setupButton(redoButton,true);buttonRow.appendChild(redoButton);buttons.redo=redoButton;var helpButton=document.createElement("li");helpButton.className="wmd-button wmd-help-button";helpButton.XShift="-260px";helpButton.isHelp=true;if(!hideHelp){var helpAnchor=document.createElement("a");helpAnchor.href=helpLink;helpAnchor.target=helpTarget
helpAnchor.title=helpHoverTitle;helpButton.appendChild(helpAnchor);setupButton(helpButton,true);buttonRow.appendChild(helpButton);buttons.help=helpButton;}
setUndoRedoButtonStates();return buttons;}
var setupEditor=function(){if(/\?noundo/.test(doc.location.href)){wmd.nativeUndo=true;}
if(!wmd.nativeUndo){undoMgr=new wmd.undoManager(function(){previewRefreshCallback();setUndoRedoButtonStates();});}
var buttons=makeSpritedButtonRow();var keyEvent="keydown";if(global.isOpera){keyEvent="keypress";}
util.addEvent(inputBox,keyEvent,function(key){if(key.ctrlKey||key.metaKey){var keyCode=key.charCode||key.keyCode;var keyCodeStr=String.fromCharCode(keyCode).toLowerCase();switch(keyCodeStr){case"b":doClick(buttons.bold);break;case"i":doClick(buttons.italic);break;case"l":doClick(buttons.link);break;case"q":doClick(buttons.quote);break;case"k":doClick(buttons.code);break;case"g":doClick(buttons.image);break;case"o":doClick(buttons.olist);break;case"u":doClick(buttons.ulist);break;case"h":doClick(buttons.heading);break;case"r":doClick(buttons.hr);break;case"y":doClick(buttons.redo);break;case"z":if(key.shiftKey){doClick(buttons.redo);}
else{doClick(buttons.undo);}
break;default:return;}
if(key.preventDefault){key.preventDefault();}
if(top.event){top.event.returnValue=false;}}});util.addEvent(inputBox,"keyup",function(key){if(!key.shiftKey&&!key.ctrlKey&&!key.metaKey){var keyCode=key.charCode||key.keyCode;if(keyCode===13){fakeButton={};fakeButton.textOp=command.doAutoindent;doClick(fakeButton);}}});if(global.isIE){util.addEvent(inputBox,"keydown",function(key){var code=key.keyCode;if(code===27){return false;}});}};var convertToHtml=function(){if(wmd.showdown){var markdownConverter=new wmd.showdown.converter();}
var text=inputBox.value;var callback=function(){inputBox.value=text;};if(!/markdown/.test(wmd.wmd_env.output.toLowerCase())){if(markdownConverter){inputBox.value=markdownConverter.makeHtml(text);top.setTimeout(callback,0);}}
return true;};this.undo=function(){if(undoMgr){undoMgr.undo();}};this.redo=function(){if(undoMgr){undoMgr.redo();}};var init=function(){setupEditor();};this.destroy=function(){if(undoMgr){undoMgr.destroy();}
if(div.parentNode){div.parentNode.removeChild(div);}
if(inputBox){inputBox.style.marginTop="";}
top.clearInterval(creationHandle);};init();};wmd.TextareaState=function(){var stateObj=this;var inputArea=wmd.panels.input;this.init=function(){if(!util.isVisible(inputArea)){return;}
this.setInputAreaSelectionStartEnd();this.scrollTop=inputArea.scrollTop;if(!this.text&&inputArea.selectionStart||inputArea.selectionStart===0){this.text=inputArea.value;}}
this.setInputAreaSelection=function(){if(!util.isVisible(inputArea)){return;}
if(inputArea.selectionStart!==undefined&&!global.isOpera&&!global.isIE_9){inputArea.focus();inputArea.selectionStart=stateObj.start;inputArea.selectionEnd=stateObj.end;inputArea.scrollTop=stateObj.scrollTop;}
else if(doc.selection){if(doc.activeElement&&doc.activeElement!==inputArea){return;}
inputArea.focus();var range=inputArea.createTextRange();range.moveStart("character",-inputArea.value.length);range.moveEnd("character",-inputArea.value.length);range.moveEnd("character",stateObj.end);range.moveStart("character",stateObj.start);range.select();}};this.setInputAreaSelectionStartEnd=function(){if((inputArea.selectionStart||inputArea.selectionStart===0)&&!global.isIE_9){stateObj.start=inputArea.selectionStart;stateObj.end=inputArea.selectionEnd;}
else if(doc.selection){stateObj.text=util.fixEolChars(inputArea.value);var range;if(wmd.ieRetardedClick&&wmd.ieCachedRange){range=wmd.ieCachedRange;wmd.ieRetardedClick=false;}
else{range=doc.selection.createRange();}
var fixedRange=util.fixEolChars(range.text);var marker="\x07";var markedRange=marker+fixedRange+marker;range.text=markedRange;var inputText=util.fixEolChars(inputArea.value);range.moveStart("character",-markedRange.length);range.text=fixedRange;stateObj.start=inputText.indexOf(marker);stateObj.end=inputText.lastIndexOf(marker)-marker.length;var len=stateObj.text.length-util.fixEolChars(inputArea.value).length;if(len){range.moveStart("character",-fixedRange.length);while(len--){fixedRange+="\n";stateObj.end+=1;}
range.text=fixedRange;}
this.setInputAreaSelection();}};this.restore=function(){if(stateObj.text!=undefined&&stateObj.text!=inputArea.value){inputArea.value=stateObj.text+"\n";}
this.setInputAreaSelection();inputArea.scrollTop=stateObj.scrollTop;};this.getChunks=function(){var chunk=new wmd.Chunks();chunk.before=util.fixEolChars(stateObj.text.substring(0,stateObj.start));chunk.startTag="";chunk.selection=util.fixEolChars(stateObj.text.substring(stateObj.start,stateObj.end));chunk.endTag="";chunk.after=util.fixEolChars(stateObj.text.substring(stateObj.end));chunk.scrollTop=stateObj.scrollTop;return chunk;};this.setChunks=function(chunk){chunk.before=chunk.before+chunk.startTag;chunk.after=chunk.endTag+chunk.after;if(global.isOpera){chunk.before=chunk.before.replace(/\n/g,"\r\n");chunk.selection=chunk.selection.replace(/\n/g,"\r\n");chunk.after=chunk.after.replace(/\n/g,"\r\n");}
this.start=chunk.before.length;this.end=chunk.before.length+chunk.selection.length;this.text=chunk.before+chunk.selection+chunk.after;this.scrollTop=chunk.scrollTop;};this.init();};wmd.Chunks=function(){};wmd.Chunks.prototype.findTags=function(startRegex,endRegex){var chunkObj=this;var regex;if(startRegex){regex=util.extendRegExp(startRegex,"","$");this.before=this.before.replace(regex,function(match){chunkObj.startTag=chunkObj.startTag+match;return"";});regex=util.extendRegExp(startRegex,"^","");this.selection=this.selection.replace(regex,function(match){chunkObj.startTag=chunkObj.startTag+match;return"";});}
if(endRegex){regex=util.extendRegExp(endRegex,"","$");this.selection=this.selection.replace(regex,function(match){chunkObj.endTag=match+chunkObj.endTag;return"";});regex=util.extendRegExp(endRegex,"^","");this.after=this.after.replace(regex,function(match){chunkObj.endTag=match+chunkObj.endTag;return"";});}};wmd.Chunks.prototype.trimWhitespace=function(remove){this.selection=this.selection.replace(/^(\s*)/,"");if(!remove){this.before+=re.$1;}
this.selection=this.selection.replace(/(\s*)$/,"");if(!remove){this.after=re.$1+this.after;}};wmd.Chunks.prototype.addBlankLines=function(nLinesBefore,nLinesAfter,findExtraNewlines){if(nLinesBefore===undefined){nLinesBefore=1;}
if(nLinesAfter===undefined){nLinesAfter=1;}
nLinesBefore++;nLinesAfter++;var regexText;var replacementText;if(navigator.userAgent.match(/Chrome/)){"X".match(/()./)}
this.selection=this.selection.replace(/(^\n*)/,"");this.startTag=this.startTag+re.$1;this.selection=this.selection.replace(/(\n*$)/,"");this.endTag=this.endTag+re.$1;this.startTag=this.startTag.replace(/(^\n*)/,"");this.before=this.before+re.$1;this.endTag=this.endTag.replace(/(\n*$)/,"");this.after=this.after+re.$1;if(this.before){regexText=replacementText="";while(nLinesBefore--){regexText+="\\n?";replacementText+="\n";}
if(findExtraNewlines){regexText="\\n*";}
this.before=this.before.replace(new re(regexText+"$",""),replacementText);}
if(this.after){regexText=replacementText="";while(nLinesAfter--){regexText+="\\n?";replacementText+="\n";}
if(findExtraNewlines){regexText="\\n*";}
this.after=this.after.replace(new re(regexText,""),replacementText);}};command.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)";command.unwrap=function(chunk){var txt=new re("([^\\n])\\n(?!(\\n|"+command.prefixes+"))","g");chunk.selection=chunk.selection.replace(txt,"$1 $2");};command.wrap=function(chunk,len){command.unwrap(chunk);var regex=new re("(.{1,"+len+"})( +|$\\n?)","gm");chunk.selection=chunk.selection.replace(regex,function(line,marked){if(new re("^"+command.prefixes,"").test(line)){return line;}
return marked+"\n";});chunk.selection=chunk.selection.replace(/\s+$/,"");};command.doBold=function(chunk,postProcessing,useDefaultText){return command.doBorI(chunk,2,"strong text");};command.doItalic=function(chunk,postProcessing,useDefaultText){return command.doBorI(chunk,1,"emphasized text");};command.doBorI=function(chunk,nStars,insertText){chunk.trimWhitespace();chunk.selection=chunk.selection.replace(/\n{2,}/g,"\n");chunk.before.search(/(\**$)/);var starsBefore=re.$1;chunk.after.search(/(^\**)/);var starsAfter=re.$1;var prevStars=Math.min(starsBefore.length,starsAfter.length);if((prevStars>=nStars)&&(prevStars!=2||nStars!=1)){chunk.before=chunk.before.replace(re("[*]{"+nStars+"}$",""),"");chunk.after=chunk.after.replace(re("^[*]{"+nStars+"}",""),"");}
else if(!chunk.selection&&starsAfter){chunk.after=chunk.after.replace(/^([*_]*)/,"");chunk.before=chunk.before.replace(/(\s?)$/,"");var whitespace=re.$1;chunk.before=chunk.before+starsAfter+whitespace;}
else{if(!chunk.selection&&!starsAfter){chunk.selection=insertText;}
var markup=nStars<=1?"*":"**";chunk.before=chunk.before+markup;chunk.after=markup+chunk.after;}
return;};command.stripLinkDefs=function(text,defsToAdd){text=text.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(totalMatch,id,link,newlines,title){defsToAdd[id]=totalMatch.replace(/\s*$/,"");if(newlines){defsToAdd[id]=totalMatch.replace(/["(](.+?)[")]$/,"");return newlines+title;}
return"";});return text;};command.addLinkDef=function(chunk,linkDef){var refNumber=0;var defsToAdd={};chunk.before=command.stripLinkDefs(chunk.before,defsToAdd);chunk.selection=command.stripLinkDefs(chunk.selection,defsToAdd);chunk.after=command.stripLinkDefs(chunk.after,defsToAdd);var defs="";var regex=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g;var addDefNumber=function(def){refNumber++;def=def.replace(/^[ ]{0,3}\[(\d+)\]:/,"  ["+refNumber+"]:");defs+="\n"+def;};var getLink=function(wholeMatch,before,inner,afterInner,id,end){inner=inner.replace(regex,getLink);if(defsToAdd[id]){addDefNumber(defsToAdd[id]);return before+inner+afterInner+refNumber+end;}
return wholeMatch;};chunk.before=chunk.before.replace(regex,getLink);if(linkDef){addDefNumber(linkDef);}
else{chunk.selection=chunk.selection.replace(regex,getLink);}
var refOut=refNumber;chunk.after=chunk.after.replace(regex,getLink);if(chunk.after){chunk.after=chunk.after.replace(/\n*$/,"");}
if(!chunk.after){chunk.selection=chunk.selection.replace(/\n*$/,"");}
chunk.after+="\n\n"+defs;return refOut;};command.doLinkOrImage=function(chunk,postProcessing,type){var isImage=type=='image';var isAttachment=type=='attachment';chunk.trimWhitespace();chunk.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);if(chunk.endTag.length>1){chunk.startTag=chunk.startTag.replace(/!?\[/,"");chunk.endTag="";command.addLinkDef(chunk,null);}
else{if(/\n\n/.test(chunk.selection)){command.addLinkDef(chunk,null);return;}
var makeLinkMarkdown=function(link,isImageOverride){if(isImageOverride!=undefined){isImage=isImageOverride;}
if(link!==null){link=link.replace(/\s/g,'+');chunk.startTag=chunk.endTag="";var linkDef=" [999]: "+link;var num=command.addLinkDef(chunk,linkDef);chunk.startTag=isImage?"![":"[";chunk.endTag="]["+num+"]";if(!chunk.selection){if(isImage){chunk.selection="alt text";}
else{chunk.selection="link text";}}}
postProcessing();};var text=null;var defaultInputText=null;if(isImage){text=imageDialogText;defaultInputText=imageDefaultText;}else{text=linkDialogText;defaultInputText=linkDefaultText;}
var $defNodes=$('<span><h3>'+text+'</h3><input type="text" size="40" value="http://" /></span>');if(isImage){command.doImage($defNodes,defaultInputText,makeLinkMarkdown);}else if(isAttachment){command.doAttachment(makeLinkMarkdown);}else{command.doLink($defNodes,makeLinkMarkdown,defaultInputText);}
return true;}};command.doAttachment=function(makeLinkMarkdown){commandUtils.showUploadDialog(null,{authorizeUrl:pageContext.url.authorizeAttachmentsUrl,authorizeContext:attachments.authorize(false),onSuccess:function(tid,data){attachments.toForm(data);makeLinkMarkdown(data.url,data.isImage);}});};command.doImage=function($defNodes,defaultInputText,makeLinkMarkdown){if(!attachments){command.doLink($defNodes,makeLinkMarkdown,defaultInputText);return;}
var $nodes=commandUtils.createUploadDialogNodes();$nodes.find('h3').before($defNodes);var $input=$nodes.find('input[type=text]');commandUtils.showUploadDialog(null,{nodes:$nodes,authorizeUrl:pageContext.url.authorizeAttachmentsUrl,authorizeContext:attachments.authorize(true),onAfterShow:function(){var input=$input[0];var defTextLen=defaultInputText.length;if(input.selectionStart!==undefined){input.selectionStart=0;input.selectionEnd=defTextLen;}
else if(input.createTextRange){var range=input.createTextRange();range.collapse(false);range.moveStart("character",-defTextLen);range.moveEnd("character",defTextLen);range.select();}
input.focus();},override_yes_callback:function($dialog,close,actions){if($dialog.find('input[type=file]').val()||$input.val()!=defaultInputText){actions.close=close;actions.dialog=$dialog;$uploadButton=$('.modal.in .modal-footer .btn-primary');$uploadButton.addClass('disabled');}
if($dialog.find('input[type=file]').val()){actions.authorizeAndStart();}else{if($input.val()!=defaultInputText){makeLinkMarkdown($input.val());actions.close();}}},onSuccess:function(tid,data){attachments.toForm(data);makeLinkMarkdown(data.url);}});};command.doLink=function($nodes,makeLinkMarkdown,defaultInputText){var input=$nodes.find('input')[0];var doptions={nodes:$nodes,yes_callback:function($dialog,close){var text=$dialog.find('input').val();text=text.replace('http://http://','http://');text=text.replace('http://https://','https://');text=text.replace('http://ftp://','ftp://');if(text.indexOf('http://')===-1&&text.indexOf('ftp://')===-1&&text.indexOf('https://')===-1){text='http://'+text;}
makeLinkMarkdown(text);close();},show_no:true,onAfterShow:function(){var defTextLen=defaultInputText.length;if(input.selectionStart!==undefined){input.selectionStart=0;input.selectionEnd=defTextLen;}
else if(input.createTextRange){var range=input.createTextRange();range.collapse(false);range.moveStart("character",-defTextLen);range.moveEnd("character",defTextLen);range.select();}
input.focus();}};commandUtils.showDialog(doptions);};util.makeAPI=function(){wmd.wmd={};wmd.wmd.editor=wmd.editor;wmd.wmd.previewManager=wmd.previewManager;};util.startEditor=function(){if(wmd.wmd_env.autostart===false){util.makeAPI();return;}
var edit;var previewMgr;var loadListener=function(){wmd.panels=new wmd.PanelCollection();previewMgr=new wmd.previewManager();var previewRefreshCallback=previewMgr.refresh;edit=new wmd.editor(previewRefreshCallback);previewMgr.refresh(true);};util.addEvent(top,"load",loadListener);};wmd.previewManager=function(){var managerObj=this;var converter;var poller;var timeout;var elapsedTime;var oldInputText;var htmlOut;var maxDelay=3000;var startType="delayed";var setupEvents=function(inputElem,listener){util.addEvent(inputElem,"input",listener);inputElem.onpaste=listener;inputElem.ondrop=listener;util.addEvent(inputElem,"keypress",listener);util.addEvent(inputElem,"keydown",listener);poller=new wmd.inputPoller(listener,previewPollInterval);};var getDocScrollTop=function(){var result=0;if(top.innerHeight){result=top.pageYOffset;}
else
if(doc.documentElement&&doc.documentElement.scrollTop){result=doc.documentElement.scrollTop;}
else
if(doc.body){result=doc.body.scrollTop;}
return result;};var makePreviewHtml=function(){if(!wmd.panels.preview&&!wmd.panels.output){return;}
var text=wmd.panels.input.value;if(text&&text==oldInputText){return;}
else{oldInputText=text;}
var prevTime=new Date().getTime();if(text){$.ajax({type:'POST',url:'/commands/updateMarkdown.json',data:{markdown:text},success:function(response){text=response.result.parsed;var currTime=new Date().getTime();elapsedTime=currTime-prevTime;pushPreviewHtml(text);htmlOut=text;}});}};var applyTimeout=function(){if(timeout){top.clearTimeout(timeout);timeout=undefined;}
if(startType!=="manual"){var delay=0;if(startType==="delayed"){delay=elapsedTime+500;}
if(delay>maxDelay){delay=maxDelay;}
timeout=top.setTimeout(makePreviewHtml,delay);}};var getScaleFactor=function(panel){if(panel.scrollHeight<=panel.clientHeight){return 1;}
return panel.scrollTop/(panel.scrollHeight-panel.clientHeight);};var setPanelScrollTops=function(){if(wmd.panels.preview){wmd.panels.preview.scrollTop=(wmd.panels.preview.scrollHeight-wmd.panels.preview.clientHeight)*getScaleFactor(wmd.panels.preview);;}
if(wmd.panels.output){wmd.panels.output.scrollTop=(wmd.panels.output.scrollHeight-wmd.panels.output.clientHeight)*getScaleFactor(wmd.panels.output);;}};this.refresh=function(requiresRefresh){if(requiresRefresh){oldInputText="";makePreviewHtml();}
else{applyTimeout();}};this.processingTime=function(){return elapsedTime;};this.output=function(){return htmlOut;};this.setUpdateMode=function(mode){startType=mode;managerObj.refresh();};var isFirstTimeFilled=true;var pushPreviewHtml=function(text){var emptyTop=position.getTop(wmd.panels.input)-getDocScrollTop();if(wmd.panels.output){if(wmd.panels.output.value!==undefined){wmd.panels.output.value=text;wmd.panels.output.readOnly=true;}
else{var newText=text.replace(/&/g,"&amp;");newText=newText.replace(/</g,"&lt;");wmd.panels.output.innerHTML="<pre><code>"+newText+"</code></pre>";}}
if(wmd.panels.preview){wmd.panels.preview.innerHTML=text;}
setPanelScrollTops();if(isFirstTimeFilled){isFirstTimeFilled=false;return;}
var fullTop=position.getTop(wmd.panels.input)-getDocScrollTop();};var init=function(){poller=new wmd.inputPoller(applyTimeout,previewPollInterval);makePreviewHtml();if(wmd.panels.preview){wmd.panels.preview.scrollTop=0;}
if(wmd.panels.output){wmd.panels.output.scrollTop=0;}};this.destroy=function(){if(poller){poller.destroy();}};init();};command.doAutoindent=function(chunk,postProcessing,useDefaultText){chunk.before=chunk.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n");chunk.before=chunk.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n");chunk.before=chunk.before.replace(/(\n|^)[ \t]+\n$/,"\n\n");useDefaultText=false;if(/(\n|^)[ ]{0,3}([*+-])[ \t]+.*\n$/.test(chunk.before)){if(command.doList){command.doList(chunk,postProcessing,false,true);}}
if(/(\n|^)[ ]{0,3}(\d+[.])[ \t]+.*\n$/.test(chunk.before)){if(command.doList){command.doList(chunk,postProcessing,true,true);}}
if(/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(chunk.before)){if(command.doBlockquote){command.doBlockquote(chunk,postProcessing,useDefaultText);}}
if(/(\n|^)(\t|[ ]{4,}).*\n$/.test(chunk.before)){if(command.doCode){command.doCode(chunk,postProcessing,useDefaultText,true);}}};command.doBlockquote=function(chunk,postProcessing,useDefaultText){chunk.selection=chunk.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(totalMatch,newlinesBefore,text,newlinesAfter){chunk.before+=newlinesBefore;chunk.after=newlinesAfter+chunk.after;return text;});chunk.before=chunk.before.replace(/(>[ \t]*)$/,function(totalMatch,blankLine){chunk.selection=blankLine+chunk.selection;return"";});var defaultText=useDefaultText?"Blockquote":"";chunk.selection=chunk.selection.replace(/^(\s|>)+$/,"");chunk.selection=chunk.selection||defaultText;var match="";var leftOver="";if(chunk.before){var lines=chunk.before.replace(/\n$/,"").split("\n");var inChain=false;for(var i in lines){var good=false;line=lines[i];inChain=inChain&&line.length>0;if(/^>/.test(line)){good=true;if(!inChain&&line.length>1)
inChain=true;}else if(/^[ \t]*$/.test(line)){good=true;}else{good=inChain;}
if(good){match+=line+"\n";}else{leftOver+=match+line;match="\n";}}
if(!/(^|\n)>/.test(match)){leftOver+=match;match="";}}
chunk.startTag=match;chunk.before=leftOver;if(chunk.after){chunk.after=chunk.after.replace(/^\n?/,"\n");}
chunk.after=chunk.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(totalMatch){chunk.endTag=totalMatch;return"";});var replaceBlanksInTags=function(useBracket){var replacement=useBracket?"> ":"";if(chunk.startTag){chunk.startTag=chunk.startTag.replace(/\n((>|\s)*)\n$/,function(totalMatch,markdown){return"\n"+markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm,replacement)+"\n";});}
if(chunk.endTag){chunk.endTag=chunk.endTag.replace(/^\n((>|\s)*)\n/,function(totalMatch,markdown){return"\n"+markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm,replacement)+"\n";});}};if(/^(?![ ]{0,3}>)/m.test(chunk.selection)){command.wrap(chunk,wmd.wmd_env.lineLength-2);chunk.selection=chunk.selection.replace(/^/gm,"> ");replaceBlanksInTags(true);chunk.addBlankLines();}
else{chunk.selection=chunk.selection.replace(/^[ ]{0,3}> ?/gm,"");command.unwrap(chunk);replaceBlanksInTags(false);if(!/^(\n|^)[ ]{0,3}>/.test(chunk.selection)&&chunk.startTag){chunk.startTag=chunk.startTag.replace(/\n{0,2}$/,"\n\n");}
if(!/(\n|^)[ ]{0,3}>.*$/.test(chunk.selection)&&chunk.endTag){chunk.endTag=chunk.endTag.replace(/^\n{0,2}/,"\n\n");}}
if(!/\n/.test(chunk.selection)){chunk.selection=chunk.selection.replace(/^(> *)/,function(wholeMatch,blanks){chunk.startTag+=blanks;return"";});}};command.doCode=function(chunk,postProcessing,useDefaultText,disableDialog){var hasTextBefore=/\S[ ]*$/.test(chunk.before);var hasTextAfter=/^[ ]*\S/.test(chunk.after);if((!hasTextAfter&&!hasTextBefore)||/\n/.test(chunk.selection)){chunk.before=chunk.before.replace(/[ ]{4}$/,function(totalMatch){chunk.selection=totalMatch+chunk.selection;return"";});var nLinesBefore=1;var nLinesAfter=1;if(/\n(\t|[ ]{4,}).*\n$/.test(chunk.before)||chunk.after===""){nLinesBefore=0;}
if(/^\n(\t|[ ]{4,})/.test(chunk.after)){nLinesAfter=0;}
chunk.addBlankLines(nLinesBefore,nLinesAfter);if(!chunk.selection&&!disableDialog){var $nodes=$('<textarea rows="15" cols="200" placeholder="enter code here" style="width: 500px; height: 250px;"></textarea>');var doptions={nodes:$nodes,extra_class:'prompt',onAfterShow:function(){var $textarea=$nodes;$textarea.focus();$textarea.select();},yes_callback:function($dialog,close){var code=$dialog.find('textarea').val();if(pageContext.options.markdownCodeInBackticks){chunk.selection='```\n'+code+'\n```';}else if(pageContext.options.markdownCodeInPreTags){chunk.selection='<pre><code>\n'+code+'\n</pre></code>';}else{chunk.selection=code.replace(/^/gm,"    ");}
postProcessing();close();},show_no:true};commandUtils.showDialog(doptions);}
else{if(/^[ ]{0,3}\S/m.test(chunk.selection)){chunk.selection=chunk.selection.replace(/^/gm,"    ");}
else{chunk.selection=chunk.selection.replace(/^[ ]{4}/gm,"");}}}
else{chunk.trimWhitespace();chunk.findTags(/`/,/`/);if(!chunk.startTag&&!chunk.endTag){chunk.startTag=chunk.endTag="`";if(!chunk.selection){chunk.selection=useDefaultText?"enter code here":"";}}
else if(chunk.endTag&&!chunk.startTag){chunk.before+=chunk.endTag;chunk.endTag="";}
else{chunk.startTag=chunk.endTag="";}}};command.doList=function(chunk,postProcessing,isNumberedList,useDefaultText){var previousItemsRegex=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/;var nextItemsRegex=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/;var bullet="-";var num=1;var getItemPrefix=function(){var prefix;if(isNumberedList){prefix=" "+num+". ";num++;}
else{prefix=" "+bullet+" ";}
return prefix;};var getPrefixedItem=function(itemText){if(isNumberedList===undefined){isNumberedList=/^\s*\d/.test(itemText);}
itemText=itemText.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(_){return getItemPrefix();});return itemText;};chunk.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null);if(chunk.before&&!/\n$/.test(chunk.before)&&!/^\n/.test(chunk.startTag)){chunk.before+=chunk.startTag;chunk.startTag="";}
if(chunk.startTag){var hasDigits=/\d+[.]/.test(chunk.startTag);chunk.startTag="";chunk.selection=chunk.selection.replace(/\n[ ]{4}/g,"\n");command.unwrap(chunk);chunk.addBlankLines();if(hasDigits){chunk.after=chunk.after.replace(nextItemsRegex,getPrefixedItem);}
if(isNumberedList==hasDigits){return;}}
var nLinesBefore=1;chunk.before=chunk.before.replace(previousItemsRegex,function(itemText){if(/^\s*([*+-])/.test(itemText)){bullet=re.$1;}
nLinesBefore=/[^\n]\n\n[^\n]/.test(itemText)?1:0;return getPrefixedItem(itemText);});if(!chunk.selection){chunk.selection=useDefaultText?"List item":" ";}
var prefix=getItemPrefix();var nLinesAfter=1;chunk.after=chunk.after.replace(nextItemsRegex,function(itemText){nLinesAfter=/[^\n]\n\n[^\n]/.test(itemText)?1:0;return getPrefixedItem(itemText);});chunk.trimWhitespace(true);chunk.addBlankLines(nLinesBefore,nLinesAfter,true);chunk.startTag=prefix;var spaces=prefix.replace(/./g," ");command.wrap(chunk,wmd.wmd_env.lineLength-spaces.length);chunk.selection=chunk.selection.replace(/\n/g,"\n"+spaces);};command.doHeading=function(chunk,postProcessing,useDefaultText){chunk.selection=chunk.selection.replace(/\s+/g," ");chunk.selection=chunk.selection.replace(/(^\s+|\s+$)/g,"");if(!chunk.selection){chunk.startTag="## ";chunk.selection="Heading";chunk.endTag=" ##";return;}
var headerLevel=0;chunk.findTags(/#+[ ]*/,/[ ]*#+/);if(/#+/.test(chunk.startTag)){headerLevel=re.lastMatch.length;}
chunk.startTag=chunk.endTag="";chunk.findTags(null,/\s?(-+|=+)/);if(/=+/.test(chunk.endTag)){headerLevel=1;}
if(/-+/.test(chunk.endTag)){headerLevel=2;}
chunk.startTag=chunk.endTag="";chunk.addBlankLines(1,1);var headerLevelToCreate=headerLevel==0?2:headerLevel-1;if(headerLevelToCreate>0){var headerChar=headerLevelToCreate>=2?"-":"=";var len=chunk.selection.length;if(len>wmd.wmd_env.lineLength){len=wmd.wmd_env.lineLength;}
chunk.endTag="\n";while(len--){chunk.endTag+=headerChar;}}};command.doHorizontalRule=function(chunk,postProcessing,useDefaultText){chunk.startTag="----------\n";chunk.selection="";chunk.addBlankLines(2,1,true);}};Attacklab.wmd_env={};Attacklab.account_options={};Attacklab.wmd_defaults={version:1,output:"HTML",lineLength:40,delayLoad:false};Attacklab.wmd_removed_plugins={};Attacklab.wmd=function()
{Attacklab.loadEnv=function()
{var mergeEnv=function(env)
{if(!env)
{return;}
for(var key in env)
{Attacklab.wmd_env[key]=env[key];}};mergeEnv(Attacklab.wmd_defaults);mergeEnv(Attacklab.account_options);mergeEnv(top["wmd_options"]);Attacklab.full=true;var defaultButtons="bold italic link blockquote code image ol ul heading hr";Attacklab.wmd_env.buttons=Attacklab.wmd_env.buttons||defaultButtons;};Attacklab.loadEnv();};return Attacklab;}
var Attacklab=createWmd(Attacklab||{});$(function(){if($('#body').length>0){Attacklab.wmd();var attachmentsContext=null;if(typeof window.getAuthorizeContext!='undefined'){attachmentsContext={authorize:getAuthorizeContext,toForm:addAttachmentToForm};}
Attacklab.wmdBase(null,false,attachmentsContext);Attacklab.Util.startEditor();}});var osqaSkin='{{settings.OSQA_SKIN}}';var i18nLang='{{settings.LANGUAGE_CODE}}';var mediaUrl=function(resource){return scriptUrl+'m/'+osqaSkin+'/'+resource;};var scriptUrl='/{{settings.FORUM_SCRIPT_ALIAS}}';(function($){$.i18n={setDictionary:function(i18n_dict){i18n_dict=i18n_dict;},_:function(str,params){var transl=str;if(i18n_dict&&i18n_dict[str]){transl=i18n_dict[str];}
return this.printf(transl,params);},toEntity:function(str){var result='';for(var i=0;i<str.length;i++){if(str.charCodeAt(i)>128)
result+="&#"+str.charCodeAt(i)+";";else
result+=str.charAt(i);}
return result;},stripStr:function(str){return str.replace(/^\s*/,"").replace(/\s*$/,"");},stripStrML:function(str){var parts=str.split('\n');for(var i=0;i<parts.length;i++)
parts[i]=stripStr(parts[i]);return stripStr(parts.join(" "));},printf:function(S,L){if(!L)return S;var nS="";var tS=S.split("%s");for(var i=0;i<L.length;i++){if(tS[i].lastIndexOf('%')==tS[i].length-1&&i!=L.length-1)
tS[i]+="s"+tS.splice(i+1,1)[0];nS+=tS[i]+L[i];}
return nS+tS[tS.length-1];}};})(jQuery);var i18nZh={'insufficient privilege':'??????????','cannot pick own answer as best':'??????????????','anonymous users cannot select favorite questions':'?????????????','please login':'??????','anonymous users cannot vote':'????????','>15 points requried to upvote':'??+15?????????','>100 points required to downvote':'??+100?????????','please see':'??','cannot vote for own posts':'??????????','daily vote cap exhausted':'????????????????','cannot revoke old vote':'??????????????','please confirm offensive':"??????????????????????",'anonymous users cannot flag offensive posts':'???????????','cannot flag message as offensive twice':'???????','flag offensive cap exhausted':'?????????????5?�??�???','need >15 points to report spam':"??+15??????�???�?",'confirm delete':"?????/????????",'anonymous users cannot delete/undelete':"???????????????",'post recovered':"?????????????",'post deleted':"????????????",'add comment':'????','community karma points':'????','to comment, need':'????','delete this comment':'?????','hide comments':"????",'add a comment':"????",'comments':"??",'confirm delete comment':"?????????",'characters':'??','can write':'???','click to close':'???????','loading...':'???...','tags cannot be empty':'???????','tablimits info':"??5????????????20????",'content cannot be empty':'???????','content minchars':'????? {0} ???','please enter title':'??????','title minchars':"????? {0} ???",'delete':'??','undelete':'??','bold':'??','italic':'??','link':'???','quote':'??','preformatted text':'??','image':'??','numbered list':'??????','bulleted list':'??????','heading':'??','horizontal bar':'???','undo':'??','redo':'??','enter image url':'<b>??????</b></p><p>???<br />http://www.example.com/image.jpg   \"????\"','enter url':'<b>??Web??</b></p><p>???<br />http://www.cnprog.com/   \"????\"</p>"','upload image':'?????????'};var i18nEn={'need >15 points to report spam':'need >15 points to report spam ','>15 points requried to upvote':'>15 points required to upvote ','tags cannot be empty':'please enter at least one tag','anonymous users cannot vote':'sorry, anonymous users cannot vote ','anonymous users cannot select favorite questions':'sorry, anonymous users cannot select favorite questions ','to comment, need':'(to comment other people\'s posts, karma ','please see':'please see ','community karma points':' or more is necessary) - ','upload image':'Upload image:','enter image url':'enter URL of the image, e.g. http://www.example.com/image.jpg \"image title\"','enter url':'enter Web address, e.g. http://www.example.com \"page title\"','daily vote cap exhausted':'sorry, you\'ve used up todays vote cap','cannot pick own answer as best':'sorry, you cannot accept your own answer','cannot revoke old vote':'sorry, older votes cannot be revoked','please confirm offensive':'are you sure this post is offensive, contains spam, advertising, malicious remarks, etc.?','flag offensive cap exhausted':'sorry, you\'ve used up todays cap of flagging offensive messages ','confirm delete':'are you sure you want to delete this?','anonymous users cannot delete/undelete':'sorry, anonymous users cannot delete or undelete posts','post recovered':'your post is now restored!','post deleted':'your post has been deleted','confirm delete comment':'do you really want to delete this comment?','can write':'have ','tablimits info':'up to 5 tags, no more than 20 characters each','content minchars':'please enter more than {0} characters','title minchars':"please enter at least {0} characters",'characters':'characters left','cannot vote for own posts':'sorry, you cannot vote for your own posts','cannot flag message as offensive twice':'cannot flag message as offensive twice ','>100 points required to downvote':'>100 points required to downvote '};var i18nEs={'insufficient privilege':'privilegio insuficiente','cannot pick own answer as best':'no puede escoger su propia respuesta com la mejor','anonymous users cannot select favorite questions':'usuarios anonimos no pueden seleccionar','please login':'por favor inicie sesi�n','anonymous users cannot vote':'usuarios an�nimos no pueden votar','>15 points requried to upvote':'>15 puntos requeridos para votar positivamente','>100 points required to downvote':'>100 puntos requeridos para votar negativamente','please see':'por favor vea','cannot vote for own posts':'no se puede votar por sus propias publicaciones','daily vote cap exhausted':'cuota de votos diarios excedida','cannot revoke old vote':'no puede revocar un voto viejo','please confirm offensive':"por favor confirme ofensiva",'anonymous users cannot flag offensive posts':'usuarios an�nimos no pueden marcar publicaciones com ofensivas','cannot flag message as offensive twice':'no puede marcar mensaje com ofensivo dos veces','flag offensive cap exhausted':'cuota para marcar ofensivas ha sido excedida','need >15 points to report spam':"necesita >15 puntos para reportar spam",'confirm delete':"�Est� seguro que desea borrar esto?",'anonymous users cannot delete/undelete':"usuarios an�nimos no pueden borrar o recuperar publicaciones",'post recovered':"publicaci�n recuperada",'post deleted':"publicaci�n borrada?",'add comment':'agregar comentario','community karma points':'reputaci�n comunitaria','to comment, need':'para comentar, necesita reputaci�n','delete this comment':'borrar este comentario','hide comments':"ocultar comentarios",'add a comment':"agregar comentarios",'comments':"comentarios",'confirm delete comment':"�Realmente desea borrar este comentario?",'characters':'caracteres faltantes','can write':'tiene ','click to close':'haga click para cerrar','loading...':'cargando...','tags cannot be empty':'las etiquetas no pueden estar vac�as','tablimits info':"hasta 5 etiquetas de no mas de 20 caracteres cada una",'content cannot be empty':'el contenido no puede estar vac�o','content minchars':'por favor introduzca mas de {0} caracteres','please enter title':'por favor ingrese un t�tulo','title minchars':"por favor introduzca al menos {0} caracteres",'delete':'borrar','undelete':'recuperar','bold':'negrita','italic':'cursiva','link':'enlace','quote':'citar','preformatted text':'texto preformateado','image':'imagen','numbered list':'lista numerada','bulleted list':'lista no numerada','heading':'??','horizontal bar':'barra horizontal','undo':'deshacer','redo':'rehacer','enter image url':'introduzca la URL de la imagen, por ejemplo?<br />http://www.example.com/image.jpg   \"titulo de imagen\"','enter url':'introduzca direcciones web, ejemplo?<br />http://www.cnprog.com/   \"titulo del enlace\"</p>"','upload image':'cargar imagen?','questions/':'preguntas/','vote/':'votar/'};var i18n={'en':i18nEn,'zh_CN':i18nZh,'es':i18nEs};var i18n_dict=i18n[i18nLang];function removePluginFromConfig(plugin,type){if(!Attacklab.wmd_removed_plugins[type]){Attacklab.wmd_removed_plugins[type]=[];}
Attacklab.wmd_removed_plugins[type].push(plugin);}
$(function(){"use strict";$("#body").before('<div id="wmd-button-bar" class="wmd-panel"></div>');$("#body").after('<div id="previewer" class="wmd-panel"></div>');$("textarea[name=body]").textcomplete([{match:/\B@(\w*)$/,search:function(term,callback){$.ajax({'url':pageContext.url.usersSearch,'dataType':'json','data':{'q':term,'page':1,'pageSize':10},success:function(data){var results=$.map(data.result,function(item,index){return{label:(pageContext.userRealName&&item.realname)?item.realname:item.username,value:item};});callback(results);}});},index:1,cache:true,replace:function(item){return'@'+item.label+' ';},template:function(item){return $('<div>').append($('<img class="gravatar" height="24" width="24"/>').attr('src',item.value.avatar)).append($('<span style="margin-left:6px" ></span>').text(item.label)).html();}}]);});(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory);}else if(typeof module==="object"&&module.exports){var $=require('jquery');module.exports=factory($);}else{factory(jQuery);}}(function(jQuery){if(typeof jQuery==='undefined'){throw new Error('jQuery.textcomplete requires jQuery');}
+function($){'use strict';var warn=function(message){if(console.warn){console.warn(message);}};var id=1;$.fn.textcomplete=function(strategies,option){var args=Array.prototype.slice.call(arguments);return this.each(function(){var self=this;var $this=$(this);var completer=$this.data('textComplete');if(!completer){option||(option={});option._oid=id++;completer=new $.fn.textcomplete.Completer(this,option);$this.data('textComplete',completer);}
if(typeof strategies==='string'){if(!completer)return;args.shift()
completer[strategies].apply(completer,args);if(strategies==='destroy'){$this.removeData('textComplete');}}else{$.each(strategies,function(obj){$.each(['header','footer','placement','maxCount'],function(name){if(obj[name]){completer.option[name]=obj[name];warn(name+'as a strategy param is deprecated. Use option.');delete obj[name];}});});completer.register($.fn.textcomplete.Strategy.parse(strategies,{el:self,$el:$this}));}});};}(jQuery);+function($){'use strict';var lock=function(func){var locked,queuedArgsToReplay;return function(){var args=Array.prototype.slice.call(arguments);if(locked){queuedArgsToReplay=args;return;}
locked=true;var self=this;args.unshift(function replayOrFree(){if(queuedArgsToReplay){var replayArgs=queuedArgsToReplay;queuedArgsToReplay=undefined;replayArgs.unshift(replayOrFree);func.apply(self,replayArgs);}else{locked=false;}});func.apply(this,args);};};var isString=function(obj){return Object.prototype.toString.call(obj)==='[object String]';};var isFunction=function(obj){return Object.prototype.toString.call(obj)==='[object Function]';};var uniqueId=0;function Completer(element,option){this.$el=$(element);this.id='textcomplete'+uniqueId++;this.strategies=[];this.views=[];this.option=$.extend({},Completer._getDefaults(),option);if(!this.$el.is('input[type=text]')&&!this.$el.is('input[type=search]')&&!this.$el.is('textarea')&&!element.isContentEditable&&element.contentEditable!='true'){throw new Error('textcomplete must be called on a Textarea or a ContentEditable.');}
if(element===document.activeElement){this.initialize()}else{var self=this;this.$el.one('focus.'+this.id,function(){self.initialize();});}}
Completer._getDefaults=function(){if(!Completer.DEFAULTS){Completer.DEFAULTS={appendTo:$('body'),zIndex:'100'};}
return Completer.DEFAULTS;}
$.extend(Completer.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,initialize:function(){var element=this.$el.get(0);this.dropdown=new $.fn.textcomplete.Dropdown(element,this,this.option);var Adapter,viewName;if(this.option.adapter){Adapter=this.option.adapter;}else{if(this.$el.is('textarea')||this.$el.is('input[type=text]')||this.$el.is('input[type=search]')){viewName=typeof element.selectionEnd==='number'?'Textarea':'IETextarea';}else{viewName='ContentEditable';}
Adapter=$.fn.textcomplete[viewName];}
this.adapter=new Adapter(element,this,this.option);},destroy:function(){this.$el.off('.'+this.id);if(this.adapter){this.adapter.destroy();}
if(this.dropdown){this.dropdown.destroy();}
this.$el=this.adapter=this.dropdown=null;},deactivate:function(){if(this.dropdown){this.dropdown.deactivate();}},trigger:function(text,skipUnchangedTerm){if(!this.dropdown){this.initialize();}
text!=null||(text=this.adapter.getTextFromHeadToCaret());var searchQuery=this._extractSearchQuery(text);if(searchQuery.length){var term=searchQuery[1];if(skipUnchangedTerm&&this._term===term&&term!==""){return;}
this._term=term;this._search.apply(this,searchQuery);}else{this._term=null;this.dropdown.deactivate();}},fire:function(eventName){var args=Array.prototype.slice.call(arguments,1);this.$el.trigger(eventName,args);return this;},register:function(strategies){Array.prototype.push.apply(this.strategies,strategies);},select:function(value,strategy,e){this._term=null;this.adapter.select(value,strategy,e);this.fire('change').fire('textComplete:select',value,strategy);this.adapter.focus();},_clearAtNext:true,_term:null,_extractSearchQuery:function(text){for(var i=0;i<this.strategies.length;i++){var strategy=this.strategies[i];var context=strategy.context(text);if(context||context===''){var matchRegexp=isFunction(strategy.match)?strategy.match(text):strategy.match;if(isString(context)){text=context;}
var match=text.match(matchRegexp);if(match){return[strategy,match[strategy.index],match];}}}
return[]},_search:lock(function(free,strategy,term,match){var self=this;strategy.search(term,function(data,stillSearching){if(!self.dropdown.shown){self.dropdown.activate();}
if(self._clearAtNext){self.dropdown.clear();self._clearAtNext=false;}
self.dropdown.setPosition(self.adapter.getCaretPosition());self.dropdown.render(self._zip(data,strategy,term));if(!stillSearching){free();self._clearAtNext=true;}},match);}),_zip:function(data,strategy,term){return $.map(data,function(value){return{value:value,strategy:strategy,term:term};});}});$.fn.textcomplete.Completer=Completer;}(jQuery);+function($){'use strict';var $window=$(window);var include=function(zippedData,datum){var i,elem;var idProperty=datum.strategy.idProperty
for(i=0;i<zippedData.length;i++){elem=zippedData[i];if(elem.strategy!==datum.strategy)continue;if(idProperty){if(elem.value[idProperty]===datum.value[idProperty])return true;}else{if(elem.value===datum.value)return true;}}
return false;};var dropdownViews={};$(document).on('click',function(e){var id=e.originalEvent&&e.originalEvent.keepTextCompleteDropdown;$.each(dropdownViews,function(key,view){if(key!==id){view.deactivate();}});});var commands={SKIP_DEFAULT:0,KEY_UP:1,KEY_DOWN:2,KEY_ENTER:3,KEY_PAGEUP:4,KEY_PAGEDOWN:5,KEY_ESCAPE:6};function Dropdown(element,completer,option){this.$el=Dropdown.createElement(option);this.completer=completer;this.id=completer.id+'dropdown';this._data=[];this.$inputEl=$(element);this.option=option;if(option.listPosition){this.setPosition=option.listPosition;}
if(option.height){this.$el.height(option.height);}
var self=this;$.each(['maxCount','placement','footer','header','noResultsMessage','className'],function(_i,name){if(option[name]!=null){self[name]=option[name];}});this._bindEvents(element);dropdownViews[this.id]=this;}
$.extend(Dropdown,{createElement:function(option){var $parent=option.appendTo;if(!($parent instanceof $)){$parent=$($parent);}
var $el=$('<ul></ul>').addClass('dropdown-menu textcomplete-dropdown').attr('id','textcomplete-dropdown-'+option._oid).css({display:'none',left:0,position:'absolute',zIndex:option.zIndex}).appendTo($parent);return $el;}});$.extend(Dropdown.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:10,placement:'',shown:false,data:[],className:'',destroy:function(){this.deactivate();this.$el.off('.'+this.id);this.$inputEl.off('.'+this.id);this.clear();this.$el.remove();this.$el=this.$inputEl=this.completer=null;delete dropdownViews[this.id]},render:function(zippedData){var contentsHtml=this._buildContents(zippedData);var unzippedData=$.map(this.data,function(d){return d.value;});if(this.data.length){var strategy=zippedData[0].strategy;if(strategy.id){this.$el.attr('data-strategy',strategy.id);}else{this.$el.removeAttr('data-strategy');}
this._renderHeader(unzippedData);this._renderFooter(unzippedData);if(contentsHtml){this._renderContents(contentsHtml);this._fitToBottom();this._fitToRight();this._activateIndexedItem();}
this._setScroll();}else if(this.noResultsMessage){this._renderNoResultsMessage(unzippedData);}else if(this.shown){this.deactivate();}},setPosition:function(pos){var position='absolute';this.$inputEl.add(this.$inputEl.parents()).each(function(){if($(this).css('position')==='absolute')
return false;if($(this).css('position')==='fixed'){pos.top-=$window.scrollTop();pos.left-=$window.scrollLeft();position='fixed';return false;}});this.$el.css(this._applyPlacement(pos));this.$el.css({position:position});return this;},clear:function(){this.$el.html('');this.data=[];this._index=0;this._$header=this._$footer=this._$noResultsMessage=null;},activate:function(){if(!this.shown){this.clear();this.$el.show();if(this.className){this.$el.addClass(this.className);}
this.completer.fire('textComplete:show');this.shown=true;}
return this;},deactivate:function(){if(this.shown){this.$el.hide();if(this.className){this.$el.removeClass(this.className);}
this.completer.fire('textComplete:hide');this.shown=false;}
return this;},isUp:function(e){return e.keyCode===38||(e.ctrlKey&&e.keyCode===80);},isDown:function(e){return e.keyCode===40||(e.ctrlKey&&e.keyCode===78);},isEnter:function(e){var modifiers=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey;return!modifiers&&(e.keyCode===13||e.keyCode===9||(this.option.completeOnSpace===true&&e.keyCode===32))},isPageup:function(e){return e.keyCode===33;},isPagedown:function(e){return e.keyCode===34;},isEscape:function(e){return e.keyCode===27;},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on('mousedown.'+this.id,'.textcomplete-item',$.proxy(this._onClick,this));this.$el.on('touchstart.'+this.id,'.textcomplete-item',$.proxy(this._onClick,this));this.$el.on('mouseover.'+this.id,'.textcomplete-item',$.proxy(this._onMouseover,this));this.$inputEl.on('keydown.'+this.id,$.proxy(this._onKeydown,this));},_onClick:function(e){var $el=$(e.target);e.preventDefault();e.originalEvent.keepTextCompleteDropdown=this.id;if(!$el.hasClass('textcomplete-item')){$el=$el.closest('.textcomplete-item');}
var datum=this.data[parseInt($el.data('index'),10)];this.completer.select(datum.value,datum.strategy,e);var self=this;setTimeout(function(){self.deactivate();if(e.type==='touchstart'){self.$inputEl.focus();}},0);},_onMouseover:function(e){var $el=$(e.target);e.preventDefault();if(!$el.hasClass('textcomplete-item')){$el=$el.closest('.textcomplete-item');}
this._index=parseInt($el.data('index'),10);this._activateIndexedItem();},_onKeydown:function(e){if(!this.shown){return;}
var command;if($.isFunction(this.option.onKeydown)){command=this.option.onKeydown(e,commands);}
if(command==null){command=this._defaultKeydown(e);}
switch(command){case commands.KEY_UP:e.preventDefault();this._up();break;case commands.KEY_DOWN:e.preventDefault();this._down();break;case commands.KEY_ENTER:e.preventDefault();this._enter(e);break;case commands.KEY_PAGEUP:e.preventDefault();this._pageup();break;case commands.KEY_PAGEDOWN:e.preventDefault();this._pagedown();break;case commands.KEY_ESCAPE:e.preventDefault();this.deactivate();break;}},_defaultKeydown:function(e){if(this.isUp(e)){return commands.KEY_UP;}else if(this.isDown(e)){return commands.KEY_DOWN;}else if(this.isEnter(e)){return commands.KEY_ENTER;}else if(this.isPageup(e)){return commands.KEY_PAGEUP;}else if(this.isPagedown(e)){return commands.KEY_PAGEDOWN;}else if(this.isEscape(e)){return commands.KEY_ESCAPE;}},_up:function(){if(this._index===0){this._index=this.data.length-1;}else{this._index-=1;}
this._activateIndexedItem();this._setScroll();},_down:function(){if(this._index===this.data.length-1){this._index=0;}else{this._index+=1;}
this._activateIndexedItem();this._setScroll();},_enter:function(e){var datum=this.data[parseInt(this._getActiveElement().data('index'),10)];this.completer.select(datum.value,datum.strategy,e);this.deactivate();},_pageup:function(){var target=0;var threshold=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(i){if($(this).position().top+$(this).outerHeight()>threshold){target=i;return false;}});this._index=target;this._activateIndexedItem();this._setScroll();},_pagedown:function(){var target=this.data.length-1;var threshold=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(i){if($(this).position().top>threshold){target=i;return false}});this._index=target;this._activateIndexedItem();this._setScroll();},_activateIndexedItem:function(){this.$el.find('.textcomplete-item.active').removeClass('active');this._getActiveElement().addClass('active');},_getActiveElement:function(){return this.$el.children('.textcomplete-item:nth('+this._index+')');},_setScroll:function(){var $activeEl=this._getActiveElement();var itemTop=$activeEl.position().top;var itemHeight=$activeEl.outerHeight();var visibleHeight=this.$el.innerHeight();var visibleTop=this.$el.scrollTop();if(this._index===0||this._index==this.data.length-1||itemTop<0){this.$el.scrollTop(itemTop+visibleTop);}else if(itemTop+itemHeight>visibleHeight){this.$el.scrollTop(itemTop+itemHeight+visibleTop-visibleHeight);}},_buildContents:function(zippedData){var datum,i,index;var html='';for(i=0;i<zippedData.length;i++){if(this.data.length===this.maxCount)break;datum=zippedData[i];if(include(this.data,datum)){continue;}
index=this.data.length;this.data.push(datum);html+='<li class="textcomplete-item" data-index="'+index+'"><a>';html+=datum.strategy.template(datum.value,datum.term);html+='</a></li>';}
return html;},_renderHeader:function(unzippedData){if(this.header){if(!this._$header){this._$header=$('<li class="textcomplete-header"></li>').prependTo(this.$el);}
var html=$.isFunction(this.header)?this.header(unzippedData):this.header;this._$header.html(html);}},_renderFooter:function(unzippedData){if(this.footer){if(!this._$footer){this._$footer=$('<li class="textcomplete-footer"></li>').appendTo(this.$el);}
var html=$.isFunction(this.footer)?this.footer(unzippedData):this.footer;this._$footer.html(html);}},_renderNoResultsMessage:function(unzippedData){if(this.noResultsMessage){if(!this._$noResultsMessage){this._$noResultsMessage=$('<li class="textcomplete-no-results-message"></li>').appendTo(this.$el);}
var html=$.isFunction(this.noResultsMessage)?this.noResultsMessage(unzippedData):this.noResultsMessage;this._$noResultsMessage.html(html);}},_renderContents:function(html){if(this._$footer){this._$footer.before(html);}else{this.$el.append(html);}},_fitToBottom:function(){var windowScrollBottom=$window.scrollTop()+$window.height();var height=this.$el.height();if((this.$el.position().top+height)>windowScrollBottom){this.$el.offset({top:windowScrollBottom-height});}},_fitToRight:function(){var tolerance=30;var lastOffset=this.$el.offset().left,offset;var width=this.$el.width();var maxLeft=$window.width()-tolerance;while(lastOffset+width>maxLeft){this.$el.offset({left:lastOffset-tolerance});offset=this.$el.offset().left;if(offset>=lastOffset){break;}
lastOffset=offset;}},_applyPlacement:function(position){if(this.placement.indexOf('top')!==-1){position={top:'auto',bottom:this.$el.parent().height()-position.top+position.lineHeight,left:position.left};}else{position.bottom='auto';delete position.lineHeight;}
if(this.placement.indexOf('absleft')!==-1){position.left=0;}else if(this.placement.indexOf('absright')!==-1){position.right=0;position.left='auto';}
return position;}});$.fn.textcomplete.Dropdown=Dropdown;$.extend($.fn.textcomplete,commands);}(jQuery);+function($){'use strict';var memoize=function(func){var memo={};return function(term,callback){if(memo[term]){callback(memo[term]);}else{func.call(this,term,function(data){memo[term]=(memo[term]||[]).concat(data);callback.apply(null,arguments);});}};};function Strategy(options){$.extend(this,options);if(this.cache){this.search=memoize(this.search);}}
Strategy.parse=function(strategiesArray,params){return $.map(strategiesArray,function(strategy){var strategyObj=new Strategy(strategy);strategyObj.el=params.el;strategyObj.$el=params.$el;return strategyObj;});};$.extend(Strategy.prototype,{match:null,replace:null,search:null,id:null,cache:false,context:function(){return true;},index:2,template:function(obj){return obj;},idProperty:null});$.fn.textcomplete.Strategy=Strategy;}(jQuery);+function($){'use strict';var now=Date.now||function(){return new Date().getTime();};var debounce=function(func,wait){var timeout,args,context,timestamp,result;var later=function(){var last=now()-timestamp;if(last<wait){timeout=setTimeout(later,wait-last);}else{timeout=null;result=func.apply(context,args);context=args=null;}};return function(){context=this;args=arguments;timestamp=now();if(!timeout){timeout=setTimeout(later,wait);}
return result;};};function Adapter(){}
$.extend(Adapter.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(element,completer,option){this.el=element;this.$el=$(element);this.id=completer.id+this.constructor.name;this.completer=completer;this.option=option;if(this.option.debounce){this._onKeyup=debounce(this._onKeyup,this.option.debounce);}
this._bindEvents();},destroy:function(){this.$el.off('.'+this.id);this.$el=this.el=this.completer=null;},select:function(){throw new Error('Not implemented');},getCaretPosition:function(){var position=this._getCaretRelativePosition();var offset=this.$el.offset();var $parent=this.option.appendTo;if($parent){if(!($parent instanceof $)){$parent=$($parent);}
var parentOffset=$parent.offsetParent().offset();offset.top-=parentOffset.top;offset.left-=parentOffset.left;}
position.top+=offset.top;position.left+=offset.left;return position;},focus:function(){this.$el.focus();},_bindEvents:function(){this.$el.on('keyup.'+this.id,$.proxy(this._onKeyup,this));},_onKeyup:function(e){if(this._skipSearch(e)){return;}
this.completer.trigger(this.getTextFromHeadToCaret(),true);},_skipSearch:function(clickEvent){switch(clickEvent.keyCode){case 9:case 13:case 40:case 38:return true;}
if(clickEvent.ctrlKey)switch(clickEvent.keyCode){case 78:case 80:return true;}}});$.fn.textcomplete.Adapter=Adapter;}(jQuery);+function($){'use strict';function Textarea(element,completer,option){this.initialize(element,completer,option);}
$.extend(Textarea.prototype,$.fn.textcomplete.Adapter.prototype,{select:function(value,strategy,e){var pre=this.getTextFromHeadToCaret();var post=this.el.value.substring(this.el.selectionEnd);var newSubstr=strategy.replace(value,e);if(typeof newSubstr!=='undefined'){if($.isArray(newSubstr)){post=newSubstr[1]+post;newSubstr=newSubstr[0];}
pre=pre.replace(strategy.match,newSubstr);this.$el.val(pre+post);this.el.selectionStart=this.el.selectionEnd=pre.length;}},getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd);},_getCaretRelativePosition:function(){var p=$.fn.textcomplete.getCaretCoordinates(this.el,this.el.selectionStart);return{top:p.top+this._calculateLineHeight()-this.$el.scrollTop(),left:p.left-this.$el.scrollLeft()};},_calculateLineHeight:function(){var lineHeight=parseInt(this.$el.css('line-height'),10);if(isNaN(lineHeight)){var parentNode=this.el.parentNode;var temp=document.createElement(this.el.nodeName);var style=this.el.style;temp.setAttribute('style','margin:0px;padding:0px;font-family:'+style.fontFamily+';font-size:'+style.fontSize);temp.innerHTML='test';parentNode.appendChild(temp);lineHeight=temp.clientHeight;parentNode.removeChild(temp);}
return lineHeight;}});$.fn.textcomplete.Textarea=Textarea;}(jQuery);+function($){'use strict';var sentinelChar='吶';function IETextarea(element,completer,option){this.initialize(element,completer,option);$('<span>'+sentinelChar+'</span>').css({position:'absolute',top:-9999,left:-9999}).insertBefore(element);}
$.extend(IETextarea.prototype,$.fn.textcomplete.Textarea.prototype,{select:function(value,strategy,e){var pre=this.getTextFromHeadToCaret();var post=this.el.value.substring(pre.length);var newSubstr=strategy.replace(value,e);if(typeof newSubstr!=='undefined'){if($.isArray(newSubstr)){post=newSubstr[1]+post;newSubstr=newSubstr[0];}
pre=pre.replace(strategy.match,newSubstr);this.$el.val(pre+post);this.el.focus();var range=this.el.createTextRange();range.collapse(true);range.moveEnd('character',pre.length);range.moveStart('character',pre.length);range.select();}},getTextFromHeadToCaret:function(){this.el.focus();var range=document.selection.createRange();range.moveStart('character',-this.el.value.length);var arr=range.text.split(sentinelChar)
return arr.length===1?arr[0]:arr[1];}});$.fn.textcomplete.IETextarea=IETextarea;}(jQuery);+function($){'use strict';function ContentEditable(element,completer,option){this.initialize(element,completer,option);}
$.extend(ContentEditable.prototype,$.fn.textcomplete.Adapter.prototype,{select:function(value,strategy,e){var pre=this.getTextFromHeadToCaret();var sel=window.getSelection()
var range=sel.getRangeAt(0);var selection=range.cloneRange();selection.selectNodeContents(range.startContainer);var content=selection.toString();var post=content.substring(range.startOffset);var newSubstr=strategy.replace(value,e);if(typeof newSubstr!=='undefined'){if($.isArray(newSubstr)){post=newSubstr[1]+post;newSubstr=newSubstr[0];}
pre=pre.replace(strategy.match,newSubstr);range.selectNodeContents(range.startContainer);range.deleteContents();var preWrapper=document.createElement("div");preWrapper.innerHTML=pre;var postWrapper=document.createElement("div");postWrapper.innerHTML=post;var fragment=document.createDocumentFragment();var childNode;var lastOfPre;while(childNode=preWrapper.firstChild){lastOfPre=fragment.appendChild(childNode);}
while(childNode=postWrapper.firstChild){fragment.appendChild(childNode);}
range.insertNode(fragment);range.setStartAfter(lastOfPre);range.collapse(true);sel.removeAllRanges();sel.addRange(range);}},_getCaretRelativePosition:function(){var range=window.getSelection().getRangeAt(0).cloneRange();var node=document.createElement('span');range.insertNode(node);range.selectNodeContents(node);range.deleteContents();var $node=$(node);var position=$node.offset();position.left-=this.$el.offset().left;position.top+=$node.height()-this.$el.offset().top;position.lineHeight=$node.height();$node.remove();return position;},getTextFromHeadToCaret:function(){var range=window.getSelection().getRangeAt(0);var selection=range.cloneRange();selection.selectNodeContents(range.startContainer);return selection.toString().substring(0,range.startOffset);}});$.fn.textcomplete.ContentEditable=ContentEditable;}(jQuery);(function($){var properties=['direction','boxSizing','width','height','overflowX','overflowY','borderTopWidth','borderRightWidth','borderBottomWidth','borderLeftWidth','borderStyle','paddingTop','paddingRight','paddingBottom','paddingLeft','fontStyle','fontVariant','fontWeight','fontStretch','fontSize','fontSizeAdjust','lineHeight','fontFamily','textAlign','textTransform','textIndent','textDecoration','letterSpacing','wordSpacing','tabSize','MozTabSize'];var isBrowser=(typeof window!=='undefined');var isFirefox=(isBrowser&&window.mozInnerScreenX!=null);function getCaretCoordinates(element,position,options){if(!isBrowser){throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');}
var debug=options&&options.debug||false;if(debug){var el=document.querySelector('#input-textarea-caret-position-mirror-div');if(el){el.parentNode.removeChild(el);}}
var div=document.createElement('div');div.id='input-textarea-caret-position-mirror-div';document.body.appendChild(div);var style=div.style;var computed=window.getComputedStyle?getComputedStyle(element):element.currentStyle;style.whiteSpace='pre-wrap';if(element.nodeName!=='INPUT')
style.wordWrap='break-word';style.position='absolute';if(!debug)
style.visibility='hidden';properties.forEach(function(prop){style[prop]=computed[prop];});if(isFirefox){if(element.scrollHeight>parseInt(computed.height))
style.overflowY='scroll';}else{style.overflow='hidden';}
div.textContent=element.value.substring(0,position);if(element.nodeName==='INPUT')
div.textContent=div.textContent.replace(/\s/g,'\u00a0');var span=document.createElement('span');span.textContent=element.value.substring(position)||'.';div.appendChild(span);var coordinates={top:span.offsetTop+parseInt(computed['borderTopWidth']),left:span.offsetLeft+parseInt(computed['borderLeftWidth'])};if(debug){span.style.backgroundColor='#aaa';}else{document.body.removeChild(div);}
return coordinates;}
$.fn.textcomplete.getCaretCoordinates=getCaretCoordinates;}(jQuery));return jQuery;}));var gaCode='UA-42271496-1';window._gaq=window._gaq||[];window._gaq.push(['account2._setAccount',gaCode]);window._gaq.push(['account2._trackPageview']);function gaAfterPageLoad(){if(Object.prototype.toString.call(window._gaq)==='[object Array]'){window._gaq=[];window._gaq.push(['_setAccount',gaCode]);window._gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();}}
if(window.attachEvent){window.attachEvent('onload',gaAfterPageLoad);}else{if(window.onload){var currOnLoad=window.onload;var newOnLoad=function(){currOnLoad();gaAfterPageLoad();};window.onload=newOnLoad;}else{window.onload=gaAfterPageLoad;}}
$(function(){if(pageContext.additional.recaptchaKey){var $submit=$('form:has(#body)').find('input[type=submit], input[type=button], button').first();commandUtils.getScript('https://www.google.com/recaptcha/api.js',function(){$submit.before('<div class="g-recaptcha" data-sitekey="'+pageContext.additional.recaptchaKey+'"></div>');if(pageContext.additional.recaptchaError){$submit.before('<div style="color: #B94A48;">'+pageContext.additional.recaptchaError+'</div> ');}});}});