/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;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 b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.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(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.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?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},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||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.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||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},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:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.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 f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.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?b.extend(e,r):r}},i={};return r.pipe=r.then,b.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=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.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],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.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;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[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%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.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&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,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 b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.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=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.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,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._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(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value: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,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.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 n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},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}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[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),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=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));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,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]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),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=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),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=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=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 b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):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,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.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))},b.Event=function(e,n){return this instanceof b.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&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.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()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._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 b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.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 b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.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,b(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(){b.event.remove(this,e,r,n)})},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)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?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},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.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},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-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 u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(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?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(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]))})})}o=st.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+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===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]||st.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]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.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,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!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[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[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]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[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[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(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:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.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===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.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!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.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:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(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})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(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 mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&&gt(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.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?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(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(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.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,Nt=/^(?:checkbox|radio)$/i,Ct=/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:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(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 b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.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 b.clone(this,e,t)})},html:function(e){return b.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)||!b.support.htmlSerialize&&mt.test(e)||!b.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&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._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++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.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)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(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||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.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),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(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,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});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("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","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"===b.css(e,"display")||!b.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]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.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}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.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))?b(this).show():b(this).hide()})}}),b.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":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],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||b.isNumeric(o)?o||0:a):a},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}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});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+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.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=b.support.boxSizing&&"border-box"===b.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&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<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=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.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,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.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=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.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)||(b.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;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.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(b.isArray(t))b.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"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.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){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.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(w)||[];if(b.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(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.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"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.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,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){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===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.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=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],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=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.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&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.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)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.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 On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=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 u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.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,On.push(o)),s&&b.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){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.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,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.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,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.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||(b.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?b.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=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.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)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.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=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._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=b.timers,a=b._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)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),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}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.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,b.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},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.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?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.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?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
/*! jQuery UI - v1.10.2 - 2013-03-14
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
(function(t,e){function i(e,i){var n,o,a,r=e.nodeName.toLowerCase();return"area"===r?(n=e.parentNode,o=n.name,e.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap=#"+o+"]")[0],!!a&&s(a)):!1):(/input|select|textarea|button|object/.test(r)?!e.disabled:"a"===r?e.href||i:i)&&s(e)}function s(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var n=0,o=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.2",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}}),t.fn.extend({focus:function(e){return function(i,s){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),s&&s.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(i){if(i!==e)return this.css("zIndex",i);if(this.length)for(var s,n,o=t(this[0]);o.length&&o[0]!==document;){if(s=o.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(n=parseInt(o.css("zIndex"),10),!isNaN(n)&&0!==n))return n;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])},focusable:function(e){return i(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var s=t.attr(e,"tabindex"),n=isNaN(s);return(n||s>=0)&&i(e,!n)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(i,s){function n(e,i,s,n){return t.each(o,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),n&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var o="Width"===s?["Left","Right"]:["Top","Bottom"],a=s.toLowerCase(),r={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+s]=function(i){return i===e?r["inner"+s].call(this):this.each(function(){t(this).css(a,n(this,i)+"px")})},t.fn["outer"+s]=function(e,i){return"number"!=typeof e?r["outer"+s].call(this,e):this.each(function(){t(this).css(a,n(this,e,!0,i)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i){var s,n=t.plugins[e];if(n&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(s=0;n.length>s;s++)t.options[n[s][0]]&&n[s][1].apply(t.element,i)}},hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)}})})(jQuery),function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.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:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),s===e)return o[i]===e?null:o[i];o[i]=s}else{if(s===e)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})}(jQuery),function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,o="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),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(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),i.containment&&this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i,s=this,n=!1,o=!1;for(t.ui.ddmanager&&!this.options.dropBehaviour&&(o=t.ui.ddmanager.drop(this,e)),this.dropped&&(o=this.dropped,this.dropped=!1),i=this.element[0];i&&(i=i.parentNode);)i===document&&(n=!0);return n||"original"!==this.options.helper?("invalid"===this.options.revert&&!o||"valid"===this.options.revert&&o||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,o)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",e)!==!1&&s._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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 e,i,s,n=this.options;if("parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=["document"===n.containment?0:t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"===n.containment?0:t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"===n.containment?0:t(window).scrollLeft())+t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"===n.containment?0:t(window).scrollTop())+(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||n.containment.constructor===Array)n.containment.constructor===Array&&(this.containment=n.containment);else{if(i=t(n.containment),s=i[0],!s)return;e="hidden"!==t(s).css("overflow"),this.containment=[(parseInt(t(s).css("borderLeftWidth"),10)||0)+(parseInt(t(s).css("paddingLeft"),10)||0),(parseInt(t(s).css("borderTopWidth"),10)||0)+(parseInt(t(s).css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(t(s).css("borderRightWidth"),10)||0)-(parseInt(t(s).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(t(s).css("borderBottomWidth"),10)||0)-(parseInt(t(s).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i}},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n,o,a=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName),l=e.pageX,c=e.pageY;return this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(c=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(c=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,c=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o)),{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var s=t(this).data("ui-draggable"),n=s.options,o=t.extend({},i,{item:s.element});s.sortables=[],t(n.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,o))})},stop:function(e,i){var s=t(this).data("ui-draggable"),n=t.extend({},i,{item:s.element});t.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,n))})},drag:function(e,i){var s=t(this).data("ui-draggable"),n=this;t.each(s.sortables,function(){var o=!1,a=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,t.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==a&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(a.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",e),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",e),s.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._opacity&&t(i.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(document).scrollTop()<s.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<s.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(document).scrollLeft()<s.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<s.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),s=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(e,i){var s,n,o,a,r,h,l,c,u,d,p=t(this).data("ui-draggable"),f=p.options,g=f.snapTolerance,m=i.offset.left,v=m+p.helperProportions.width,_=i.offset.top,b=_+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)r=p.snapElements[u].left,h=r+p.snapElements[u].width,l=p.snapElements[u].top,c=l+p.snapElements[u].height,m>r-g&&h+g>m&&_>l-g&&c+g>_||m>r-g&&h+g>m&&b>l-g&&c+g>b||v>r-g&&h+g>v&&_>l-g&&c+g>_||v>r-g&&h+g>v&&b>l-g&&c+g>b?("inner"!==f.snapMode&&(s=g>=Math.abs(l-b),n=g>=Math.abs(c-_),o=g>=Math.abs(r-v),a=g>=Math.abs(h-m),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||o||a,"outer"!==f.snapMode&&(s=g>=Math.abs(l-_),n=g>=Math.abs(c-b),o=g>=Math.abs(r-m),a=g>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(s||n||o||a||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=s||n||o||a||d):(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,s=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});s.length&&(e=parseInt(t(s[0]).css("zIndex"),10)||0,t(s).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+s.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._zIndex&&t(i.helper).css("zIndex",s._zIndex)}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}t.widget("ui.droppable",{version:"1.10.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(i)?i:function(t){return t.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},t.ui.ddmanager.droppables[e.scope]=t.ui.ddmanager.droppables[e.scope]||[],t.ui.ddmanager.droppables[e.scope].push(this),e.addClasses&&this.element.addClass("ui-droppable")
},_destroy:function(){for(var e=0,i=t.ui.ddmanager.droppables[this.options.scope];i.length>e;e++)i[e]===this&&i.splice(e,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,i){"accept"===e&&(this.accept=t.isFunction(i)?i:function(t){return t.is(i)}),t.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var e=t.data(this,"ui-droppable");return e.options.greedy&&!e.options.disabled&&e.options.scope===s.options.scope&&e.accept.call(e.element[0],s.currentItem||s.element)&&t.ui.intersect(s,t.extend(e,{offset:e.element.offset()}),e.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(t,i,s){if(!i.offset)return!1;var n,o,a=(t.positionAbs||t.position.absolute).left,r=a+t.helperProportions.width,h=(t.positionAbs||t.position.absolute).top,l=h+t.helperProportions.height,c=i.offset.left,u=c+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return a>=c&&u>=r&&h>=d&&p>=l;case"intersect":return a+t.helperProportions.width/2>c&&u>r-t.helperProportions.width/2&&h+t.helperProportions.height/2>d&&p>l-t.helperProportions.height/2;case"pointer":return n=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,o=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(o,d,i.proportions.height)&&e(n,c,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(a>=c&&u>=a||r>=c&&u>=r||c>a&&r>u);default:return!1}},t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions.height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions={width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight})}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").bind("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=t.ui.intersect(e,this,this.options.tolerance),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t.data(this,"ui-droppable").options.scope===n}),o.length&&(s=t.data(o[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").unbind("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}}}(jQuery),function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,s,n,o,a=this,r=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<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=!0,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=r.handles||(t(".ui-resizable-handle",this.element).length?{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"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)s=t.trim(e[i]),o="ui-resizable-"+s,n=t("<div class='ui-resizable-handle "+o+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(t(this).removeClass("ui-resizable-autohide"),a._handles.show())}).mouseleave(function(){r.disabled||a.resizing||(t(this).addClass("ui-resizable-autohide"),a._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,o,a=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=e(this.helper.css("left")),n=e(this.helper.css("top")),a.containment&&(s+=t(a.containment).scrollLeft()||0,n+=t(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,o=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===o?this.axis+"-resize":o),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(e){var i,s=this.helper,n={},o=this.originalMousePosition,a=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,c=this.size.height,u=e.pageX-o.left||0,d=e.pageY-o.top||0,p=this._change[a];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==c&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(n)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,h=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,s,n,o,a,r=this.options;a={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||t)&&(e=a.minHeight*this.aspectRatio,n=a.minWidth/this.aspectRatio,s=a.maxHeight*this.aspectRatio,o=a.maxWidth/this.aspectRatio,e>a.minWidth&&(a.minWidth=e),n>a.minHeight&&(a.minHeight=n),a.maxWidth>s&&(a.maxWidth=s),a.maxHeight>o&&(a.maxHeight=o)),this._vBoundaries=a},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,s=this.size,n=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===n&&(t.left=e.left+(s.width-t.width),t.top=null),"nw"===n&&(t.top=e.top+(s.height-t.height),t.left=e.left+(s.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,s=this.axis,n=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,o=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,a=i(t.width)&&e.minWidth&&e.minWidth>t.width,r=i(t.height)&&e.minHeight&&e.minHeight>t.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,c=/sw|nw|w/.test(s),u=/nw|ne|n/.test(s);return a&&(t.width=e.minWidth),r&&(t.height=e.minHeight),n&&(t.width=e.maxWidth),o&&(t.height=e.maxHeight),a&&c&&(t.left=h-e.minWidth),n&&c&&(t.left=h-e.maxWidth),r&&u&&(t.top=l-e.minHeight),o&&u&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,s,n,o=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(n=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(s[e],10)||0);n.css({height:o.height()-this.borderDif[0]-this.borderDif[2]||0,width:o.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<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:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,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}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&t.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,o,a,r,h,l=t(this).data("ui-resizable"),c=l.options,u=l.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(l.containerElement=t(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),s=[],t(["Top","Right","Left","Bottom"]).each(function(t,n){s[t]=e(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,o=l.containerSize.height,a=l.containerSize.width,r=t.ui.hasScroll(p,"left")?p.scrollWidth:a,h=t.ui.hasScroll(p)?p.scrollHeight:o,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(e){var i,s,n,o,a=t(this).data("ui-resizable"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio),a.position.top=a._helper?h.top:0),a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top,i=Math.abs((a._helper?a.offset.left-u.left:a.offset.left-u.left)+a.sizeDiff.width),s=Math.abs((a._helper?a.offset.top-u.top:a.offset.top-h.top)+a.sizeDiff.height),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o&&(i-=a.parentData.left),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):t.each(i.alsoResize,function(t){s(t)})},resize:function(e,i){var s=t(this).data("ui-resizable"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0},h=function(e,s){t(e).each(function(){var e=t(this),n=t(this).data("ui-resizable-alsoresize"),o={},a=s&&s.length?s:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(a,function(t,e){var i=(n[e]||0)+(r[e]||0);i&&i>=0&&(o[e]=i||null)}),e.css(o)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):t.each(n.alsoResize,function(t,e){h(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&d>i.maxWidth,g=i.maxHeight&&p>i.maxHeight,m=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=h),v&&(p+=l),f&&(d-=h),g&&(p-=l),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):(e.size.width=d,e.size.height=p,e.position.top=o.top-u,e.position.left=o.left-c)}})}(jQuery),function(t){t.widget("ui.selectable",t.ui.mouse,{version:"1.10.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e=t(i.options.filter,i.element[0]),e.addClass("ui-selectee"),e.each(function(){var e=t(this),i=e.offset();t.data(this,"selectable-item",{element:this,$element:e,left:i.left,top:i.top,right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=t("<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(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):undefined}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||o>i.right||i.top>h||a>i.bottom):"fit"===n.tolerance&&(l=i.left>o&&r>i.right&&i.top>a&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,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 t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):undefined}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),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},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.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(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-t(document).scrollTop()<a.scrollSensitivity?r=t(document).scrollTop(t(document).scrollTop()-a.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<a.scrollSensitivity&&(r=t(document).scrollTop(t(document).scrollTop()+a.scrollSpeed)),e.pageX-t(document).scrollLeft()<a.scrollSensitivity?r=t(document).scrollLeft(t(document).scrollLeft()-a.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<a.scrollSensitivity&&(r=t(document).scrollLeft(t(document).scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;
this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u=s+l>r&&h>s+l&&e+c>o&&a>e+c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?u:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return n?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&s||"left"===o&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,o,a=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--)for(n=t(h[i]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&r.push([t.isFunction(o.options.items)?o.options.items.call(o.element):t(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){a.push(this)});return t(a)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.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--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.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(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t(e.document[0].createElement(s)).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?n.append("<td colspan='99'>&#160;</td>"):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,o,a,r,h,l,c,u,d,p,f=null,g=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],g=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[g].containerCache.over||(this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1);else{for(a=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],o=this.items.length-1;o>=0;o--)t.contains(this.containers[g].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))&&(u=this.items[o].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[o][l]-c)&&(d=!0,u+=this.items[o][l]),a>Math.abs(u-c)&&(a=Math.abs(u-c),r=this.items[o],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[g])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[g].element,!0),this._trigger("change",s,this._uiHash()),this.containers[g]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[g],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[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")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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 e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}(jQuery),function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function s(e,i){var s,n,a={};for(s in i)n=i[s],e[s]!==n&&(o[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(a[s]=n));return a}var n=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var e=t(this);return{el:e,start:i(this)}}),o=function(){t.each(n,function(t,i){e[i]&&a[i+"Class"](e[i])})},o(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,o,a,r){return"boolean"==typeof n||n===e?o?t.effects.animateClass.call(this,n?{add:s}:{remove:s},o,a,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,o,a)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.2",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,o;for(o=0;s.length>o;o++)null!==s[o]&&(n=t.data(i+s[o]),n===e&&(n=""),t.css(s[o],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(o)&&o.call(n[0]),t.isFunction(e)&&e()}var n=t(this),o=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):a.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,o=i.queue,a=t.effects.effect[i.effect];return t.fx.off||!a?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):o===!1?this.each(e):this.queue(o||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()}(jQuery),function(t){var e=0,i={},s={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",t.widget("ui.accordion",{version:"1.10.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t(),content:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("<span>").addClass("ui-accordion-header-icon ui-icon "+e.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(e.header).addClass(e.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()
},_destroy:function(){var t;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-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").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(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),undefined):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),"disabled"===t&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e),undefined)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),o.focus(),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().focus()},refresh:function(){var e=this.options;this._processPanels(),(e.active===!1&&e.collapsible===!0||!this.headers.length)&&(e.active=!1,this.active=t()),e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){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 i,s=this.options,n=s.heightStyle,o=this.element.parent(),a=this.accordionId="ui-accordion-"+(this.element.attr("id")||++e);this.active=this._findActive(s.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(e){var i=t(this),s=i.attr("id"),n=i.next(),o=n.attr("id");s||(s=a+"-header-"+e,i.attr("id",s)),o||(o=a+"-panel-"+e,n.attr("id",o)),i.attr("aria-controls",o),n.attr("aria-labelledby",s)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(s.event),"fill"===n?(i=o.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===n&&(i=0,this.headers.next().each(function(){i=Math.max(i,t(this).css("height","").height())}).height(i))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n[0]===s[0],a=o&&i.collapsible,r=a?t():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:a?t():n,newPanel:r};e.preventDefault(),o&&!i.collapsible||this._trigger("beforeActivate",e,l)===!1||(i.active=a?!1:this.headers.index(n),this.active=o?t():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),o||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-expanded":"false","aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(t,e,n){var o,a,r,h=this,l=0,c=t.length&&(!e.length||t.index()<e.index()),u=this.options.animate||{},d=c&&u.down||u,p=function(){h._toggleComplete(n)};return"number"==typeof d&&(r=d),"string"==typeof d&&(a=d),a=a||d.easing||u.easing,r=r||d.duration||u.duration,e.length?t.length?(o=t.show().outerHeight(),e.animate(i,{duration:r,easing:a,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(s,{duration:r,easing:a,complete:p,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(o-e.outerHeight()-l),l=0)}}),undefined):e.animate(i,r,a,p):t.animate(s,r,a,p)},_toggleComplete:function(t){var e=t.oldPanel;e.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}})}(jQuery),function(t){var e=0;t.widget("ui.autocomplete",{version:"1.10.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o?!0:a?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,undefined;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:case o.NUMPAD_ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,s.preventDefault(),undefined;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),undefined):(this._searchTimeout(t),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(t),this._change(t),undefined)}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({input:t(),role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(s){s.target===e.element[0]||s.target===i||t.contains(i,s.target)||e.close()})})},menufocus:function(e,i){if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),undefined;var s=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",e,{item:s})?e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value):this.liveRegion.text(s.value)},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertAfter(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(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):undefined},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var t=this,i=++e;return function(s){i===e&&t.__response(s),t.pending--,t.pending||t.element.removeClass("ui-autocomplete-loading")}},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({label:e.label||e.value,value:e.value||e.label},e)})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<a>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[t](e),undefined):(this.search(null,e),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.text(e))}})}(jQuery),function(t){var e,i,s,n,o="ui-button ui-widget ui-state-default ui-corner-all",a="ui-state-hover ui-state-active ",r="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",h=function(){var e=t(this).find(":ui-button");setTimeout(function(){e.button("refresh")},1)},l=function(e){var i=e.name,s=e.form,n=t([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?t(s).find("[name='"+i+"']"):t("[name='"+i+"']",e.ownerDocument).filter(function(){return!this.form})),n};t.widget("ui.button",{version:"1.10.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,h),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var a=this,r=this.options,c="checkbox"===this.type||"radio"===this.type,u=c?"":"ui-state-active",d="ui-state-focus";null===r.label&&(r.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(o).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){r.disabled||this===e&&t(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){r.disabled||t(this).removeClass(u)}).bind("click"+this.eventNamespace,function(t){r.disabled&&(t.preventDefault(),t.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){a.buttonElement.addClass(d)}).bind("blur"+this.eventNamespace,function(){a.buttonElement.removeClass(d)}),c&&(this.element.bind("change"+this.eventNamespace,function(){n||a.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(t){r.disabled||(n=!1,i=t.pageX,s=t.pageY)}).bind("mouseup"+this.eventNamespace,function(t){r.disabled||(i!==t.pageX||s!==t.pageY)&&(n=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return r.disabled||n?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(r.disabled||n)return!1;t(this).addClass("ui-state-active"),a.buttonElement.attr("aria-pressed","true");var e=a.element[0];l(e).not(e).map(function(){return t(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return r.disabled?!1:(t(this).addClass("ui-state-active"),e=this,a.document.one("mouseup",function(){e=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return r.disabled?!1:(t(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(e){return r.disabled?!1:((e.keyCode===t.ui.keyCode.SPACE||e.keyCode===t.ui.keyCode.ENTER)&&t(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){t(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===t.ui.keyCode.SPACE&&t(this).click()})),this._setOption("disabled",r.disabled),this._resetButton()},_determineButtonType:function(){var t,e,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(t=this.element.parents().last(),e="label[for='"+this.element.attr("id")+"']",this.buttonElement=t.find(e),this.buttonElement.length||(t=t.length?t.siblings():this.element.siblings(),this.buttonElement=t.filter(e),this.buttonElement.length||(this.buttonElement=t.find(e))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(o+" "+a+" "+r).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(t,e){return this._super(t,e),"disabled"===t?(e?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var e=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");e!==this.options.disabled&&this._setOption("disabled",e),"radio"===this.type?l(this.element[0]).each(function(){t(this).is(":checked")?t(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):t(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var e=this.buttonElement.removeClass(r),i=t("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(e.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,o=[];s.primary||s.secondary?(this.options.text&&o.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&e.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&e.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(o.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||e.attr("title",t.trim(i)))):o.push("ui-button-text-only"),e.addClass(o.join(" "))}}),t.widget("ui.buttonset",{version:"1.10.2",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(t,e){"disabled"===t&&this.buttons.button("option",t,e),this._super(t,e)},refresh:function(){var e="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(e?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(e?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})}(jQuery),function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,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:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,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:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=s(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(o.inline?e.parent()[0]:o.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function n(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.extend(t.ui,{datepicker:{version:"1.10.2"}});var o,a="datepicker",r=(new Date).getTime();t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return n(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,a,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,a,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,o,r){var h,l,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],a,p)),n(p.settings,o||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=r?r.length?r:[r.pageX,r.pageY]:null,this._pos||(l=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],a,p),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,a);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,a),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,a)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,s,o){var a,r,h,l,c=this._getInst(i);return 2===arguments.length&&"string"==typeof s?"defaults"===s?t.extend({},t.datepicker._defaults):c?"all"===s?t.extend({},c.settings):this._get(c,s):null:(a=s||{},"string"==typeof s&&(a={},a[s]=o),c&&(this._curInst===c&&this._hideDatepicker(),r=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(c,"min"),l=this._getMinMaxDate(c,"max"),n(c.settings,a),null!==h&&a.dateFormat!==e&&a.minDate===e&&(c.settings.minDate=this._formatDate(c,h)),null!==l&&a.dateFormat!==e&&a.maxDate===e&&(c.settings.maxDate=this._formatDate(c,l)),"disabled"in a&&(a.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,r),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");
break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var s,n,o=t.datepicker._getInst(i.target);return t.datepicker._get(o,"constrainInput")?(s=t.datepicker._possibleChars(t.datepicker._get(o,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!s||s.indexOf(n)>-1):e},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,s,o,a,r,h,l;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),s=t.datepicker._get(i,"beforeShow"),o=s?s.apply(e,[e,i]):{},o!==!1&&(n(i.settings,o),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),a=!1,t(e).parents().each(function(){return a|="fixed"===t(this).css("position"),!a}),r={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),r=t.datepicker._checkOffset(i,r,a),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":a?"fixed":"absolute",display:"none",left:r.left+"px",top:r.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),i.input.is(":visible")&&!i.input.is(":disabled")&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,o=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,s=this._getNumberOfMonths(e),n=s[1],a=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&e.input[0]!==document.activeElement&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_getBorders:function(t){var e=function(t){return{thin:1,medium:2,thick:3}[t]||t};return[parseFloat(e(t.css("border-left-width"))),parseFloat(e(t.css("border-top-width")))]},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,r=this._curInst;!r||e&&r!==t.data(e,a)||this._datepickerShowing&&(i=this._get(r,"showAnim"),s=this._get(r,"duration"),n=function(){t.datepicker._tidyDialog(r)},t.effects&&(t.effects.effect[i]||t.effects[i])?r.dpDiv.hide(i,t.datepicker._get(r,"showOptions"),s,n):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(r,"onClose"),o&&o.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,s,n){if(null==i||null==s)throw"Invalid arguments";if(s="object"==typeof s?""+s:s+"",""===s)return null;var o,a,r,h,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,g=(n?n.monthNames:null)||this._defaults.monthNames,m=-1,v=-1,_=-1,b=-1,y=!1,w=function(t){var e=i.length>o+1&&i.charAt(o+1)===t;return e&&o++,e},k=function(t){var e=w(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{1,"+i+"}"),o=s.substring(l).match(n);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},x=function(i,n,o){var a=-1,r=t.map(w(i)?o:n,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(r,function(t,i){var n=i[1];return s.substr(l,n.length).toLowerCase()===n.toLowerCase()?(a=i[0],l+=n.length,!1):e}),-1!==a)return a+1;throw"Unknown name at position "+l},D=function(){if(s.charAt(l)!==i.charAt(o))throw"Unexpected literal at position "+l;l++};for(o=0;i.length>o;o++)if(y)"'"!==i.charAt(o)||w("'")?D():y=!1;else switch(i.charAt(o)){case"d":_=k("d");break;case"D":x("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=x("M",f,g);break;case"y":m=k("y");break;case"@":h=new Date(k("@")),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"!":h=new Date((k("!")-this._ticksTo1970)/1e4),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"'":w("'")?D():y=!0;break;default:D()}if(s.length>l&&(r=s.substr(l),!/^\s+/.test(r)))throw"Extra/unparsed characters found in date: "+r;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),b>-1)for(v=1,_=b;;){if(a=this._getDaysInMonth(m,v-1),a>=_)break;v++,_-=a}if(h=this._daylightSavingAdjust(new Date(m,v-1,_)),h.getFullYear()!==m||h.getMonth()+1!==v||h.getDate()!==_)throw"Invalid date";return h},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:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){window["DP_jQuery_"+r].datepicker._adjustDate(s,-i,"M")},next:function(){window["DP_jQuery_"+r].datepicker._adjustDate(s,+i,"M")},hide:function(){window["DP_jQuery_"+r].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+r].datepicker._gotoToday(s)},selectDay:function(){return window["DP_jQuery_"+r].datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+r].datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+r].datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,v,_,b,y,w,k,x,D,C,I,P,T,M,S,z,A,H,N,E,W,O,F,R,j=new Date,L=this._daylightSavingAdjust(new Date(j.getFullYear(),j.getMonth(),j.getDate())),Y=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),V=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),q=this._get(t,"showCurrentAtPos"),Q=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],$=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-q,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=G&&G>e?G:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-Q,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":V?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+Q,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":V?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?$:L,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.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(t,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,D=0;U[1]>D;D++){if(C=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",P="",X){if(P+="<div class='ui-datepicker-group",U[1]>1)switch(D){case 0:P+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:P+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:P+=" ui-datepicker-group-middle",I=""}P+="'>"}for(P+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,G,J,k>0||D>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",T=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,T+="<th"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(P+=T+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),z=(this._getFirstDayOfMonth(te,Z)-c+7)%7,A=Math.ceil((z+S)/7),H=X?this.maxRows>A?this.maxRows:A:A,this.maxRows=H,N=this._daylightSavingAdjust(new Date(te,Z,1-z)),E=0;H>E;E++){for(P+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(N)+"</td>":"",w=0;7>w;w++)O=m?m.apply(t.input?t.input[0]:null,[N]):[!0,""],F=N.getMonth()!==Z,R=F&&!_||!O[0]||G&&G>N||J&&N>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(N.getTime()===C.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===N.getTime()&&b.getTime()===C.getTime()?" "+this._dayOverClass:"")+(R?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!v?"":" "+O[1]+(N.getTime()===$.getTime()?" "+this._currentClass:"")+(N.getTime()===L.getTime()?" ui-datepicker-today":""))+"'"+(F&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(R?"":" data-handler='selectDay' data-event='click' data-month='"+N.getMonth()+"' data-year='"+N.getFullYear()+"'")+">"+(F&&!v?"&#xa0;":R?"<span class='ui-state-default'>"+N.getDate()+"</span>":"<a class='ui-state-default"+(N.getTime()===L.getTime()?" ui-state-highlight":"")+(N.getTime()===$.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+N.getDate()+"</a>")+"</td>",N.setDate(N.getDate()+1),N=this._daylightSavingAdjust(N);P+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),P+="</tbody></table>"+(X?"</div>"+(U[0]>0&&D===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=P}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(_||(b+=y+(!o&&m&&v?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!o&&m&&v?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.2",window["DP_jQuery_"+r]=t}(jQuery),function(t){var e={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};t.widget("ui.dialog",{version:"1.10.2",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,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(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||t(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!e&&this._trigger("focus",t),i},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=t(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var t=this.element.find("[autofocus]");t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).focus()},_keepFocus:function(e){function i(){var e=this.document[0].activeElement,i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<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(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),undefined;if(e.keyCode===t.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(n.focus(1),e.preventDefault()):(s.focus(1),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=t("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(e),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title||t.html("&#160;"),t.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(e.element[0],arguments)},o={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,t("<button></button>",s).button(o).appendTo(e.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){t(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){s.position=[o.position.left-i.document.scrollLeft(),o.position.top-i.document.scrollTop()],t(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))
}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){t(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){s.height=t(this).height(),s.width=t(this).width(),t(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(s){var n=this,o=!1,a={};t.each(s,function(t,s){n._setOption(t,s),t in e&&(o=!0),t in i&&(a[t]=s)}),o&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(t,e){var i,s,n=this.uiDialog;"dialogClass"===t&&n.removeClass(this.options.dialogClass).addClass(e),"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:""+e}),"draggable"===t&&(i=n.is(":data(ui-draggable)"),i&&!e&&n.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&(s=n.is(":data(ui-resizable)"),s&&!e&&n.resizable("destroy"),s&&"string"==typeof e&&n.resizable("option","handles",e),s||e===!1||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=this,i=this.widgetFullName;t.ui.dialog.overlayInstances||this._delay(function(){t.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(s){e._allowInteraction(s)||(s.preventDefault(),t(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=t("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),t.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(t.ui.dialog.overlayInstances--,t.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),t.ui.dialog.overlayInstances=0,t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{_position:function(){var e,i=this.options.position,s=[],n=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(s=i.split?i.split(" "):[i[0],i[1]],1===s.length&&(s[1]=s[0]),t.each(["left","top"],function(t,e){+s[t]===s[t]&&(n[t]=s[t],s[t]=e)}),i={my:s[0]+(0>n[0]?n[0]:"+"+n[0])+" "+s[1]+(0>n[1]?n[1]:"+"+n[1]),at:s.join(" ")}),i=t.extend({},t.ui.dialog.prototype.options.position,i)):i=t.ui.dialog.prototype.options.position,e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.position(i),e||this.uiDialog.hide()}})}(jQuery),function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var o,a,r,h=t(this),l=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(h,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",g=i.test(u),m={},v="show"===c;h.parent().is(".ui-effects-wrapper")?t.effects.save(h.parent(),l):t.effects.save(h,l),h.show(),o=t.effects.createWrapper(h).css({overflow:"hidden"}),a=o[p](),r=parseFloat(o.css(f))||0,m[p]=v?a:0,g||(h.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),m[f]=v?r:a+r),v&&(o.css(p,0),g||o.css(f,r+a)),o.animate(m,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&h.hide(),t.effects.restore(h,l),t.effects.removeWrapper(h),n()}})}}(jQuery),function(t){t.effects.effect.bounce=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"effect"),l="hide"===h,c="show"===h,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||l?1:0),g=e.duration/f,m=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=a.queue(),y=b.length;for((c||l)&&r.push("opacity"),t.effects.save(a,r),a.show(),t.effects.createWrapper(a),d||(d=a["top"===v?"outerHeight":"outerWidth"]()/3),c&&(o={opacity:1},o[v]=0,a.css("opacity",0).css(v,_?2*-d:2*d).animate(o,g,m)),l&&(d/=Math.pow(2,p-1)),o={},o[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m).animate(o,g,m),d=l?2*d:d/2;l&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m)),a.queue(function(){l&&a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),a.dequeue()}}(jQuery),function(t){t.effects.effect.clip=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"hide"),l="show"===h,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(a,r),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n="IMG"===a[0].tagName?s:a,o=n[d](),l&&(n.css(d,0),n.css(p,o/2)),f[d]=l?o:0,f[p]=l?0:o/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){l||a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","opacity","height","width"],a=t.effects.setMode(n,e.mode||"hide"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,o),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===c?-s:s),u[l]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),g||p.hide(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),g="show"===f,m=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*_,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*v,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*v,top:-o*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(g?l*v:0),top:h+(g?c*_:0),opacity:g?0:1}).animate({left:r+(g?0:l*v),top:h+(g?0:c*_),opacity:g?1:0},e.duration||500,e.easing,s)}}(jQuery),function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}}(jQuery),function(t){t.effects.effect.fold=function(e,i){var s,n,o=t(this),a=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(o,e.mode||"hide"),h="show"===r,l="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=h!==d,f=p?["width","height"]:["height","width"],g=e.duration/2,m={},v={};t.effects.save(o,a),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[l?0:1]),h&&s.css(d?{height:0,width:c}:{height:c,width:0}),m[f[0]]=h?n[0]:c,v[f[1]]=h?n[1]:0,s.animate(m,g,e.easing).animate(v,g,e.easing,function(){l&&o.hide(),t.effects.restore(o,a),t.effects.removeWrapper(o),i()})}}(jQuery),function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],o=t.effects.setMode(s,e.mode||"show"),a={backgroundColor:s.css("backgroundColor")};"hide"===o&&(a.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(a,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&s.hide(),t.effects.restore(s,n),i()}})}}(jQuery),function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),o=t.effects.setMode(n,e.mode||"show"),a="show"===o,r="hide"===o,h=a||"hide"===o,l=2*(e.times||5)+(h?1:0),c=e.duration/l,u=0,d=n.queue(),p=d.length;for((a||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;l>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,l+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),o="hide"===n,a=parseInt(e.percent,10)||150,r=a/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:o?a:100,from:o?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),o=t.effects.setMode(s,e.mode||"effect"),a=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===o?0:100),r=e.direction||"both",h=e.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?a/100:1,x:"vertical"!==r?a/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==o&&(n.origin=h||["middle","center"],n.restore=!0),n.from=e.from||("show"===o?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*c.y,width:l.width*c.x,outerHeight:l.outerHeight*c.y,outerWidth:l.outerWidth*c.x},n.fade&&("show"===o&&(n.from.opacity=0,n.to.opacity=1),"hide"===o&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(a,e.mode||"effect"),f=e.restore||"effect"!==p,g=e.scale||"both",m=e.origin||["middle","center"],v=a.css("position"),_=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&a.show(),s={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},"toggle"===e.mode&&"show"===p?(a.from=e.to||b,a.to=e.from||s):(a.from=e.from||("show"===p?b:s),a.to=e.to||("hide"===p?b:s)),o={from:{y:a.from.height/s.height,x:a.from.width/s.width},to:{y:a.to.height/s.height,x:a.to.width/s.width}},("box"===g||"both"===g)&&(o.from.y!==o.to.y&&(_=_.concat(u),a.from=t.effects.setTransition(a,u,o.from.y,a.from),a.to=t.effects.setTransition(a,u,o.to.y,a.to)),o.from.x!==o.to.x&&(_=_.concat(d),a.from=t.effects.setTransition(a,d,o.from.x,a.from),a.to=t.effects.setTransition(a,d,o.to.x,a.to))),("content"===g||"both"===g)&&o.from.y!==o.to.y&&(_=_.concat(c).concat(l),a.from=t.effects.setTransition(a,c,o.from.y,a.from),a.to=t.effects.setTransition(a,c,o.to.y,a.to)),t.effects.save(a,_),a.show(),t.effects.createWrapper(a),a.css("overflow","hidden").css(a.from),m&&(n=t.effects.getBaseline(m,s),a.from.top=(s.outerHeight-a.outerHeight())*n.y,a.from.left=(s.outerWidth-a.outerWidth())*n.x,a.to.top=(s.outerHeight-a.to.outerHeight)*n.y,a.to.left=(s.outerWidth-a.to.outerWidth)*n.x),a.css(a.from),("content"===g||"both"===g)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),l=r.concat(u).concat(d),a.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,l),i.from={height:s.height*o.from.y,width:s.width*o.from.x,outerHeight:s.outerHeight*o.from.y,outerWidth:s.outerWidth*o.from.x},i.to={height:s.height*o.to.y,width:s.width*o.to.x,outerHeight:s.height*o.to.y,outerWidth:s.width*o.to.x},o.from.y!==o.to.y&&(i.from=t.effects.setTransition(i,u,o.from.y,i.from),i.to=t.effects.setTransition(i,u,o.to.y,i.to)),o.from.x!==o.to.x&&(i.from=t.effects.setTransition(i,d,o.from.x,i.from),i.to=t.effects.setTransition(i,d,o.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,l)})})),a.animate(a.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===a.to.opacity&&a.css("opacity",a.from.opacity),"hide"===p&&a.hide(),t.effects.restore(a,_),f||("static"===v?a.css({position:"relative",top:a.to.top,left:a.to.left}):t.each(["top","left"],function(t,e){a.css(e,function(e,i){var s=parseInt(i,10),n=t?a.to.left:a.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","height","width"],a=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",h=e.distance||20,l=e.times||3,c=2*l+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},g={},m={},v=n.queue(),_=v.length;for(t.effects.save(n,o),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+h,g[d]=(p?"+=":"-=")+2*h,m[d]=(p?"-=":"+=")+2*h,n.animate(f,u,e.easing),s=1;l>s;s++)n.animate(g,u,e.easing).animate(m,u,e.easing);n.animate(g,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","width","height"],a=t.effects.setMode(n,e.mode||"show"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u={};t.effects.save(n,o),n.show(),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,c?isNaN(s)?"-"+s:-s:s),u[l]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}}(jQuery),function(t){t.widget("ui.menu",{version:"1.10.2",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=!1,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,t.proxy(function(t){this.options.disabled&&t.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(t){t.preventDefault()},"click .ui-state-disabled > a":function(t){t.preventDefault()},"click .ui-menu-item:has(a)":function(e){var i=t(e.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(e),i.has(".ui-menu").length?this.expand(e):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){var i=t(e.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.children(".ui-menu-item").eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){t(e.target).closest(".ui-menu").length||this.collapseAll(e),this.mouseHandled=!1}})},_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 e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,o,a,r,h=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:h=!1,n=this.previousFilter||"",o=String.fromCharCode(e.keyCode),a=!1,clearTimeout(this.filterTimer),o===n?a=!0:o=n+o,r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())}),s=a&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(o=String.fromCharCode(e.keyCode),r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())})),s.length?(this.focus(e,s),s.length>1?(this.previousFilter=o,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i=this.options.icons.submenu,s=this.element.find(this.options.menus);s.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 e=t(this),s=e.prev("a"),n=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(n),e.attr("aria-labelledby",s.attr("id"))}),e=s.add(this.element),e.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()}),e.children(":not(.ui-menu-item)").each(function(){var e=t(this);/[^\-\u2014\u2013\s]/.test(e.text())||e.addClass("ui-widget-content ui-menu-divider")}),e.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.height(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(e),undefined)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(e),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)}})}(jQuery),function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var o,a=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(o!==e)return o;var i,s,n=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=n.children()[0];return t("body").append(n),i=a.offsetWidth,n.css("overflow","scroll"),s=a.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),o=i-s},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]);return{element:i,isWindow:s,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var o,p,g,m,v,_,b=t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),k=(e.collision||"flip").split(" "),x={};return _=n(b),b[0].preventDefault&&(e.at="left top"),p=_.width,g=_.height,m=_.offset,v=t.extend({},m),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),x[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=g:"center"===e.at[1]&&(v.top+=g/2),o=i(x.at,p,g),v.left+=o[0],v.top+=o[1],this.each(function(){var n,l,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),_=s(this,"marginTop"),D=u+f+s(this,"marginRight")+w.width,C=d+_+s(this,"marginBottom")+w.height,I=t.extend({},v),P=i(x.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?I.left-=u:"center"===e.my[0]&&(I.left-=u/2),"bottom"===e.my[1]?I.top-=d:"center"===e.my[1]&&(I.top-=d/2),I.left+=P[0],I.top+=P[1],t.support.offsetFractions||(I.left=h(I.left),I.top=h(I.top)),n={marginLeft:f,marginTop:_},t.each(["left","top"],function(i,s){t.ui.position[k[i]]&&t.ui.position[k[i]][s](I,{targetWidth:p,targetHeight:g,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:D,collisionHeight:C,offset:[o[0]+P[0],o[1]+P[1]],my:e.my,at:e.at,within:y,elem:c})}),e.using&&(l=function(t){var i=m.left-I.left,s=i+p-u,n=m.top-I.top,o=n+g-d,h={target:{element:b,left:m.left,top:m.top,width:p,height:g},element:{element:c,left:I.left,top:I.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>o?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>g&&g>r(n+o)&&(h.vertical="middle"),h.important=a(r(i),r(s))>a(r(n),r(o))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(I,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,o=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-o-n;e.collisionWidth>o?h>0&&0>=l?(i=t.left+h+e.collisionWidth-o-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+o-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=a(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,o=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-o-n;e.collisionHeight>o?h>0&&0>=l?(i=t.top+h+e.collisionHeight-o-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+o-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=a(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,a=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-a-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-a-o,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-a-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-a-o,t.top+p+f+g>c&&(0>s||r(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,t.top+p+f+g>u&&(i>0||u>r(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,o,a=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(a?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},a&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)e.style[o]=s[o];e.appendChild(r),i=a||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()}(jQuery),function(t,e){t.widget("ui.progressbar",{version:"1.10.2",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=t("<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(t){return t===e?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),e)},_constrainedValue:function(t){return t===e&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})}(jQuery),function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,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=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):this.range=t([])},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),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(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,o.addClass("ui-state-active").focus(),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,o;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,o=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),o!==!1&&this.values(e,i,!0))):i!==this.value()&&(o=this._trigger("slide",t,{handle:this.handles[e],value:i}),o!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){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=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,o,a,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(a=this.options.step,n=o=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:o=this._valueMin();break;case t.ui.keyCode.END:o=this._valueMax();break;case t.ui.keyCode.PAGE_UP:o=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:o=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;o=this._trimAlignValue(n+a);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;o=this._trimAlignValue(n-a)}this._slide(i,r,o)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})}(jQuery),function(t){function e(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.widget("ui.spinner",{version:"1.10.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,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),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e={},i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);void 0!==n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var t=this.element[0]===this.document[0].activeElement;t||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var t=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=t.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*t.height())&&t.height()>0&&t.height(t.height()),this.options.disabled&&this.disable()},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_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(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){if("culture"===t||"numberFormat"===t){var i=this._parse(this.element.val());return this.options[t]=e,this.element.val(this._format(i)),void 0}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(e.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(e.down)),this._super(t,e),"disabled"===t&&(e?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:e(function(t){this._super(t),this._value(this.element.val())}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:e(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:e(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:e(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:e(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(e(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(t,e){function i(){return++n}function s(t){return t.hash.length>1&&decodeURIComponent(t.href.replace(o,""))===decodeURIComponent(location.href.replace(o,""))}var n=0,o=/#.*$/;t.widget("ui.tabs",{version:"1.10.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var e=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,s=this.options.collapsible,n=location.hash.substring(1);return null===i&&(n&&this.tabs.each(function(s,o){return t(o).attr("aria-controls")===n?(i=s,!1):e}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=s?!1:0)),!s&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(i){var s=t(this.document[0].activeElement).closest("li"),n=this.tabs.index(s),o=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:n++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:o=!1,n--;break;case t.ui.keyCode.END:n=this.anchors.length-1;break;case t.ui.keyCode.HOME:n=0;break;case t.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(n),e;case t.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(n===this.options.active?!1:n),e;default:return}i.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,o),i.ctrlKey||(s.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):e},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).focus(),t},_setOption:function(t,i){return"active"===t?(this._activate(i),e):"disabled"===t?(this._setupDisabled(i),e):(this._super(t,i),"collapsible"===t&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(i),"heightStyle"===t&&this._setupHeightStyle(i),e)},_tabId:function(t){return t.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),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"}),this.active.length?(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"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=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 t("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=t(),this.anchors.each(function(i,n){var o,a,r,h=t(n).uniqueId().attr("id"),l=t(n).closest("li"),c=l.attr("aria-controls");s(n)?(o=n.hash,a=e.element.find(e._sanitizeSelector(o))):(r=e._tabId(l),o="#"+r,a=e.element.find(o),a.length||(a=e._createPanel(r),a.insertAfter(e.panels[i-1]||e.tablist)),a.attr("aria-live","polite")),a.length&&(e.panels=e.panels.add(a)),c&&l.data("ui-tabs-aria-controls",c),l.attr({"aria-controls":o.substring(1),"aria-labelledby":h}),a.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(e){t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1);for(var i,s=0;i=this.tabs[s];s++)e===!0||-1!==t.inArray(s,e)?t(i).addClass("ui-state-disabled").attr("aria-disabled","true"):t(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=e},_setupEvents:function(e){var i={click:function(t){t.preventDefault()}};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+t+"']"))),t},_destroy:function(){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(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(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 e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var s=this.options.disabled;s!==!1&&(i===e?s=!1:(i=this._getIndex(i),s=t.isArray(s)?t.map(s,function(t){return t!==i?t:null}):t.map(this.tabs,function(t,e){return e!==i?e:null})),this._setupDisabled(s))},disable:function(i){var s=this.options.disabled;if(s!==!0){if(i===e)s=!0;else{if(i=this._getIndex(i),-1!==t.inArray(i,s))return;s=t.isArray(s)?t.merge([i],s).sort():[i]}this._setupDisabled(s)}},load:function(e,i){e=this._getIndex(e);var n=this,o=this.tabs.eq(e),a=o.find(".ui-tabs-anchor"),r=this._getPanelForTab(o),h={tab:o,panel:r};s(a[0])||(this.xhr=t.ajax(this._ajaxSettings(a,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(o.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(t){setTimeout(function(){r.html(t),n._trigger("load",i,h)},1)}).complete(function(t,e){setTimeout(function(){"abort"===e&&n.panels.stop(!1,!0),o.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),t===n.xhr&&delete n.xhr},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href"),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}(jQuery),function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.2",options:{content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=o),this._open(e,t,i)
})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function o(t){l.of=t,a.is(":hidden")||a.position(l)}var a,r,h,l=t.extend({},this.options.position);if(n){if(a=this._find(s),a.length)return a.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),a=this._tooltip(s),e(s,a.attr("id")),a.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:o}),o(i)):a.position(t.extend({of:s},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){a.is(":visible")&&(o(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:a}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(a)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),o.stop(!0),this._hide(o,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:o}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})}(jQuery);
(function($, window, undefined) {
	"use strict";
	 
	var matched, browser;
	 
	$.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"
		};
	};
	 
	matched = $.uaMatch(window.navigator.userAgent);
	browser = {};
	 
	if(matched.browser) {
		browser[ matched.browser ] = true;
		browser.version = matched.version;
	}
	 
	// Chrome is Webkit, but Webkit is also Safari.
	if(browser.chrome) {
		browser.webkit = true;
	} else if ( browser.webkit ) {
		browser.safari = true;
	}
	 
	$.browser = browser;
})($, window);
/* SNOW EFFECT */
$.fn.snow = function(numFlakes) {
  var no = numFlakes || 20;
  var hidesnowtime = 0;
  var snowdistance = $(this).outerHeight()+50;
 
  var dx, xp, yp, am, stx, sty; 
  var doc_width = $("body").width();
  var doc_height = $("body").height();
 
  dx = [];
  xp = [];
  yp = [];
  am = [];
  stx = [];
  sty = [];
  for(var i = 0; i < no; ++ i) {  
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
    $(this).append("<div id=\"dot"+i+"\" class=\"snowflake\"><\/div>");
  }
 
  (function letItSnow() {  // IE and NS6 main animation function
    for(var i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if(yp[i] > snowdistance-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = -50;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      $("#dot"+i).css({'top':yp[i]+"px", 'left':(xp[i] + am[i]*Math.sin(dx[i]))+"px"});
    }
    snowtimer = setTimeout(function() { letItSnow(); }, 10);
  })();

  return this;
};

/* BOUNCE animation */
$.throttle = jq_throttle = function(delay, no_trailing, callback, debounce_mode) {
  var timeout_id, last_exec = 0;
  
  if(typeof no_trailing !== "boolean") {
    debounce_mode = callback;
    callback = no_trailing;
    no_trailing = undefined;
  }

  function wrapper() {
    var that = this,
      elapsed = +new Date() - last_exec,
      args = arguments;
    
    function exec() {
      last_exec = +new Date();
      callback.apply( that, args );
    };
    function clear() {
      timeout_id = undefined;
    };
    
    if(debounce_mode && !timeout_id ) exec();
    timeout_id && clearTimeout( timeout_id );
    
    if(debounce_mode === undefined && elapsed > delay) exec();
    else if(no_trailing !== true) timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );    
  };
  if($.guid)  wrapper.guid = callback.guid = callback.guid || $.guid++;

  return wrapper;
};
$.debounce = function(delay, at_begin, callback) {
  return callback === undefined ? jq_throttle( delay, at_begin, false ) : jq_throttle( delay, callback, at_begin !== false );
};

/* EASING animation */
// t: current time, b: begInnIng value, c: change In value, d: duration
$.easing["jswing"] = $.easing["swing"];
$.extend($.easing, {
  def: "easeOutQuad",
  swing: function (x, t, b, c, d) { return $.easing[$.easing.def](x, t, b, c, d); },
  easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; },
  easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; },
  easeInOutQuad: function (x, t, b, c, d) { 
    if ((t/=d/2) < 1) return c/2*t*t + b;
    return -c/2 * ((--t)*(t-2) - 1) + b;
  },
  easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; },
  easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; },
  easeInOutCubic: function (x, t, b, c, d) { 
    if ((t/=d/2) < 1) return c/2*t*t*t + b;
    return c/2*((t-=2)*t*t + 2) + b;
  },
  easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; },
  easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; },
  easeInOutQuart: function (x, t, b, c, d) { 
    if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
    return -c/2 * ((t-=2)*t*t*t - 2) + b;
  },
  easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; },
  easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; },
  easeInOutQuint: function (x, t, b, c, d) { 
    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
  },
  easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; },
  easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; },
  easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; },
  easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; },
  easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; },
  easeInOutExpo: function (x, t, b, c, d) {
    if (t==0) return b;
    if (t==d) return b+c;
    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
    return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  },
  easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; },
  easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; },
  easeInOutCirc: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
    return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  },
  easeInElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  },
  easeOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  },
  easeInOutElastic: function (x, t, b, c, d) {
    var s=1.70158;var p=0;var a=c;
    if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
    if (a < Math.abs(c)) { a=c; var s=p/4; }
    else var s = p/(2*Math.PI) * Math.asin (c/a);
    if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  },
  easeInBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158;
    return c*(t/=d)*t*((s+1)*t - s) + b;
  },
  easeOutBack: function (x, t, b, c, d, s) {
    //if (s == undefined) s = 1.70158;
    if (s == undefined) s = 1;
    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  },
  easeInOutBack: function (x, t, b, c, d, s) {
    if (s == undefined) s = 1.70158; 
    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  },
  easeInBounce: function (x, t, b, c, d) { return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; },
  easeOutBounce: function (x, t, b, c, d) {
    if ((t/=d) < (1/2.75)) return c*(7.5625*t*t) + b;
    else if (t < (2/2.75)) return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
    else if (t < (2.5/2.75)) return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
    else return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  },
  easeInOutBounce: function (x, t, b, c, d) {
    if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
    return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  }
});
var browsercontroller = {};
browsercontroller.notify = function (warning) {
    shadowboxcontroller.shadow({
        SBXclass: "SBXmultimedia SBXmultimediaPopup",
        player: "html",
        content: "<div class='shadowInlinePie browserAdvice' style=\"margin-top:-20px;\">" + warning + "<ul><li><a class='browser chrome' href='https://www.google.com/chrome?hl=en' target='_blank'>Chrome</a></li><li><a class='browser firefox' href='http://www.mozilla.org/en-US/firefox/fx/#desktop' target='_blank'>Firefox</a></li><li><a class='browser ie' href='http://www.windows.microsoft.com/en-US/internet-explorer/download-ie' target='_blank'>Internet Explorer</a></li><li><a class='browser opera' href='http://www.opera.com/browser/' target='_blank'>Opera</a></li><li><a class='browser safari' href='http://www.apple.com/safari/' target='_blank'>Safari</a></li></ul></p></div>",
        modal: false,
        width: 610,
        height: 240
    });
};
var cookiecontroller = { };
cookiecontroller.notify = function(warning) {
  $("body").append("<div class=\"cookie-container\" id=\"cookieInfo\" style=\"display: none;\"><div>"+warning+"</div></div>");

  setTimeout(function() { $("#cookieInfo").fadeIn(); }, 100);
  this.cookieT = setTimeout(function() { cookiecontroller.removeNotification(); }, 7500);
};
cookiecontroller.removeNotification = function() {
  $("#cookieInfo").fadeOut("400", function() { 
    $("#cookieInfo").remove(); 
  });
};
/* Steven; warning, applying .selectivizr() will remove all slvzr classes on decendants, might have unwanted styling results */
//enable prototype property
$.fn.selectivizr = function() {
  var cc = compensatorcontroller;
  if(cc.isOldBrowser()) {
    //fix css for IE8 and below
    var objNode = this[0];
    var doCompensation = true;
    //is new in queue
    if($.inArray(objNode, cc.queue) > -1) doCompensation = false;
    //ancestor is already in queue
    $.each(cc.queue, function() {
      if($(objNode).closest(this).length > 0) doCompensation = false;
    });
    if(doCompensation) {
      cc.queue.push(objNode);
      //wait 5 ms, then execute compensation
      setTimeout(function() {
        //remove current slctvzr classes
        $(objNode).find("[class*=slvzr]").each( function() {
          $el = $(this);
          var classes = $el.attr("class").split(" ");
          $.each(classes, function(index, value) { if(value.indexOf("slvzr") > -1) classes[index] = ""; });
          $el.attr("class", classes.join(" "));
        });
        //do compensation
        cc.compensate(objNode);
        cc.queue.splice($.inArray(objNode, cc.queue), 1);
      }, 5);
    }
    return this;
  }
};

