/*
 GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
*/
if(typeof window.console!=="object"||typeof window.console.emulated==="undefined"){if(typeof window.console!=="object"||!(typeof window.console.log==="function"||typeof window.console.log==="object")){window.console={};window.console.log=window.console.debug=window.console.warn=window.console.trace=function(){};window.console.error=function(){for(var b="An error has occured. More information will be available in the console log.",a=0;a<arguments.length;++a){if(typeof arguments[a]!=="string")break;
b+="\n"+arguments[a]}if(typeof Error!=="undefined")throw Error(b);else throw b;}}else{if(typeof window.console.debug==="undefined")window.console.debug=function(){for(var b=["console.debug:"],a=0;a<arguments.length;a++)b.push(arguments[a]);window.console.log.apply(window.console,b)};if(typeof window.console.warn==="undefined")window.console.warn=function(){for(var b=["console.warn:"],a=0;a<arguments.length;a++)b.push(arguments[a]);window.console.log.apply(window.console,b)};if(typeof window.console.error===
"undefined")window.console.error=function(){for(var b=["console.error"],a=0;a<arguments.length;a++)b.push(arguments[a]);window.console.log.apply(window.console,b)};if(typeof window.console.trace==="undefined")window.console.trace=function(){window.console.error.apply(window.console,["console.trace does not exist"])}}window.console.emulated=true}String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
String.prototype.strip=String.prototype.strip||function(b,a){b=String(b);var c=this;if(b.length){a||0||(b=b.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/^"+b+"+|"+b+"+$/g"),"")}return String(c)};String.prototype.stripLeft=String.prototype.stripLeft||function(b,a){b=String(b);var c=this;if(b.length){a||0||(b=b.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/^"+b+"+/g"),"")}return String(c)};
String.prototype.stripRight=String.prototype.stripRight||function(b,a){b=String(b);var c=this;if(b.length){a||0||(b=b.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));c=c.replace(eval("/"+b+"+$/g"),"")}return String(c)};String.prototype.toInt=String.prototype.toInt||function(){return parseInt(this,10)};String.prototype.wrap=String.prototype.wrap||function(b,a){return b+this+a};
String.prototype.wrapSelection=String.prototype.wrapSelection||function(b,a,c,d){if(typeof c==="undefined"||c===null)c=this.length;if(typeof d==="undefined"||d===null)d=this.length;return this.substring(0,c)+b+this.substring(c,d)+a+this.substring(d)};String.prototype.toSlug=String.prototype.toSlug||function(){return this.toLowerCase().replace(/[\s_]/g,"-").replace(/[^-a-z0-9]/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")};
String.prototype.queryStringToJSON=String.prototype.queryStringToJSON||function(){var b=String(this);b=b.substring(b.indexOf("?")+1);b=b.replace(/\+/g,"%20");if(b.substring(0,1)==="{"&&b.substring(b.length-1)==="}")return eval(decodeURIComponent(b));b=b.split(/\&(amp\;)?/);for(var a={},c=0,d=b.length;c<d;++c){var e=b[c]||null;if(e!==null){e=e.split("=");if(e!==null){var g=e[0]||null;if(g!==null)if(typeof e[1]!=="undefined"){e=e[1];g=decodeURIComponent(g);e=decodeURIComponent(e);try{e=eval(e)}catch(f){}var h=
g.split(".");if(h.length===1)a[g]=e;else{var i="",j="";$.each(h,function(l,k){i+='["'+k.replace(/"/g,'\\"')+'"]';jsonCLOSUREGLOBAL=a;j="if ( typeof jsonCLOSUREGLOBAL"+i+' === "undefined" ) jsonCLOSUREGLOBAL'+i+" = {}";eval(j);a=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL});jsonCLOSUREGLOBAL=a;valueCLOSUREGLOBAL=e;j="jsonCLOSUREGLOBAL"+i+" = valueCLOSUREGLOBAL";eval(j);a=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL;delete valueCLOSUREGLOBAL}}}}}return a};
(function(b){b.fn.opacityFix=b.fn.opacityFix||function(){var a=b(this),c=a.css("background-color");if(c&&c!=="rgba(0, 0, 0, 0)")return this;for(var d=a;d.inDOM();){d=d.parent();if((c=d.css("background-color"))&&c!=="rgba(0, 0, 0, 0)"){a.css("background-color",c);break}}return this};b.fn.parentsAndSelf=b.fn.parentsAndSelf||function(a){return b(this).parents(a).andSelf().filter(a)};b.fn.findAndSelf=b.fn.findAndSelf||function(a){return b(this).find(a).andSelf().filter(a)};b.fn.firstInput=b.fn.firstInput||
function(){return b(this).findAndSelf(":input").filter(":first")};b.fn.choose=b.fn.choose||function(a){var c=b(this);if(typeof a==="undefined")a=c.val();else if(c.val()!==a)return this;switch(true){case this.is("option"):c.parents("select:first").choose(a);break;case c.is(":checkbox"):c.attr("checked",true);break;case c.is(":radio"):c.attr("checked",true);break;case c.is("select"):c.val(a);break;default:break}return this};b.fn.unchoose=b.fn.unchoose||function(){var a=b(this);switch(true){case a.is("option"):a.parents(":select:first").unchoose();
break;case a.is(":checkbox"):a.attr("checked",false);break;case a.is(":radio"):a.attr("checked",false);break;case a.is("select"):a.val(a.find("option:first").val());break;default:break}return this};b.fn.wouldSubmit=b.fn.wouldSubmit||function(){var a=b(this).findAndSelf(":input"),c=true;if(!a.length||!(a.attr("name")||0)||a.is(":radio,:checkbox")&&!a.is(":selected,:checked"))c=false;return c};b.fn.values=b.fn.values||function(){var a={};b(this).findAndSelf(":input").each(function(){var c=b(this),d=
c.attr("name")||null,e=c.val();if(!c.wouldSubmit())return true;if(d.indexOf("[]")!==-1){if(typeof a[d]==="undefined")a[d]=[];a[d].push(e)}else a[d]=e});return a};b.fn.submitForm=b.fn.submitForm||function(){var a=b(this);a.parentsAndSelf("form:first").trigger("submit");return a};b.fn.inDOM=b.fn.inDOM||function(){var a=b(this).parent().parent();return a.size()&&(a.height()||a.width())};b.fn.valWrap=b.fn.valWrap||function(a,c){var d=b(this);return d.val(d.val().wrap(a,c))};b.fn.valWrapSelection=b.fn.valWrapSelection||
function(a,c,d,e){var g=b(this),f=g.get(0);a=a||"";c=c||"";if(d||e)g.val(g.val().wrapSelection(a,c,d,e));else{d=f.selectionStart;e=f.selectionEnd;if(document.selection){f.focus();d=document.selection.createRange();d.text=a+d.text+c}else{var h=f.scrollTop;g.val(g.val().wrapSelection(a,c,d,e));f.focus();f.selectionStart=d+a.length;f.selectionEnd=e+a.length;f.scrollTop=h}}return g};b.fn.giveFocus=b.fn.giveFocus||function(){b(this).findAndSelf(":input:visible:first").focus();return this};b.fn.highlight=
b.fn.highlight||function(a){return b(this).effect("highlight",{},a||3E3)};b.fn.htmlAndSelf=b.fn.htmlAndSelf||function(){return b(this).attr("outerHTML")};b.fn.preventDefault=b.fn.preventDefault||function(){return b(this).click(function(a){a.preventDefault();return false})};b.fn.attemptTypeChangeTo=b.fn.attemptTypeChangeTo||function(a){var c=b(this),d=false,e=c.get(0),g=e.type;if(a===g)d=true;else if(c.is("input"))if(!b.browser.msie){e.type=a;if(e.type!==g)d=true}return d}})(jQuery);
(function(b){if(b.History)window.console.warn("$.History has already been defined...");else{b.History={options:{debug:false},state:"",$window:null,$iframe:null,handlers:{generic:[],specific:{}},extractHash:function(a){return a.replace(/^[^#]*#/,"").replace(/^#+|#+$/,"")},getState:function(){return b.History.state},setState:function(a){var c=b.History;a=c.extractHash(a);c.state=a;return c.state},getHash:function(){return b.History.extractHash(window.location.hash||location.hash)},setHash:function(a){a=
b.History.extractHash(a);if(typeof window.location.hash!=="undefined"){if(window.location.hash!==a)window.location.hash=a}else if(location.hash!==a)location.hash=a;return a},go:function(a){var c=b.History;a=c.extractHash(a);var d=c.getHash(),e=c.getState();if(a!==d)c.setHash(a);else{a!==e&&c.setState(a);c.trigger()}return true},hashchange:function(){var a=b.History,c=a.getHash();a.go(c);return true},bind:function(a,c){var d=b.History;if(c){if(typeof d.handlers.specific[a]==="undefined")d.handlers.specific[a]=
[];d.handlers.specific[a].push(c)}else{c=a;d.handlers.generic.push(c)}return true},trigger:function(a){var c=b.History;if(typeof a==="undefined")a=c.getState();var d,e,g,f;if(typeof c.handlers.specific[a]!=="undefined"){f=c.handlers.specific[a];d=0;for(e=f.length;d<e;++d){g=f[d];g(a)}}f=c.handlers.generic;d=0;for(e=f.length;d<e;++d){g=f[d];g(a)}return true},construct:function(){var a=b.History;b(document).ready(function(){a.domReady()});return true},configure:function(a){var c=b.History;c.options=
b.extend(c.options,a);return true},domReadied:false,domReady:function(){var a=b.History;if(!a.domRedied){a.domRedied=true;a.$window=b(window);a.$window.bind("hashchange",this.hashchange);setTimeout(a.hashchangeLoader,200);return true}},nativeSupport:function(a){a=a||b.browser;var c=a.version,d=parseInt(c,10),e=c.split(/[^0-9]/g);c=parseInt(e[0],10);var g=parseInt(e[1],10);e=parseInt(e[2],10);var f=false;if((a.msie||0)&&d>=8)f=true;else if((a.webkit||0)&&d>=528)f=true;else if(a.mozilla)if(c>1)f=true;
else{if(c===1)if(g>9)f=true;else if(g===9)if(e>=2)f=true}else if(a.opera)if(c>10)f=true;else if(c===10)if(g>=60)f=true;return f},hashchangeLoader:function(){var a=b.History;if(a.nativeSupport())a.getHash()&&a.$window.trigger("hashchange");else{var c;if(b.browser.msie){a.$iframe=b('<iframe id="jquery-history-iframe" style="display: none;"></$iframe>').prependTo(document.body)[0];a.$iframe.contentWindow.document.open();a.$iframe.contentWindow.document.close();var d=false;c=function(){var e=a.getHash(),
g=a.getState(),f=a.extractHash(a.$iframe.contentWindow.document.location.hash);if(g!==e){if(!d){a.$iframe.contentWindow.document.open();a.$iframe.contentWindow.document.close();a.$iframe.contentWindow.document.location.hash=e}d=false;a.$window.trigger("hashchange")}else if(g!==f){d=true;a.setHash(f)}}}else c=function(){var e=a.getHash();a.getState()!==e&&a.$window.trigger("hashchange")};setInterval(c,200)}return true}};b.History.construct()}})(jQuery);