var compensatorcontroller = {
  selectivizrCssCache : [],
  queue : []
};
compensatorcontroller.init = function () {
  var that = this;
  //init selectivizr
  this.compensate(); 
}
compensatorcontroller.isOldBrowser = function() {
  if(this.oldBrowser == undefined) {
    if($.browser.msie) parseInt($.browser.version) <= 8 ? this.oldBrowser = true : this.oldBrowser = false;
    else this.oldBrowser = false;
  }
  return this.oldBrowser;
}

/*!
 * selectivizr v1.0.2 - (c) Keith Clark, freely distributable under the terms of the MIT license.
 * selectivizr.com
 * nov 12th 2012, customized by Steven Waltman
 */ 
compensatorcontroller.compensate = function(objNode) {
  var that = this;
  var objNode = objNode || false;
  var j = window;

  function A(a) {
    return a.replace(B, h).replace(C, function (a, d, b) {
      for (var a = b.split(","), b = 0, e = a.length; b < e; b++) {
        var s = D(a[b].replace(E, h).replace(F, h)) + o,
        l = [];
        a[b] = s.replace(G, function (a, b, c, d, e) {
          if (b) {
            if (l.length > 0) {
              var a = l,
                f, e = s.substring(0, e).replace(H, i);
              if (e == i || e.charAt(e.length - 1) == o) e += "*";
              try {
                objNode != false ? f = $(e, objNode) : f = t(e);
              } catch (k) {}
              if (f) {
                e = 0;
                for (c = f.length; e < c; e++) {
                  for (var d = f[e], h = d.className, j = 0, m = a.length; j < m; j++) {
                    var g = a[j];
                    if (!RegExp("(^|\\s)" + g.className + "(\\s|$)").test(d.className) && g.b && (g.b === !0 || g.b(d) === !0)) {
                      h = u(h, g.className, !0);
                    }
                  }
                  d.className = h
                }
              }
              l = []
            }
            return b
          } else {
            if (b = c ? I(c) : !v || v.test(d) ? {
              className: w(d),
              b: !0
            } : null) 
              return l.push(b), "." + b.className; 
            return a
          }
        })
      }
      return d + a.join(",")
    });
  }
  function I(a) {
    var c = !0,
      d = w(a.slice(1)),
      b = a.substring(0, 5) == ":not(",
      e, f;
    b && (a = a.slice(5, -1));
    var l = a.indexOf("(");
    l > -1 && (a = a.substring(0, l));
    if (a.charAt(0) == ":") switch (a.slice(1)) {
      case "root":
        c = function (a) {
          return b ? a != p : a == p
        };
        break;
      case "target":
        if (m == 8) {
          c = function (a) {
            function c() {
              var d = location.hash,
                e = d.slice(1);
              return b ? d == i || a.id != e : d != i && a.id == e
            }
            k(j, "hashchange", function () {
              g(a, d, c())
            });
            return c()
          };
          break
        }
        return !1;
      case "checked":
        c = function (a) {
          J.test(a.type) && k(a, "propertychange", function () {
            event.propertyName == "checked" && g(a, d, a.checked !== b)
          });
          return a.checked !== b
        };
        break;
      case "disabled":
        b = !b;
      case "enabled":
        c = function (c) {
          if (K.test(c.tagName)) return k(c, "propertychange", function () {
            event.propertyName == "$disabled" && g(c, d, c.a === b)
          }), q.push(c), c.a = c.disabled, c.disabled === b;
          return a == ":enabled" ? b : !b
        };
        break;
      case "focus":
        e = "focus", f = "blur";
      case "hover":
        e || (e = "mouseenter", f = "mouseleave");
        c = function (a) {
          k(a, b ? f : e, function () {
            g(a, d, !0)
          });
          k(a, b ? e : f, function () {
            g(a, d, !1)
          });
          return b
        };
        break;
      default:
        if (!L.test(a)) return !1
    }
    return {
      className: d,
      b: c
    }
  }
  function w(a) {
    return M + "-" + (m == 6 && N ? O++ : a.replace(P, function (a) {
      return a.charCodeAt(0)
    }))
  }
  function D(a) {
    return a.replace(x, h).replace(Q, o)
  }
  function g(a, c, d) {
    var b = a.className,
      c = u(b, c, d);
    if (c != b) a.className = c, a.parentNode.className += i
  }
  function u(a, c, d) {
    var b = RegExp("(^|\\s)" + c + "(\\s|$)"),
      e = b.test(a);
    return d ? e ? a : a + o + c : e ? a.replace(b, h).replace(x, h) : a
  }
  function k(a, c, d) {
    a.attachEvent("on" + c, d)
  }
  function r(a, c) {
    if (/^https?:\/\//i.test(a)) return c.substring(0, c.indexOf("/", 8)) == a.substring(0, a.indexOf("/", 8)) ? a : null;
    if (a.charAt(0) == "/") return c.substring(0, c.indexOf("/", 8)) + a;
    var d = c.split(/[?#]/)[0];
    a.charAt(0) != "?" && d.charAt(d.length - 1) != "/" && (d = d.substring(0, d.lastIndexOf("/") + 1));
    return d + a
  }
  function y(a) {
    if (a) return n.open("GET", a, !1), n.send(), (n.status == 200 ? n.responseText : i).replace(R, i).replace(S, function (c, d, b, e, f) {
      return y(r(b || f, a))
    }).replace(T, function (c, d, b) {
      d = d || i;
      return " url(" + d + r(b, a) + d + ") "
    });
    return i
  }
  function U() {
    var a;
    var cssTxt;
    var c = {};
    a = f.getElementsByTagName("BASE");
    for (var d = a.length > 0 ? a[0].href : f.location.href, b = 0; b < f.styleSheets.length; b++) {
    	if (c = f.styleSheets[b], c.href != i && (a = r(c.href, d)) && c.media != "print") {
    		that.selectivizrCssCache[c.href] != undefined ? cssTxt += that.selectivizrCssCache[c.href] : cssTxt += that.selectivizrCssCache[c.href] = y(a);
      }
    }
    c.cssText = A(cssTxt);

    q.length > 0 && setInterval(function () {
      for (var a = 0, c = q.length; a < c; a++) {
        var b = q[a];
        if (b.disabled !== b.a) b.disabled ? (b.disabled = !1, b.a = !0, b.disabled = !0) : b.a = b.disabled
      }
    }, 250)
  }

  if (! /*@cc_on!@*/ true) {
    var f = document,
      p = f.documentElement,
      n = function () {
        if (j.XMLHttpRequest) return new XMLHttpRequest;
        try {
          return new ActiveXObject("Microsoft.XMLHTTP")
        } catch (a) {
          return null
        }
      }(),
      m = /MSIE (\d+)/.exec(navigator.userAgent)[1];
    if (!(f.compatMode != "CSS1Compat" || m < 6 || m > 8 || !n)) {
      var z = {
        NW: "*.Dom.select",
        MooTools: "$$",
        DOMAssistant: "*.$",
        Prototype: "$$",
        YAHOO: "*.util.Selector.query",
        Sizzle: "*",
        jQuery: "*",
        dojo: "*.query"
      }, t, q = [],
        O = 0,
        N = !0,
        M = "slvzr",
        R = /(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*/g,
        S = /@import\s*(?:(?:(?:url\(\s*(['"]?)(.*)\1)\s*\))|(?:(['"])(.*)\3))[^;]*;/g,
        T = /\burl\(\s*(["']?)(?!data:)([^"')]+)\1\s*\)/g,
        L = /^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/,
        B = /:(:first-(?:line|letter))/g,
        C = /(^|})\s*([^\{]*?[\[:][^{]+)/g,
        G = /([ +~>])|(:[a-z-]+(?:\(.*?\)+)?)|(\[.*?\])/g,
        H = /(:not\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\)?/g,
        P = /[^\w-]/g,
        K = /^(INPUT|SELECT|TEXTAREA|BUTTON)$/,
        J = /^(checkbox|radio)$/,
        v = m > 6 ? /[\$\^*]=(['"])\1/ : null,
        E = /([(\[+~])\s+/g,
        F = /\s+([)\]+~])/g,
        Q = /\s+/g,
        x = /^\s*((?:[\S\s]*\S)?)\s*$/,
        i = "",
        o = " ",
        h = "$1";
      (function (a, c) {
        function d() {
          try {
            p.doScroll("left")
          } catch (a) {
            setTimeout(d, 50);
            return
          }
          b("poll")
        }
        function b(d) {
          if (!(d.type == "readystatechange" && f.readyState != "complete") && ((d.type == "load" ? a : f).detachEvent("on" + d.type, b, !1), !e && (e = !0))) c.call(a, d.type || d)
        }
        var e = !1,
          g = !0;
        if (f.readyState == "complete") c.call(a, i);
        else {
          if (f.createEventObject && p.doScroll) {
            try {
              g = !a.frameElement
            } catch (h) {}
            g && d()
          }
          k(f, "readystatechange", b);
          k(a, "load", b)
        }
      })(j, function () {
        for (var a in z) {
          var c, d, b = j;
          if (j[a]) {
            for (c = z[a].replace("*", a).split(".");
            (d = c.shift()) && (b = b[d]););
            if (typeof b == "function") {
              t = b;
              U();
              break
            }
          }
        }
      })
    }
  }
}

var errorcontroller = {};
errorcontroller.init = function() {
	if(!window.console) {
	  window.console = {};
	 	window.console.log = function(){};
	}
};

var analyticscontroller = { };
analyticscontroller.trackEvent = function(category, action, label) {
  /* google analytics */
 	if(window._gaq) _gaq.push(["_trackEvent", category, action, label]);
};
var elementcontroller = {};
elementcontroller.init = function() {
};

elementcontroller.editContent = function(ID, type, details) {
	details = details || {};
	width = details.width || null;
	height = details.height || null;

	shadowboxcontroller.shadow({
		player: "iframe",
		content: "/"+globalref+"do/?incA=editor&incB=editor&editor=element&action=edit&ID="+ID+"&type="+type, 
		modal: true,
		width: width,
		height: height
	});
};
var feedbackcontroller = { };
feedbackcontroller.notify = function(details) {
	var message = details.message || "";
	var feedbackType = details.type || "";
  var duration = false;
	if(details.duration == undefined) duration = 7500;
	else duration = details.duration || false;
  var $container = details.container || $("body");
  if($container.length == 0) $container = $("body");

  if($("#feedbackInfo").length > 0) $("#feedbackInfo").remove(); 

  $container.append("<div class=\"feedback-container "+feedbackType+"\" id=\"feedbackInfo\" style=\"display: none;\"><div>"+message+"</div></div>");

  if(this.feedbackT) clearTimeout(this.feedbackT);
  this.feedbackT = setTimeout(function() { 
    $("#feedbackInfo").fadeIn(); 
    windowcontroller.window.trigger("resize");
  }, 100);
 	if(duration) this.feedbackT = setTimeout(function() { feedbackcontroller.removeNotification(); }, duration);
};

feedbackcontroller.removeNotification = function() {
  $("#feedbackInfo").fadeOut("400", function() { 
    $("#feedbackInfo").remove(); 
    windowcontroller.window.trigger("resize");
  });
};

//enable prototype property
$.fn.typing = function(func) {
  var T = undefined, S = 0, D = 500;
  $(this).bind("keypress", onKeyPress).bind("focusout", onTimeOut);
  function onKeyPress() {
    clearTimeout(T);
    if (S == 0) { S = new Date().getTime(); D = 500; T = setTimeout(onTimeOut, 500); return; }
    var t = new Date().getTime();
    D = (D + (t - S)) / 2; S = t; T = setTimeout(onTimeOut, D * 2);
  }

  function onTimeOut() {
    func.apply( $("input:focus") ); S = 0;
  }
	return this;
};

//enable prototype property
$.fn.monitor = function(func) {
  var T = undefined, S = 0, D = 500;
  $(this).bind("focus", onFocus).bind("focusout", onTimeOut).bind("blur", onBlur);
  function onFocus() {
    if (S == 0) { S = new Date().getTime(); D = 500; T = setInterval(onTimeOut, 500); return; }
    var t = new Date().getTime();
    D = (D + (t - S)) / 2; S = t; T = setInterval(onTimeOut, D * 2);
  }
  function onBlur() {
    clearInterval(T);
  } 
  function onTimeOut() {
    func.apply( $("input:focus") ); S = 0;
  }
	return this;
};


var formcontroller = { };
// TAGS invoegen als jQuery obj
formcontroller.init = function(details) {
	this.containerElem 		= details.containerElem || $("form"); //MOET FORM element zijn
	this.submitElem				= details.submitElem || this.containerElem.find("[type=submit]"); 
	this.objArray					= []; 

	this.firsttime 				= details.firsttime || true; 	//nieuw form (als in, niet eerder benaderd)
	this.callback 				= details.callback || false; 	//return na form (na bv submit)
	this.backstep					= details.backstep || false;	//als je terug wil naar een vorige stap (zonder submit button)
	this.valid 						= false; //is form valid

	this.build();
	this.bind();
};

formcontroller.build = function() {
	that = this;
	this.setSubmit();

	//voeg alle form objecten toe
	this.containerElem.find(":input").each( function() {
		$this = $(this);
		inpType = $this.attr("type");

		if(inpType == "submit") { }
		else {
			var formElem = new formObj({
				inputElems 			: $this,
				formcontroller 	: that
			});	
			//containerElem		: ""
			that.objArray.push(formElem);
		}
	}); 

	//gender selection trigger (slordig)
	this.containerElem.find("input[type=radio][checked=checked]").each( function() { $(this).trigger("click"); });
};

formcontroller.bind = function() {
	var that = this;

	// submitten
	this.containerElem
 		.submit( function() { return that.onSubmit() });
};

formcontroller.setSubmit = function() {
	if(this.valid) this.submitElem.removeClass("noSubmit disabled");
	else this.submitElem.addClass("noSubmit disabled");
};

formcontroller.onSubmit = function() {
	this.firsttime = false;	
	this.callback = true; //alles is 'gedaan'
	allowSubmit = false;

	if(this.backstep) { allowSubmit = true; } //met 'vorige' stap altijd informatie submitten
	else { 
		this.validate();	
		allowSubmit = this.valid;
	}
	//remove default values (als er gesubmit mag worden)
	if(allowSubmit) { 
		for(var i = 0; i < this.objArray.length; i++)  {
			obj = this.objArray[i];
			obj.unsetDefault(); 
		} 
	}
	return allowSubmit;
};

formcontroller.isValid = function() {
	//is valid
	valid = true;
	for(var i = 0; i < this.objArray.length; i++)  {
		obj = this.objArray[i];
		if(!obj.isValid()) valid = false;
	}

	this.valid = valid;
	return this.valid;
};

formcontroller.validate = function() {
	//validate all
	valid = true;
	for(var i = 0; i < this.objArray.length; i++)  {
		obj = this.objArray[i];
		obj.validate(); 
		if(!obj.isValid) valid = false;
	}

	this.valid = valid;
};

formcontroller.addCustomRule = function(rule) {
	if(!this.customRules) this.customRules = [];
	this.customRules.push(rule);
};

/* ------------------------------------------------------- */

/* ------------------------------------------------------- */

// TAGS invoegen als jQuery obj
function formObj(details) {
	this.inputElem 			= details.inputElems; //INPUT elements (kan array zijn, bv radios)
	this.inputType 			= "";
	if(this.inputElem.is("input")) this.inputType = this.inputElem.attr("type");
	else if(this.inputElem.is("select")) this.inputType = "select";
	else if(this.inputElem.is("textarea")) this.inputType = "textarea";

	this.formcontroller = details.formcontroller; //form controller
	this.containerElem	= details.containerElem || this.inputElem.closest("[data-inputcontainer]"); //lement dat OM de input(groep) heen zit (oa voor error markering)
	this.labelElem			= this.containerElem.children("span");

	this.valid 					= false; //is obj valid
	this.hadFocus 			= false; //is er een focus geweest op dit object

	this.errors 				= []; //error messages

	//this.userVal			= this.inputElem.val() || ""; //ingevoerd door user
	this.givenVal		 		= this.inputElem[0].getAttribute("value") || ""; //waarde die als voorbeeld getoont wordt
	this.defaultVal 		= this.inputElem.attr("data-defval") || ""; //waarde die als voorbeeld getoont wordt
	this.errorVal 			= this.inputElem.attr("data-errorval") || ""; //door server niet geaccepteerde value
	this.errorMessage		= "";
	this.validationRule	= this.inputElem.attr("data-validation") || "";
	//object dat wel/niet getoond moet worden eraan binden 
	this.trigger 				= this.inputElem.attr("data-extratrigger") || "";

	//time to build it!
	this.build(); //visueel
	this.bind(); //functional

	this.validate(); 
}

/* DATA FILL */
formObj.prototype.build = function() {
	inpEl = this.inputElem;
	//prefilled value on alternative elems, as SELECT, CHECKBOX, RADIO
	if(this.givenVal && this.inputType == "select") this.inputElem.val(this.givenVal);
	//default value
	if(this.defaultVal) {
		if(this.isDefault() || this.inputElem.val().length == 0) this.setDefault(); //invoegen default value in textfield, plus css update
		else { this.unsetDefault(); }
	}
	//error value
	if(this.errorVal) if(this.isErrorValue()) { 
		this.setError(); //css wijziging error
		this.valid = false;
		this.formcontroller.firsttime = false; //als er een error in het form staat, is het niet een nieuw formulier

		var errorType = "server";
		var errorMessage = "not accepted";
		this.setMark({ errorType: errorType, errorMessage: errorMessage });
	};

	//if has formatting rules
	if(inpEl.data("format")) {
		inpEl.setMask({ mask: inpEl.attr("data-format") });
	}
};

/* FUNCTION BINDING */
formObj.prototype.bind = function() {
	var that = this;
	inpEl = this.inputElem;
	inpType = this.inputType;

	switch(inpType) {
		case "radio":
		case "checkbox":
		case "select":
		 	inpEl
		 		.click( function() { that.validate(); })
		 		.change( function() { that.validate(); })
		 		.bind("update", function(event, valid) { that.valid = valid; });
		  break;
		case "textarea":
		case "text":
		case "password":
			if(inpEl.data("maxlength")) {
				containerEl = this.containerElem;
				if(containerEl.children(".charsRemaining").length == 0) containerEl.append("<div class=\"charsRemaining\"></div>");
				inpEl.keyup(function() { that.checkLength(); });
			}
		 	inpEl
		 		.focus( function() { that.unsetDefault(); })
		 		.blur( function() { that.recheckDefault(); that.hadFocus = true; that.formcontroller.firsttime = false; that.validate(); })
		 		.mouseup( function() { that.validate(); })
		 		.change( function() { that.validate(); })
		 		.monitor( function() { that.validate(); })
		 		.typing( function() { that.validate(); });
		  break;
		default:
			break;
	}
};

formObj.prototype.isActive			= function() { return(this.inputElem.is(":visible") && this.inputElem.attr("disabled") != "disabled"); };
formObj.prototype.isEmpty				= function() { return(this.isDefault() || this.inputElem.val() == ""); };
formObj.prototype.isMandatory		= function() { return(this.validationRule.indexOf("req") >= 0); };
formObj.prototype.isValid				= function() { return this.valid; };

formObj.prototype.isDefault 		= function() { return(this.inputElem.val() == this.defaultVal); };
formObj.prototype.recheckDefault= function() { if(this.isEmpty()) this.setDefault(); else this.unsetDefault(); };
formObj.prototype.setDefault 		= function() { if(this.isEmpty()) this.inputElem.val(this.defaultVal).addClass("defaultValue"); };
formObj.prototype.unsetDefault 	= function() { if(this.isDefault()) { this.inputElem.val(""); } this.inputElem.removeClass("defaultValue"); };

formObj.prototype.isErrorValue 	= function() { if(this.inputElem.val().length > 0) { return(this.inputElem.val() == this.errorVal); } else { return false; } } //is het een error van de server?
formObj.prototype.isError 			= function() { return(this.valid()); }; //is het invalid
formObj.prototype.setError 			= function() { this.inputElem.mark(); };
formObj.prototype.unsetError 		= function() { this.inputElem.unmark(); };

/* ERROR MARKING */
formObj.prototype.setMark = function(details) { 
	//toon errors als het form niet nieuw is of als het een callback is
	if(this.formcontroller.callback || !this.formcontroller.firsttime) {
		errorType = details.errorType || "client";	
		this.errors[details.errorType] = details.errorMessage;

		this.containerElem.addClass("hasError");
		this.setMessage(details);
		this.showMessage(details);
	}
};
formObj.prototype.unsetMark = function() { 
	this.containerElem.removeClass("hasError")
	this.hideMessage();
};

/* ERROR MESSAGES */
//place error in HTML
formObj.prototype.setMessage = function(details) {
	containerEl = this.containerElem;
	errorType = details.errorType || "client";	

	//bestaat er al een error container
	if(containerEl.children(".errorTip").length == 0) {
		$("<span class=\"errorTip\" data-tooltip=\"\"></span>").insertAfter(this.inputElem); // !nu verwacht het form een .h2 om het erachter te zetten. data-type van maken
	}
	
	//activeer tooltip functie op dit object
	containerEl.tooltips(); 
};
//display error
formObj.prototype.showMessage = function(details) {
	containerEl = this.containerElem;
	errorType = details.errorType || "client";	
	errorMessage = this.errors[errorType];	
	
	containerEl.find(".errorTip").show().attr("data-tooltip", errorMessage);
};
//hide error
formObj.prototype.hideMessage = function() { 
	containerEl = this.containerElem;
	containerEl.find(".errorTip").hide();
};

/* max length */
formObj.prototype.checkLength = function() {
	inpEl = this.inputElem;
	containerEl = this.containerElem;
	var max = parseInt(inpEl.data("maxlength"));
	if(inpEl.val().length > max){
		inpEl.val(inpEl.val().substr(0, max));
	}
	containerEl.children(".charsRemaining").text((max-inpEl.val().length));
};

/* toon / verberg gerelateerde 'trigger' element(en) */
formObj.prototype.triggerElements = function() {
  inpEl = this.inputElem;
  containerEl = this.formcontroller.containerElem;
	inpType = this.inputType;

  //elk gerelateerde element
  containerEl.find("[data-extratriggerref="+this.trigger+"]").each( function() {
    var $this = $(this);
    $this.hide();
    //nu alleen een trigger op 'radio' elementen
    if(inpType == "radio" || inpType == "checkbox") {
      if($("input[name="+inpEl.attr("name")+"]:checked")) {
      if($this.data("extratriggervalue")+"f" == $("input[name="+inpEl.attr("name")+"]:checked").val()+"f") $this.show();
      }
    }
  });
  //resize window
	if(typeof(windowcontroller) != "undefined") windowcontroller.resize(); 
};

/* VALIDATIE */
formObj.prototype.validate = function() {
	var that = this;
	var errorType = "client";
	var errorMessage = "";

	if(this.trigger) this.triggerElements();


	this.valid = true; //default
	if(!this.isActive()) {  } //hoeft geen validatie
	else if(!this.isMandatory() && this.isEmpty() && this.validationRule.indexOf("weburl") < 0) {  } //hoeft geen validatie
	else {
		inpEl = this.inputElem;
		inpElVal = inpEl.val()
		inpType = this.inputType;
		valRule = this.validationRule;

		if(valRule) {
			if(inpType == "radio") {
				if($("input[name="+inpEl.attr("name")+"]:checked").length <= 0) { 
					this.valid = false; errorMessage = tr.str("no selection"); 
				}
				$("input[name="+inpEl.attr("name")+"]").trigger("update", [this.valid]); //update all siblings
			}

			else if(inpType == "checkbox") {
				if($("input[name="+inpEl.attr("name")+"]:checked").length <= 0) { 
					this.valid = false; errorMessage = tr.str("no selection"); 
				}
			}

			else if(inpType == "select") {
				if(this.isErrorValue()) { this.valid = false;	errorType = "server"; errorMessage = tr.str("not accepted"); }
				else if(valRule.indexOf("req") >= 0 		&& inpElVal.replace(/\s/gi, "")== "" || valRule.indexOf("req") >= 0 && this.isDefault()) { this.valid = false; errorMessage = tr.str("no selection"); }
				else this.valid = true;
			}

			else if(inpType == "text" || inpType == "textarea" || inpType == "password") {
				var regExMail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
				var regExUrl = /^https?:\/\//i;
				if(this.isErrorValue()) { this.valid = false;	errorType = "server"; errorMessage = tr.str("not accepted"); }
				else if(valRule.indexOf("req") >= 0 		&& inpElVal.replace(/\s/gi, "")== "" || valRule.indexOf("req") >= 0 && this.isDefault()) { this.valid = false; errorMessage = tr.str("not filled"); }
				else if(valRule.indexOf("mail") >= 0 		&& inpElVal.length > 0 && !this.isDefault() && regExMail.test( inpElVal) == false) { this.valid = false; errorMessage = tr.str("not email"); }
				else if(valRule.indexOf("pass") >= 0 		&& inpElVal.length > 0 && !this.isDefault() && inpElVal.length < 6) { this.valid = false; errorMessage = tr.str("not enough chars, requires {0}", ["6"]); } 
				else if(valRule.indexOf("phone") >= 0 	&& inpElVal.length > 0 && !this.isDefault() && inpElVal.length < 4) { this.valid = false; errorMessage = tr.str("not enough chars, requires {0}", ["4"]); } 
				else if(valRule.indexOf("zipcode") >= 0	&& inpElVal.length > 0 && !this.isDefault() && inpElVal.length < 3) { this.valid = false; errorMessage = tr.str("zipcode not complete"); }
				else if(valRule.indexOf("weburl") >= 0) {
					if(inpElVal.length > 0 && !this.isDefault() && regExUrl.test( inpEl.val()) == false) { this.valid = false; errorMessage = tr.str("not url"); }
				} 
				//combine fields
				else if(valRule.indexOf("mix") >= 0) {
					if(inpEl.data("match")) {
						var matchkey = inpEl.data("match");
						//alleen markeren is dit de laatste in de 'match' reeks is
						if(that.formcontroller.containerElem.find("[data-match="+matchkey+"]:last")[0] === inpEl[0]) {
							var matchArray = new Array();
							that.formcontroller.containerElem.find("[data-match="+matchkey+"]").each( function() {
								matchArray.push($(this).val());
							});

							//als er meer dan 1 waarde is, dan matchen ze niet
							matchArray = $.unique(matchArray);
							if(matchArray.length != 1) { this.valid = false; errorMessage = tr.str("no match"); }
				}	}	}
				else this.valid = true;
				//bij weburls, extra markeringen
				if(valRule.indexOf("weburl") >= 0 && inpElVal.length > 0) {
					if(inpElVal.substring(0,4) == "www.") { inpEl.val("http://"+inpElVal); }
	}	}	}	} 

	//custom rules
	var custErrorMessage = "";
	if(this.formcontroller.customRules) {
		$.each(this.formcontroller.customRules, function() {
			custErrorMessage = this(that.inputElem);
			if(custErrorMessage) { if(custErrorMessage.length > 1) { that.valid = false; errorMessage = custErrorMessage; } }
		});
	}

	//markeren als niet valide EN had focus OF callback (dan altijd fouten markeren)
	if(!this.valid) {
		if(this.hadFocus || this.formcontroller.callback) this.setMark({ errorType: errorType, errorMessage: errorMessage });
		else this.unsetMark();
	}
	else this.unsetMark();

	//is full form valid? (geen validatie per item)
	this.formcontroller.isValid();
	//set submit button
	this.formcontroller.setSubmit();
};
(function(q){function t(c){var b=c.skinDir+"/"+c.skin,a=l[b];if(a){a.loaded?v.call(this,c,a.html):a.queue.push({c:this,s:c});}else{l[b]={loaded:false,queue:[{c:this,s:c}]};
q.ajax({url:b+".html",dataType:"text",success:function(e){var d=l[b];d.loaded=true;d.html=e;for(e=0;e<d.queue.length;e++){v.call(d.queue[e].c,d.queue[e].s,d.html);
}},dataFilter:function(d){return d=d.substring(d.indexOf("<body>")+6,d.lastIndexOf("</body>"));},error:function(){if(c.error){var d=q.Event("tn3_error");
d.description="tn3 skin load error";c.error(d);}}});}return this;}function v(b,a){this.each(function(){for(var c=q(this),f,e,d=a.indexOf("<img src=");d!=-1;
){d+=10;e=a.indexOf('"',d);f=b.skinDir+"/"+a.substring(d,e);a=a.substr(0,d)+f+a.substr(e);d=a.indexOf("<img src=",d);}c.append(a);c.data("tn3").init(c,b.fullOnly);
});}function s(c){var b=[],a=c.children(".tn3.album"),e,d;if(a.length>0){a.each(function(f){e=q(this);b[f]={title:e.find(":header").html()};q.extend(b[f],r(e));
if(d=u(e)){b[f].imgs=d;if(!b[f].thumb){b[f].thumb=b[f].imgs[0].thumb;}}});}else{if(d=u(c)){b[0]={imgs:d};}}return b;}function u(c){var b=[],a,d;a=c.find("li");
if(a.length>0){a.each(function(e){d=q(this);$firsta=d.find("a.tn3_image").filter(":first");b[e]={title:d.find(":header").filter(":first").html()};if($firsta.length>0){b[e].img=$firsta.attr("href");
b[e].thumb=$firsta.find("img").attr("src");}else{b[e].img=d.find("img").filter(":first").attr("src");}q.extend(b[e],r(d));});}else{a=c.find("img");a.each(function(e){d=q(this);
$at=d.parent("a");b[e]=$at.length==0?{title:d.attr("title"),img:d.attr("src")}:{title:d.attr("title"),img:$at.attr("href"),thumb:d.attr("src")};});}if(b.length==0){return null;
}return b;}function r(c){var b={};c=c.children(".tn3");var a;q.each(c,function(){a=q(this);b[a.attr("class").substr(4)]=a.html();});return b;}function p(a){q('a[href^="#tn3-'+a+'"]').click(function(c){var b=h[a];
c=q(c.currentTarget).attr("href");c=c.substr(c.indexOf("-",5)+1);c=c.split("-");switch(c[0]){case"next":b.cAlbum!=null&&b.show("next",c[1]=="fs");break;
case"prev":b.cAlbum!=null&&b.show("prev",c[1]=="fs");break;default:b.cAlbum!=parseInt(c[0])?b.showAlbum(parseInt(c[0]),parseInt(c[1]),c[2]=="fs"):b.show(parseInt(c[1]),c[2]=="fs");
}});}function k(){if(h.length==0){var a=q(".tn3gallery");a.length>0&&a.tn3({});}}if(/1\.(0|1|2|3|4)\.(0|1)/.test(q.fn.jquery)||/^1.1/.test(q.fn.jquery)||/^1.2/.test(q.fn.jquery)||/^1.3/.test(q.fn.jquery)){alert("tn3gallery requires jQuery v1.4.2 or later!  You are using v"+q.fn.jquery);
}else{var l={},h=[];q.fn.tn3=function(c){c=q.extend(true,{},q.fn.tn3.config,c);if(c.skin!=null){if(typeof c.skin=="object"){c.skinDir+="/"+c.skin[0];if(c.cssID==null){c.cssID=c.skin[0];
}c.skin=c.skin[1];}else{}}else{c.skin="tn3";c.skinDir+="/tn3";var b=true;}if(c.cssID==null){c.cssID=c.skin==null?"tn3":c.skin;}var a;this.each(function(){var d=q(this);
c.fullOnly?d.hide():d.css("visibility","hidden");var f=c.data?c.data:s(d);a=new q.fn.tn3.Gallery(f,c);f=h.push(a)-1;d.data("tn3",h[f]);for(var e=0;e<q.fn.tn3.plugins.length;
e++){q.fn.tn3.plugins[e].init(d,c);}d.empty();p(f);});b?v.call(this,c,c.skinDefault):t.call(this,c);return{container:this,tn3g:a};};q.fn.tn3.plugins=[];
q.fn.tn3.plugIn=function(b,a){q.fn.tn3.plugins.push({id:b,init:a});};q.fn.tn3.version="1.2.0.45";q.fn.tn3.config={data:null,skin:null,skinDir:"skins",skinDefault:'<div class="tn3-gallery"><div class="tn3-image"><div class="tn3-text-bg"><div class="tn3-image-title"></div><div class="tn3-image-description"></div></div><div class="tn3-next tn3_v tn3_o"></div><div class="tn3-prev tn3_v tn3_o"></div><div class="tn3-preloader tn3_h tn3_v"><img src="preload.gif"/></div><div class="tn3-timer"></div></div><div class="tn3-controls-bg tn3_rh"><div class="tn3-sep1"></div><div class="tn3-sep2"></div><div class="tn3-sep3"></div></div><div class="tn3-thumbs"></div><div class="tn3-fullscreen"></div><div class="tn3-show-albums"></div><div class="tn3-next-page"></div><div class="tn3-prev-page"></div><div class="tn3-play"></div><div class="tn3-count"></div><div class="tn3-albums"><div class="tn3-inalbums"><div class="tn3-album"></div></div><div class="tn3-albums-next"></div><div class="tn3-albums-prev"></div><div class="tn3-albums-close"></div></div></div>',cssID:null};
q.fn.tn3.translations={};q.fn.tn3.translate=function(c,b){if(b){q.fn.tn3.translations[c]=b;}else{var a=q.fn.tn3.translations[c];return a?a:c;}};q(function(){setTimeout(k,1);
});}})(jQuery);(function(a){a.fn.tn3utils=U={};U.shuffle=function(h){var f,g,e=h.length;if(e){for(;--e;){g=Math.floor(Math.random()*(e+1));f=h[g];h[g]=h[e];
h[e]=f;}}};a.extend(a.easing,{def:"easeOutQuad",swing:function(j,g,i,f,h){return a.easing[a.easing.def](j,g,i,f,h);},linear:function(j,g,i,f,h){return f*g/h+i;
},easeInQuad:function(j,g,i,f,h){return f*(g/=h)*g+i;},easeOutQuad:function(j,g,i,f,h){return -f*(g/=h)*(g-2)+i;},easeInOutQuad:function(j,g,i,f,h){if((g/=h/2)<1){return f/2*g*g+i;
}return -f/2*(--g*(g-2)-1)+i;},easeInCubic:function(j,g,i,f,h){return f*(g/=h)*g*g+i;},easeOutCubic:function(j,g,i,f,h){return f*((g=g/h-1)*g*g+1)+i;},easeInOutCubic:function(j,g,i,f,h){if((g/=h/2)<1){return f/2*g*g*g+i;
}return f/2*((g-=2)*g*g+2)+i;},easeInQuart:function(j,g,i,f,h){return f*(g/=h)*g*g*g+i;},easeOutQuart:function(j,g,i,f,h){return -f*((g=g/h-1)*g*g*g-1)+i;
},easeInOutQuart:function(j,g,i,f,h){if((g/=h/2)<1){return f/2*g*g*g*g+i;}return -f/2*((g-=2)*g*g*g-2)+i;},easeInQuint:function(j,g,i,f,h){return f*(g/=h)*g*g*g*g+i;
},easeOutQuint:function(j,g,i,f,h){return f*((g=g/h-1)*g*g*g*g+1)+i;},easeInOutQuint:function(j,g,i,f,h){if((g/=h/2)<1){return f/2*g*g*g*g*g+i;}return f/2*((g-=2)*g*g*g*g+2)+i;
},easeInSine:function(j,g,i,f,h){return -f*Math.cos(g/h*(Math.PI/2))+f+i;},easeOutSine:function(j,g,i,f,h){return f*Math.sin(g/h*(Math.PI/2))+i;},easeInOutSine:function(j,g,i,f,h){return -f/2*(Math.cos(Math.PI*g/h)-1)+i;
},easeInExpo:function(j,g,i,f,h){return g==0?i:f*Math.pow(2,10*(g/h-1))+i;},easeOutExpo:function(j,g,i,f,h){return g==h?i+f:f*(-Math.pow(2,-10*g/h)+1)+i;
},easeInOutExpo:function(j,g,i,f,h){if(g==0){return i;}if(g==h){return i+f;}if((g/=h/2)<1){return f/2*Math.pow(2,10*(g-1))+i;}return f/2*(-Math.pow(2,-10*--g)+2)+i;
},easeInCirc:function(j,g,i,f,h){return -f*(Math.sqrt(1-(g/=h)*g)-1)+i;},easeOutCirc:function(j,g,i,f,h){return f*Math.sqrt(1-(g=g/h-1)*g)+i;},easeInOutCirc:function(j,g,i,f,h){if((g/=h/2)<1){return -f/2*(Math.sqrt(1-g*g)-1)+i;
}return f/2*(Math.sqrt(1-(g-=2)*g)+1)+i;},easeInElastic:function(p,h,m,f,l){p=1.70158;var k=0,i=f;if(h==0){return m;}if((h/=l)==1){return m+f;}k||(k=l*0.3);
if(i<Math.abs(f)){i=f;p=k/4;}else{p=k/(2*Math.PI)*Math.asin(f/i);}return -(i*Math.pow(2,10*(h-=1))*Math.sin((h*l-p)*2*Math.PI/k))+m;},easeOutElastic:function(p,h,m,f,l){p=1.70158;
var k=0,i=f;if(h==0){return m;}if((h/=l)==1){return m+f;}k||(k=l*0.3);if(i<Math.abs(f)){i=f;p=k/4;}else{p=k/(2*Math.PI)*Math.asin(f/i);}return i*Math.pow(2,-10*h)*Math.sin((h*l-p)*2*Math.PI/k)+f+m;
},easeInOutElastic:function(p,h,m,f,l){p=1.70158;var k=0,i=f;if(h==0){return m;}if((h/=l/2)==2){return m+f;}k||(k=l*0.3*1.5);if(i<Math.abs(f)){i=f;p=k/4;
}else{p=k/(2*Math.PI)*Math.asin(f/i);}if(h<1){return -0.5*i*Math.pow(2,10*(h-=1))*Math.sin((h*l-p)*2*Math.PI/k)+m;}return i*Math.pow(2,-10*(h-=1))*Math.sin((h*l-p)*2*Math.PI/k)*0.5+f+m;
},easeInBack:function(l,h,k,f,j,i){if(i==undefined){i=1.70158;}return f*(h/=j)*h*((i+1)*h-i)+k;},easeOutBack:function(l,h,k,f,j,i){if(i==undefined){i=1.70158;
}return f*((h=h/j-1)*h*((i+1)*h+i)+1)+k;},easeInOutBack:function(l,h,k,f,j,i){if(i==undefined){i=1.70158;}if((h/=j/2)<1){return f/2*h*h*(((i*=1.525)+1)*h-i)+k;
}return f/2*((h-=2)*h*(((i*=1.525)+1)*h+i)+2)+k;},easeInBounce:function(j,g,i,f,h){return f-a.easing.easeOutBounce(j,h-g,0,f,h)+i;},easeOutBounce:function(j,g,i,f,h){return(g/=h)<1/2.75?f*7.5625*g*g+i:g<2/2.75?f*(7.5625*(g-=1.5/2.75)*g+0.75)+i:g<2.5/2.75?f*(7.5625*(g-=2.25/2.75)*g+0.9375)+i:f*(7.5625*(g-=2.625/2.75)*g+0.984375)+i;
},easeInOutBounce:function(j,g,i,f,h){if(g<h/2){return a.easing.easeInBounce(j,g*2,0,f,h)*0.5+i;}return a.easing.easeOutBounce(j,g*2-h,0,f,h)*0.5+f*0.5+i;
}});})(jQuery);(function(a){a.fn.tn3.Gallery=function(d,b){this.data=d;this.config=a.extend(true,{},a.fn.tn3.Gallery.config,b);this.initialized=false;this.t=a.fn.tn3.translate;
this.loader=new a.fn.tn3.External(b.external,this);};a.fn.tn3.Gallery.config={cssID:"tn3",active:[],inactive:[],iniAlbum:0,iniImage:0,imageClick:"next",startWithAlbums:false,autoplay:false,delay:7000,timerMode:"bar",timerSteps:300,timerStepChar:"&#8226;",isFullScreen:false,fullOnly:false,width:null,height:null,mouseWheel:true,keyNavigation:"fullscreen",timerOverStop:true,responsive:false,image:{},thumbnailer:{}};
a.fn.tn3.Gallery.prototype={config:null,$c:null,$tn3:null,data:null,thumbnailer:null,imager:null,cAlbum:null,timer:null,items:null,initialized:null,n:null,albums:null,loader:null,fso:null,timerSize:null,special:null,areHidden:false,$inImage:null,isPlaying:false,cparent:null,init:function(h,f){this.$c=h;
if(!(this.loader.reqs>0||this.data.length==0||f)){this.trigger("init_start");this.config.fullOnly&&this.$c.show();this.$c.css("visibility","visible");this.$tn3=this.$c.find("."+this.config.cssID+"-gallery");
var g=this.config.initValues={width:this.$tn3.width(),height:this.$tn3.height()};g.wDif=this.$tn3.outerWidth(true)-g.width;g.hDif=this.$tn3.outerHeight(true)-g.height;
this.config.mouseWheel&&this.initMouseWheel();var e=this;this.timer=new a.fn.tn3.Timer(this.$c,this.config.delay,this.config.timerSteps);this.$c.bind("timer_end",function(){if(e.$c.find("."+e.config.cssID+"-image-tags").length>0){if(e.$c.find("."+e.config.cssID+"-image-tags").find(".tag.active").length>0){e.tagT=setInterval(function(){if(e.$c.find("."+e.config.cssID+"-image-tags").length==0){clearInterval(e.tagT);
}if(e.$c.find("."+e.config.cssID+"-image-tags").find(".tag.active").length==0){clearInterval(e.tagT);e.show("next");}},500);return false;}else{e.show("next");
}}else{e.show("next");}});this.special={rv:[],rh:[],v:[],h:[],vi:[],hi:[],o:[]};this.parseLayout();this.center();a.each(this.items,function(d,c){switch(d){case"next":c.click(function(j){e.show("next");
j.stopPropagation();});c.attr("title",e.t("Next Image"));break;case"prev":c.click(function(j){e.show("prev");j.stopPropagation();});c.attr("title",e.t("Previous Image"));
break;case"next-page":c.click(function(){e.items.thumbs&&e.thumbnailer.next(true);});c.attr("title",e.t("Next Page"));break;case"prev-page":c.click(function(){e.items.thumbs&&e.thumbnailer.prev(true);
});c.attr("title",e.t("Previous Page"));break;case"thumbs":e.config.thumbnailer.cssID=e.config.cssID;e.config.thumbnailer.initValues={width:c.width(),height:c.height()};
e.config.thumbnailer.initValues.vertical=c.width()<=c.height();c.bind("tn_click",function(j){e.show(j.n);}).bind("tn_over",function(){e.timer.pause(true);
}).bind("tn_out",function(){e.timer.pause(false);}).bind("tn_error",function(j){e.trigger("error",j);});break;case"image":e.config.image.cssID=e.config.cssID;
e.config.image.initValues={width:c.width(),height:c.height()};c.bind("img_click",function(j){switch(e.config.imageClick){case"next":e.show("next");break;
case"fullscreen":e.fullscreen();break;case"url":if(j=e.data[e.cAlbum].imgs[j.n].url){window.location=j;}}}).bind("img_load_start",function(){e.items.preloader&&e.items.preloader.show();
}).bind("img_load_end",function(j){e.n=j.n;e.items.thumbs&&e.thumbnailer.thumbClick(j.n);e.items.preloader&&e.items.preloader.hide();e.items.timer&&e.items.timer.hide();
e.$inImage&&e.$inImage.hide();}).bind("img_transition",function(j){if(typeof(e.imager.cached[j.n])=="undefined"){return false;}if(e.imager.cached[j.n]==undefined){return false;
}e.setTextValues(false,"image");e.$inImage&&e.imager.cached[j.n].isImage&&e.$inImage.fadeIn(300);e.items.count&&e.items.count.text(e.n+1+"/"+e.data[e.cAlbum].imgs.length);
e.isPlaying&&e.timer.start();e.special.o.length>0&&e.hideElements();}).bind("img_enter",function(){e.items.timer&&e.config.timerOverStop&&e.timer.pause(true);
e.special.o.length>0&&e.showElements(300);}).bind("img_leave",function(){e.items.timer&&e.config.timerOverStop&&e.timer.pause(false);e.special.o.length>0&&e.hideElements(300);
}).bind("img_resize",function(j){if(e.$inImage){e.$inImage.width(j.w).height(j.h).css("left",j.left).css("top",j.top);e.center();e.imager.bindMouseEvents(e.$inImage);
}}).bind("img_error",function(j){e.trigger("error",j);});break;case"preloader":c.hide();break;case"timer":var b=c.width()>c.height()?"width":"height";e.$c.bind("timer_tick",function(k){if(e.config.timerMode=="char"){for(var j=e.config.timerStepChar;
--k.tick;){j+=e.config.timerStepChar;}e.items.timer.html(j);}else{e.items.timer[b](e.timerSize/k.totalTicks*k.tick);}e.trigger(k.type,k);}).bind("timer_start",function(j){e.timerSize=e.$inImage[b]();
e.items.timer.fadeIn(300);e.trigger(j.type,j);}).bind("timer_end timer_stop",function(j){e.items.timer.hide();e.trigger(j.type,j);});c.hide();break;case"play":c.click(function(k){var j={id:"play",execute:true};
e.trigger("control",j);if(e.isPlaying){if(j.execute){e.timer.stop();c.removeClass(e.config.cssID+"-play-active");c.attr("title",e.t("Start Slideshow"));
}e.isPlaying=false;}else{if(j.execute){e.timer.start();c.addClass(e.config.cssID+"-play-active");c.attr("title",e.t("Stop Slideshow"));}e.isPlaying=true;
}k.stopPropagation();});c.attr("title",e.t("Start Slideshow"));e.config.autoplay&&c.click();break;case"albums":e.albums=new a.fn.tn3.Albums(e.data,c,e.config.cssID);
c.hide();c.bind("albums_binit",function(j){e.trigger(j.type,j);}).bind("albums_click",function(j){e.showAlbum(j.n);e.trigger(j.type,j);}).bind("albums_init",function(j){e.timer.pause(true);
e.trigger(j.type,j);}).bind("albums_error",function(j){e.trigger("error",j);}).bind("albums_close",function(){e.timer.pause(false);});break;case"albums-next":e.albums&&e.albums.setControl("next",c);
c.attr("title",e.t("Next Album Page"));break;case"albums-prev":e.albums&&e.albums.setControl("prev",c);c.attr("title",e.t("Previous Album Page"));break;
case"albums-close":e.albums&&e.albums.setControl("close",c);c.attr("title",e.t("Close"));break;case"show-albums":c.click(function(j){e.items.albums&&e.albums.show(0,e.cAlbum,false,true);
j.stopPropagation();});c.attr("title",e.t("Album List"));break;case"fullscreen":c.click(function(k){var j={id:"fullscreen",execute:true};e.trigger("control",j);
j.execute&&e.fullscreen();k.stopPropagation();});c.attr("title",e.t("Maximize"));}});if(this.config.width!==null||this.config.height!==null){if(this.config.width==null){this.config.width=this.config.initValues.width;
}if(this.config.height==null){this.config.height=this.config.initValues.height;}this.resize(this.config.width,this.config.height);}g=Math.min(this.config.iniAlbum,this.data.length-1);
this.initialized=true;this.config.startWithAlbums&&this.data.length>1&&this.items.albums?this.albums.show():this.showAlbum(g,this.config.iniImage);this.config.isFullScreen&&this.onFullResize(a(window).width(),a(window).height());
this.config.keyNavigation=="always"&&a(document).bind("keyup",a.proxy(this.listenKeys,this));this.trigger("init");}},parseLayout:function(){var r=this.items={},h=this.config,q=h.active,f=h.inactive,p=h.cssID.length+1,m=this,k,l;
this.$c.find("div[class^='"+h.cssID+"-']").each(function(){k=a(this);l=k.attr("class").split(" ")[0].substr(p);if(a.inArray(l,f)!=-1){k.remove();}else{if(q.length==0||a.inArray(l,q)!=-1){r[l]=k;
}else{l!="gallery"&&k.remove();}}if(k.parent().hasClass(h.cssID+"-image")){if(!m.$inImage){m.$inImage=k.parent().append('<div class="tn3-in-image"></div>').find(":last");
if(a.browser.msie){var b=a("<div />");b.css("background-color","#fff").css("opacity",0).css("width","100%").css("height","100%");b.appendTo(m.$inImage);
}m.$inImage.css("position","absolute").width(r.image.width()).height(r.image.height());}k.appendTo(m.$inImage);}this.className.indexOf("tn3_")!=-1&&m.addSpecial(l,this.className);
});},addSpecial:function(j,g){for(var i=g.split(" "),f,h=0;h<i.length;h++){f=i[h].split("_");if(f[0]=="tn3"){this.special[f[1]].push(j);if(f[1]=="rh"||f[1]=="rv"){this.config.initValues[j]={w:this.items[j].width(),h:this.items[j].height()};
}}}},initHover:function(f,b){var e=this;f.hover(function(){f.addClass(e.config.cssID+"-"+b+"-over");},function(){f.removeClass(e.config.cssID+"-"+b+"-over");
});},setTextValues:function(l,h){var k,f,j,i=h+"-";for(j in this.items){if(j.indexOf(i)==0){k=j.substr(i.length);if(k!="info"&&k!="prev"&&k!="next"){f=h=="image"?this.data[this.cAlbum].imgs[this.n]:this.data[this.cAlbum];
if(!f||f[k]==undefined){f={};f[k]="";}else{f[k]=a.trim(f[k]);}k={field:k,text:f[k],data:f};this.trigger("set_text",k);if(l||k.text==undefined||k.text.length==0){this.items[j].html("");
this.items[j].hide();}else{this.items[j].html(k.text);this.items[j].show();}}}}},show:function(d,b){this.timer.stop();this.imager&&this.imager.show(d);
b&&this.fullscreen();},setAlbumData:function(h,f){if(f){this.trigger("error",{description:f});}else{for(var g=0,e=h.length;g<e;g++){this.data.push(h[g]);
}this.$c&&this.init(this.$c,this.config.fullOnly);}},setImageData:function(f,b,e){if(e){this.trigger("error",{description:e});}else{this.items.preloader&&this.items.preloader.hide();
f={data:f};this.trigger("image_data",f);this.data[b].imgs=f.data;if(this.cAlbum==b){this.rebuild(f.data,b==0?this.config.iniImage:0);}}},showAlbum:function(f,b,e){if(this.initialized){if(f>this.data.length){return;
}this.timer.stop();this.cAlbum=f;this.albums&&this.albums.hide();if(this.data[this.cAlbum].imgs===undefined){if(this.loader){this.loader.getImages(this.data[this.cAlbum].adata,this.cAlbum);
this.items.preloader&&this.items.preloader.show();}else{this.trigger("error",{description:"Wrong album id"});}}else{this.rebuild(this.data[this.cAlbum].imgs,b);
}}else{this.config.iniAlbum=f;this.config.iniImage=b;this.init(this.$c,false);}e&&this.fullscreen();},rebuild:function(d,b){if(this.items.thumbs){if(this.thumbnailer){this.thumbnailer.rebuild(d);
}else{this.thumbnailer=new a.fn.tn3.Thumbnailer(this.items.thumbs,d,this.config.thumbnailer);}}if(this.items.image){if(this.imager){this.imager.rebuild(d);
}else{this.imager=new a.fn.tn3.Imager(this.items.image,d,this.config.image);}}this.setTextValues(true,"image");this.setTextValues(false,"album");this.show(b==null?0:b);
this.trigger("rebuild",{album:this.cAlbum});},showElements:function(f){if(this.areHidden){var b=this,e;a.each(this.special.o,function(c,d){e=b.items[d];
e.show();if(f&&a.support.opacity){e.stop(true);e.css("opacity",0);e.animate({opacity:1},{duration:f,queue:false});}});this.areHidden=false;}},hideElements:function(f){if(!this.areHidden){var b=this,e;
a.each(this.special.o,function(c,d){e=b.items[d];if(f&&a.support.opacity){e.stop(true);e.animate({opacity:0},{duration:f,complete:function(){e.hide();},queue:false});
}else{e.hide();}});this.areHidden=true;}},setData:function(b){if(this.items.thumbs){this.thumbnailer.data=b;}if(this.items.imager){this.imager.data=b;}},fullscreen:function(){if(this.config.isFullScreen){a(window).unbind("resize",this.onFullResize);
a.tn3unblock();this.config.width!==null||this.config.height!==null?this.resize(this.config.width,this.config.height):this.resize(this.config.initValues.width,this.config.initValues.height);
if(this.items.fullscreen){this.items.fullscreen.removeClass(this.config.cssID+"-fullscreen-active");this.items.fullscreen.attr("title",this.t("Maximize"));
}this.config.fullOnly&&this.$c.hide();this.config.isFullScreen=false;this.trigger("fullscreen",{fullscreen:false});this.config.keyNavigation=="fullscreen"&&a(document).unbind("keyup",this.listenKeys);
}else{a.tn3block({message:this.$tn3,cssID:this.config.cssID});a(window).bind("resize",a.proxy(this.onFullResize,this));this.config.fullOnly&&this.$c.show();
this.config.isFullScreen=true;if(this.items.fullscreen){this.items.fullscreen.addClass(this.config.cssID+"-fullscreen-active");this.items.fullscreen.attr("title",this.t("Minimize"));
}this.onFullResize();this.config.keyNavigation=="fullscreen"&&a(document).bind("keyup",a.proxy(this.listenKeys,this));this.trigger("fullscreen",{fullscreen:true});
}},listenKeys:function(d){if(d.keyCode==70){this.items.fullscreen.click();}else{if(this.items.albums&&this.albums.enabled){var b=0;switch(d.keyCode){case 27:this.albums.hide();
break;case 39:b="r";break;case 37:b="l";break;case 38:b="u";break;case 40:b="d";break;case 32:b="p";}b&&this.albums.select(b);}else{switch(d.keyCode){case 27:this.config.isFullScreen&&this.fullscreen();
break;case 39:this.show("next");break;case 37:this.show("prev");break;case 38:this.items.albums&&this.albums.show(0,this.cAlbum,false,true);break;case 32:this.items.play.click();
}}}},onFullResize:function(){var d=a(window),b=d.width();d=d.height();b-=this.config.initValues.wDif;d-=this.config.initValues.hDif;this.resize(b,d);},resize:function(p,h){this.$tn3.width(p).height(h);
var m=p-this.config.initValues.width,f=h-this.config.initValues.height,l,k,i=this;if(this.items.image){l=this.config.image.initValues.width+m;k=this.config.image.initValues.height+f;
if(this.imager){this.imager.setSize(l,k);}else{this.items.image.width(l).height(k);this.$inImage.width(l).height(k);}}if(this.items.thumbs){l=this.config.thumbnailer.initValues.width+m;
k=this.config.thumbnailer.initValues.height+f;if(this.thumbnailer){this.thumbnailer.setSize(l,k);}else{this.config.thumbnailer.initValues.vertical?this.items.thumbs.height(k):this.items.thumbs.width(l);
}}if(this.items.albums){l=this.albums.initValues.width+m;k=this.albums.initValues.height+f;this.albums.changeSize(m,f);}a.each(this.special.rh,function(c,b){i.items[b].width(i.config.initValues[b].w+m);
});a.each(this.special.rv,function(c,b){i.items[b].height(i.config.initValues[b].h+f);});this.center();},center:function(){var f,b=this,e=b.items.image.position();
a.each(this.special.v,function(c,d){f=b.items[d];f.css("top",(f.parent().height()-f.height())/2);});a.each(this.special.h,function(c,d){f=b.items[d];f.css("left",(f.parent().width()-f.width())/2);
});a.each(this.special.vi,function(c,d){f=b.items[d];f.css("top",e.top+(b.items.image.height()-f.height())/2);});a.each(this.special.hi,function(c,d){f=b.items[d];
f.css("left",e.left+(b.items.image.width()-f.width())/2);});},trigger:function(h,f){var g=a.Event("tn3_"+h),e;for(e in f){g[e]=f[e];}if(f&&f.type!=undefined){g.type="tn3_"+h;
}g.source=this;this.$c.trigger(g);this.config[h]&&this.config[h].call(this,g);for(e in f){f[e]=g[e];}},initMouseWheel:function(){var d=this,b=function(c){d.show((c.originalEvent.detail?-c.originalEvent.detail:c.originalEvent.wheelDelta)>0?"prev":"next");
c.preventDefault();};this.$tn3.bind("mousewheel",b);this.$tn3.bind("DOMMouseScroll",b);},replaceMenu:function(f,b){var e='<div style="position:absolute;background-color:#fff;color: #000;padding:0px 4px 0px 4px;z-index:1010;font-family:sans-serif;font-size:12px;">&copy; <a href="'+b+'">'+f+"</a></div>";
this.$tn3.bind("contextmenu",function(c){c.preventDefault();}).bind("mousedown",function(c){if(c.which==3){var d=a("body").append(e).find("div:last");d.css("left",c.pageX).css("top",c.pageY);
d.find("a").mouseup(function(h){window.location=b;d.unbind(h);});a("body").mouseup(function(h){d.remove();a("body").unbind(h);});}});}};})(jQuery);(function(a){a.fn.tn3.Imager=function(f,b,e){this.$c=f;
this.data=b;this.config=a.extend(true,{},a.fn.tn3.Imager.config,e);this.init();};a.fn.tn3.Imager.config={transitions:null,defaultTransition:{type:"slide"},random:false,cssID:"tn3",maxZoom:1.4,crop:false,clickEvent:"click",idleDelay:3000,stretch:true,dif:0};
a.fn.tn3.Imager.prototype={config:null,$c:false,data:false,cached:null,active:-1,$active:false,$buffer:false,isInTransition:false,ts:null,cDim:null,qid:null,currentlyLoading:null,side:null,$ic:null,$binder:null,infoID:null,lastEnter:false,mouseCoor:{x:0,y:0},mouseIsOver:false,init:function(){this.$c.css("overflow","hidden");
this.$c.css("position","relative");this.bindMouseEvents(this.$c);this.cached=[];this.ts=new a.fn.tn3.Transitions(this.config.transitions,this.config.defaultTransition,this.config.random,this,"onTransitionEnd");
},bindMouseEvents:function(d){this.unbindMouseEvents();var b=this;d.hover(function(){b.mouseIsOver=true;b.enterLeave("enter");b.startIdle();a(document).mousemove(a.proxy(b.onMouseMove,b));
},function(){b.mouseIsOver=false;b.enterLeave("leave");b.stopIdle();a(document).unbind("mousemove",b.onMouseMove);});d[this.config.clickEvent](function(c){b.active==-1||b.isInTransition||c.target.tagName.toUpperCase()!="A"&&b.trigger("click",{n:b.active});
});this.$binder=d;},unbindMouseEvents:function(){this.$binder&&this.$binder.unbind("mouseenter mouseleave "+this.config.clickEvent);a(document).unbind("mousemove",this.onMouseMove);
this.stopIdle();},startIdle:function(){this.stopIdle();var b=this;if(this.config.idleDelay>0){this.infoID=setTimeout(function(){b.enterLeave("leave");b.stopIdle();
},this.config.idleDelay);}},onMouseMove:function(b){this.mouseCoor={x:b.pageX,y:b.pageY};if(!this.isInTransition){this.infoID||this.enterLeave("enter");
this.startIdle();}},stopIdle:function(){clearTimeout(this.infoID);this.infoID=null;},enterLeave:function(b){this.lastEnter!=b&&this.trigger(b);this.lastEnter=b;
},show:function(b){if(this.isInTransition){this.qid=b;}else{this.qid=null;if(b=="next"){b=this.active+1<this.data.length?this.active+1:0;this.side="left";
}else{if(b=="prev"){b=this.active>0?this.active-1:this.data.length-1;this.side="right";}else{this.side=this.active>b?"right":"left";}}if(this.data[b]){this.trigger("load_start",{n:b});
this.$buffer=this.$c.prepend('<div class="'+this.config.cssID+'-image-in" style="position:absolute;overflow:hidden;"></div>').find(":first");if(this.cached[this.currentlyLoading]!=undefined){this.cached[this.currentlyLoading].init=false;
}if(this.cached[b]!=undefined&&typeof(this.cached[b])!="undefined"){if(this.cached[b].status=="loaded"){this.initImage(b);}else{this.cached[b].init=true;
this.currentlyLoading=b;}}else{this.startLoading(b,true);}}}},startLoading:function(d,b){this.cached[d]={isImage:true,status:"loading",init:b};this.currentlyLoading=d;
if(this.data[d].content!=undefined){this.cached[d].isImage=false;this.onCacheLoad(a(this.data[d].content),d);}else{this.cached[d].loader=new a.fn.tn3.ImageLoader(this.data[d].img,this,this.onCacheLoad,[d]);
}},onCacheLoad:function(f,b,e){if(this.cached[b]==undefined||typeof(this.cached[b])=="undefined"){this.cached[b]={isImage:true,status:"loading",init:true};
}this.cached[b].status="loaded";this.cached[b].$content=f;e&&this.trigger("error",{description:e,n:b});this.cached[b].init&&this.initImage(b);},initImage:function(f){var b=this.cached[f].$content;
this.currentlyLoading=null;this.active=f;if(!this.cDim){this.cDim={w:this.$c.width(),h:this.$c.height()};}this.$buffer.width(this.cDim.w).height(this.cDim.h);
var e=a('<div class="'+this.config.cssID+'-full-image" style="position:absolute"></div>');b.appendTo(e);this.$buffer.append(e);this.$buffer.data("ic",e);
this.$buffer.data("img",b);this.resize(this.$buffer);this.trigger("load_end",{n:f,content:b,isImage:this.cached[f].isImage});if(this.$active!=false){this.isInTransition=true;
this.unbindMouseEvents();if(this.mouseIsOver){a(document).mousemove(a.proxy(this.onMouseMove,this));}else{this.mouseCoor={x:0,y:0};}this.lastEnter="leave";
this.ts.start(this.$active,this.$buffer,this.side);}else{this.$active=this.$buffer;this.trigger("transition",{n:this.active});}this.cached[f+1]==undefined&&this.data[f+1]!=undefined&&this.startLoading(f+1,false);
},setSize:function(d,b){this.isInTransition&&this.ts.stop(this.$active,this.$buffer,this.ts.config);this.$c.width(d).height(b);this.cDim={w:this.$c.width(),h:this.$c.height()};
if(this.$active){this.$active.width(d).height(b);this.resize(this.$active);}},resize:function(b){if(b.data("img")==undefined){this.trigger("resize",{w:this.cDim.w,h:this.cDim.h,left:0,top:0});
}else{this.cached[this.active].isImage?this.resizeImage(b):this.resizeContent(b);}},resizeImage:function(l){$img=l.data("img");$ic=l.data("ic");$img.width("").height("");
l.data("scaled",false);var h=$img.width(),k=$img.height(),f=0,j=0,i={w:h,h:k,left:0,top:0};$img.attr("width",h).attr("height",k);if($img.get(0).tagName.toUpperCase()=="IMG"&&(h!=this.cDim.w||k!=this.cDim.h)){f=this.cDim.w/h;
j=this.cDim.h/k;f=this.config.crop?Math.max(f,j):Math.min(f,j);f=Math.min(this.config.maxZoom,f);h=i.w=Math.round(h*f)-this.config.dif;k=i.h=Math.round(k*f)-this.config.dif;
if(this.cDim.w>=h){f=i.left=(this.cDim.w-h)/2;}else{f=-(h-this.cDim.w)*0.5;i.w=this.cDim.w;}if(this.cDim.h>k){j=i.top=(this.cDim.h-k)/2;}else{j=-(k-this.cDim.h)*0.5;
i.h=this.cDim.h;}$img.attr("width",h).attr("height",k);$ic.width(h).height(k);l.data("scaled",true);}$ic.css("left",f).css("top",j);this.bindMouseEvents($ic);
this.trigger("resize",i);if(this.$c.parent().find("."+this.config.cssID+"-image-tags").length>0){this.$c.parent().find("."+this.config.cssID+"-image-tags").css({width:$img.width()+"px",height:$img.height()+"px",left:$ic.position().left+"px",top:$ic.position().top+"px"});
}},resizeContent:function(h){$ic=h.data("ic");$img=h.data("img");h.data("scaled",false);var f=$img.width(),g=$img.height(),e={w:f,h:g,left:0,top:0};if(this.config.stretch){$ic.width(this.cDim.w).height(this.cDim.h);
$img.width(this.cDim.w).height(this.cDim.h);h.data("scaled",true);}else{e.left=(this.cDim.w-f)*0.5;e.top=(this.cDim.h-g)*0.5;$ic.css("left",e.left).css("top",e.top);
}this.bindMouseEvents($ic);this.trigger("resize",e);},onTransitionEnd:function(){this.$active.remove();this.$active=this.$buffer;this.isInTransition=false;
this.trigger("transition",{n:this.active});this.bindMouseEvents(this.$binder);var b=this.$binder.offset();this.mouseIsOver=false;if(this.mouseCoor.x>=b.left&&this.mouseCoor.x<=b.left+this.$binder.width()){if(this.mouseCoor.y>=b.top&&this.mouseCoor.y<=b.top+this.$binder.height()){this.lastEnter="leave";
this.enterLeave("enter");this.startIdle();this.mouseIsOver=true;a(document).mousemove(a.proxy(this.onMouseMove,this));}}this.qid!=null&&this.show(this.qid);
},trigger:function(h,f){var g=a.Event("img_"+h),e;for(e in f){g[e]=f[e];}g.source=this;this.$c.trigger(g);this.config[h]&&this.config[h].call(this,g);},destroy:function(){this.isInTransition&&this.ts.stop(this.$active,this.$buffer);
this.$active&&this.$active.remove();this.$buffer.remove();},rebuild:function(b){this.quid=null;this.isInTransition&&this.ts.stop(this.$active,this.$buffer);
this.$buffer&&this.$buffer.remove();this.cached=[];this.data=b;this.loader&&this.loader.cancel();}};})(jQuery);(function(a){a.fn.tn3.Thumbnailer=function(f,b,e){this.$c=f;
this.data=b;this.config=a.extend({},a.fn.tn3.Thumbnailer.config,e);a(window).resize(a.proxy(this.onWinResize,this));this.init();};a.fn.tn3.Thumbnailer.config={overMove:true,buffer:20,speed:8,slowdown:50,shaderColor:"#000000",shaderOpacity:0.5,shaderDuration:300,shaderOut:300,useTitle:false,seqLoad:true,align:1,mode:"thumbs",cssID:"tn3"};
a.fn.tn3.Thumbnailer.prototype={config:null,$c:null,$oc:null,$ul:null,data:null,active:-1,listSize:0,containerSize:0,containerPadding:0,noBufSize:0,containerOffset:0,mcoor:"mouseX",edge:"left",size:"width",outerSize:"outerWidth",mouseX:0,mouseY:0,intID:false,pos:0,difference:0,cnt:1,thumbCount:-1,initialized:false,clickWhenReady:-1,loaders:null,lis:null,isVertical:null,marginDif:0,nloaded:0,firstToLoad:0,init:function(){this.$c.css("position","absolute").css("cursor","progress");
this.lis=[];this.loaders=[];this.initialized=false;this.$oc=a("<div />");this.$ul=a("<ul />");this.$oc.appendTo(this.$c);this.$oc.css("position","absolute").css("overflow","hidden").width(this.$c.width()).height(this.$c.height());
this.$ul.appendTo(this.$oc);this.$ul.css("position","relative");if(this.isVertical==null){if(this.isVertical=this.$c.width()<this.$c.height()){this.mcoor="mouseY";
this.edge="top";this.size="height";this.outerSize="outerHeight";}else{this.mcoor="mouseX";this.edge="left";this.size="width";this.outerSize="outerWidth";
}this.containerSize=this.$oc[this.size]();this.noBufSize=this.containerSize-2*this.config.buffer;this.containerOffset=this.$oc.offset()[this.edge];this.containerPadding=parseInt(this.$c.css("padding-"+this.edge));
}this.listSize=0;if(navigator.userAgent.indexOf("MSIE")!=-1){this.config.seqLoad=false;}this.data.length>0&&this.loadNextThumb();},loadNextThumb:function(){this.thumbCount++;
var d=this.$ul.append("<li></li>").find(":last");if(this.config.mode=="thumbs"){var b=this.data[this.thumbCount].thumb;if(b){this.loaders.push(new a.fn.tn3.ImageLoader(b,this,this.onLoadThumb,[d,this.thumbCount]));
!this.config.seqLoad&&this.thumbCount<this.data.length-1&&this.loadNextThumb();return;}else{this.config.mode="bullets";}}else{if(this.config.mode=="text"){var b=this.data[this.thumbCount].thumb;
d.text(this.data[this.thumbCount].thumbtext);}}this.config.mode=="numbers"&&d.text(this.thumbCount+1);this.onLoadThumb(null,d,this.thumbCount);},onLoadThumb:function(j,g,i,f){this.lis[i]={li:g};
g.addClass(this.config.cssID+"-thumb");g.css("float",this.isVertical?"none":"left");if(j){var h=this.lis[i].thumb=g.append(j).find(":last");this.lis[i].pos=g.position()[this.edge];
}this.config.useTitle&&g.attr("title",this.data[i].title);if(this.config.mode=="thumbs"){this.lis[i].shade=g.prepend("<div/>").find(":first");this.lis[i].shade.css("background-color",this.config.shaderColor).css("width",h.width()).css("height",h.height()).css("position","absolute");
}this.initThumb(i);g.css("opacity",0);g.animate({opacity:1},1000);this.listSize+=g[this.outerSize](true);if(!this.initialized){this.firstToLoad=i;this.initialized=true;
this.initMouse(true);}f&&this.trigger("error",{description:f,n:i});this.trigger("thumbLoad",{n:i});this.nloaded++;if(this.nloaded<this.data.length){if(this.config.seqLoad||this.config.mode!="thumbs"){this.loadNextThumb();
}}else{if(j){this.loaders=null;}if(!this.config.seqLoad){for(j=0;j<this.lis.length;j++){this.lis[j].pos=this.lis[j].li.position()[this.edge];}}this.thumbsLoaded();
}if(this.clickWhenReady==i){this.clickWhenReady=-1;this.thumbClick(i);}},initThumb:function(f){var b=this.lis[f];if(b.li){b.li.removeClass().addClass(this.config.cssID+"-thumb");
if(b.shade){b.shade.stop();b.shade.css("opacity",this.config.shaderOpacity);}var e=this;b.li.click(function(){e.thumbClick(f);e.trigger("click",{n:f});
return false;});this.config.mode!="thumbs"&&b.li.hover(function(){e.mouseOver(f);},function(){e.mouseOver(-1);});}},lastOver:-1,mouseOver:function(d){if(d!=this.lastOver){if(this.lastOver!=-1&&this.lastOver!=this.active){b=this.lis[this.lastOver];
b.li.removeClass(this.config.cssID+"-thumb-over");if(b.shade){b.shade.stop();b.shade.animate({opacity:this.config.shaderOpacity},{duration:this.config.shaderOut,easing:"easeOutCubic",queue:false});
}this.trigger("thumbOut",{n:d});}this.lastOver=d;if(!(d==-1||d==this.active)){var b=this.lis[d];b.li.addClass(this.config.cssID+"-thumb-over");if(b.shade){b.shade.stop();
b.shade.animate({opacity:0},{duration:this.config.shaderDuration,easing:"easeOutCubic",queue:false});}this.trigger("thumbOver",{n:d});}}},next:function(b){if(b){this.listSize>this.containerSize&&this.move(this.$ul.position()[this.edge]-this.containerSize);
}else{b=this.active+1;if(this.active==-1||this.active+1==this.data.length){b=0;}this.thumbClick(b);}},prev:function(b){if(b){this.listSize>this.containerSize&&this.move(this.$ul.position()[this.edge]+this.containerSize);
}else{b=this.active-1;if(this.active==-1||this.active==0){b=this.data.length-1;}this.thumbClick(b);}},move:function(d){var b={};b[this.edge]=Math.min(0,Math.max(d,-(this.listSize-this.containerSize)));
this.$ul.stop();this.$ul.animate(b,300);},thumbClick:function(d){if(this.active==-1){if(this.thumbCount<=d||this.lis.length<=d||this.lis[d]==null){this.clickWhenReady=d;
return;}}else{if(d==this.active){return;}else{this.initThumb(this.active);}}if(d=="next"){d=this.active+1<this.data.length?this.active+1:0;}else{if(d=="prev"){d=this.active>0?this.active-1:this.data.length-1;
}}var b=this.lis[d];b.li.addClass(this.config.cssID+"-thumb-selected").unbind("click mouseenter mouseleave");b.shade&&b.shade.animate({opacity:0},this.config.shaderDuration);
this.active=d;this.centerActive();},centerActive:function(h){if(this.active!=-1){var f=this.lis[this.active].li,g=this.$ul.position()[this.edge]+f.position()[this.edge],e=f[this.outerSize]()/2;
if(g+e>this.containerSize||g+e<0){f=10-f.position()[this.edge]+this.containerSize/2-e;f=Math.min(0,f);f=Math.max(f,-this.listSize+this.containerSize);g={};
g[this.edge]=f;h?this.$ul.css(g):this.$ul.animate(g,200);}}},thumbsLoaded:function(){this.$c.css("cursor","auto");this.$ul.css("width",this.listSize+"px");
this.centerList();this.trigger("load");},centerList:function(d){if(this.listSize<this.containerSize){var b={};b[this.edge]=this.config.align?this.config.align==1?(this.containerSize-this.listSize)/2:this.containerSize-this.listSize:0;
d||this.config.mode!="thumbs"?this.$ul.css(b):this.$ul.animate(b,300);}else{this.centerActive(d);if(this.$ul.position()[this.edge]>0){this.$ul.css(this.edge,0);
}else{this.$ul.position()[this.edge]+this.listSize<this.containerSize&&this.$ul.css(this.edge,-(this.listSize-this.containerSize));}}},initMouse:function(b){if(this.config.mode=="thumbs"){b=b?"bind":"unbind";
this.$oc[b]("mouseenter",a.proxy(this.mouseenter,this));this.$oc[b]("mouseleave",a.proxy(this.mouseleave,this));}},mouseenter:function(){this.trigger("over");
clearInterval(this.intID);var b=this;this.$ul.stop();this.$c.mousemove(this.mcoor=="mouseX"?function(c){b.mouseX=c.pageX-b.containerOffset;}:function(c){b.mouseY=c.pageY-b.containerOffset;
});this.marginDif=parseInt(this.lis[this.firstToLoad].li.css("margin-"+this.edge));if(isNaN(this.marginDif)){this.marginDif=0;}b.intID=this.listSize>this.containerSize&&this.config.overMove?setInterval(function(){b.slide.call(b);
},10):setInterval(function(){b.mouseTrack.call(b);},10);},mouseleave:function(){this.trigger("out");this.$c.unbind("mousemove");clearInterval(this.intID);
var b=this;this.intID=setInterval(function(){b.slideOut.call(b);},10);this.mouseOver(-1);},slide:function(){this.cnt=1;var f=this[this.mcoor];if(f<=this.config.buffer){this.pos=0;
}else{if(f>=this.containerSize-this.config.buffer){this.pos=this.containerSize-this.listSize-1;}else{var b=this.containerSize*(f-this.config.buffer);b/=this.noBufSize;
this.pos=b*(1-this.listSize/this.containerSize);}}for(b=this.lis.length-1;b>-1;b--){var e=f-this.prevdx;if(e>=this.lis[b].pos&&e<this.lis[b].pos+this.lis[b].li.width()){this.mouseOver(b);
break;}}f=this.prevdx-this.marginDif;this.difference=f-this.pos;f=Math.round(f-this.difference/this.config.speed);if(this.prevdx!=f){this.$ul.css(this.edge,f);
this.prevdx=f;}},prevdx:0,mouseTrack:function(){for(var f=this[this.mcoor],b=this.lis.length-1;b>-1;b--){var e=f-this.$ul.position()[this.edge];if(e>=this.lis[b].pos&&e<this.lis[b].pos+this.lis[b].li.width()){this.mouseOver(b);
break;}}},slideOut:function(){if(this.config.slowdown!=0&&this.difference!=0){var b=this.$ul.position()[this.edge];this.difference=b-this.pos;this.$ul.css(this.edge,b-this.difference/(this.config.speed*this.cnt));
this.cnt*=1+4/this.config.slowdown;if(this.cnt>=40){this.difference=0;this.cnt=1;}}else{clearInterval(this.intID);this.intID=null;}},trigger:function(h,f){var g=a.Event("tn_"+h),e;
for(e in f){g[e]=f[e];}g.source=this;this.$c.trigger(g);this.config[h]&&this.config[h].call(this,g);},destroy:function(){clearInterval(this.intID);this.$c.empty();
},rebuild:function(b){clearInterval(this.intID);this.$c.empty();this.data=b;this.active=this.thumbCount=-1;this.nloaded=0;this.initMouse(false);this.loaders!==null&&a.each(this.loaders,function(c,e){e.cancel();
});this.init();},setSize:function(d,b){if(this.config.mode=="thumbs"){this.isVertical?this.$c.height(b):this.$c.width(d);this.$oc.width(this.$c.width()).height(this.$c.height());
this.containerSize=this.$oc[this.size]();this.noBufSize=this.containerSize-2*this.config.buffer;this.containerOffset=this.$oc.offset()[this.edge];this.initMouse(true);
this.loaders===null&&this.centerList(true);}},onWinResize:function(){this.containerOffset=this.$oc.offset()[this.edge];}};})(jQuery);(function(a){a.fn.tn3.altLink=null;
a.fn.tn3.ImageLoader=function(h,f,g,e){this.$img=a(new Image);e.unshift(this.$img);this.altLink=a.fn.tn3.altLink;f={url:h,context:f,callback:g,args:e};
this.$img.bind("load",f,this.load);this.$img.bind("error",f,a.proxy(this.error,this));this.$img.attr("src",h);};a.fn.tn3.ImageLoader.prototype={$img:null,altLink:null,load:function(b){b.data.callback.apply(b.data.context,b.data.args);
b.data.args[0].unbind("load").unbind("error");},error:function(b){if(this.altLink){this.altLink=null;this.$img.attr("src",a.fn.tn3.altLink+b.data.url);
}else{b.data.args.push("image loading error: "+b.data.url);b.data.callback.apply(b.data.context,b.data.args);this.$img.unbind("load").unbind("error");}},cancel:function(){this.$img.unbind("load").unbind("error");
}};})(jQuery);(function(a){a.fn.tn3.Timer=function(f,b,e){this.$target=f;this.duration=b;};a.fn.tn3.Timer.prototype={$target:null,duration:null,id:null,runs:false,counter:null,countDuration:null,tickid:null,ticks:null,tickint:500,start:function(){if(!this.runs){this.runs=true;
this.startCount(this.duration);this.trigger("timer_start");}},startCount:function(f){this.clean();this.countDuration=f;this.counter=+new Date;var b=this;
this.id=setTimeout(function(){b.clean.call(b);b.runs=false;b.trigger.call(b,"timer_end");},f);var e=this.duration/this.tickint;this.ticks=Math.round(f/e);
this.tickid=setInterval(function(){b.ticks=Math.ceil((f-new Date+b.counter)/e);b.ticks>0&&b.trigger.call(b,"timer_tick",{tick:b.ticks,totalTicks:b.tickint});
},e);this.trigger("timer_tick",{tick:this.ticks,totalTicks:this.tickint});},stop:function(){this.clean();this.runs=false;this.trigger("timer_stop");},clean:function(){clearTimeout(this.id);
this.id=null;clearInterval(this.tickid);this.elapsed=this.tickid=null;},elapsed:null,pause:function(d){if(this.runs){if(d){this.clean();var b=this.duration/this.tickint;
this.elapsed=Math.floor((+new Date-this.counter)/b)*b;}else{if(this.elapsed==null){return;}this.startCount(this.countDuration-this.elapsed);this.elapsed=null;
}this.trigger("timer_pause",{pause:d});}},trigger:function(h,f){var g=a.Event(h),e;for(e in f){g[e]=f[e];}this.$target.trigger(g);}};})(jQuery);(function(a){a.fn.tn3.Albums=function(f,b,e){this.data=f;
this.$c=b;this.$in=b.find("."+e+"-inalbums");this.cssID=e;this.$a=this.$in.find("."+this.cssID+"-album");this.n=0;this.initValues={width:b.width(),height:b.height(),aw:this.$a.width(),ah:this.$a.height(),inw:this.$in.width(),inh:this.$in.height()};
this.pad=parseInt(this.$in.css("padding-left"));};a.fn.tn3.Albums.prototype={data:null,$c:null,$in:null,$a:null,initValues:null,p:null,aw:null,ah:null,cssID:null,coors:null,ctrl_next:null,ctrl_prev:null,n:null,selected:null,pad:null,enabled:false,space:null,getButtons:function(){this.$in.empty();
var f=[];$cur=this.$a.clone();$cur.appendTo(this.$in);this.space=this.space===null?this.pad:this.space;var b=this.$in.width()-2*this.pad;this.$in.height();
var e=Math.floor(b/this.initValues.aw);this.aw=Math.floor((b-(e-1)*this.space)/e);this.ah=this.initValues.ah;for(e=b=this.pad;e+this.ah<this.$in.height();
){for(;b+this.aw<this.$in.width();){f.push($cur);$cur.css("left",b).css("top",e);$cur.width(this.aw).height(this.ah);$cur.hide();$cur=this.$a.clone();$cur.appendTo(this.$in);
b+=this.aw+this.space;}e+=this.ah+this.space;b=this.pad;}$cur.remove();return f;},show:function(v,x,u,w){this.$c.show();this.enabled=true;if(v==undefined){v=0;
}else{if(v=="next"){v=this.n+1<this.data.length?this.n+1:0;}else{if(v=="prev"){v=this.n>0?this.n-1:this.data.length-1;}}}if(x!=undefined){this.selected=x;
}var t,s,p=this.getButtons();if(w&&x!==null){for(;p.length*(v+1)<x;){v++;}}var q=this;x=v*p.length;w=Math.min(this.data.length,(v+1)*p.length);this.trigger("init");
for(var f=x;f<w;f++){var r=this.data[f];if(!r.title){r.title="Unknown";}t=p[f-x];s='<div class="'+this.cssID+'-album-image"></div>';s+='<div class="'+this.cssID+'-album-title">'+r.title+"</div>";
if(r.description){s+='<div class="'+this.cssID+'-album-description">'+r.description+"</div>";}t.html(s);new a.fn.tn3.ImageLoader(r.thumb,this,this.onThumbLoad,[t.find("."+this.cssID+"-album-image")]);
t.data("tn3",f);this.trigger("binit",{$a:t});t.click(function(){var b=a(this).data("tn3");if(b==q.selected){q.$c.hide();q.trigger("close");}else{q.trigger("click",{n:b});
}}).hover(function(){a(this).addClass(q.cssID+"-album-over");},function(){a(this).removeClass(q.cssID+"-album-over");});f==this.selected&&t.addClass(this.cssID+"-album-selected");
}t=f%p.length;if(t!=0){for(s=p.length-1;s>=t;s--){p.splice(s,1);}}this.n=v;if(u){a.each(p,function(b){p[b].show();});}else{var l=800/p.length;this.$c.slideDown(v==0?300:0,function(){a.each(p,function(b){p[b].delay(b*l).fadeIn(150);
});});}this.ctrl_prev&&this.enablePageControl("prev",x>0);this.ctrl_next&&this.enablePageControl("next",w<this.data.length);if(this.ctrl_close){this.ctrl_close.css("display",this.selected===null?"none":"inline");
}},onThumbLoad:function(f,b,e){e&&this.trigger("error",{description:e});b.prepend(f);},hide:function(){this.$c.hide();this.enabled=false;},enablePageControl:function(h,f){var g=this["ctrl_"+h];
if(f){if(!g.data("active")){var e=this;g.click(function(b){e.show(h);b.stopPropagation();}).hover(function(){a(this).addClass(e.cssID+"-albums-"+h+"-over");
},function(){a(this).removeClass(e.cssID+"-albums-"+h+"-over");});g.data("active",true);}}else{g.removeClass(this.cssID+"-albums-"+h+"-over");g.unbind();
g.data("active",false);}},setControl:function(f,b){if(f=="close"){var e=this;b.click(function(c){e.$c.hide();e.trigger("close");c.stopPropagation();});
}this["ctrl_"+f]=b;},trigger:function(h,f){var g=a.Event("albums_"+h),e;for(e in f){g[e]=f[e];}g.source=this;this.$c.trigger(g);},changeSize:function(d,b){this.$c.width(this.initValues.width+d).height(this.initValues.height+b);
this.$in.width(this.initValues.inw+d).height(this.initValues.inh+b);this.$c.css("display")!="none"&&this.show(undefined,undefined,true);},select:function(){}};
})(jQuery);(function(d){var e=d.fn.tn3.Transitions=function(l,a,k,h,c){this.ts=l;this.def=d.extend(true,{},this[a.type+"Config"],a);if(!l){this.ts=[this.def];
}for(var f in this.ts){this.ts[f]=d.extend(true,{},this[this.ts[f].type+"Config"],this.ts[f]);}this.random=k;this.end=d.proxy(h,c);},b=e.prototype={ts:null,def:{type:"slide"},random:false,gs:[],end:null,ct:null,counter:-1,setTransition:function(){if(this.ts.length==1){this.ct=this.ts[0];
}else{this.counter++;if(this.counter==this.ts.length){this.counter=0;}this.random&&this.counter==0&&d.fn.tn3utils.shuffle(this.ts);this.ct=this.ts[this.counter];
}},start:function(f,a,c){this.setTransition();if(this[this.ct.type+"Condition"]!==undefined&&!this[this.ct.type+"Condition"](f,a,this.ct)){this.ct=this.def;
}this[this.ct.type](f,a,this.ct,c);},stop:function(c,a){this[this.ct.type+"Stop"](c,a,this.ct);},makeGrid:function(C,D,B){var A=C.width(),x=Math.round(A/D);
A=A-x*D;var y=C.height(),t=Math.round(y/B);y=y-t*B;var z,w,v,f,c,a=0,F=0,E="url("+C.find("img").attr("src")+") no-repeat scroll -";for(z=0;z<D;z++){this.gs[z]=[];
f=A>z?x+1:x;for(w=0;w<B;w++){v=C.append("<div></div>").find(":last");c=y>w?t+1:t;v.width(f).height(c).css("background",E+a+"px -"+F+"px").css("left",a).css("top",F).css("position","absolute");
this.gs[z].push(v);F+=c;}a+=f;F=0;}C.find("img").remove();},stopGrid:function(){for(var c=0;c<this.gs.length;c++){for(var a=0;a<this.gs[c].length;a++){this.gs[c][a].clearQueue();
this.gs[c][a].remove();}}this.gs=[];},flatSort:function(h){for(var a=[],f=0;f<this.gs.length;f++){for(var c=0;c<this.gs[f].length;c++){a.push(this.gs[f][c]);
}}h&&a.reverse();return a;},randomSort:function(){var a=this.flatSort();d.fn.tn3utils.shuffle(a);return a;},diagonalSort:function(i,a){for(var h=[],f=i>0?this.gs.length-1:0,c=a>0?0:this.gs[0].length-1;
this.gs[f];){h.push(this.addDiagonal([],f,c,i,a));f-=i;}f+=i;for(c+=a;this.gs[f][c];){h.push(this.addDiagonal([],f,c,i,a));c+=a;}return h;},addDiagonal:function(i,a,h,f,c){i.push(this.gs[a][h]);
return this.gs[a+f]&&this.gs[a+f][h+c]?this.addDiagonal(i,a+f,h+c,f,c):i;},circleSort:function(r){var c=[],q=this.gs.length,p=this.gs[0].length,f=[Math.floor(q/2),Math.floor(p/2)];
q=q*p;p=[[1,0],[0,1],[-1,0],[0,-1]];var k=0,a=0,l;for(c.push(this.gs[f[0]][f[1]]);c.length<q;){for(l=0;l<=k;l++){this.addGridPiece(c,f,p[a]);}if(a==p.length-1){a=0;
}else{a++;}k+=0.5;}r&&c.reverse();return c;},addGridPiece:function(f,a,c){a[0]+=c[0];a[1]+=c[1];this.gs[a[0]]&&this.gs[a[0]][a[1]]&&f.push(this.gs[a[0]][a[1]]);
},getSlidePositions:function(f,a){var c={dir:a};switch(a){case"left":c.pos=f.outerWidth(true);break;case"right":c.pos=-f.outerWidth(true);c.dir="left";
break;case"top":c.pos=-f.outerHeight(true);break;case"bottom":c.pos=f.outerHeight(true);c.dir="top";}return c;},animateGrid:function(u,v,t,s,p,q,a){var r={duration:s,easing:t,complete:function(){d(this).remove();
}};for(t=0;t<u.length;t++){s=d.easing[p](0,t,0,q,u.length);if(t==u.length-1){var f=this;r.complete=function(){d(this).remove();a.call(f);};}if(d.isArray(u[t])){for(var c in u[t]){u[t][c].delay(s).animate(v[t],r);
}}else{u[t].delay(s).animate(v[t],r);}}},getValueArray:function(p,c,l){var k=[],f=d.isArray(c),h=d.isArray(l),a;for(a=0;a<p;a++){o={};o[f?c[a%c.length]:c]=h?l[a%l.length]:l;
k.push(o);}return k;}};e.defined=[];e.define=function(c){for(var a in c){switch(a){case"type":e.defined.push(c.type);break;case"config":b[c.type+"Config"]=c.config;
break;case"f":b[c.type]=c.f;break;case"stop":b[c.type+"Stop"]=c.stop;break;case"condition":b[c.type+"Condition"]=c.condition;break;default:b[a]=c[a];}}};
e.define({type:"none",config:{},f:function(){this.end();},stop:function(){this.end();}});e.define({type:"fade",config:{duration:300,easing:"easeInQuad"},f:function(h,a,f){var c=this;
h.animate({opacity:0},f.duration,f.easing,function(){c.end();});},stop:function(a){a.stop();this.end();}});e.define({type:"slide",config:{duration:300,direction:"auto",easing:"easeInOutCirc"},f:function(l,a,k,h){h=this.getSlidePositions(a,k.direction=="auto"?h:k.direction);
var c={},f={};a.css(h.dir,h.pos);c[h.dir]=0;a.animate(c,k.duration,k.easing,this.end);f[h.dir]=-h.pos;l.animate(f,k.duration,k.easing);},stop:function(c,a){a.stop();
c.stop();c.css("left",0).css("top",0);a.css("left",0).css("top",0);this.end();}});e.define({type:"blinds",config:{duration:240,easing:"easeInQuad",direction:"vertical",parts:12,partDuration:100,partEasing:"easeInQuad",method:"fade",partDirection:"auto",cross:true},f:function(i,a,h,f){h.direction=="horizontal"?this.makeGrid(i,1,h.parts):this.makeGrid(i,h.parts,1);
f=h.partDirection=="auto"?f:h.partDirection;i=this.flatSort(f=="left"||f=="top");var c;switch(h.method){case"fade":c=this.getValueArray(i.length,"opacity",0);
break;case"scale":c=this.getValueArray(i.length,f=="left"?"width":"height","1px");break;case"slide":a=this.getSlidePositions(a,f);c=this.getValueArray(i.length,a.dir,h.cross?[a.pos,-a.pos]:a.pos);
}this.animateGrid(i,c,h.partEasing,h.partDuration,h.easing,h.duration,this.blindsStop);},stop:function(){this.stopGrid();this.end();},condition:function(c,a){return !c.data("scaled")||!a.data("scaled");
}});e.define({type:"grid",config:{duration:260,easing:"easeInQuad",gridX:7,gridY:5,sort:"diagonal",sortReverse:false,diagonalStart:"bl",method:"fade",partDuration:300,partEasing:"easeOutSine",partDirection:"left"},f:function(l,a,k,h){this.makeGrid(l,k.gridX,k.gridY);
l=k.partDirection=="auto"?h:k.partDirection;var c,f;if(k.sort=="diagonal"){switch(k.diagonalStart){case"tr":c=this.diagonalSort(1,1);break;case"tl":c=this.diagonalSort(-1,1);
break;case"br":c=this.diagonalSort(1,-1);break;case"bl":c=this.diagonalSort(-1,-1);}}else{c=this[k.sort+"Sort"](k.sortReverse);}switch(k.method){case"fade":f=this.getValueArray(c.length,"opacity",0);
break;case"scale":f=this.getValueArray(c.length,l=="left"?"width":"height","1px");}this.animateGrid(c,f,k.partEasing,k.partDuration,k.easing,k.duration,this.gridStop);
},stop:function(){this.stopGrid();this.end();},condition:function(c,a){return !c.data("scaled")||!a.data("scaled");}});})(jQuery);(function(q){function t(d){var b=d&&d.message!==undefined?d.message:undefined;
d=q.extend({},q.tn3block.defaults,d||{});b=b===undefined?d.message:b;h&&v({});var a=d.baseZ,g=q.browser.msie||d.forceIframe?q('<iframe class="blockUI" style="z-index:'+a+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+d.iframeSrc+'"></iframe>'):q('<div class="blockUI" style="display:none"></div>'),f=q('<div class="blockUI '+d.cssID+'-overlay" style="z-index:'+a+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
a=q('<div class="blockUI '+d.blockMsgClass+' blockPage" style="z-index:'+a+';display:none;position:fixed"></div>');a.css("left","0px").css("top","0px");
if(!d.applyPlatformOpacityRules||!(q.browser.mozilla&&/Linux/.test(navigator.platform))){f.css(d.overlayCSS);}f.css("position","fixed");if(q.browser.msie||d.forceIframe){g.css("opacity",0);
}var e=[g,f,a],c=q("body");q.each(e,function(){this.appendTo(c);});e=k&&(!q.boxModel||q("object,embed",null).length>0);if(l||e){d.allowBodyStretch&&q.boxModel&&q("html,body").css("height","100%");
q.each([g,f,a],function(j,i){var m=i[0].style;m.position="absolute";if(j<2){m.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight)- (jQuery.boxModel?0:"+d.quirksmodeOffsetHack+') + "px"');
m.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');}else{if(d.centerY){m.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2- (this.offsetHeight / 2)+ (blah = document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop)+ "px"');
m.marginTop=0;}else{d.centerY||m.setExpression("top",'(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
}}});}if(b){b.data("blockUI.parent",b.parent());a.append(b);if(b.jquery||b.nodeType){q(b).show();}}if((q.browser.msie||d.forceIframe)&&d.showOverlay){g.show();
}d.showOverlay&&f.show();b&&a.show();d.onBlock&&d.onBlock();u(1,d);h=b;}function v(b){b=q.extend({},q.tn3block.defaults,b||{});u(0,b);var a=q("body").children().filter(".blockUI").add("body > .blockUI");
s(a,b);}function s(b,a){b.each(function(){this.parentNode&&this.parentNode.removeChild(this);});h.data("blockUI.parent").append(h);h=null;typeof a.onUnblock=="function"&&a.onUnblock.call(a.con);
}function u(b,a){if(b||h){!a.bindEvents||b&&!a.showOverlay||(b?q(document).bind("mousedown mouseup keydown keypress",a,r):q(document).unbind("mousedown mouseup keydown keypress",r));
}}function r(b){var a=b.data;if(q(b.target).parents("div."+a.blockMsgClass).length>0){return true;}return q(b.target).parents().children().filter("div.blockUI").length==0;
}var p=document.documentMode||0,k=q.browser.msie&&(q.browser.version<8&&!p||p<8),l=q.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!p;q.tn3block=function(a){t(a);
};q.tn3unblock=function(a){v(a);};var h=undefined;q.tn3block.defaults={message:"<h1>Please wait...</h1>",overlayCSS:{},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,allowBodyStretch:true,bindEvents:true,showOverlay:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",cssID:"tn3"};
})(jQuery);(function(a){(a.fn.tn3.External=function(f,b){if(f){this.context=b;this.reqs=f.length;for(var e=0;e<f.length;e++){new a.fn.tn3.External[f[e].origin](f[e],this);
}}}).prototype={context:null,reqs:0,getImages:function(d,b){d.origin.getImages(d,b);},setAlbumData:function(d,b){this.reqs--;this.context.setAlbumData.call(this.context,d,b);
},setImageData:function(f,b,e){this.context.setImageData.call(this.context,f,b,e);},getAlbumData:function(b){return this.context.data[b];}};})(jQuery);
(function(a){var b=a.fn.tn3.External;b.xml=function(c,e){this.extcon=e;this.config=a.extend(true,{},b.xml.config,c);this.init();};b.xml.config={url:"",thumb_size:1,image_size:0};
b.xml.prototype={config:null,extcon:null,getImages:function(){},init:function(){this.request();},request:function(){a.ajax({url:this.config.url,cache:false,context:this,success:function(c){this.extcon.setAlbumData(this.parseXML(c));
},error:function(){this.extcon.setAlbumData([],"XML loading failed");}});},parseXML:function(f){try{var p=[],c=this,m,l,h;a(f).find(":first").children().each(function(d,e){m=a(this);
p[d]={};p[d].adata={id:d,origin:c};l=m.find("file_root").text();c.setProps(e,p[d],l);p[d].imgs=[];delete p[d].images;m.find("images > image").each(function(i,g){h=p[d].imgs[i]={};
c.setProps(g,h,l);});});}catch(k){this.extcon.setAlbumData([],"XML parsing error");}return p;},setProps:function(f,h,c){var g;a(f).children().each(function(e,d){if(d.firstChild){g=d.firstChild.nodeValue;
n=d.tagName;if(n.substring(n.length-3)=="src"){g=c+g;if(n=="image_src"){n="img";}else{if(n=="thumb_src"){n="thumb";}}}h[n]=g;}});if(!h.thumb){h.thumb=this.getThumb(h.img,this.config.thumb_size);
}if(this.config.image_size>0){h.img=this.getThumb(h.img,this.config.image_size);}},getThumb:function(f,j){if(!(!f||f=="")){if(j==undefined){j=1;}else{if(j==0){return f;
}}var c=f.split("/"),i=c.pop().split("."),h=i.pop().toString();h=i.join(".")+"_"+j+"."+h.toLowerCase();return f=c.join("/")+"/thumbs/"+h;}}};})(jQuery);

//.tn3g.imager.active);
//.tn3g.imager.show("1");
var gallerycontroller = {
	galleryArray : [], //array
	skin : "custom",
	tagMethod : "hover", //click, hover, none
	tagAnimation : "fade", //direct, fade
	tagMultiple : false //allow multeple active tags
};
/* http://www.tn3gallery.com/userguide/ */
gallerycontroller.init = function(details) {
	var that = this;

	$container = $(details.container);
	if($container.length < 1) return false;
	if($container.children().length > 0) {
		if(!$container.children(":first").hasClass("tn3")) return false;
	}
	if(details.skin != undefined) this.skin = details.skin;
	if(details.tagMethod != undefined) this.tagMethod = details.tagMethod;
	if(details.tagAnimation != undefined) this.tagAnimation = details.tagAnimation;
	if(details.tagMultiple != undefined) this.tagMultiple = details.tagMultiple;

	this.galleryArray[this.galleryArray.length] = $container.tn3({
    skinDir	 		: "/"+globalref+"style/gallery",
    skin 				: this.skin,
    delay				: details.delay || 8000,
    autoplay 		: true,
    mouseWheel 	: false,
    timerMode 	: "bar", //bar, chart
    imageClick 	: "", //fullscreen, next, url
    image 			: {
										maxZoom: 5,
										crop: details.crop || false,
										clickEvent:"dblclick",
										transitions:[{
									    type: "fade",
									    easing: "easeInQuad",
									    duration: 300
										}]
    },
    inactive		: details.inactive || ["fullscreen","show-albums"],
    thumbnailer : {
										overMove: false,
										align: 2,
										mode: "bullets"  
    }
	});
};

gallerycontroller.setImages = function(galleryNum, newImages) {
	var that = this;
	var newImages = newImages || false;

	if(!newImages) {
		//return img
		var returnImages = [];
		$.each(this.galleryArray[galleryNum].tn3g.data[0].imgs, function(index, photo) {
			returnImages.push(photo.img);
		});
		return returnImages;
	}
	else {
		$currentImageContainer = that.galleryArray[galleryNum].container.find("."+this.skin+"-full-image");
		$currentImage = $currentImageContainer.children("img");
		//update img and thumb
		$.each(this.galleryArray[galleryNum].tn3g.data[0].imgs, function(index, photo) {
			currentImageNum = false;
			if(index < newImages.length) {
				//is current image, refresh
				if($currentImage.attr("src") == that.galleryArray[galleryNum].tn3g.data[0].imgs[index].img) {
					currentImageNum = index;
					
					$c = that.galleryArray[galleryNum].container;
					rW = parseInt($currentImage.attr("width")) / $c.outerWidth();
					rH = parseInt($currentImage.attr("height")) / $c.outerHeight();
					rW < rH ? rI = Math.pow(rW,-1) : rI = Math.pow(rH,-1);
					iW = Math.round(parseInt($currentImage.attr("width"))*rI);
					iH = Math.round(parseInt($currentImage.attr("height"))*rI);
					$currentImage
						.attr("src", newImages[index])
						.attr("width", iW)
						.attr("height", iH);
					$currentImageContainer
						.css({
							'left':Math.round(($c.outerWidth()-iW)/2)+"px",
							'top':Math.round(($c.outerHeight()-iH)/2)+"px" }); 
				}
				//set new src url
				that.galleryArray[galleryNum].tn3g.data[0].imgs[index].thumb = that.galleryArray[galleryNum].tn3g.data[0].imgs[index].img = newImages[index];
				//remove iscached param
				if(that.galleryArray[galleryNum].tn3g.imager.cached[index] != undefined) {
					if(that.galleryArray[galleryNum].tn3g.imager.cached[index].init == false) {
						that.galleryArray[galleryNum].tn3g.imager.cached[index] = undefined;
						//prevent load next image
						that.galleryArray[galleryNum].tn3g.imager.show(that.galleryArray[galleryNum].tn3g.imager.active);
				}	}
			}
		});
		if(currentImageNum <= that.galleryArray[galleryNum].tn3g.imager.active) showImageNum = currentImageNum;
		else if(currentImageNum > that.galleryArray[galleryNum].tn3g.imager.active) showImageNum = that.galleryArray[galleryNum].tn3g.imager.active;
		else showImageNum = 0;

		that.galleryArray[galleryNum].tn3g.imager.show(showImageNum);
	}
};

gallerycontroller.editContent = function(ID, type, details) {
	details = details || {};
	width = details.width || null;
	height = details.height || null;

	shadowboxcontroller.shadow({
		player: "iframe",
		content: "/"+globalref+"do/?incA=editor&incB=editor&editor=photo&action=edit&ID="+ID+"&type="+type, 
		modal: true,
		width: width,
		height: height
	});
};

gallerycontroller.toggleTag = function(obj) {
	var that = this;
	var $obj = $(obj);
	var $objTag = $obj.closest(".tag");

	var galleryIndex = false;
	$.each(this.galleryArray, function(index, gallery) {
		if($obj.closest(".gallery").data("gallery") == gallery.container.data("gallery")) galleryIndex = index;
	});

	//close other tags
	if(!this.tagMultiple && !$objTag.hasClass("active")) {
		$objTag.siblings(".tag.active").find(".tag-hitzone").trigger("click");
	}

	switch(this.tagMethod) {
		case "hover":
			switch(that.tagAnimation) {
				case "direct":
					$obj.siblings().show();
					$objTag.addClass("active");
					$obj.mouseleave(function() {
						$objTag.removeClass("active");
						$obj.siblings().hide();
						$obj.unbind("mouseleave");
					})
					break;

				case "fade":
					$obj.siblings().stop(true,true).fadeIn(200);
					$objTag.addClass("active");
					$obj.mouseleave(function() {
						$objTag.removeClass("active");
						$obj.siblings().stop(true,true).fadeOut(200);
						$obj.unbind("mouseleave");
					})
					break;
			}
		break;

		case "click":
			switch(that.tagAnimation) {
				case "direct":
					if($obj.next().is(":visible")) {
						$objTag.addClass("active");
						$obj.siblings().show();
					}
					else {
						$objTag.removeClass("active");
						$obj.siblings().hide();
					}
					break;

				case "fade":
					if($obj.next().is(":visible")) {
						$objTag.removeClass("active");
						$obj.siblings().stop(true,true).fadeOut(200);
					}
					else {
						$objTag.addClass("active");
						$obj.siblings().stop(true,true).fadeIn(200);
					}
					break;
			}
		break;
	}

	//set active
	if($obj.parent().parent().hasClass("active")) {
		this.galleryArray[galleryIndex].memoryPlaying = this.galleryArray[galleryIndex].tn3g.isPlaying;
		this.galleryArray[galleryIndex].tn3g.timer.pause(true);
	}
	else if(this.galleryArray[galleryIndex].memoryPlaying && $obj.parent().parent().siblings(".active").length == 0) {
		this.galleryArray[galleryIndex].tn3g.timer.pause(false);
	}
};
//enable prototype property
$.fn.translate = function() {
  if(this.length == 2) return languagecontroller.translate(this[0], this[1]);
  else return languagecontroller.translate(this["selector"], []);
};

function tr() { }
tr.str = function(message, details) {
  if(details == undefined) details = [];
  return languagecontroller.translate(message, details);
}

var languagecontroller = { 
  selectedLanguage : "EN",
  languageStrings : {}
};
languagecontroller.init = function(details) {
  this.selectedLanguage = details.selectedLanguage || "NL";
};
/* basic translation */
languagecontroller.translate = function(message, details) {
  if(details == undefined) details = [];
  if(this.languageStrings[this.selectedLanguage] == undefined) this.languageStrings[this.selectedLanguage] = {};
  var translation = this.languageStrings[this.selectedLanguage][message];
 
  //no message
  if(!translation || typeof(translation) == undefined) { translation = message; }
  //translate, incl params
  if(details && translation != "") {
    stringParams = translation.match(/\{[0-9]*\}/g);
    if(stringParams) {
      for(var i = 0; i < stringParams.length; i++) {
        paramNum = stringParams[i].match(/\d+/g);
        paramTag = "{"+paramNum+"}";
        if(details[paramNum]) {
          paramValue = details[paramNum] || "";
          translation = translation.replace(paramTag, paramValue);
        }
  } } }
  return translation;
};

var listcontroller = {
	listArray : {} //array
};
listcontroller.init = function(details) {
	this.initEffect();
};
listcontroller.createList = function(details) {
	if(details.listNum) this.listArray[details.listNum] = new listObj(details);
	else this.listArray[this.listArray.length] = new listObj(details);
};
/* MASTER RESET CHART (object) */
listcontroller.resetList = function() {
	this.listArray = {};
};

listcontroller.initEffect = function() {
	var that = this;

	//pager
	$("ul[data-list]").each(function() {
		$list = $(this);
		
		var listType = $list.data("list");
		var listId = listType+"_"+Math.floor(Math.random()*9999);
		$list.wrap("<div id=\"list_"+listId+"\"></div>");

		var listSettings = "";
		if(listType == "animated") {
			listSettings = { };
		}
    listcontroller.createList({ 
			listContainer : "list_"+listId,
      listcontroller : listcontroller,
      listSettings : listSettings
    });
    $("#list_"+listId).selectivizr();
		if(typeof(windowcontroller) != "undefined") windowcontroller.resize(); 
	});
};

/* ------------------------------ */
/* -------- list object -------- */
/* ------------------------------ */

function listObj(details) { 
	var that = this;
	this.rendered = false;
	this.listContainer = $("#"+details.listContainer); //container

	this.listSettings = details.listSettings || []; //object
	this.listcontroller = details.listcontroller; //object
	this.list = this.listContainer.find("ul"); //object
	this.listWrapper; //html

	this.animation = this.list.data("animation") || "fade";
	this.step = this.list.data("step") || 1;
	this.limit = this.list.data("limit") || 1;
	if(this.limit == "NONE") this.limit = this.list.children().length;
	this.autoPlay = this.list.data("autoplay") || false;
	this.speed = this.list.data("speed") || 6000;
	this.disableControls = this.list.data("disablecontrols") || false;

	//init
	this.init(); 
	//is done
	this.rendered = true;
}

listObj.prototype.init = function() { 
	var that = this;

	this.build(); //set HTML

	if(!this.disableControls) {
		this.renderControls(); //set HTML controls
		this.bindControls(); //set JS controls functions
	}
	if(this.autoPlay) {
		this.t = setInterval(function() { that.showItem("next"); }, this.speed);
	}
};

/* BUILD HTML controlls en wrapper toevoegen */
listObj.prototype.build = function() {
	var that = this;

	//wrap as a whole
	if(this.listWrapper == undefined) {
		this.listContainer
			.addClass("list")
			.wrap("<div class=\"listwrapper\"></div>")
		this.listWrapper = this.listContainer.parent(".listwrapper");
	}

	//set list width equal to sum of all items
	if(this.animation == "scroll") {
		w = 0;
		this.list.children().each(function() { w += $(this).outerWidth(); });
		this.list.css({'width':w+"px",'position':"absolute"});
	}

	this.list.children("li").hide();
	this.showItem();
};

/* CONTROLS html, js, update */
listObj.prototype.renderControls = function() {
	var that = this;

	//add controls
	var controlOptions = "";
	if(this.listSettings.flippable) {
		this.flipMode = "0";
		this.numHeadRows = [this.list.find("thead").find("tr").length,1];
		controlOptions += "<div class=\"flip\" data-listcontrol=\"flip\">"+tr.str("flip list")+"</div>";
	}
	if(top === self) controlOptions += "<div class=\"prev\" data-listcontrol=\"prev\">"+tr.str("prev li")+"</div>";
	controlOptions += "<div class=\"next\" data-listcontrol=\"next\">"+tr.str("next li")+"</div>";
	var controlsHtml = "<div data-listcontrols=\"1\" class=\"listcontrols\">"+controlOptions+"</div>";
	this.listWrapper.prepend(controlsHtml);

	this.listcontrolsContainer = this.listContainer.parent(".listwrapper").find("div[data-listcontrols]");
};
listObj.prototype.bindControls = function() {
	var that = this;
	this.listcontrolsContainer.find("div[data-listcontrol]").each( function() {
		$this = $(this);
		var controlType = $this.data("listcontrol");
		var controlOption = "";
		switch(controlType) {
			case "prev":
				$this.click( function() { 
					if(that.autoPlay) {
						if(that.t) clearInterval(that.t);
						that.t = setInterval(function() { that.showItem("next"); }, that.speed);
					}
					that.showItem("prev");
				});
				break; 

			case "next":
				$this.click( function() { 
					if(that.autoPlay) {
						if(that.t) clearInterval(that.t);
						that.t = setInterval(function() { that.showItem("next"); }, that.speed);
					}
					that.showItem("next");
				});
				break;
		}
	});
};
listObj.prototype.showItem = function(n) {
	var that = this;
	//this.animation = this.list.data('animation') || 'fade';
	//this.step = this.list.data('step') || 1;
	switch(n) {
		case "prev":
			switch(this.animation) {
				case "fade":
					this.list.children("li:lt("+(this.step)+")")
						.stop(true,true)
						.fadeOut(300, function() {
							that.list.children("li:gt("+(that.list.children().length-that.step-1)+")")
								.prependTo(that.list)
								.parent().selectivizr();
							that.list.children("li:lt("+(that.limit+that.step-1)+")").stop(true,true).fadeIn(300);
						});
					break;
				case "scroll":
					//get sum width of items to hide
					w = 0;
					this.list.children("li:gt("+(that.list.children().length-that.step-1)+")").each(function() { w += $(this).outerWidth(); });
					this.list.children("li:gt("+(that.list.children().length-that.step-1)+")")
						.prependTo(that.list)
						.parent().selectivizr();

					this.list
						.stop(true,true)
						.css({'left': (w*-1)+"px"})
						.animate({ left: "0px" }, 
						250, function() { 
						});
					break;
			}
			break;

		case "next":
			this.list.children().first()

			switch(this.animation) {
				case "fade":
					this.list.children("li:lt("+(this.step)+")")
						.stop(true,true)
						.fadeOut(300, function() {
							that.list.children("li:lt("+(that.step)+")")
								.appendTo(that.list)
								.parent().selectivizr();
							that.list.children("li:lt("+(that.limit+that.step-1)+")").stop(true,true).fadeIn(300);
						});
					break;
				case "scroll":
					//get sum width of items to hide
					w = 0;
					this.list.children("li:lt("+(this.step)+")").each(function() { w += $(this).outerWidth(); });

					this.list
						.stop(true,true)
						.animate({ left: (w*-1)+"px" }, 
						250, function() { 
							that.list.css({'left': 0});
							that.list.children("li:lt("+(that.step)+")")
								.appendTo(that.list)
								.parent().selectivizr();
						});
					break;

			}
			break;

		default:
			this.list.children("li:lt("+(this.limit)+")").show();
			break;
	}
	this.list.parent().selectivizr();
}
var menucontroller = {};
menucontroller.init = function(obj, currentId, masterId) {
	var that = this;
	$container = obj;
	
	this.markActive(currentId, masterId);
	
	//has submenu
	$container.find("li").each( function() {
		$li = $(this);

		if($li.children("ul").size() > 0 ) {
			$li
				.children("a").each( function() { //child A element
					if(!$(this).attr("href")) { //zonder link
						$(this).unbind("click").click( function() {
							that.toggleMenu(this);
						});
					}
				});
			//niet actieve en niet de parent	
			if(!$li.hasClass("active") && $li.data("mlvl") != 0) {
				$li.children("ul").hide();
		}	}
	});
};

menucontroller.markActive = function(currentId, masterId, disable) {
	var disable = disable || false;

	//menu marking
	var active_mlvl = $("a.mid[data-id="+currentId+"]").closest("li[data-mlvl]").data("mlvl");
	if(disable) $("a.mid[data-id="+currentId+"]").removeAttr("href");
	for(var i = active_mlvl; i > 0; i--) {
		//parents en eigen item van master en actief item krijgen klassen 'active'
		$("a.mid[data-id="+currentId+"]").closest("li[data-mlvl="+i+"]").addClass("active");		
		$("a.mid[data-id="+masterId+"]").closest("li[data-mlvl="+i+"]").addClass("active");		
	}
};

menucontroller.toggleMenu = function(obj) {
	$parentlistobj = $(obj).parent("li");
	//collapse
	if($parentlistobj.hasClass("opened") == true) {
		$parentlistobj
			.removeClass("opened")
			.addClass("closed")
			.children("ul").hide();
	}
	//extend
	else {
		$parentlistobj
			.addClass("opened")
			.removeClass("closed")
			.children("ul").show();
	}
};
				
var pagecontroller = {};
pagecontroller.init = function() {
	var that = this;
	this.elementID = 0;
	this.build();
};

pagecontroller.build = function() { 
	var that = this;
	this.buildElementSwitch();
}

pagecontroller.buildElementSwitch = function() { 
	var that = this;
	//iedere set
	$("div[data-set]").each(function() {
		var $container = $(this);
		//voeg elementhead toe
		var elementlistHtml = "";

		//bij meer dan 1 element de 'tab opts' genereren
		if($container.find("div[data-element]").length > 1) { 
			$container.find("div[data-element]").each(function() {
				var $element = $(this);
				that.elementID++; //element ID (over hele pagina)

				var style = "";
				if($element.hasClass("active")) style += "active "; //markeer als 'open' (via html)
				if($element.hasClass("offline")) style += "offline "; //markeer als 'open' (via html)

				var elementReference = $element.data("element");
				var elementTitel = elementReference;
				if(elementTitel == "[CONTENT]") {
					elementTitel = $element.html();
				}

				elementlistHtml += "<li class=\""+style+"\"> <a id=\""+that.elementID+"\" onclick=\"pagecontroller.switchElement("+that.elementID+");\" data-elementreference=\""+elementReference+"\">"+elementTitel+"</a> </li>";
				//hide
				setTimeout(function() { $element.hide(); }, 1);
			});
		}
		var setstyle = $container.data("style");
		//remove script tags
		$container.find("script").remove();
		//wrap
		$container.wrap("<div class=\"setcontainer "+setstyle+"\"></div>");
		//bij meer dan 1 element de 'tab opts' toevoegen
		if(elementlistHtml) $container.before("<div class=\"elementswitch\" data-elementswitch=\"1\"><ul>"+elementlistHtml+"</ul></div>");
	});

	//activeren elements	
	$("div[data-elementswitch]").each(function() {
		var $this = $(this);
		//tab opts. verbergen bij minder dan 2 (zou sowieso niet moeten bestaan)
		if($this.find("li").length < 2) $this.hide();

		//activeren
		//prio open
		setTimeout(function() { 
			if($this.find("li.active")[0]) $this.find("li.active").children("a").trigger("click");
			//default open
			else $this.find("li").first().children("a").trigger("click");
		 }, 1);
	});
}

pagecontroller.switchElement = function(elementID) {
	var $element = $("#"+elementID);
	var elementReference = $element.data("elementreference");
	//mark element
	$element
		.parent("li")
			.addClass("active")
			.siblings()
				.removeClass("active");
	//show content
	var $content = $element.closest("div.setcontainer").find("div[data-element=\""+elementReference+"\"]");
	$content
		.show()
		.siblings("div.element")
			.hide();	

	//regenerate charts
	if(typeof(chartcontroller) != undefined) {
		setTimeout(function() { windowcontroller.resize(); }, 50);
		$.each(chartcontroller.chartArray, function() { this.redrawChart(); });
	}

	//resize window
	if(windowcontroller.window != undefined) {
		setTimeout(function() { windowcontroller.resize(); }, 50);
		$content.find("img").each( function() { 
			//na image load nogmaals resizen
			$(this).attr("src", $(this).attr("src")).load(function() {  
				setTimeout(function() { windowcontroller.resize(); }, 50);
			});  
		});
	}
	
};


var photocontroller = {};


/* ------------------------------ */


var phototagcontroller = {
	tagArray : {}
};
phototagcontroller.init = function(frame, box, image, databox, details) {
	details = details || [];
	this.frame = frame;
	this.box = box;
	this.databox = databox;
	this.image = image;
	this.masterId = details.masterId;
	this.selectedID = false;
	this.selectedTag = false;

	this.build();
	this.bind();
};

phototagcontroller.build = function() {
	//size to box
	if(this.image.width() > this.frame.width() || this.image.height() > this.frame.height()) {
		if(this.image.width() > this.frame.width()) this.image.css({'width':this.frame.width()-10+"px"});
		if(this.image.height() > this.frame.height()) this.image.css({'width':"",'height':this.frame.height()-10+"px"}); 
	}
	this.box.css({'width':this.image.width()+"px",'height':this.image.height()+"px"});

	this.imgXYWH = {'x':this.box.offset().left, 'y':this.box.offset().top, 'w':this.box.width(), 'h':this.box.height() }

	this.databox.hide();
};

phototagcontroller.bind = function() {
	var that = this;
	//track x y
	this.image
		.click(function(e) {
			var e = e;

			$.ajax({
				type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
				data: "action=insert&about=photoTagManager&id="+that.masterId,
				success: function(data){ 
					var tagID = data.new_ID;

					posX = Math.round((e.clientX-that.imgXYWH["x"])/that.imgXYWH["w"]*100);
					$.ajax({
						type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
						data: "action=save&about=photoTagManager&id="+tagID+"&type=posX&value="+posX,
						success: function(data){ }
					});

					posY = Math.round((e.clientY-that.imgXYWH["y"])/that.imgXYWH["h"]*100);
					$.ajax({
						type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
						data: "action=save&about=photoTagManager&id="+tagID+"&type=posY&value="+posY,
						success: function(data){ }
					});

					newTag = that.insert({
						'tagID' : tagID,
						'posX': posX,
						'posY': posY,
						'photoController': this
					});
					newTag.select();
				}
			});
		});

	var tagformcontroller = $.extend(true, {}, formcontroller); 
	tagformcontroller.init({ containerElem: this.databox });

	//form

	//HTML management parts
	this.databox.find("[data-part]").each(function() {
		var $this = $(this);
		var parttype = $this.data("part");

		/* edit panel */
		if(parttype == "edit") {
			//verberg dropdowns met 1 of minder opties
			if($this.is("select")) if($this.children().length <= 1) $this.hide();
			//bind
			$this
				.change(function(){ 
					that.initsave(this); 
				})
				.typing(function(){ 
					that.initsave(this); 
				});
		}
		/* remove obj */
		else if(parttype == "remove") {
			$this.click(function(){ 
				if(confirm(tr.str("Tag verwijderen van foto?"))) that.remove(); 
			});
		}
		/* upload obj */
		else if(parttype == "upload") {
			$this.click(function(){ 
				that.upload(); 
			});
		}
		/* crop */
		else if(parttype == "crop") {
			$this.click(function(){ 
				that.crop(); 
			});
		}
	});
};

/* fill AJAX form */
phototagcontroller.updateform = function(data) {
	var that = this;
	var data = data || [];

	this.databox.find("input, select, textarea").each(function() {
		//welke edit parts zijn er?
		var $obj = $(this);
		if($obj.data("part") == "edit") {

			if($obj.is("input")) var objtype = $obj.attr("type");
			else if($obj.is("select")) var objtype = "select";
			else if($obj.is("textarea")) var objtype = "textarea";
			//bestaat er data voor?
			var objvalue = data[$obj.data("editpart")] || ""; 

			if(objtype == "text") {
				$obj.val(objvalue);
			}
			if(objtype == "checkbox") {
				if(objvalue == 1) {
					$obj.attr("checked", true); 
					$obj.parent("label").removeClass("unchecked").addClass("checked");
				}
				else {
					$obj.attr("checked", false); 
					$obj.parent("label").addClass("unchecked").removeClass("checked");
			}	}
			if(objtype == "select") {
				$obj.val(objvalue);
			}
			if(objtype == "textarea") {
				$obj.val(objvalue);
			}
			
			//find related (bv page preview blocks)
			else $obj.trigger("blur");
		}
	});

	//imagesample
	if(data.url) this.databox.find("#imagePreview").show().attr("src", data.url+"?v="+Math.ceil(Math.round()*9999));
	else this.databox.find("#imagePreview").hide();
};

phototagcontroller.insert = function(details) {
	var details = details;
	var that = this;

	//pos is in procent
	that.tagArray[details.tagID] = new phototagObj({
		'posX': details.posX,
		'posY': details.posY,
		'tagID': details.tagID, 
		'photoTagController': this
	});

	return that.tagArray[details.tagID];
};

phototagcontroller.reselect = function() {
	this.selectedTag.select();
};

/* AJAX save */
phototagcontroller.initsave = function(obj) {	
	var that = this;
	var $obj = $(obj);
	var objAttr = $obj.data("editpart");

	//limit 'save' calls
	if(this.saveTimer == undefined) this.saveTimer = {};
	if(this.saveTimer[objAttr]) clearTimeout(this.saveTimer[objAttr]);
	this.saveTimer[objAttr] = setTimeout(function() { that.save(obj); }, 250);
};

phototagcontroller.save = function(obj) {	
	var that = this;	
	var $obj = $(obj);
	if($obj.attr("readonly")) return false;

	if($obj.is("input")) var objtype = $obj.attr("type");
	else if($obj.is("select")) objtype = "select";
	else if($obj.is("textarea")) objtype = "textarea";
	var objAttr = $obj.data("editpart");

	if(objtype == "text" || objtype == "select" || objtype == "textarea") {
		var objValue = $obj.val();
		if(objValue == $obj.data("defval")) objValue = "";
	}
	if(objtype == "checkbox") {
		if($obj.is(":checked")) {
			var objValue = 1;
			$obj.parent("label").removeClass("unchecked").addClass("checked");
		}
		else {
			var objValue = 0;
			$obj.parent("label").addClass("unchecked").removeClass("checked");
	}	}

	if(objAttr) {	
		//prevent double saving
		var currentSave = objAttr+"_"+that.selectedID+"_"+escape(objValue);
		if(currentSave == this.lastSave) return false; 
		this.lastSave = currentSave;

		$.ajax({
			type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
			data: "action=save&about=photoTagManager&id="+that.selectedID+"&type="+objAttr+"&value="+escape(objValue),
			success: function(data){ 
				if(objAttr == "isonline" && objValue == 1) that.tagArray[that.selectedID].tag.removeClass("offline");
				else if(objAttr == "isonline" && objValue == 0) that.tagArray[that.selectedID].tag.addClass("offline");
			}
		});
	}
};

/* POPUP UPLOAD */
phototagcontroller.upload = function() {
	var that = this;	

	shadowboxcontroller.shadow({
		player: "iframe",
		content: "/"+globalref+"do/?wizardupload=1&action=upload&about=photoTagManager&id="+this.selectedID,
		modal: true,
		width: 400,
		height: 220
	});
};

/* AJAX remove */
phototagcontroller.remove = function() {	
	var that = this;	
	$.ajax({
		type: "POST", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
		data: "action=remove&about=photoTagManager&id="+this.selectedID,
		success: function(reponse){ 
			that.tagArray[that.selectedID].tag.fadeOut();
			that.databox.hide();
		}
	});
};

/* crop */
phototagcontroller.crop = function() {
	$img = this.databox.find("#imagePreview");
	if(!$img.length) { alert(tr.str("no image found")); return false; }

	var src = false;
	if($img.attr("src")) src = $img.attr("src");
	if(!src) { alert(tr.str("no image found")); return false; }

	shadowboxcontroller.shadow({
		player: "iframe",
		content: "/"+globalref+"do/?incA=images&incB=cropper&about=photoTagManager&URL="+encodeURIComponent($img.attr("src")), 
		modal: true,
		width: null,
		height: null
	});
};



/* ------------------------------ */


function phototagObj(details) {
	this.posX = details.posX;
	this.posY = details.posY;
	this.tagID = details.tagID;
	this.photoTagController = details.photoTagController;
	this.tag; //object

	this.build();
	this.bind();
}

phototagObj.prototype.build = function() {
	this.tag = $("<div class=\"tag\" style=\"left: "+Math.round((this.posX/100)*this.photoTagController.imgXYWH["w"])+"px; top: "+Math.round((this.posY/100)*this.photoTagController.imgXYWH["h"])+"px;\"><div>");
	this.tag.appendTo(this.photoTagController.box);
};

phototagObj.prototype.bind = function() {
	var that = this;

	this.tag
		.click(function() {
			that.select();
		})
		.draggable({ 
			containment: that.photoTagController.box, 
			//axis: 'y', 
			start: function(e, ui) {
			},
			stop: function(e, ui) { 
				posX = Math.round(that.tag.position().left/that.photoTagController.imgXYWH["w"]*100);
				$.ajax({
					type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
					data: "action=save&about=photoTagManager&id="+that.tagID+"&type=posX&value="+posX,
					success: function(data){ }
				});

				posY = Math.round(that.tag.position().top/that.photoTagController.imgXYWH["h"]*100);
				$.ajax({
					type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
					data: "action=save&about=photoTagManager&id="+that.tagID+"&type=posY&value="+posY,
					success: function(data){ }
				});
			},
			drag: function(e, ui) { 
			}
		});
};

phototagObj.prototype.select = function() {
	var that = this;

	$.ajax({
		type: "POST", dataType: "jSon", url: "/"+globalref+"do/?incA=wizard&incB=wizardcontroller",
		data: "action=edit&about=photoTagManager&id="+that.tagID,
		success: function(data){ 
			that.photoTagController.selectedID = that.tagID;
			that.photoTagController.selectedTag = that;
			that.photoTagController.updateform(data);
			that.photoTagController.databox.show();
			that.tag.siblings(".active").removeClass("active");
			that.tag.addClass("active");
		},
		error: function() { 
			that.photoTagController.databox.hide();
		}
	});
};
var readmorecontroller = { };
readmorecontroller.init = function(details) {
	if(details == undefined) details = [];
	
	this.defaultOpentext = tr.str("read more");
	this.defaultClosetext = tr.str("read less");

	this.readmoreObjects = [];
	this.initReadmore(details);
};
readmorecontroller.initReadmore = function(details) {
	var that = this;

	if(details == undefined) details = [];
	if(details.position) this.position = details.position;

	//highlighter
	$(".readmore[data-readmore=start]").each( function() { 
		var elementArray = new Array;
		$this = $(this);
		$nextObj = $this.next();
		$firstObj = $nextObj;
		while(!$nextObj.hasClass("readmore") && $nextObj[0]) {
			elementArray.push($nextObj);
			$lastestObj = $nextObj;
			$nextObj = $nextObj.next();
			if($nextObj.hasClass("readmore")) {
				$nextObj.remove();
				break;
			}
			if(!$nextObj[0]) break;
		}
		var readmoreObj = new readmoreObject({
			controller: that, 
			readmoreElem: $this,
			startElem: $firstObj, 
			endElem: $lastestObj, 
			elementArray: elementArray
		});
		that.readmoreObjects.push(readmoreObj);
	});

};

/* READMORE */
function readmoreObject(details) {
	this.controller = details.controller;
	this.readmoreElem = details.readmoreElem;
	this.startElem = details.startElem;
	this.endElem = details.endElem;
	this.elementArray = details.elementArray;
	this.visible = true;
	this.position = this.controller.position;
	if(this.readmoreElem.is("h3")) {
		this.position = "before";
		this.opentext = this.readmoreElem.text() || this.controller.defaultOpentext;
		this.closetext = this.readmoreElem.text() || this.controller.defaultClosetext;
	}
	else {
		this.opentext = this.readmoreElem.data("opentext") || this.controller.defaultOpentext;
		this.closetext = this.readmoreElem.data("closetext") || this.controller.defaultClosetext;
	}
	this.extraClass = this.readmoreElem.data("extraclass") || "";

	this.build();
	this.bind();

	this.readmoreElem.remove();
}
readmoreObject.prototype.build = function() {
	if(this.position == "before") {
		this.startElem.before("<div class=\"readmorebutton "+this.extraClass+"\"></div>");
		this.controls = this.startElem.prev();
	}
	else {
		this.endElem.after("<div class=\"readmorebutton "+this.extraClass+"\"></div>");
		this.controls = this.endElem.next();
	}
	if(this.readmoreElem.hasClass("active")) this.visible = false; 
	this.toggle();
};
readmoreObject.prototype.bind = function() {
	var that = this;
	this.controls.click(function() { that.toggle(); });
};
readmoreObject.prototype.toggle = function() {
	if(this.visible) {
		this.visible = false;
		this.controls
			.html(this.opentext)
			.addClass("inactive").removeClass("active");
		for(var i = 0; i < this.elementArray.length; i++) {
			this.elementArray[i].stop(true,true).slideUp(200, function() { $(this).addClass("invisible").show(); if(windowcontroller != undefined) windowcontroller.resize() });
		}
	}
	else {
		this.visible = true;
		this.controls
			.html(this.closetext)
			.addClass("active").removeClass("inactive");
		for(var i = 0; i < this.elementArray.length; i++) {
			this.elementArray[i].removeClass("invisible").hide(); 
			this.elementArray[i].stop(true,true).slideDown(200, function() { $(this).removeClass("invisible").show(); if(windowcontroller != undefined) windowcontroller.resize() });
		}
	}
};
var shadowboxcontroller = {};
shadowboxcontroller.init = function() {
};

shadowboxcontroller.shadow = function(details) {
	var options = {};

	if(details.modal) options.modal = true;
	else options.modal = false;
	if(details.displayNav) options.displayNav = true;
	else options.displayNav = false;
	if(details.player) {
		if(details.player == "html") {
			options.enableKeys = false;
	}	}

	Shadowbox.open({
		options: options,
		SBXclass: details.SBXclass || "",
		player:   details.player || "iframe",
		content: 	details.content,
		title:  	details.title || "",
		width:		details.width,
		height:		details.height
	});
};
(function () {
    function waitDom(a) {
        if (document.addEventListener) document.addEventListener("DOMContentLoaded", function () {
                document.removeEventListener("DOMContentLoaded", arguments.callee, false);
                a()
            }, false);
        else if (document.attachEvent) {
            document.attachEvent("onreadystatechange", function () {
                if (document.readyState === "complete") {
                    document.detachEvent("onreadystatechange", arguments.callee);
                    a()
                }
            });
            if (document.documentElement.doScroll && window == window.top)(function () {
                    if (S.ready) return;
                    try {
                        document.documentElement.doScroll("left")
                    } catch (b) {
                        setTimeout(arguments.callee, 0);
                        return
                    }
                    a()
                })()
        }
        if (typeof window.onload == "function") {
            var b = window.onload;
            window.onload = function () {
                b();
                a()
            }
        } else window.onload = a
    }
    function waitLibs() {
        if (S.lib && S.lang) S.load();
        else setTimeout(waitLibs, 0)
    }
    function handleClick(a) {
        var b;
        if (U.isLink(this)) b = this;
        else {
            b = S.lib.getTarget(a);
            while (!U.isLink(b) && b.parentNode) b = b.parentNode
        }
        S.lib.preventDefault(a);
        if (b) {
            S.open(b);
            if (S.gallery.length) S.lib.preventDefault(a)
        }
    }
    function listenKeys(a) {
        if (!S.options.enableKeys) return;
        S.lib[(a ? "add" : "remove") + "Event"](document, "keydown", handleKey)
    }
    function handleKey(a) {
        var b = S.lib.keyCode(a),
            c;
        switch (b) {
            case 81:
            case 88:
            case 27:
                c = S.close;
                break;
            case 37:
                c = S.previous;
                break;
            case 39:
                c = S.next;
                break;
            case 32:
                c = typeof slide_timer == "number" ? S.pause : S.play
        }
        if (c) {
            S.lib.preventDefault(a);
            c()
        }
    }
    function loadContent() {
        var a = S.getCurrent();
        if (!a) return;
        var b = a.player == "inline" ? "html" : a.player;
        if (typeof S[b] != "function") S.error("Unknown player: " + b);
        $("#sb-container").removeAttr("class");
        if (a.SBXclass) $("#sb-container").addClass(a.SBXclass);
        else if (b == "img" || a.content.indexOf("youtube") > -1 || a.content.indexOf("vimeo") > -1) $("#sb-container").addClass("SBXmultimedia");
        var c = false;
        if (S.content) {
            S.content.remove();
            c = true;
            S.revertOptions();
            if (a.options) S.applyOptions(a.options)
        }
        U.removeChildren(S.skin.bodyEl());
        S.content = new S[b](a);
        listenKeys(false);
        S.skin.onLoad(S.content, c, function () {
            if (!S.content) return;
            if (typeof S.content.ready != "undefined") var a = setInterval(function () {
                    if (S.content) {
                        if (S.content.ready) {
                            clearInterval(a);
                            a = null;
                            S.skin.onReady(contentReady)
                        }
                    } else {
                        clearInterval(a);
                        a = null
                    }
                }, 100);
            else S.skin.onReady(contentReady)
        });
        if (S.gallery.length > 1) {
            var d = S.gallery[S.current + 1] || S.gallery[0];
            if (d.player == "img") {
                var e = new Image;
                e.src = d.content
            }
            var f = S.gallery[S.current - 1] || S.gallery[S.gallery.length - 1];
            if (f.player == "img") {
                var g = new Image;
                g.src = f.content
            }
        }
    }
    function contentReady() {
        if (!S.content) return;
        S.content.append(S.skin.bodyEl(), content_id, S.dimensions);
        S.skin.onFinish(finishContent)
    }
    function finishContent() {
        if (!S.content) return;
        if (S.content.onLoad) S.content.onLoad();
        if (S.options.onFinish) S.options.onFinish();
        if (!S.isPaused()) S.play();
        listenKeys(true);

        /* analytics */
        if(S.gallery[0]) {
            if(S.gallery[0].player == "html") analyticscontroller.trackEvent("shadowbox", "open", "html");
            else analyticscontroller.trackEvent("shadowbox", "open", S.gallery[0].content);
        }
    }
    var ua = navigator.userAgent.toLowerCase(),
        S = {
            version: "3.0rc1",
            adapter: null,
            cache: [],
            client: {
                isIE: ua.indexOf("msie") > -1,
                isIE6: ua.indexOf("msie 6") > -1,
                isIE7: ua.indexOf("msie 7") > -1,
                isGecko: ua.indexOf("gecko") > -1 && ua.indexOf("safari") == -1,
                isWebkit: ua.indexOf("applewebkit/") > -1,
                isWindows: ua.indexOf("windows") > -1 || ua.indexOf("win32") > -1,
                isMac: ua.indexOf("macintosh") > -1 || ua.indexOf("mac os x") > -1,
                isLinux: ua.indexOf("linux") > -1
            },
            content: null,
            current: -1,
            dimensions: null,
            gallery: [],
            expando: "shadowboxCacheKey",
            libraries: {
                Prototype: "prototype",
                jQuery: "jquery",
                MooTools: "mootools",
                YAHOO: "yui",
                dojo: "dojo",
                Ext: "ext"
            },
            options: {
                adapter: null,
                animate: true,
                animateFade: true,
                autoplayMovies: true,
                continuous: false,
                ease: function (a) {
                    return 1 + Math.pow(a - 1, 3)
                },
                enableKeys: true,
                errors: {
                    fla: {
                        name: "Flash",
                        url: "http://www.adobe.com/products/flashplayer/"
                    },
                    qt: {
                        name: "QuickTime",
                        url: "http://www.apple.com/quicktime/download/"
                    },
                    wmp: {
                        name: "Windows Media Player",
                        url: "http://www.microsoft.com/windows/windowsmedia/"
                    },
                    f4m: {
                        name: "Flip4Mac",
                        url: "http://www.flip4mac.com/wmv_download.htm"
                    }
                },
                ext: {
                    img: ["png", "jpg", "jpeg", "gif", "bmp"],
                    swf: ["swf"],
                    flv: ["flv", "m4v"],
                    qt: ["dv", "mov", "moov", "movie", "mp4"],
                    wmp: ["asf", "wm", "wmv"],
                    qtwmp: ["avi", "mpg", "mpeg"]
                },
                flashParams: {
                    bgcolor: "#000000",
                    allowfullscreen: true
                },
                flashVars: {},
                flashVersion: "9.0.115",
                handleOversize: "resize",
                handleUnsupported: "link",
                language: "en",
                onChange: null,
                onClose: null,
                onFinish: null,
                onOpen: null,
                players: ["img"],
                showMovieControls: true,
                skipSetup: false,
                slideshowDelay: 0,
                useSizzle: true,
                viewportPadding: 20
            },
            path: "",
            plugins: null,
            ready: false,
            regex: {
                domain: /:\/\/(.*?)[:\/]/,
                inline: /#(.+)$$/,
                rel: /^(light|shadow)box/i,
                gallery: /^(light|shadow)box\[(.*?)\]/i,
                unsupported: /^unsupported-(\w+)/,
                param: /\s*([a-z_]*?)\s*=\s*(.+)\s*/
            },
            applyOptions: function (a) {
                if (a) {
                    default_options = apply({}, S.options);
                    apply(S.options, a)
                }
            },
            revertOptions: function () {
                apply(S.options, default_options)
            },
            change: function (a) {
                if (!S.gallery) return;
                if (!S.gallery[a]) if (!S.options.continuous) return;
                    else a = a < 0 ? S.gallery.length - 1 : 0;
                S.current = a;
                if (typeof slide_timer == "number") {
                    clearTimeout(slide_timer);
                    slide_timer = null;
                    slide_delay = slide_start = 0
                }
                if (S.options.onChange) S.options.onChange();
                loadContent()
            },
            close: function () {
                if (!active) return;
                active = false;
                listenKeys(false);
                if (S.content) {
                    S.content.remove();
                    S.content = null;

                    /* analytics */
                    if(S.gallery[0]) {
                        if(S.gallery[0].player == "html") analyticscontroller.trackEvent("shadowbox", "close", "html");
                        else analyticscontroller.trackEvent("shadowbox", "close", S.gallery[0].content);
                }   }
                if (typeof slide_timer == "number") clearTimeout(slide_timer);
                slide_timer = null;
                slide_delay = 0;
                if (S.options.onClose) S.options.onClose();
                S.skin.onClose();
                S.revertOptions()
            },
            contentId: function () {
                return content_id
            },
            error: function (a) {
                if (!S.debug) return;
                if (typeof window.console != "undefined" && typeof console.log == "function") console.log(a);
                else alert(a)
            },
            getCurrent: function () {
                return S.current > -1 ? S.gallery[S.current] : null
            },
            hasNext: function () {
                return S.gallery.length > 1 && (S.current != S.gallery.length - 1 || S.options.continuous)
            },
            init: function (a) {
                if (initialized) return;
                initialized = true;
                a = a || {};
                init_options = a;
                if (a) apply(S.options, a);
                for (var b in S.options.ext) S.regex[b] = new RegExp(".(" + S.options.ext[b].join("|") + ")s*$$", "i");
                if (!S.path) {
                    S.path = "/" + globalref + "" + toolkit + "shadowbox/shadowbox-3.0/";
                }
                if (S.options.adapter) S.adapter = S.options.adapter.toLowerCase();
                else {
                    for (var e in S.libraries) if (typeof window[e] != "undefined") {
                            S.adapter = S.libraries[e];
                            break
                        }
                    if (!S.adapter) S.adapter = "base"
                } if (S.options.useSizzle && !window.Sizzle) if (window.jQuery) window.Sizzle = jQuery.find;
                    else U.include(S.path + "libraries/sizzle/sizzle.js");
                if (!S.lang) U.include(S.path + "languages/shadowbox-" + S.options.language + ".js");
                each(S.options.players, function (a) {
                    if ((a == "swf" || a == "flv") && !window.swfobject) U.include(S.path + "libraries/swfobject/swfobject.js");
                    if (!S[a]) U.include(S.path + "players/shadowbox-" + a + ".js")
                });
                if (!S.lib) U.include(S.path + "adapters/shadowbox-" + S.adapter + ".js");
                waitDom(waitLibs)
            },
            isActive: function () {
                return active
            },
            isPaused: function () {
                return slide_timer == "paused"
            },
            load: function () {
                if (S.ready) return;
                S.ready = true;
                if (S.skin.options) {
                    apply(S.options, S.skin.options);
                    apply(S.options, init_options)
                }
                S.skin.init();
                if (!S.options.skipSetup) S.setup()
            },
            next: function () {
                S.change(S.current + 1)
            },
            open: function (a) {
                if (U.isLink(a)) if (S.inCache(a)) a = S.cache[a[S.expando]];
                    else a = S.buildCacheObj(a);
                if (a.constructor == Array) {
                    S.gallery = a;
                    S.current = 0
                } else if (!a.gallery) {
                    S.gallery = [a];
                    S.current = 0
                } else {
                    S.current = null;
                    S.gallery = [];
                    each(S.cache, function (b) {
                        if (b.gallery && b.gallery == a.gallery) {
                            if (S.current == null && b.content == a.content && b.title == a.title) S.current = S.gallery.length;
                            S.gallery.push(b)
                        }
                    });
                    if (S.current == null) {
                        S.gallery.unshift(a);
                        S.current = 0
                    }
                }
                a = S.getCurrent();
                if (a.options) {
                    S.revertOptions();
                    S.applyOptions(a.options)
                }
                var b, c, d, e, f, g = S.options.errors,
                    h, i;
                for (var j = 0; j < S.gallery.length; ++j) {
                    b = S.gallery[j] = apply({}, S.gallery[j]);
                    c = false;
                    if (d = S.regex.unsupported.exec(b.player)) if (S.options.handleUnsupported == "link") {
                            b.player = "html";
                            switch (d[1]) {
                                case "qtwmp":
                                    e = "either";
                                    f = [g.qt.url, g.qt.name, g.wmp.url, g.wmp.name];
                                    break;
                                case "qtf4m":
                                    e = "shared";
                                    f = [g.qt.url, g.qt.name, g.f4m.url, g.f4m.name];
                                    break;
                                default:
                                    e = "single";
                                    if (d[1] == "swf" || d[1] == "flv") d[1] = "fla";
                                    f = [g[d[1]].url, g[d[1]].name]
                            }
                            h = S.lang.errors[e].replace(/\{(\d+)\}/g, function (a, b) {
                                return f[b]
                            });
                            b.content = "<div class=\"sb-message\">" + h + "</div>"
                        } else c = true;
                        else if (b.player == "inline") {
                        d = S.regex.inline.exec(b.content);
                        if (d) {
                            var i = U.get(d[1]);
                            if (i) b.content = i.innerHTML;
                            else S.error("Cannot find element with id " + d[1])
                        } else S.error("Cannot find element id for inline content")
                    } else if (b.player == "swf" || b.player == "flv") {
                        var k = b.options && b.options.flashVersion || S.options.flashVersion;
                        if (!swfobject.hasFlashPlayerVersion(k)) {
                            b.width = 310;
                            b.height = 177
                        }
                    }
                    if (c) {
                        S.gallery.splice(j, 1);
                        if (j < S.current)--S.current;
                        else if (j == S.current) S.current = j > 0 ? j - 1 : j;
                        --j
                    }
                }
                if (S.gallery.length) {
                    if (!active) {
                        if (typeof S.options.onOpen == "function" && S.options.onOpen(a) === false) return;
                        S.skin.onOpen(a, loadContent)
                    } else loadContent();
                    active = true
                }
            },
            pause: function () {
                if (typeof slide_timer != "number") return;
                var a = (new Date).getTime();
                slide_delay = Math.max(0, slide_delay - (a - slide_start));
                if (slide_delay) {
                    clearTimeout(slide_timer);
                    slide_timer = "paused";
                    if (S.skin.onPause) S.skin.onPause()
                }
            },
            play: function () {
                if (!S.hasNext()) return;
                if (!slide_delay) slide_delay = S.options.slideshowDelay * 1e3;
                if (slide_delay) {
                    slide_start = (new Date).getTime();
                    slide_timer = setTimeout(function () {
                        slide_delay = slide_start = 0;
                        S.next()
                    }, slide_delay);
                    if (S.skin.onPlay) S.skin.onPlay()
                }
            },
            previous: function () {
                S.change(S.current - 1)
            },
            setDimensions: function (a, b, c, d, e, f, g) {
                var h = a = parseInt(a),
                    i = b = parseInt(b),
                    j = parseInt(S.options.viewportPadding) || 0;
                var k = 2 * j + e;
                if (h + k >= c) h = c - k;
                var l = 2 * j + f;
                if (i + l >= d) i = d - l;
                var m = a,
                    n = b,
                    o = (a - h) / a,
                    p = (b - i) / b,
                    q = o > 0 || p > 0;
                if (g && q && S.options.handleOversize == "resize") {
                    if (o > p) i = Math.round(b / a * h);
                    else if (p > o) h = Math.round(a / b * i);
                    n = i;
                    m = h
                }
                S.dimensions = {
                    height: h + e,
                    width: i + f,
                    inner_h: h,
                    inner_w: i,
                    top: (c - (h + k)) / 2 + j,
                    left: (d - (i + l)) / 2 + j,
                    oversized: q,
                    resize_h: m,
                    resize_w: n
                }
            },
            setSize: function(W, H) { 
            	if(W) S.content.width = W;
            	if(H) S.content.width = H;
            	S.skin.onWindowResize();
            },
            setup: function (a, b) {
                each(S.findLinks(a), function (a) {
                    S.addCache(a, b)
                })
            },
            teardown: function (a) {
                each(S.findLinks(a), S.removeCache)
            },
            findLinks: function (a) {
                if (!a) {
                    var a = [],
                        b;
                    each(document.getElementsByTagName("a"), function (c) {
                        b = c.getAttribute("rel");
                        if (b && S.regex.rel.test(b)) a.push(c)
                    })
                } else {
                    var c = a.length;
                    if (c) {
                        if (window.Sizzle) if (typeof a == "string") a = Sizzle(a);
                            else if (c == 2 && a.push && typeof a[0] == "string" && a[1].nodeType) a = Sizzle(a[0], a[1])
                    } else a = [a]
                }
                return a
            },
            inCache: function (a) {
                return typeof a[S.expando] == "number" && S.cache[a[S.expando]]
            },
            addCache: function (a, b) {
                if (!S.inCache(a)) {
                    a[S.expando] = S.cache.length;
                    S.lib.addEvent(a, "click", handleClick)
                }
                S.cache[a[S.expando]] = S.buildCacheObj(a, b)
            },
            removeCache: function (a) {
                S.lib.removeEvent(a, "click", handleClick);
                S.cache[a[S.expando]] = null;
                delete a[S.expando]
            },
            clearCache: function () {
                each(S.cache, function (a) {
                    S.removeCache(a.link)
                });
                S.cache = []
            },
            buildCacheObj: function (link, opts) {
                var obj = {
                    link: link,
                    title: link.getAttribute("title"),
                    options: apply({}, opts || {}),
                    content: link.href
                };
                if (opts) each(["player", "title", "height", "width", "gallery"], function (a) {
                        if (typeof obj.options[a] != "undefined") {
                            obj[a] = obj.options[a];
                            delete obj.options[a]
                        }
                    });
                if (!obj.player) obj.player = S.getPlayer(obj.content);
                var rel = link.getAttribute("rel");
                if (rel) {
                    var match = rel.match(S.regex.gallery);
                    if (match) obj.gallery = escape(match[2]);
                    each(rel.split(";"), function (parameter) {
                        match = parameter.match(S.regex.param);
                        if (match) if (match[1] == "options") eval("apply(obj.options," + match[2] + ")");
                            else obj[match[1]] = match[2]
                    })
                }
                return obj
            },
            getPlayer: function (a) {
                var b = S.regex,
                    c = S.plugins,
                    d = a.match(b.domain),
                    e = d && document.domain == d[1];
                if (a.indexOf("#") > -1 && e) return "inline";
                var f = a.indexOf("?");
                if (f > -1) a = a.substring(0, f);
                if (b.img.test(a)) return "img";
                if (b.swf.test(a)) return c.fla ? "swf" : "unsupported-swf";
                if (b.flv.test(a)) return c.fla ? "flv" : "unsupported-flv";
                if (b.qt.test(a)) return c.qt ? "qt" : "unsupported-qt";
                if (b.wmp.test(a)) {
                    if (c.wmp) return "wmp";
                    if (c.f4m) return "qt";
                    if (S.client.isMac) return c.qt ? "unsupported-f4m" : "unsupported-qtf4m";
                    return "unsupported-wmp"
                }
                if (b.qtwmp.test(a)) {
                    if (c.qt) return "qt";
                    if (c.wmp) return "wmp";
                    return S.client.isMac ? "unsupported-qt" : "unsupported-qtwmp"
                }
                return "iframe"
            }
        }, U = S.util = {
            animate: function (a, b, c, d, e) {
                function i(c) {
                    var d = f + c * g;
                    if (h) U.setOpacity(a, d);
                    else a.style[b] = d + "px"
                }
                var f = parseFloat(S.lib.getStyle(a, b));
                if (isNaN(f)) f = 0;
                var g = c - f;
                if (g == 0) {
                    if (e) e();
                    return
                }
                var h = b == "opacity";
                if (!d || !h && !S.options.animate || h && !S.options.animateFade) {
                    i(1);
                    if (e) e();
                    return
                }
                d *= 1e3;
                var j = (new Date).getTime(),
                    k = S.options.ease,
                    l = j + d,
                    m, n = setInterval(function () {
                        m = (new Date).getTime();
                        if (m >= l) {
                            clearInterval(n);
                            i(1);
                            if (e) e()
                        } else i(k((m - j) / d))
                    }, 10)
            },
            apply: function (a, b) {
                for (var c in b) a[c] = b[c];
                return a
            },
            clearOpacity: function (a) {
                var b = a.style;
                if (window.ActiveXObject) {
                    if (typeof b.filter == "string" && /alpha/i.test(b.filter)) b.filter = b.filter.replace(/[\w\.]*alpha\(.*?\);?/i, "")
                } else b.opacity = ""
            },
            each: function (a, b, c) {
                for (var d = 0, e = a.length; d < e; ++d) if (b.call(c || a[d], a[d], d, a) === false) return
            },
            get: function (a) {
                return document.getElementById(a)
            },
            include: function () {
                var a = {};
                return function (b) {
                    if (a[b]) return;
                    a[b] = true;
                    var c = document.getElementsByTagName("head")[0],
                        d = document.createElement("script");
                    d.src = b;
                    c.appendChild(d)
                }
            }(),
            isLink: function (a) {
                if (!a || !a.tagName) return false;
                var b = a.tagName.toUpperCase();
                return b == "A" || b == "AREA"
            },
            removeChildren: function (a) {
                while (a.firstChild) a.removeChild(a.firstChild)
            },
            setOpacity: function (a, b) {
                var c = a.style;
                if (window.ActiveXObject) {
                    c.zoom = 1;
                    c.filter = (c.filter || "").replace(/\s*alpha\([^\)]*\)/gi, "") + (b == 1 ? "" : " alpha(opacity=" + b * 100 + ")")
                } else c.opacity = b
            }
        }, apply = U.apply,
        each = U.each,
        init_options, initialized = false,
        default_options = {}, content_id = "sb-content",
        active = false,
        slide_timer, slide_start, slide_delay = 0;
    if (navigator.plugins && navigator.plugins.length) {
        var names = [];
        each(navigator.plugins, function (a) {
            names.push(a.name)
        });
        names = names.join();
        var f4m = names.indexOf("Flip4Mac") > -1;
        S.plugins = {
            fla: names.indexOf("Shockwave Flash") > -1,
            qt: names.indexOf("QuickTime") > -1,
            wmp: !f4m && names.indexOf("Windows Media") > -1,
            f4m: f4m
        }
    } else {
        function detectPlugin(a) {
            try {
                var b = new ActiveXObject(a)
            } catch (c) {}
            return !!b
        }
        S.plugins = {
            fla: detectPlugin("ShockwaveFlash.ShockwaveFlash"),
            qt: detectPlugin("QuickTime.QuickTime"),
            wmp: detectPlugin("wmplayer.ocx"),
            f4m: false
        }
    }
    window.Shadowbox = S
})();
(function () {
    function g() {
        b.get("sb-container").style.top = document.documentElement.scrollTop + "px"
    }
    function h(c) {
        if (c) b.each(d, function (a) {
                a[0].style.visibility = a[1] || ""
            });
        else {
            d = [];
            b.each(a.options.troubleElements, function (a) {
                b.each(document.getElementsByTagName(a), function (a) {
                    d.push([a, a.style.visibility]);
                    a.style.visibility = "hidden"
                })
            })
        }
    }
    function i(d) {
        var e = b.get("sb-overlay"),
            f = b.get("sb-container"),
            h = b.get("sb-wrapper");
        if (d) {
            if (a.client.isIE6) {
                g();
                a.lib.addEvent(window, "scroll", g)
            }
            if (a.options.showOverlay) {
                c = true;
                e.style.backgroundColor = a.options.overlayColor;
                b.setOpacity(e, 0);
                if (!a.options.modal) a.lib.addEvent(e, "click", a.close);
                h.style.display = "none"
            }
            f.style.visibility = "visible";
            if (c) {
                var i = parseFloat(a.options.overlayOpacity);
                $(e).fadeTo((a.options.fadeDuration*1000), i, d); //fix, for IE10
                //b.animate(e, "opacity", i, a.options.fadeDuration, d)
            } else d()
        } else {
            if (a.client.isIE6) a.lib.removeEvent(window, "scroll", g);
            a.lib.removeEvent(e, "click", a.close);
            if (c) {
                h.style.display = "none";
                b.animate(e, "opacity", 0, a.options.fadeDuration, function () {
                    f.style.display = "";
                    h.style.display = "";
                    b.clearOpacity(e)
                })
            } else f.style.visibility = "hidden"
        }
    }
    function j(a, c) {
        var d = b.get("sb-nav-" + a);
        if (d) d.style.display = c ? "" : "none"
    }
    function k(c, d) {
        var e = b.get("sb-loading"),
            f = a.getCurrent().player,
            g = f == "img" || f == "html";
        if (c) {
            function h() {
                b.clearOpacity(e);
                if (d) d()
            }
            b.setOpacity(e, 0);
            e.style.display = "";
            if (g) b.animate(e, "opacity", 1, a.options.fadeDuration, h);
            else h()
        } else {
            function h() {
                e.style.display = "none";
                b.clearOpacity(e);
                if (d) d()
            }
            if (g) b.animate(e, "opacity", 0, a.options.fadeDuration, h);
            else h()
        }
    }
    function l(c) {
        var d = a.getCurrent();
        b.get("sb-title-inner").innerHTML = d.title || "";
        b.get("sb-description-inner").innerHTML = d.description || "";
        var e, f, g, h, i;
        if (a.options.displayNav) {
            e = true;
            var k = a.gallery.length;
            if (k > 1) if (a.options.continuous) f = i = true;
                else {
                    f = k - 1 > a.current;
                    i = a.current > 0
                }
            if (a.options.slideshowDelay > 0 && a.hasNext()) {
                h = !a.isPaused();
                g = !h
            }
        } else e = f = g = h = i = false;
        j("close", e);
        j("next", f);
        j("play", g);
        j("pause", h);
        j("previous", i);
        var l = "";
        if (a.options.displayCounter && a.gallery.length > 1) {
            var k = a.gallery.length;
            if (a.options.counterType == "skip") {
                var m = 0,
                    n = k,
                    o = parseInt(a.options.counterLimit) || 0;
                if (o < k && o > 2) {
                    var p = Math.floor(o / 2);
                    m = a.current - p;
                    if (m < 0) m += k;
                    n = a.current + (o - p);
                    if (n > k) n -= k
                }
                while (m != n) {
                    if (m == k) m = 0;
                    l += "<a onclick=\"Shadowbox.change(" + m + ");\"";
                    if (m == a.current) l += " class=\"sb-counter-current\"";
                    l += ">" + m+++"</a>"
                }
            } else var l = a.current + 1 + " " + a.lang.of + " " + k
        }
        b.get("sb-counter").innerHTML = l;
        c()
    }
    function m(c, d) {
        var e = b.get("sb-wrapper"),
            f = b.get("sb-title"),
            g = b.get("sb-info"),
            h = b.get("sb-title-inner"),
            i = b.get("sb-info-inner"),
            j = parseInt(a.lib.getStyle(h, "height")) || 0,
            k = parseInt(a.lib.getStyle(i, "height")) || 0;
        var m = function () {
            h.style.visibility = i.style.visibility = "hidden";
            l(d)
        };
        if (c) {
            b.animate(f, "height", 0, .35);
            b.animate(g, "height", 0, .35);
            b.animate(e, "paddingTop", j, .35);
            b.animate(e, "paddingBottom", k, .35, m)
        } else {
            f.style.height = g.style.height = "0px";
            e.style.paddingTop = j + "px";
            e.style.paddingBottom = k + "px";
            m()
        }
    }
    function n(c) {
        var d = b.get("sb-wrapper"),
            e = b.get("sb-title"),
            f = b.get("sb-info"),
            g = b.get("sb-title-inner"),
            h = b.get("sb-info-inner"),
            i = parseInt(a.lib.getStyle(g, "height")) || 0,
            j = parseInt(a.lib.getStyle(h, "height")) || 0;
        g.style.visibility = h.style.visibility = "";
        if (g.innerHTML != "") {
            b.animate(e, "height", i, .35);
            b.animate(d, "paddingTop", 0, .35)
        }
        b.animate(f, "height", j, .35);
        b.animate(d, "paddingBottom", 0, .35, c)
    }
    function o(c, d, e, f) {
        var g = b.get("sb-body"),
            h = b.get("sb-wrapper"),
            i = parseInt(c),
            j = parseInt(d);
        if (e) {
            b.animate(g, "height", i, a.options.resizeDuration);
            b.animate(h, "top", j, a.options.resizeDuration, f)
        } else {
            g.style.height = i + "px";
            h.style.top = j + "px";
            if (f) f()
        }
    }
    function p(c, d, e, f) {
        var g = b.get("sb-wrapper"),
            h = parseInt(c),
            i = parseInt(d);
        if (e) {
            b.animate(g, "width", h, a.options.resizeDuration);
            b.animate(g, "left", i, a.options.resizeDuration, f)
        } else {
            g.style.width = h + "px";
            g.style.left = i + "px";
            if (f) f()
        }
    }
    function q(c, d, e) {
        var f = b.get("sb-body-inner");
        sw = b.get("sb-wrapper"), so = b.get("sb-overlay"), tb = sw.offsetHeight - f.offsetHeight, lr = sw.offsetWidth - f.offsetWidth, max_h = so.offsetHeight, max_w = so.offsetWidth;
        a.setDimensions(c, d, max_h, max_w, tb, lr, e);
        return a.dimensions
    }
    var a = Shadowbox,
        b = a.util,
        c = false,
        d = [],
        e = ["sb-nav-close", "sb-nav-next", "sb-nav-play", "sb-nav-pause", "sb-nav-previous"],
        f = {
            markup: "<div id=\"sb-container\"><div id=\"sb-overlay\"></div><div id=\"sb-wrapper\"><div id=\"sb-quick-close\" title=\"{close}\" onclick=\"Shadowbox.close()\"></div><div id=\"sb-title\"><div id=\"sb-title-inner\"></div></div><div id=\"sb-body\"><div id=\"sb-body-inner\"></div><div id=\"sb-loading\"><a onclick=\"Shadowbox.close()\">{cancel}</a></div></div><div id=\"sb-description\"><div id=\"sb-description-inner\"></div></div><div id=\"sb-info\"><div id=\"sb-info-inner\"><div id=\"sb-test\"><a href=\"javascript: window.print();\" class=\"printbutton\" id=\"button\"/><div id=\"sb-counter\"></div></div><div id=\"sb-nav\"><a id=\"sb-nav-close\" title=\"{close}\" onclick=\"Shadowbox.close()\"></a><a id=\"sb-nav-next\" title=\"{next}\" onclick=\"Shadowbox.next()\"></a><a id=\"sb-nav-play\" title=\"{play}\" onclick=\"Shadowbox.play()\"></a><a id=\"sb-nav-pause\" title=\"{pause}\" onclick=\"Shadowbox.pause()\"></a><a id=\"sb-nav-previous\" title=\"{previous}\" onclick=\"Shadowbox.previous()\"></a></div><div style=\"clear:both\"></div></div></div></div></div>",
            options: {
                animSequence: "sync",
                autoDimensions: false,
                counterLimit: 10,
                counterType: "default",
                displayCounter: true,
                displayNav: true,
                fadeDuration: .35,
                initialHeight: 160,
                initialWidth: 320,
                modal: false,
                overlayColor: "#000",
                overlayOpacity: .2,
                resizeDuration: .35,
                showOverlay: true,
                troubleElements: ["select", "object", "embed", "canvas"]
            },
            init: function () {
                var c = f.markup.replace(/\{(\w+)\}/g, function (b, c) {
                    return a.lang[c]
                });
                a.lib.append(document.body, c);
                if (a.client.isIE6) {
                    b.get("sb-body").style.zoom = 1;
                    var d, g, h = /url\("(.*\.png)"\)/;
                    b.each(e, function (c) {
                        d = b.get(c);
                        if (d) {
                            g = a.lib.getStyle(d, "backgroundImage").match(h);
                            if (g) {
                                d.style.backgroundImage = "none";
                                d.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=" + g[1] + ",sizingMethod=scale);"
                            }
                        }
                    })
                }
                var i;
                a.lib.addEvent(window, "resize", function () {
                    if (i) {
                        clearTimeout(i);
                        i = null
                    }
                    if (a.isActive()) i = setTimeout(function () {
                            f.onWindowResize();
                            var b = a.content;
                            if (b && b.onWindowResize) b.onWindowResize()
                        }, 50)
                })
            },
            bodyEl: function () {
                return b.get("sb-body-inner")
            },
            onOpen: function (c, d) {
                h(false);
                var e = a.options.autoDimensions && "height" in c ? c.height : a.options.initialHeight,
                    f = a.options.autoDimensions && "width" in c ? c.width : a.options.initialWidth;
                b.get("sb-container").style.display = "block";
                var g = q(e, f);
                o(g.inner_h, g.top, false);
                p(g.width, g.left, false);
                i(d)
            },
            onLoad: function (a, c, d) {
                k(true);
                m(c, function () {
                    if (!a) return;
                    if (!c) b.get("sb-wrapper").style.display = "";
                    d()
                })
            },
            onReady: function (b) {
                var c = a.content;
                if (!c) return;
                var d = q(c.height, c.width, c.resizable);
                f.resizeContent(d.inner_h, d.width, d.top, d.left, true, function () {
                    n(b)
                })
            },
            onFinish: function (a) {
                k(false, a)
            },
            onClose: function () {
                i();
                h(true)
            },
            onPlay: function () {
                j("play", false);
                j("pause", true)
            },
            onPause: function () {
                j("pause", false);
                j("play", true)
            },
            onWindowResize: function () {
                var c = a.content;
                if (!c) return;
                var d = q(c.height, c.width, c.resizable);
                p(d.width, d.left, false);
                o(d.inner_h, d.top, false);
                var e = b.get(a.contentId());
                if (e) if (c.resizable && a.options.handleOversize == "resize") {
                        e.height = d.resize_h;
                        e.width = d.resize_w
                    }
            },
            resizeContent: function (b, c, d, e, f, g) {
                var h = a.content;
                if (!h) return;
                var i = q(h.height, h.width, h.resizable);
                switch (a.options.animSequence) {
                    case "hw":
                        o(i.inner_h, i.top, f, function () {
                            p(i.width, i.left, f, g)
                        });
                        break;
                    case "wh":
                        p(i.width, i.left, f, function () {
                            o(i.inner_h, i.top, f, g)
                        });
                        break;
                    default:
                        p(i.width, i.left, f);
                        o(i.inner_h, i.top, f, g)
                }
            }
        };
    a.skin = f
})();
if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox language file, Shadowbox not found."}Shadowbox.lang={code:"en",of:"of",loading:"loading",cancel:"Cancel",next:"Next",previous:"Previous",play:"Play",pause:"Pause",close:"Close",errors:{single:"You must install the <a href=\"{0}\">{1}</a> browser plugin to view this content.",shared:"You must install both the <a href=\"{0}\">{1}</a> and <a href=\"{2}\">{3}</a> browser plugins to view this content.",either:"You must install either the <a href=\"{0}\">{1}</a> or the <a href=\"{2}\">{3}</a> browser plugin to view this content."}};
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=" class=\""+ai[ae]+"\""}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+"=\""+ai[ae]+"\""}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+="<param name=\""+ad+"\" value=\""+ag[ad]+"\" />"}}aa.outerHTML="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
(function(a){a.html=function(b){this.obj=b;this.height=b.height?parseInt(b.height,10):300;this.width=b.width?parseInt(b.width,10):500};a.html.prototype={append:function(b,e,c){this.id=e;var d=document.createElement("div");d.id=e;d.className="html";d.innerHTML=this.obj.content;b.appendChild(d)},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b)}}}})(Shadowbox);
(function(a){a.iframe=function(c){this.obj=c;var b=document.getElementById("sb-overlay");this.height=c.height?parseInt(c.height,10):b.offsetHeight;this.width=c.width?parseInt(c.width,10):b.offsetWidth};a.iframe.prototype={append:function(b,e,d){this.id=e;var c="<iframe id=\""+e+"\" name=\""+e+"\" height=\"100%\" width=\"100%\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\"";if(a.client.isIE){c+=" allowtransparency=\"true\"";if(a.client.isIE6){c+=" src=\"javascript:false;document.write('');\""}}c+="></iframe>";b.innerHTML=c},remove:function(){var b=document.getElementById(this.id);if(b){a.lib.remove(b);if(a.client.isGecko){delete window.frames[this.id]}}},onLoad:function(){var b=a.client.isIE?document.getElementById(this.id).contentWindow:window.frames[this.id];b.location.href=this.obj.content}}})(Shadowbox);
(function(h){var e=h.util,i,k,j="sb-drag-layer",d;function b(){i={x:0,y:0,start_x:null,start_y:null}}function c(m,o,l){if(m){b();var n=["position:absolute","height:"+o+"px","width:"+l+"px","cursor:"+(h.client.isGecko?"-moz-grab":"move"),"background-color:"+(h.client.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");h.lib.append(h.skin.bodyEl(),"<div id=\""+j+"\" style=\""+n+"\"></div>");h.lib.addEvent(e.get(j),"mousedown",g)}else{var p=e.get(j);if(p){h.lib.removeEvent(p,"mousedown",g);h.lib.remove(p)}k=null}}function g(m){h.lib.preventDefault(m);var l=h.lib.getPageXY(m);i.start_x=l[0];i.start_y=l[1];k=e.get(h.contentId());h.lib.addEvent(document,"mousemove",f);h.lib.addEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grabbing"}}function a(){h.lib.removeEvent(document,"mousemove",f);h.lib.removeEvent(document,"mouseup",a);if(h.client.isGecko){e.get(j).style.cursor="-moz-grab"}}function f(o){var q=h.content,p=h.dimensions,n=h.lib.getPageXY(o);var m=n[0]-i.start_x;i.start_x+=m;i.x=Math.max(Math.min(0,i.x+m),p.inner_w-q.width);k.style.left=i.x+"px";var l=n[1]-i.start_y;i.start_y+=l;i.y=Math.max(Math.min(0,i.y+l),p.inner_h-q.height);k.style.top=i.y+"px"}h.img=function(m){this.obj=m;this.resizable=true;this.ready=false;var l=this;d=new Image();d.onload=function(){l.height=m.height?parseInt(m.height,10):d.height;l.width=m.width?parseInt(m.width,10):d.width;l.ready=true;d.onload="";d=null};d.src=m.content};h.img.prototype={append:function(l,o,n){this.id=o;var m=document.createElement("img");m.id=o;m.src=this.obj.content;m.style.position="absolute";m.setAttribute("height",n.resize_h);m.setAttribute("width",n.resize_w);l.appendChild(m)},remove:function(){var l=e.get(this.id);if(l){h.lib.remove(l)}c(false);if(d){d.onload="";d=null}},onLoad:function(){var l=h.dimensions;if(l.oversized&&h.options.handleOversize=="drag"){c(true,l.resize_h,l.resize_w)}},onWindowResize:function(){if(k){var p=h.content,o=h.dimensions,n=parseInt(h.lib.getStyle(k,"top")),m=parseInt(h.lib.getStyle(k,"left"));if(n+p.height<o.inner_h){k.style.top=o.inner_h-p.height+"px"}if(m+p.width<o.inner_w){k.style.left=o.inner_w-p.width+"px"}}}}})(Shadowbox);
(function(b){var a=b.util;b.swf=function(c){this.obj=c;this.resizable=true;this.height=c.height?parseInt(c.height,10):300;this.width=c.width?parseInt(c.width,10):300};b.swf.prototype={append:function(k,d,m){this.id=d;var i=document.createElement("div");i.id=d;k.appendChild(i);var j=m.resize_h,n=m.resize_w,e=this.obj.content,l=b.options.flashVersion,c=b.path+"libraries/swfobject/expressInstall.swf",f=b.options.flashVars,g=b.options.flashParams;swfobject.embedSWF(e,d,n,j,l,c,f,g)},remove:function(){swfobject.expressInstallCallback();swfobject.removeSWF(this.id)}}})(Shadowbox);
if(typeof jQuery=="undefined"){throw"Unable to load Shadowbox adapter, jQuery not found"}if(typeof Shadowbox=="undefined"){throw"Unable to load Shadowbox adapter, Shadowbox not found"}(function(b,a){a.lib={getStyle:function(d,c){return b(d).css(c)},remove:function(c){b(c).remove()},getTarget:function(c){return c.target},getPageXY:function(c){return[c.pageX,c.pageY]},preventDefault:function(c){c.preventDefault()},keyCode:function(c){return c.keyCode},addEvent:function(e,c,d){b(e).bind(c,d)},removeEvent:function(e,c,d){b(e).unbind(c,d)},append:function(d,c){b(d).append(c)}}})(jQuery,Shadowbox);(function(a){a.fn.shadowbox=function(b){return this.each(function(){var d=a(this);var e=a.extend({},b||{},a.metadata?d.metadata():a.meta?d.data():{});var c=this.className||"";e.width=parseInt((c.match(/w:(\d+)/)||[])[1])||e.width;e.height=parseInt((c.match(/h:(\d+)/)||[])[1])||e.height;Shadowbox.setup(d,e)})}})(jQuery);
var tablecontroller = {
	tableArray : {} //array
};
tablecontroller.init = function(details) {
	var details = details || [];
	this.initEffect();
	this.exportUrl = details.exportUrl || "/"+globalref+"do/?table=true"; //string
};
tablecontroller.createTable = function(details) {
	if(details.tableNum) this.tableArray[details.tableNum] = new tableObj(details);
	else this.tableArray[this.tableArray.length] = new tableObj(details);
};
/* MASTER RESET CHART (object) */
tablecontroller.resetTable = function() {
	this.tableArray = {};
};

tablecontroller.initEffect = function() {
	var that = this;
	
	//pager
	$("table[data-table]").each(function() {
		$table = $(this);

		var tableType = $table.data("table");
		
		var tableId = tableType+"_"+Math.floor(Math.random()*9999);
		$table.wrap("<div id=\"table_"+tableId+"\"></div>");

		var tableSettings = "";
		if(tableType == "paged") {
			tableSettings = { 
				'sortable': true,
				'paging': true,
				'highlight': false,
				'disableControls' : true,
				'noSortColumn' : "1" };
		}
    tablecontroller.createTable({ 
			tableContainer : "table_"+tableId,
      tableController : tablecontroller,
      tableSettings : tableSettings
    });
    $("#table_"+tableId).selectivizr();
		if(typeof(windowcontroller) != "undefined") windowcontroller.resize(); 
	});

	//chart
	$("table[data-chart]").each(function() {
		$table = $(this);

		var chartType = $table.data("chart");
		var chartId = chartType+"_"+Math.floor(Math.random()*9999);

		$chartContainer = $("<div id=\"chart_"+chartId+"\" class=\"chart_"+chartType+"\"></div>");
		$chartContainer.insertAfter($table);
		
		var chartSettings = "";
		chartSettings = chartcontroller.createDataFromTable({ 
			'table': $table, 
			'hideTable': true, 
			'type': chartType, 
			'chartContainer': "chart_"+chartId }); 
		if(chartSettings) {
			chartcontroller.createChart({ 
				chartSettings : chartSettings, 
				chartContainer : "chart_"+chartId,
				chartController : chartcontroller
			});
		}
    $("#chart_"+chartId).selectivizr();
		if(typeof(windowcontroller) != "undefined") windowcontroller.resize(); 
  });
};


/* ------------------------------ */
/* -------- table object -------- */
/* ------------------------------ */

function tableObj(details) { 
	var that = this;
	this.rendered = false;
	this.tableContainer = $("#"+details.tableContainer); //container

	this.tableSettings = details.tableSettings || []; //object
	this.tableController = details.tableController; //object
	this.tableConstruct = "";
	this.table = this.tableContainer.find("table"); //object
	this.tableWrapper; //html

	this.tablecontrolsContainer; //html
	this.tablecontrols = []; //object
	this.disableControls = details.tableSettings.disableControls || false;
	//init
	this.init(); 
	//is done
	this.rendered = true;
}

tableObj.prototype.buildExportConstruct = function() {
	$pageSizer = this.tableContainer.find("select.pagesize");
	$pageDirect = this.tableContainer.find("input.direct");
	//moveToPage
	if($pageSizer) {
		var memorySize = $pageSizer.val();
		var memoryPage = $pageDirect.val();
		$pageSizer
			.append("<option value=\"10000\"></option>")
			.val(10000)
			.trigger("change");
	}

	$table = $(this.table);
	$clonedtable = $table.clone();
	
	if($pageSizer) {
		$pageSizer
			.val(memorySize)
			.trigger("change")
			.children(":last")
				.remove();
		$pageDirect
			.val(memoryPage)
			.trigger("click");
	}

	$clonedtable.find("[colspan]").each( function() { 
		$this = $(this);
		for(var i = 0; i < (parseInt($this.attr("colspan"))-1); i++) {
			$("<th>skipcell</th>").insertAfter($this);
		}
	});

	fullHtml = "<table>"+$clonedtable.find("thead").html()+""+$clonedtable.find("tbody").html()+"</table>";
  fullHtml = fullHtml.replace(/skipcell/gi, "");
  fullHtml = fullHtml.replace(/\&amp\;/gi, "&");

  fullHtml = fullHtml.replace(/<[a-zA-Z]+(?:[^>"']+|"[^"]*"|'[^']*')*>/g, "[");
  fullHtml = fullHtml.replace(/<(\/?)[a-zA-Z]+(?:[^>"']+|"[^"]*"|'[^']*')*>/g, "]");
  fullHtml = fullHtml.replace(/\[\-\]/g,"-");

  fullHtml = fullHtml.replace(/[\r\n]/g, "");
	this.tableConstruct = fullHtml;
};
tableObj.prototype.init = function() { 
	if(!this.tableSettings.exporting) this.tableSettings.exporting = "";
	if(!this.tableSettings.exporting.filename) this.tableSettings.exporting.filename = "table";

	this.build(); //set HTML
	this.bind(); //set EVENTS
	if(!this.disableControls) {
		this.renderControls(); //set HTML controls
		this.bindControls(); //set JS controls functions
	}
	if(this.tableSettings.tooltip) this.setTooltip(); //set tooltips
};

/* BUILD HTML controlls en wrapper toevoegen */
tableObj.prototype.build = function() {
	var that = this;

	//remove border
	this.table.removeAttr("border");

	//wrap as a whole
	if(this.tableWrapper == undefined) {
		this.tableContainer
			.addClass("table")
			.wrap("<div class=\"tablewrapper\"></div>")
		this.tableWrapper = this.tableContainer.parent(".tablewrapper");
	}
	//sorting
	if(this.tableSettings.sortable) {
		var properties = { };
		/* fix width */
		if(this.tableSettings.widthFixed) properties.widthFixed = true;
		/* disallowed sorts */
		if(this.tableSettings.sortDirections) {
			sdir = this.tableSettings.sortDirections;
			sdirArray = {'asc':[],'desc':[]};
			if(sdir.indexOf("AZ") > -1) sdirArray["desc"].push("text");
			if(sdir.indexOf("ZA") > -1) sdirArray["asc"].push("text");
			if(sdir.indexOf("09") > -1) sdirArray["desc"].push("numeric");
			if(sdir.indexOf("90") > -1) sdirArray["asc"].push("numeric");
			properties.sortDisallowedOrder = sdirArray;
		}
		/* no sort */
		if(this.tableSettings.noSortColumn != undefined) {
			var columnNums = [];
			if(this.tableSettings.noSortColumn == "-1") {
				for(var i = 1; i <= this.table.find("th").length; i++) columnNums[(i-1)] = i;
			}
			else columnNums = this.tableSettings.noSortColumn.split(";");
			properties.headers = { }
			$.each(columnNums, function(index, value) { 
				properties.headers[(value-1)] = { sorter: false };
			});
		}
		/* pre sort */
		if(this.tableSettings.sortColumn != undefined) {
			var columnNum = parseInt(this.tableSettings.sortColumn)-1;
			var columnOrder = this.tableSettings.sortDesc || 0;
			properties.sortList = [[columnNum,columnOrder]];
			//this.table.addClass('sortable').tablesorter({widthFixed: widthFixed, sortList:[[columnNum,columnOrder]] });
		}
		/* normal start */
		this.table.addClass("sortable").tablesorter(properties);
	}
	//paging
	if(this.tableSettings.paging) {
		this.tableContainer.prepend("<div class=\"tablepager\"> \
			<form> \
				<div class=\"first\"></div> \
				<div class=\"prev\"></div> \
				<input type=\"text\" class=\"direct invisible\"/> \
				<input type=\"text\" class=\"pagedisplay\" readonly=\"readonly\"/> \
				<div class=\"next\"></div> \
				<div class=\"last\"></div> \
				<select class=\"pagesize\"> \
					<option selected=\"selected\"  value=\"10\">10</option> \
					<option value=\"20\">20</option> \
					<option value=\"30\">30</option> \
					<option  value=\"40\">40</option> \
				</select> \
			</form> \
		</div>"); 
	  this.table.tablesorterPager({ container : this.tableContainer.children(".tablepager"), positionFixed : false }); 
   }
};
tableObj.prototype.bind = function() {
	var that = this;

	if(this.tableSettings.highlight) {
		//highlighter
		this.table.find("td").each( function() {
			$(this)
				.mouseenter(function() {
					that.highlight($(this));
				})
				.mouseleave(function() {
					that.unhighlight();
				});
		});
	}
};

tableObj.prototype.setTooltip = function() {
	var that = this;
	if(this.tableSettings.tooltip.head) {
		if(this.tableSettings.tooltip.head.rows) {
			$.each(this.tableSettings.tooltip.head.rows, function(row, tooltip) {
				that.table.find("thead").find("tr:nth-child("+row.match(/[0-9]+/)+")").find("th").each( function() {
					$(this).attr("data-tooltip", eval(tooltip));
				});
			});
		}	
		if(this.tableSettings.tooltip.head.columns) { 
			$.each(this.tableSettings.tooltip.head.columns, function(column, tooltip) {
				that.table.find("thead").find("th:nth-child("+column.match(/[0-9]+/)+")").each( function() {
					$(this).attr("data-tooltip", eval(tooltip));
				});
			});
	}	}

	if(this.tableSettings.tooltip.body) {
		if(this.tableSettings.tooltip.body.rows) { 
			$.each(this.tableSettings.tooltip.body.rows, function(row, tooltip) {
				that.table.find("tbody").find("tr:nth-child("+row.match(/[0-9]+/)+")").find("th").each( function() {
					$(this).attr("data-tooltip", eval(tooltip));
				});
			});
		}
		if(this.tableSettings.tooltip.body.columns) {
			$.each(this.tableSettings.tooltip.body.columns, function(column, tooltip) {
				that.table.find("tbody").find("td:nth-child("+column.match(/[0-9]+/)+")").each( function() {
					$(this).attr("data-tooltip", eval(tooltip));
				});
			});
	}	}	

	setTimeout( function() { that.table.tooltips(); }, 5);
};

/* CONTROLS html, js, update */
tableObj.prototype.renderControls = function() {
	var that = this;

	//add controls
	var controlOptions = "";
	if(this.tableSettings.flippable) {
		this.flipMode = "0";
		this.numHeadRows = [this.table.find("thead").find("tr").length,1];
		controlOptions += "<div class=\"flip\" data-tablecontrol=\"flip\">"+tr.str("flip table")+"</div>";
	}
	if(top === self) controlOptions += "<div class=\"shadow\" data-tablecontrol=\"shadow\">"+tr.str("full screen")+"</div>";
	controlOptions += "<div class=\"export\" data-tablecontrol=\"export\" data-export-option=\"csv\">"+tr.str("export csv")+"</div>";
	controlOptions += "<div class=\"export\" data-tablecontrol=\"export\" data-export-option=\"excel\">"+tr.str("export xlsx")+"</div>";
	controlOptions += "<div class=\"print\" data-tablecontrol=\"print\">"+tr.str("print")+"</div>";
	var controlsHtml = "<div data-tablecontrols=\"1\" class=\"tablecontrols\">"+controlOptions+"</div>";
	this.tableWrapper.prepend(controlsHtml);

	this.tablecontrolsContainer = this.tableContainer.parent(".tablewrapper").find("div[data-tablecontrols]");
	//set style for table
	if(this.tableSettings.flippable) {
		this.table.addClass("flippable");
		this.setStyle();
	}
};
tableObj.prototype.bindControls = function() {
	var that = this;
	this.tablecontrolsContainer.find("div[data-tablecontrol]").each( function() {
		$this = $(this);
		var controlType = $this.data("tablecontrol");
		var controlOption = "";
		switch(controlType) {
			case "shadow":
				$this.click( function() { 
					that.tableController.overLayObject = that;
					//toon overlay
					shadowboxcontroller.shadow({
						player: "iframe",
						content: "/"+globalref+"do/?incA=table&incB=shadow", 
						modal: false,
						width: (that.tableContainer.width+40)
					});
				});
				break; 

			case "export":
				var controlOption = $this.data("export-option") || "csv";
				$this.click( function() { that.exportTable({ type: controlOption }); });
				break;

			case "flip":
				$this.click( function() { 
					that.flipTable(); 
					that.build(); 
					that.tableWrapper.selectivizr();
				});
				break;

			case "print":
				$this.click( function() { that.printTable(); });
				break;
		}
		//misc binds for fix style
		that.tableContainer.find(".tablepager").each( function() { 
			//table paging
			$(this).children("form").children().each( function() { 
				$(this)
					.click( function() { that.tableWrapper.selectivizr(); })
					.change( function() { that.tableWrapper.selectivizr(); });
			});
			//sorting
			$(this).siblings("table").find("th").click( function() { that.tableWrapper.selectivizr(); });
		});

		//add to object array
		var controlReference = controlType;
		if(controlOption) controlReference += ","+controlOption;
		that.tablecontrols[controlReference] = $this;
	});
};

/* DIRECT PRINT */
tableObj.prototype.printTable = function() {
	this.tableContainer.print();
};

/* DIRECT FORCED DOWNLOAD (custom; exporting.custom.js) */
tableObj.prototype.exportTable = function(details) {
	var that = this;
	
	if(!details.method) details.method = "download";

	switch (details.method) {			
		//post as form to receive download
		case "download":
			//reconstruct export
			that.buildExportConstruct();

			$("body")
				.append($("<form/>")
			  .attr({'action': this.tableController.exportUrl, 'method': "post", 'id': "replacer"})
			  .append($("<input/>")
			    .attr({'type': "hidden", 'name': "filename", 'value': this.tableSettings.exporting.filename})
			  )
			  .append($("<input/>")
			    .attr({'type': "hidden", 'name': "type", 'value': details.type})
			  )
			  .append($("<input/>")
			    .attr({'type': "hidden", 'name': "method", 'value': details.method})
			  )
			  .append($("<input/>")
			    .attr({'type': "hidden", 'name': "table", 'value': escape(this.tableConstruct) })
			  )
			).find("#replacer").submit();
			setTimeout( function() { $("#replacer").remove(); }, 500);
			break;

		//use ajax to prevent form reloading
		case "batch":
			//reconstruct export
			that.buildExportConstruct();
			
			$.ajax({	
				type: "POST", url: this.tableController.exportUrl,
				data: "type="+details.type+"&filename="+this.tableSettings.exporting.filename+"&method="+details.method+"&table="+escape(this.tableConstruct),
				success: function(){ windowcontroller.returnMessage("generated"); },
				error: function() { windowcontroller.returnMessage("not generated"); }
			});
			break;
	}
};

tableObj.prototype.flipTable = function() {
	var that = this;

	var table = [];
	var tableColSpan = [];
	var tableRowSpan = [];
	var tableTooltips= [];
	var tableHtml = { 'thead' : "", 'tbody' : ""};
	this.numHeadRows[this.flipMode] = this.table.find("thead").find("tr").length;
	if(this.flipMode == 0) this.flipMode = 1;
	else this.flipMode = 0;

	var trs = this.table.find("tr");
	//reorder
	RowindexOffset = 0;
	$.each(trs, function(Rowindex, Rowvalue) {
		var tds = $(Rowvalue).find("td,th");
		CellindexOffset = 0;
		$.each(tds, function(Cellindex, Tdvalue) {
			CellindexCorr = Cellindex + CellindexOffset;

			$td = $(Tdvalue);
			if(table[CellindexCorr] == undefined) table[CellindexCorr] = [];

			//store cell content
			table[CellindexCorr][Rowindex] = $td.html();

			//has tooltip?
			if($td.attr("data-tooltip")) {
				if(!tableTooltips[CellindexCorr]) tableTooltips[CellindexCorr] = [];
				tableTooltips[CellindexCorr][(Rowindex)] = $td.attr("data-tooltip");
			}
			//has colspan?
			if($td.attr("colspan")) {
				if(!tableColSpan[CellindexCorr]) tableColSpan[CellindexCorr] = [];
				tableColSpan[CellindexCorr][Rowindex] = $td.attr("colspan");
				//fill array with skippable cells
				for(var i = 1; i < (parseInt($td.attr("colspan"))); i++) {
					if(table[(CellindexCorr+i)] == undefined) table[(CellindexCorr+i)] = [];
					table[(CellindexCorr+i)][Rowindex] = "skipcell";
				}
				CellindexOffset += (parseInt($td.attr("colspan"))-1);
				$td.removeAttr("colspan");
			}
			//has rowspan?
			if($td.attr("rowspan")) {
				if(!tableRowSpan[CellindexCorr]) tableRowSpan[CellindexCorr] = [];
				tableRowSpan[CellindexCorr][(Rowindex)] = $td.attr("rowspan");
				RowindexOffset += (parseInt($td.attr("rowspan"))-1);
				$td.removeAttr("rowspan");
			}
		});
	});

	//each
	$.each(table, function(Rowindex, Rowvalue) {
		if(Rowindex < that.numHeadRows[that.flipMode]) { cellType = "th"; tablePart = "thead"; }
		else { cellType = "td"; tablePart = "tbody"; }

		var cells = "";
		tableHtml[tablePart][Rowindex];
		$.each(Rowvalue, function(Cellindex, Tdvalue) {
			cellAttr = "";
			//set tooltip?
			if(tableTooltips[Rowindex]) {
				if(tableTooltips[Rowindex][Cellindex]) {
					span = tableTooltips[Rowindex][Cellindex];
					cellAttr += "data-tooltip=\""+span+"\"";
				}
			}
			//set rowspan?
			if(tableColSpan[Rowindex]) {
				if(tableColSpan[Rowindex][Cellindex]) {
					span = tableColSpan[Rowindex][Cellindex];
					cellAttr += "rowspan=\""+span+"\"";
				}
			}
			//set colspan?
			if(tableRowSpan[Rowindex]) {
				if(tableRowSpan[Rowindex][Cellindex]) {
					span = tableRowSpan[Rowindex][Cellindex];
					cellAttr += " colspan=\""+span+"\"";
				}
			}
			if(Tdvalue == "skipcell") cellAttr += "style=\"display: none\"";
			if(Tdvalue == "skipcell" && Rowindex != 0 || Tdvalue != "skipcell") cells += "<"+cellType+" "+cellAttr+">"+Tdvalue+"</"+cellType+">";
		});
		tableHtml[tablePart] += "<tr>"+cells+"</tr>";
	});
	$newtable = $("<table class=\"flippable\"><thead>"+tableHtml["thead"]+"</thead><tbody>"+tableHtml["tbody"]+"</tbody></table>");
	this.table.remove()
	$newtable.appendTo(this.tableContainer);
	this.table = $newtable;
	
	this.setStyle(); //set style for table
	this.bind(); //set EVENTS
	setTimeout( function() { that.table.tooltips(); }, 5); //reinit tooltips

	if(windowcontroller != undefined) setTimeout( function() {  windowcontroller.resize(); }, 50);
};
tableObj.prototype.setStyle = function() { 
	var that = this;

	//main table style
	this.table.addClass("fm"+this.flipMode+" th"+this.numHeadRows[0]+"th"+this.numHeadRows[1]);

	//column style
	var cellNum = 0;
	var columnPos = [];
	this.table.find("thead tr:first th").each( function() { 
		$th = $(this);
		if($th.attr("colspan") > 1) {
			colspan = parseInt($th.attr("colspan"));
			cellNum += colspan;
		}
		else cellNum++;
		//add column style to table cells
		columnPos.push(cellNum);
	});
  uColumnPos = $.unique(columnPos);
  //add to each thead row (except first) and cell
  if(uColumnPos.length > 1 || uColumnPos[0] != 1) { 
		this.table.find("thead tr:first th").addClass("bgncol endcol");
  	$.each(columnPos, function(index, value) {
  		//end colspan
	  	that.table.find("thead tr:not(:first) th:nth-child("+value+")").addClass("endcol");
	  	that.table.find("tbody td:nth-child("+value+")").addClass("endcol");
	  	//begin colspan
	  	that.table.find("thead tr:not(:first) th:nth-child("+(value+1)+")").addClass("bgncol");
	  	that.table.find("tbody td:nth-child("+(value+1)+")").addClass("bgncol");
  	});
  }

	//row style
	var cellNum = 0;
	var rowPos = [];
	this.table.find("tbody tr").each( function() { 
		$td = $(this).find("td:first");
		if($td.attr("rowspan") > 1) {
			rowspan = parseInt($td.attr("rowspan"));
			cellNum += rowspan;
			//add row style to table cells
			rowPos.push(cellNum);
		}
	});
  uRowPos = $.unique(rowPos);
  //add to each thead row (except first) and cell
  if(uRowPos.length > 1 || uRowPos[0] != 1) { 
  	this.table.find("tbody tr:first-child td").addClass("bgnrow");
  	this.table.find("tbody tr:first-child").addClass("tr-bgnrow");
  	this.table.find("tbody tr:last-child td").addClass("endrow");
  	this.table.find("tbody tr:last-child").addClass("tr-endrow");
  	$.each(rowPos, function(index, value) {
  		//end rowspan
	  	that.table.find("tbody tr:nth-child("+value+") td").addClass("endrow");
	  	that.table.find("tbody tr:nth-child("+value+")").addClass("tr-endrow");
	  	//begin rowspan
	  	that.table.find("tbody tr:nth-child("+(value+1)+") td").addClass("bgnrow");
	  	that.table.find("tbody tr:nth-child("+(value+1)+")").addClass("tr-bgnrow");
  	});
  }
 	if(uRowPos.length == 0) this.table.find("tbody td").addClass("bgnrow endrow");
 	if(uRowPos.length == 0) this.table.find("tbody tr").addClass("bgnrow tr-endrow");
  //larger cells
  this.table.find("[colspan]").each( function() { if($(this).attr("colspan") > 1) $(this).addClass("spanned"); });
  this.table.find("[rowspan]").each( function() { if($(this).attr("rowspan") > 1) $(this).addClass("spanned"); });

  //IE issue with rendering table border
  if($.browser.msie) setTimeout( function() { that.table.html(that.table.html()).selectivizr(); }, 1);
};

/* HIGHLIGHT */
tableObj.prototype.unhighlight = function(obj) {
	this.table.find("td").removeClass("highlight middle");
};
tableObj.prototype.highlight = function(obj) {
	$td = $(obj);
	$tr = $td.parent();
	$table = this.table;
	var tdIndex = $tr.children().index($td);
	var trIndex = $tr.parent().children().index($tr);

	//remove classes
	$table.find("td").removeClass("highlight middle");
	//column
	$table.find("tr").each( function() {
		var $tr = $(this);

		//same row
		if($tr.parent().children().index($tr) == trIndex) {
			$tr.find("td").each( function() {
				var $th = $(this);
				var tdSize = $th.attr("colspan") || 1;
				var tdThisIndex = $th.parent().children().index($th);

				if(tdSize == 1) {
					if(tdThisIndex == tdIndex) $td.addClass("middle"); //current focus
					$th.addClass("highlight");
				}
			});
		}

		//same column
		$tr.find("td:eq("+tdIndex+")").each( function() {
			var $th = $(this);
			var tdSize = $th.attr("colspan") || 1;
			//column
			if(tdSize == 1) $th.addClass("highlight");
		});
	});
};
/*
 * 
 * TableSorter 2.0 - Client-side table sorting with ease!
 * Version 2.0.5b
 * @requires jQuery v1.2.3
 * 
 * Copyright (c) 2007 Christian Bach
 * Examples and docs at: http://tablesorter.com
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 */
/**
 * 
 * @description Create a sortable table with multi-column sorting capabilitys
 * 
 * @example $('table').tablesorter();
 * @desc Create a simple tablesorter interface.
 * 
 * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
 * @desc Create a tablesorter interface and sort on the first and secound column column headers.
 * 
 * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
 *          
 * @desc Create a tablesorter interface and disableing the first and second  column headers.
 *      
 * 
 * @example $('table').tablesorter({ headers: { 0: {sorter:"integer"}, 1: {sorter:"currency"} } });
 * 
 * @desc Create a tablesorter interface and set a column parser for the first
 *       and second column.
 * 
 * 
 * @param Object
 *            settings An object literal containing key/value pairs to provide
 *            optional settings.
 * 
 * 
 * @option String cssHeader (optional) A string of the class name to be appended
 *         to sortable tr elements in the thead of the table. Default value:
 *         "header"
 * 
 * @option String cssAsc (optional) A string of the class name to be appended to
 *         sortable tr elements in the thead on a ascending sort. Default value:
 *         "headerSortUp"
 * 
 * @option String cssDesc (optional) A string of the class name to be appended
 *         to sortable tr elements in the thead on a descending sort. Default
 *         value: "headerSortDown"
 * 
 * @option String sortInitialOrder (optional) A string of the inital sorting
 *         order can be asc or desc. Default value: "asc"
 * 
 * @option String sortMultisortKey (optional) A string of the multi-column sort
 *         key. Default value: "shiftKey"
 * 
 * @option String textExtraction (optional) A string of the text-extraction
 *         method to use. For complex html structures inside td cell set this
 *         option to "complex", on large tables the complex option can be slow.
 *         Default value: "simple"
 * 
 * @option Object headers (optional) An array containing the forces sorting
 *         rules. This option let's you specify a default sorting rule. Default
 *         value: null
 * 
 * @option Array sortList (optional) An array containing the forces sorting
 *         rules. This option let's you specify a default sorting rule. Default
 *         value: null
 * 
 * @option Array sortForce (optional) An array containing forced sorting rules.
 *         This option let's you specify a default sorting rule, which is
 *         prepended to user-selected rules. Default value: null
 * 
 * @option Boolean sortLocaleCompare (optional) Boolean flag indicating whatever
 *         to use String.localeCampare method or not. Default set to true.
 * 
 * 
 * @option Array sortAppend (optional) An array containing forced sorting rules.
 *         This option let's you specify a default sorting rule, which is
 *         appended to user-selected rules. Default value: null
 * 
 * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter
 *         should apply fixed widths to the table columns. This is usefull when
 *         using the pager companion plugin. This options requires the dimension
 *         jquery plugin. Default value: false
 * 
 * @option Boolean cancelSelection (optional) Boolean flag indicating if
 *         tablesorter should cancel selection of the table headers text.
 *         Default value: true
 * 
 * @option Boolean debug (optional) Boolean flag indicating if tablesorter
 *         should display debuging information usefull for development.
 * 
 * @type jQuery
 * 
 * @name tablesorter
 * 
 * @cat Plugins/Tablesorter
 * 
 * @author Christian Bach/christian.bach@polyester.se
 */

(function ($) {
    $.extend({
        tablesorter: new
        function () {

            var parsers = [],
                widgets = [];

            this.defaults = {
                cssHeader: "header",
                cssDisabled: "headerNoSort",
                cssLocked: "headerLockedSort",
                cssAsc: "headerSortUp",
                cssDesc: "headerSortDown",
                cssChildRow: "expand-child",
                sortInitialOrder: "asc",
                sortDisallowedOrder: { 'asc':[],'desc':[] },
                sortMultiSortKey: "shiftKey",
                sortForce: null,
                sortAppend: null,
                sortLocaleCompare: true,
                textExtraction: "simple",
                parsers: {}, widgets: [],
                widgetZebra: {
                    css: ["even", "odd"]
                }, headers: {}, widthFixed: false,
                cancelSelection: true,
                sortList: [],
                headerList: [],
                dateFormat: "us",
                decimal: "/\.|\,/g",
                onRenderHeader: null,
                selectorHeaders: "thead th",
                debug: false
            };

            /* debuging utils */

            function benchmark(s, d) {
                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
            }

            this.benchmark = benchmark;

            function log(s) {
                if (typeof console != "undefined" && typeof console.debug != "undefined") {
                    console.log(s);
                } else {
                    alert(s);
                }
            }

            /* parsers utils */

            function buildParserCache(table, $headers) {
                $body = $(table).find("tbody"); 

                if (table.config.debug) {
                    var parsersDebug = "";
                }

                if ($body.find("tr").length == 0) return; // In the case of empty tables
                var rows = $body.find("tr");

                if (rows[0]) {

                    var list = [],
                        cells = rows[0].cells,
                        l = cells.length;

                    for (var i = 0; i < l; i++) {

                        var p = false;

                        if ($.metadata && ($($headers[i]).metadata() && $($headers[i]).metadata().sorter)) {

                            p = getParserById($($headers[i]).metadata().sorter);

                        } else if ((table.config.headers[i] && table.config.headers[i].sorter)) {

                            p = getParserById(table.config.headers[i].sorter);
                        }
                        if (!p) {

                            p = detectParserForColumn(table, rows, -1, i);
                        }

                        if (table.config.debug) {
                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";
                        }

                        list.push(p);
                    }
                }

                if (table.config.debug) {
                    log(parsersDebug);
                }

                return list;
            };

            function detectParserForColumn(table, rows, rowIndex, cellIndex) {
                var l = parsers.length,
                    node = false,
                    nodeValue = false,
                    keepLooking = true;
                while (nodeValue == "" && keepLooking) {
                    rowIndex++;
                    if (rows[rowIndex]) {
                        node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);
                        nodeValue = trimAndGetNodeText(table.config, node);
                        if (table.config.debug) {
                            log("Checking if value was empty on row:" + rowIndex);
                        }
                    } else {
                        keepLooking = false;
                    }
                }
                for (var i = 1; i < l; i++) {
                    if (parsers[i].is(nodeValue, table, node)) {
                        return parsers[i];
                    }
                }
                // 0 is always the generic parser (text)
                return parsers[0];
            }

            function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {
                return rows[rowIndex].cells[cellIndex];
            }

            function trimAndGetNodeText(config, node) {
                return $.trim(getElementText(config, node));
            }

            function getParserById(name) {
                var l = parsers.length;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {
                        return parsers[i];
                    }
                }
                return false;
            }

            /* utils */

            function buildCache(table) {
                $body = $(table).find("tbody"); 
                if (table.config.debug) {
                    var cacheTime = new Date();
                }

                var totalRows = $body.find("tr").length || 0,
                    totalCells = $body.find("tr").first().children("th, td").length || 0,
                    parsers = table.config.parsers,
                    cache = {
                        row: [],
                        normalized: []
                    };

                for (var i = 0; i < totalRows; ++i) {

                    /** Add the table data to main data array */
                    var c = $($body.find("tr")[i]),
                        cols = [];

                    // if this is a child row, add it to the last row's children and
                    // continue to the next row
                    if (c.hasClass(table.config.cssChildRow)) {
                        cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);
                        // go to the next for loop
                        continue;
                    }

                    cache.row.push(c);

                    for (var j = 0; j < totalCells; ++j) {
                        cols.push(parsers[j].format(getElementText(table.config, c[0].cells[j]), table, c[0].cells[j]));
                    }

                    cols.push(cache.normalized.length); // add position for rowCache
                    cache.normalized.push(cols);
                    cols = null;
                };

                if (table.config.debug) {
                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);
                }

                return cache;
            };

            function getElementText(config, node) {

                var text = "";

                if (!node) return "";

                if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;

                if (config.textExtraction == "simple") {
                    if (config.supportsTextContent) {
                        text = node.textContent;
                    } else {
                        if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
                            text = node.childNodes[0].innerHTML;
                        } else {
                            text = node.innerHTML;
                        }
                    }
                } else {
                    if (typeof(config.textExtraction) == "function") {
                        text = config.textExtraction(node);
                    } else {
                        text = $(node).text();
                    }
                }
                return text;
            }

            function appendToTable(table, cache) {
                $body = $(table).find("tbody"); 

                if (table.config.debug) {
                    var appendTime = new Date()
                }

                var c = cache,
                    r = c.row,
                    n = c.normalized,
                    totalRows = n.length,
                    checkCell = (n[0].length - 1),
                    tableBody = $body,
                    rows = [];


                for (var i = 0; i < totalRows; i++) {
                    var pos = n[i][checkCell];

                    rows.push(r[pos]);

                    if (!table.config.appender) {

                        //var o = ;
                        var l = r[pos].length;
                        for (var j = 0; j < l; j++) {
                            tableBody[0].appendChild(r[pos][j]);
                        }
                    }
                }



                if (table.config.appender) {

                    table.config.appender(table, rows);
                }

                rows = null;

                if (table.config.debug) {
                    benchmark("Rebuilt table:", appendTime);
                }

                // apply table widgets
                applyWidget(table);

                // trigger sortend
                setTimeout(function () {
                    $(table).trigger("sortEnd");
                }, 0);

            };

            function buildHeaders(table) {

                if (table.config.debug) {
                    var time = new Date();
                }

                var meta = ($.metadata) ? true : false;
                
                var header_index = computeTableHeaderCellIndexes(table);

                $tableHeaders = $(table.config.selectorHeaders, table).each(function (index) {

                    this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
                    // this.column = index;
                    this.order = formatSortingOrder(table.config.sortInitialOrder);
                    
					
					this.count = this.order;

                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true;
					if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);

                    if (!this.sortDisabled) {
                        var $th = $(this).addClass(table.config.cssHeader);
                        if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);
                    }
                    else {
                        var $th = $(this).addClass(table.config.cssDisabled);
                    }

                    var s = (table.config.parsers[this.column].type);
                    //disallowed order
                    if($.inArray(s, table.config.sortDisallowedOrder["asc"]) > -1 || $.inArray(s, table.config.sortDisallowedOrder["desc"]) > -1) {
                        $(this).addClass(table.config.cssLocked);
                    }

                    // add cell to headerList
                    table.config.headerList[index] = this;
                });

                if (table.config.debug) {
                    benchmark("Built headers:", time);
                    log($tableHeaders);
                }

                return $tableHeaders;

            };

            // from:
            // http://www.javascripttoolbox.com/lib/table/examples.php
            // http://www.javascripttoolbox.com/temp/table_cellindex.html


            function computeTableHeaderCellIndexes(t) {
                var matrix = [];
                var lookup = {};
                var thead = $(t).find("thead");
                var trs = thead.find("tr");

                for (var i = 0; i < trs.length; i++) {
                    var cells = trs[i].cells;
                    for (var j = 0; j < cells.length; j++) {
                        var c = cells[j];

                        var rowIndex = c.parentNode.rowIndex;
                        var cellId = rowIndex + "-" + c.cellIndex;
                        var rowSpan = c.rowSpan || 1;
                        var colSpan = c.colSpan || 1
                        var firstAvailCol;
                        if (typeof(matrix[rowIndex]) == "undefined") {
                            matrix[rowIndex] = [];
                        }
                        // Find first available column in the first row
                        for (var k = 0; k < matrix[rowIndex].length + 1; k++) {
                            if (typeof(matrix[rowIndex][k]) == "undefined") {
                                firstAvailCol = k;
                                break;
                            }
                        }
                        lookup[cellId] = firstAvailCol;
                        for (var k = rowIndex; k < rowIndex + rowSpan; k++) {
                            if (typeof(matrix[k]) == "undefined") {
                                matrix[k] = [];
                            }
                            var matrixrow = matrix[k];
                            for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {
                                matrixrow[l] = "x";
                            }
                        }
                    }
                }
                return lookup;
            }

            function checkCellColSpan(table, rows, row) {
                var arr = [],
                    r = $(table).find("thead").find("tr"),
                    c = r[row].cells;

                for (var i = 0; i < c.length; i++) {
                    var cell = c[i];

                    if (cell.colSpan > 1) {
                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));
                    } else {
                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {
                            arr.push(cell);
                        }
                        // headerArr[row] = (i+row);
                    }
                }
                return arr;
            };

            function checkHeaderMetadata(cell) {
                if (($.metadata) && ($(cell).metadata().sorter === false)) {
                    return true;
                };
                return false;
            }

            function checkHeaderOptions(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {
                    return true;
                };
                return false;
            }
			
			 function checkHeaderOptionsSortingLocked(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].lockedOrder)) return table.config.headers[i].lockedOrder;
                return false;
            }
			
            function applyWidget(table) {
                var c = table.config.widgets;
                var l = c.length;
                for (var i = 0; i < l; i++) {

                    getWidgetById(c[i]).format(table);
                }

            }

            function getWidgetById(name) {
                var l = widgets.length;
                for (var i = 0; i < l; i++) {
                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {
                        return widgets[i];
                    }
                }
            };

            function formatSortingOrder(v) {
                if (typeof(v) != "Number") {
                    return (v.toLowerCase() == "desc") ? 1 : 0;
                } else {
                    return (v == 1) ? 1 : 0;
                }
            }

            function isValueInArray(v, a) {
                var l = a.length;
                for (var i = 0; i < l; i++) {
                    if (a[i][0] == v) {
                        return true;
                    }
                }
                return false;
            }

            function setHeadersCss(table, $headers, list, css) {
                // remove all header information
                $headers.removeClass(css[0]).removeClass(css[1]);

                var h = [];
                $headers.each(function (offset) {
                    if (!this.sortDisabled) {
                        h[this.column] = $(this);
                    }
                });

                var l = list.length;
                for (var i = 0; i < l; i++) {
                    var s = (table.config.parsers[list[i][0]].type);
                    //disallowed order
                    var direction;
                    list[i][1] == 0 ? direction = "asc" : direction = "desc";
                    if(h[list[i][0]]) {
                        //disallowed
                        if($.inArray(s, table.config.sortDisallowedOrder[direction]) > -1) {
                            list[i][1] == 0 ? list[i][1] = 1 : list[i][1] = 0;
                            h[list[i][0]].addClass(css[list[i][1]]+" "+table.config.cssLocked);
                        }
                        //normal add class
                        else h[list[i][0]].addClass(css[list[i][1]]);
                    }
                }
            }

            function fixColumnWidth(table, $headers) {
                var c = table.config;
                if (c.widthFixed) {
                    var colgroup = $("<colgroup>");
                    $(table).find("tr:first td").each(function () {
                        colgroup.append($("<col>").css("width", ($(this).width()+25)));
                    });
                    $(table).prepend(colgroup);
                };
            }

            function updateHeaderSortCount(table, sortList) {
                var c = table.config,
                    l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var s = sortList[i],
                        o = c.headerList[s[0]];
                    o.count = s[1];
                    o.count++;
                }
            }

            /* sorting methods */

            function multisort(table, sortList, cache) {

                if (table.config.debug) {
                    var sortTime = new Date();
                }

                var dynamicExp = "var sortWrapper = function(a,b) {",
                    l = sortList.length;

                // TODO: inline functions.
                for (var i = 0; i < l; i++) {

                    var c = sortList[i][0];
                    var order = sortList[i][1];
                    // var s = (getCachedSortType(table.config.parsers,c) == "text") ?
                    // ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ?
                    // "sortNumeric" : "sortNumericDesc");
                    // var s = (table.config.parsers[c].type == "text") ? ((order == 0)
                    // ? makeSortText(c) : makeSortTextDesc(c)) : ((order == 0) ?
                    // makeSortNumeric(c) : makeSortNumericDesc(c));
                    var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction(table, "text", "asc", c) : makeSortFunction(table, "text", "desc", c)) : ((order == 0) ? makeSortFunction(table, "numeric", "asc", c) : makeSortFunction(table, "numeric", "desc", c));
                    if(!s) return cache;

                    var e = "e" + i;

                    dynamicExp += "var " + e + " = " + s; // + "(a[" + c + "],b[" + c
                    // + "]); ";
                    dynamicExp += "if(" + e + ") { return " + e + "; } ";
                    dynamicExp += "else { ";
                }

                // if value is the same keep orignal order
                var orgOrderCol = cache.normalized[0].length - 1;
                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";

                for (var i = 0; i < l; i++) {
                    dynamicExp += "}; ";
                }

                dynamicExp += "return 0; ";
                dynamicExp += "}; ";

                if (table.config.debug) {
                    benchmark("Evaling expression:" + dynamicExp, new Date());
                }

                eval(dynamicExp);

                cache.normalized.sort(sortWrapper);

                if (table.config.debug) {
                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);
                }

                return cache;
            };

            function makeSortFunction(table, type, direction, index) {
                //disallowed order
                if($.inArray(type, table.config.sortDisallowedOrder[direction]) > -1) {
                    direction == "desc" ? direction = "asc" : direction = "desc";
                }

                var a = "a[" + index + "]",
                    b = "b[" + index + "]";
                if (type == "text" && direction == "asc") {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
                } else if (type == "text" && direction == "desc") {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
                } else if (type == "numeric" && direction == "asc") {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
                } else if (type == "numeric" && direction == "desc") {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
                }
            };

            this.construct = function (settings) {
                return this.each(function () {
                    // if no thead or tbody quit.
                    if (!this.tHead || !this.tBodies) return;
                    // declare
                    var $this, $document, $headers, cache, config, shiftDown = 0,
                        sortOrder;
                    // new blank config object
                    this.config = {};
                    // merge and extend.
                    config = $.extend(this.config, $.tablesorter.defaults, settings);
                    // store common expression for speed
                    $this = $(this);
                    // save the settings where they read
                    $.data(this, "tablesorter", config);
                    // try to auto detect column type, and store in tables config
                    this.config.parsers = buildParserCache(this, $headers);
                    // build headers
                    $headers = buildHeaders(this);
                    // build the cache for the tbody cells
                    cache = buildCache(this);
                    // get the css class names, could be done else where.
                    var sortCSS = [config.cssDesc, config.cssAsc];
                    // fixate columns if the users supplies the fixedWidth option
                    fixColumnWidth(this);
                    // apply event handling to headers
                    // this is to big, perhaps break it out?
                    $headers.click(

                    function (e) {
                        var totalRows = $this.find("tbody").find("tr").length || 0;
                        if (!this.sortDisabled && totalRows > 0) {
                            // Only call sortStart if sorting is
                            // enabled.
                            $this.trigger("sortStart");
                            // store exp, for speed
                            var $cell = $(this);
                            // get current column index
                            var i = this.column;
                            // get current column sort order
                            this.order = this.count++ % 2;
							// always sort on the locked order.
							if(this.lockedOrder) this.order = this.lockedOrder;
							
							// user only whants to sort on one
                            // column
                            if (!e[config.sortMultiSortKey]) {
                                // flush the sort list
                                config.sortList = [];
                                if (config.sortForce != null) {
                                    var a = config.sortForce;
                                    for (var j = 0; j < a.length; j++) {
                                        if (a[j][0] != i) {
                                            config.sortList.push(a[j]);
                                        }
                                    }
                                }
                                // add column to sort list
                                config.sortList.push([i, this.order]);
                                // multi column sorting
                            } else {
                                // the user has clicked on an all
                                // ready sortet column.
                                if (isValueInArray(i, config.sortList)) {
                                    // revers the sorting direction
                                    // for all tables.
                                    for (var j = 0; j < config.sortList.length; j++) {
                                        var s = config.sortList[j],
                                            o = config.headerList[s[0]];
                                        if (s[0] == i) {
                                            o.count = s[1];
                                            o.count++;
                                            s[1] = o.count % 2;
                                        }
                                    }
                                } else {
                                    // add column to sort list array
                                    config.sortList.push([i, this.order]);
                                }
                            };
                            setTimeout(function () {
                                // set css for headers
                                setHeadersCss($this[0], $headers, config.sortList, sortCSS);
                                appendToTable(
	                                $this[0], multisort(
	                                $this[0], config.sortList, cache)
								);
                                if(windowcontroller != undefined) windowcontroller.resize();
                            }, 1);
                            // stop normal event by returning false
                            return false;
                        }
                        // cancel selection
                    }).mousedown(function () {
                        if (config.cancelSelection) {
                            this.onselectstart = function () {
                                return false
                            };
                            return false;
                        }
                    });
                    // apply easy methods that trigger binded events
                    $this.bind("update", function () {
                        var me = this;
                        setTimeout(function () {
                            // rebuild parsers.
                            me.config.parsers = buildParserCache(
                            me, $headers);
                            // rebuild the cache map
                            cache = buildCache(me);
                        }, 1);
                    }).bind("updateCell", function (e, cell) {
                        var config = this.config;
                        // get position from the dom.
                        var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];
                        // update cache
                        cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(
                        getElementText(config, cell), cell);
                    }).bind("sorton", function (e, list) {
                        $(this).trigger("sortStart");
                        config.sortList = list;
                        // update and store the sortlist
                        var sortList = config.sortList;
                        // update header count index
                        updateHeaderSortCount(this, sortList);
                        // set css for headers
                        setHeadersCss(this, $headers, sortList, sortCSS);
                        // sort the table and append it to the dom
                        appendToTable(this, multisort(this, sortList, cache));
                    }).bind("appendCache", function () {
                        appendToTable(this, cache);
                    }).bind("applyWidgetId", function (e, id) {
                        getWidgetById(id).format(this);
                    }).bind("applyWidgets", function () {
                        // apply widgets
                        applyWidget(this);
                    });
                    if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
                        config.sortList = $(this).metadata().sortlist;
                    }
                    // if user has supplied a sort list to constructor.
                    if (config.sortList.length > 0) {
                        $this.trigger("sorton", [config.sortList]);
                    }
                    // apply widgets
                    applyWidget(this);
                });
            };
            this.addParser = function (parser) {
                var l = parsers.length,
                    a = true;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
                        a = false;
                    }
                }
                if (a) {
                    parsers.push(parser);
                };
            };
            this.addWidget = function (widget) {
                widgets.push(widget);
            };
            this.formatFloat = function (s) {
                var i = parseFloat(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.formatInt = function (s) {
                var i = parseInt(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.isDigit = function (s, config) {
                // replace all an wanted chars and match.
                return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, "")));
            };
            this.clearTableBody = function (table) {
                $body = $(table).find("tbody"); 
                $(table).find("tbody").empty();
            };
        }
    });

    // extend plugin scope
    $.fn.extend({
        tablesorter: $.tablesorter.construct
    });

    // make shortcut
    var ts = $.tablesorter;

    // add default parsers
    ts.addParser({
        id: "text",
        is: function (s) {
            return true;
        }, format: function (s) {
            return $.trim(s.toLocaleLowerCase());
        }, type: "text"
    });

    ts.addParser({
        id: "digit",
        is: function (s, table) {
            var c = table.config;
            return $.tablesorter.isDigit(s, c);
        }, format: function (s) {
            return $.tablesorter.formatFloat(s);
        }, type: "numeric"
    });

    ts.addParser({
        id: "currency",
        is: function (s) {
            return /^[£$€?.]/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));
        }, type: "numeric"
    });

    ts.addParser({
        id: "ipAddress",
        is: function (s) {
            return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
        }, format: function (s) {
            var a = s.split("."),
                r = "",
                l = a.length;
            for (var i = 0; i < l; i++) {
                var item = a[i];
                if (item.length == 2) {
                    r += "0" + item;
                } else {
                    r += item;
                }
            }
            return $.tablesorter.formatFloat(r);
        }, type: "numeric"
    });

    ts.addParser({
        id: "url",
        is: function (s) {
            return /^(https?|ftp|file):\/\/$/.test(s);
        }, format: function (s) {
            return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ""));
        }, type: "text"
    });

    ts.addParser({
        id: "isoDate",
        is: function (s) {
            return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(
            new RegExp(/-/g), "/")).getTime() : "0");
        }, type: "numeric"
    });

    ts.addParser({
        id: "percent",
        is: function (s) {
            return /\%$/.test($.trim(s));
        }, format: function (s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));
        }, type: "numeric"
    });

    ts.addParser({
        id: "usLongDate",
        is: function (s) {
            return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
        }, format: function (s) {
            return $.tablesorter.formatFloat(new Date(s).getTime());
        }, type: "numeric"
    });

    ts.addParser({
        id: "shortDate",
        is: function (s) {
            return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
        }, format: function (s, table) {
            var c = table.config;
            s = s.replace(/\-/g, "/");
            if (c.dateFormat == "us") {
                // reformat the string in ISO format
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
            } else if (c.dateFormat == "uk") {
                // reformat the string in ISO format
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
            } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
            }
            return $.tablesorter.formatFloat(new Date(s).getTime());
        }, type: "numeric"
    });
    ts.addParser({
        id: "time",
        is: function (s) {
            return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
        }, type: "numeric"
    });
    ts.addParser({
        id: "metadata",
        is: function (s) {
            return false;
        }, format: function (s, table, cell) {
            var c = table.config,
                p = (!c.parserMetadataName) ? "sortValue" : c.parserMetadataName;
            return $(cell).metadata()[p];
        }, type: "numeric"
    });
    // add default widgets
    ts.addWidget({
        id: "zebra",
        format: function (table) {
            $body = $(table).find("tbody"); 

            if (table.config.debug) {
                var time = new Date();
            }
            var $tr, row = -1,
                odd;
            // loop through the visible rows
            $body.find("tr:visible").each(function (i) {
                $tr = $(this);
                // style children rows the same way the parent
                // row was styled
                if (!$tr.hasClass(table.config.cssChildRow)) row++;
                odd = (row % 2 == 0);
                $tr.removeClass(
                table.config.widgetZebra.css[odd ? 0 : 1]).addClass(
                table.config.widgetZebra.css[odd ? 1 : 0])
            });
            if (table.config.debug) {
                $.tablesorter.benchmark("Applying Zebra widget", time);
            }
        }
    });
})(jQuery);
(function($) {
	$.extend({
		tablesorterPager: new function() {
			
			function updatePageDisplay(c) {
				var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);	
				var s = $(c.cssDirect,c.container).val((c.page+1));	
				if(windowcontroller != undefined) windowcontroller.resize();
			}
			
			function setPageSize(table,size) {
				var c = table.config;
				c.size = size;
				c.totalPages = Math.ceil(c.totalRows / c.size);
				c.pagerPositionSet = false;
				moveToPage(table);
				fixPosition(table);
			}
			
			function fixPosition(table) {
				var c = table.config;
				if(!c.pagerPositionSet && c.positionFixed) {
					var c = table.config, o = $(table);
					if(o.offset) {
						c.container.css({
							top: o.offset().top + o.height() + "px",
							position: "absolute"
						});
					}
					c.pagerPositionSet = true;
				}
			}
			
			function moveToFirstPage(table) {
				var c = table.config;
				c.page = 0;
				moveToPage(table);
			}
			
			function moveToLastPage(table) {
				var c = table.config;
				c.page = (c.totalPages-1);
				moveToPage(table);
			}
			
			function moveToNextPage(table) {
				var c = table.config;
				c.page++;
				if(c.page >= (c.totalPages-1)) {
					c.page = (c.totalPages-1);
				}
				moveToPage(table);
			}
			
			function moveToPrevPage(table) {
				var c = table.config;
				c.page--;
				if(c.page <= 0) {
					c.page = 0;
				}
				moveToPage(table);
			}
						
			function moveToPage(table) {
				var c = table.config;
				if(c.page < 0 || c.page > (c.totalPages-1)) {
					c.page = 0;
				}
				
				renderTable(table,c.rowsCopy);
			}
			
			function renderTable(table,rows) {
				
				var c = table.config;
				var l = rows.length;
				var s = (c.page * c.size);
				var e = (s + c.size);
				if(e > rows.length ) {
					e = rows.length;
				}
				
				
				var tableBody = $(table).find("tbody");
				
				// clear the table body
				
				$.tablesorter.clearTableBody(table);
				
				for(var i = s; i < e; i++) {
					
					//tableBody.append(rows[i]);
					
					var o = rows[i];
					var l = o.length;
					for(var j=0; j < l; j++) {
						
						tableBody[0].appendChild(o[j]);

					}
				}
				
				fixPosition(table,tableBody);
				$(table).parent().parent().parent().selectivizr();
				
				$(table).trigger("applyWidgets");
				
				if( c.page >= c.totalPages ) {
        			moveToLastPage(table);
				}
				updatePageDisplay(c);
			}
			
			this.appender = function(table,rows) {
				
				var c = table.config;
				
				c.rowsCopy = rows;
				c.totalRows = rows.length;
				c.totalPages = Math.ceil(c.totalRows / c.size);
				if(c.totalPages <= 1) c.container.addClass("invisible");
				
				renderTable(table,rows);
			};
			
			this.defaults = {
				size: 10,
				offset: 0,
				page: 0,
				totalRows: 0,
				totalPages: 0,
				container: null,
				cssNext: ".next",
				cssPrev: ".prev",
				cssFirst: ".first",
				cssLast: ".last",
				cssDirect: ".direct",
				cssPageDisplay: ".pagedisplay",
				cssPageSize: ".pagesize",
				seperator: " / ",
				positionFixed: true,
				appender: this.appender
			};
			
			this.construct = function(settings) {
				
				return this.each(function() {	
					
					config = $.extend(this.config, $.tablesorterPager.defaults, settings);
					
					var table = this, pager = config.container;
				
					$(this).trigger("appendCache");
					
					config.size = parseInt($(".pagesize",pager).val());
					$(config.cssDirect,pager).click(function() {
						table.config.page = parseInt($(this).val()-1);
						moveToPage(table);
						return false;
					});
					$(config.cssFirst,pager).click(function() {
						moveToFirstPage(table);
						return false;
					});
					$(config.cssNext,pager).click(function() {
						moveToNextPage(table);
						return false;
					});
					$(config.cssPrev,pager).click(function() {
						moveToPrevPage(table);
						return false;
					});
					$(config.cssLast,pager).click(function() {
						moveToLastPage(table);
						return false;
					});
					$(config.cssPageSize,pager).change(function() {
						setPageSize(table,parseInt($(this).val()));
						return false;
					});
				});
			};
			
		}
	});
	// extend plugin scope
	$.fn.extend({
        tablesorterPager: $.tablesorterPager.construct
	});
	
})(jQuery);				
//on ready
$(function() {
  //enable prototype property
  $.fn.tooltips = function() {
    tooltipcontroller.bind(this);
    return this;
  };
});

var tooltipcontroller = {};
tooltipcontroller.init = function(obj) {
	this.x_offset = -8;
	this.y_offset = -10;
	this.container = obj;
	this.allowDisplay = true;

	this.build();
	this.bind(obj);	
};
tooltipcontroller.build = function() {
	var tooltipHtml = "<div data-tooltipHolder='1' class='tooltipHolder'> <div class='top'></div> <div class='middle'></div> <div class='bottom'></div> </div>";
	if( $("div[data-tooltipHolder]", "body").size() < 1) $("body").append(tooltipHtml);
	this.tooltipHolder = $("div[data-tooltipHolder]");
};
tooltipcontroller.bind = function(obj) { 
	var that = this;

	obj = obj || "body";
	$container = $(obj);	

	$container.find("[data-tooltip]").each( function() {
		var $this = $(this);
		$this
			.mouseenter(function(e){ 
				that.show(e, $this); 
				if(that.checkTooltip) clearInterval(that.checkTooltip); 
				that.checkTooltip = setInterval(function() { 
					if(!$this.is(":visible")) {
						if(that.checkTooltip) clearInterval(that.checkTooltip); 
						that.hide(); 
					}
				}, 250);
			})
			.mousemove(function(e){ that.move(e); })
			.mouseleave(function(){ 
				that.hide(); 
				if(that.checkTooltip) clearInterval(that.checkTooltip); 
			});
		
		if($this.attr("data-tooltip") == "[CONTENT]") { $this.children().hide(); } //hide children
	});
};
tooltipcontroller.show = function(e, obj) {
	var that = this;

	$tooltip = obj;
	this.tooltipHolder
		.removeClass("bottom top left right")
		.css({'left':"",'right':""})
		.addClass("top"); 

	tooltipContent = $tooltip.attr("data-tooltip");
	this.allowDisplay = false; 
	if(tooltipContent == "" || tooltipContent == undefined) { this.fill(""); } //empty
	else if(tooltipContent == "[CONTENT]") { this.enable(e, $tooltip.children().html()); } //vullen met html content
	else { this.enable(e, tooltipContent); } //vullen met data value

	//verticale offset
	if( (e.pageY-$("body").scrollTop()) >= ( $(window).height()*0.6) ) {
		this.y_currOffset = (this.tooltipHolder.outerHeight()+this.y_offset)*-1;
		this.tooltipHolder.addClass("bottom"); 
	}
	else this.y_currOffset = this.y_offset;

	//horizontale offset
	if( e.pageX >= ( $("body").width()*0.6) ) this.tooltipHolder.addClass("right"); 
	else this.tooltipHolder.addClass("left"); 
};
tooltipcontroller.enable = function(e, content) {
	var that = this;

	if(this.t) { clearTimeout(this.t); }
	this.t = setTimeout(function() { 
		that.allowDisplay = true; 
		that.move(that.e); }, 450); 
	this.fill(content); 
};
tooltipcontroller.move = function(e) {
	if(this.allowDisplay) {
		if(this.tooltipHolder.hasClass("left")) this.tooltipHolder.css({"display":"block","top":(e.pageY+this.y_currOffset)+"px", "left":(e.pageX-this.x_offset)+"px"});	
		else this.tooltipHolder.css({"display":"block","top":(e.pageY+this.y_currOffset)+"px", "right":($(window).width()-e.pageX-this.x_offset)+"px"});	
	}
	else if(this.t) { this.e = e; }
	else this.hide();
};
tooltipcontroller.hide = function() {
	if(this.t) { clearTimeout(this.t); }
	this.tooltipHolder.css({"display":"none"});	
	this.fill("");
};
tooltipcontroller.fill = function(content) {
	this.tooltipHolder.find(".middle").html( content );

	this.tooltipHolder.show();
	this.tooltipWidth = this.tooltipHolder.find(".middle").width();
	this.tooltipHolder.hide();
};


$.fn.anchor = function(settings) {
 	settings = jQuery.extend({
		speed : 1500,
		yOffset : 0
	}, settings);	
	
	return this.each(function(){
		var $caller = $(this);
		$caller.click(function (event) {
			event.preventDefault();
			var locationHref = window.location.href;
			var elementClick = $caller.attr("data-anchor");
			var speed = settings.speed;
			
			$target = $("a[data-anchortarget="+elementClick+"]");
			if($target.length > 0) {
				var destination = $target.offset().top - settings.yOffset;
				var diff = $("html").scrollTop()-destination;
				if(diff < 0) diff*=-1;
				speed = Math.floor(diff/2);
				if(destination < 0) destination = 0; 
				if(destination + $("window").height() > $("body").height()) console.log("x");
				
				$("html,body").stop(true,false).animate({ 
					scrollTop: destination
				}, speed, "easeOutQuad", function() {
					window.location.hash = elementClick;
					$("html,body").scrollTop(destination);
				});
		  	return false;
		  }
		});
	});
}

var windowcontroller = {
	resizeFunctions : [],
	scrollFunctions : []
};
windowcontroller.init = function(obj) {
	var that = this;

	this.window = $(window);
	this.minHeight = 500;
	this.offsetHeight = 0;
	this.w_co = $("div[data-content=outer]");
	this.w_cr = $("div[data-content=core]"); //centrale deel, volledige breedte
	this.w_cc = $("div[data-content=content]"); 

	this.bind();

	setTimeout(function() { 
		that.window
			.trigger("resize")
			.trigger("scroll");
	}, 500);
};
windowcontroller.bind = function() {
	var that = this;

	//bind scroll en resize
	this.window
		.resize( function() { that.resize(); })
		.scroll( function() { that.scroll(); })

	//set anchors
	if($("a[data-anchor]").length > 0) {
		$("a[data-anchor]").anchor();
		this.window.scroll($.debounce( 250, function() { windowcontroller.findClosestAnchor(); }));
}	}


windowcontroller.scroll = function() { 
	$.each(this.scrollFunctions, function() { this(); });
};
windowcontroller.resize = function() { 
	if(this.window == undefined) return false; 

	var availableBodyHeight = this.window.height();
	if(availableBodyHeight < this.minHeight) availableBodyHeight = this.minHeight;		
	var outerContentHeight = 0
	$.each(this.w_co, function() { outerContentHeight += $(this).outerHeight() });
	var availableContentHeight = availableBodyHeight - outerContentHeight;	
	if(availableContentHeight < this.w_cc.height()+this.offsetHeight) availableContentHeight = this.w_cc.height()+this.offsetHeight;
	this.w_cr.css({"height":availableContentHeight+"px"});

	$.each(this.resizeFunctions, function() { this(); });
};

/* feedback */
windowcontroller.returnMessage = function(value) { };

/* anchors */
windowcontroller.findClosestAnchor = function() {
	var selectedAnchor;
	var selectedDistance = 9999;
	var $window = $(window);
	//find closest anchor
	$("a[data-anchortarget]").each(function() {
		var $this = $(this);
		var distance = $this.offset().top - $window.scrollTop();
		if(distance > -100 && distance < selectedDistance) {
			selectedDistance = distance;
			selectedAnchor = $this;
		}
	});
};

/* applepie */
windowcontroller.toggleCms = function(obj, setSession) {
	$obj = $(obj);
	var setSession = setSession || false;

	var part = $obj.data("cmstoggle");
	if($obj.data("hidden") == "1") { 
		$("[data-cms="+part+"], [data-cmsbase="+part+"], [data-cmsExtend="+part+"], [data-cmsExtendRear="+part+"]").show(); 
		$obj
			.data("hidden", 0)
			.addClass("open");
		if(setSession) this.hideCms(false, part); 
	}
	else { 
		$obj
			.data("hidden", 1)
			.removeClass("open");
		$("[data-cms="+part+"], [data-cmsbase="+part+"], [data-cmsExtend="+part+"], [data-cmsExtendRear="+part+"]").hide(); 
		if(setSession) this.hideCms(true, part); 
	}
};
windowcontroller.hideCms = function(status, part) {
	$.ajax({
		type: "POST", url: "/"+globalref+"do/?incA=window/windowcontroller",
		data: "action=hideCms"+part+"&value="+status,
		success: function(response){ }
	});
};
var interfacecontroller = {
};
interfacecontroller.init = function() {
	this.build();
	this.bind();
};

interfacecontroller.build = function() {

};

interfacecontroller.bind = function() {
	this.mastercontainer = $(".contentmaster");
	this.topcontainer = $(".topcontainer");
	this.centercontainer = $(".centercontainer");
	this.basecontent = $(".centercontent").children();

	windowcontroller.resizeFunctions.push(function() { interfacecontroller.setBackgroundMark(); } );
	windowcontroller.scrollFunctions.push(function() { interfacecontroller.setHeader(); } );

	//if contentmenu has space in right column
	this.contentMenuContainer = $("div.contentmenucontainer");
	if(this.contentMenuContainer.length > 0) {
		var dynamicContentMenu = true;
		var maxWidth = 600;
		$nextRows = $("div.contentmenucontainer").closest(".row").nextAll(".row");
		if($nextRows.length == 0) dynamicContentMenu = false;
		else {
			$.each($nextRows, function() {
				var rowWidth = 0;
				$(this).children(".setcontainer").each(function() { rowWidth += $(this).width(); });
				if(rowWidth > maxWidth) dynamicContentMenu = false;
			});
		}
		if(dynamicContentMenu) {
			this.contentMenuTop = this.contentMenuContainer.offset().top;
			windowcontroller.scrollFunctions.push(function() { interfacecontroller.setContentMenu(true, false); } );
			interfacecontroller.setContentMenu(true, true);
		}
		else {
			windowcontroller.scrollFunctions.push(function() { interfacecontroller.setContentMenu(false, false); } );
			interfacecontroller.setContentMenu(false, true);
}	}	}

interfacecontroller.setBackgroundMark = function() {
	this.topcontainer.css({'background-position':"center  -"+(1200-$(window).height())+"px"})
};
interfacecontroller.setHeader = function() {
	var that = this;
	var scrollT = $(window).scrollTop();

	//set scrolling menu style
	if(scrollT > 1 && !this.mastercontainer.hasClass("scrolling")) {
		this.mastercontainer.addClass("scrolling");
	}
	else if(scrollT <= 1 && this.mastercontainer.hasClass("scrolling")) {
		this.mastercontainer.removeClass("scrolling");
	}

	//set mini top style
	if(scrollT > 50 && parseInt(this.topcontainer.css("height")) == 175) {
		this.topcontainer
			.stop(true,true)
			.animate({ height: "105px" }, 
				250, function() { 
					that.mastercontainer.addClass("mini"); 
				}
			);
		this.topcontainer.find(".logo").stop(true,true).fadeOut();
		this.topcontainer.find(".logo.mini").stop(true,true).fadeIn();  
	}
	else if(scrollT <= 50 && parseInt(this.topcontainer.css("height")) == 105) {
		this.topcontainer
			.stop(true,true)
			.animate({ height: "175px" }, 
				250, function() { 
					that.mastercontainer.removeClass("mini"); 
				}
			);
		this.topcontainer.find(".logo").stop(true,true).fadeIn();
		this.topcontainer.find(".logo.mini").stop(true,true).fadeOut();  
	}	
};
interfacecontroller.setContentMenu = function(isDynamic, skipTimeout) {
	var that = this;
	var skipTimeout = skipTimeout || false;

	if(skipTimeout) this.doSetContentMenu(isDynamic);
	else {
		if(this.contentMenuTimer) clearTimeout(this.contentMenuTimer);
		this.contentMenuTimer = setTimeout(function() { that.doSetContentMenu(isDynamic) }, 25);
	}
};

interfacecontroller.doSetContentMenu = function(isDynamic) {
	var scrollT = $(window).scrollTop();

	//position (if fit in screen, minus header en footer)
	if(isDynamic) {
		fitInBody = true;
		if(($(window).height()-$(".footcontainer").height()-$(".headcontainer").height()) < this.contentMenuContainer.outerHeight()) fitInBody = false;

		if(scrollT > this.contentMenuTop-140 && fitInBody) this.contentMenuContainer.css({'position':"fixed",'top':"135px"});
		else this.contentMenuContainer.css({'position':"absolute",'top':""});
	}

	//set anchors
	this.contentMenuContainer.find("a[data-anchor]").each(function() {
		$this = $(this);
		$targetAnchor = $(".centercontent").find("a.anchortarget[data-anchortarget="+$(this).data("anchor")+"]");

		if(($targetAnchor.offset().top - scrollT) == 0) $this.parent().removeClass("up down").addClass("current");
		else if(($targetAnchor.offset().top - scrollT) > 0) $this.parent().removeClass("up current").addClass("down");
		else $this.parent().removeClass("down current").addClass("up");
	});
};

