(function(a){if(typeof define==="function"&&define.amd){define(["jquery","Cookies"],a)}else{if(typeof exports==="object"){module.exports=a()}else{var c=window.Lang;var b=window.Lang=a(jQuery,typeof Cookies!=="undefined"?Cookies:undefined);b.noConflict=function(){window.Lang=c;return b}}}}(function(c,a){var b=function(){this._fireEvents=true;this._dynamic={}};b.prototype.init=function(f){var d=this,h,e,i,g;f=f||{};f.cookie=f.cookie||{};e=f.defaultLang;i=f.currentLang;g=f.allowCookieOverride;this.cookieName=f.cookie.name||"langCookie";this.cookieExpiry=f.cookie.expiry||365;this.cookiePath=f.cookie.path||"/";this._mutationCopies={append:c.fn.append,appendTo:c.fn.appendTo,prepend:c.fn.prepend,before:c.fn.before,after:c.fn.after,html:c.fn.html};c.fn.append=function(){return d._mutation(this,"append",arguments)};c.fn.appendTo=function(){return d._mutation(this,"appendTo",arguments)};c.fn.prepend=function(){return d._mutation(this,"prepend",arguments)};c.fn.before=function(){return d._mutation(this,"before",arguments)};c.fn.after=function(){return d._mutation(this,"after",arguments)};c.fn.html=function(){return d._mutation(this,"html",arguments)};this.defaultLang=e||"en";this.currentLang=e||"en";if((g||!i)&&typeof a!=="undefined"){h=a.get(this.cookieName);if(h){i=h}}c(function(){d._start();if(i&&i!==d.defaultLang){d.change(i)}})};b.prototype.pack={};b.prototype.attrList=["title","alt","placeholder","href"];b.prototype.dynamic=function(e,d){if(e!==undefined&&d!==undefined){this._dynamic[e]=d}};b.prototype.loadPack=function(e,f){var d=this;if(e&&d._dynamic[e]){c.ajax({dataType:"json",url:d._dynamic[e],success:function(k){d.pack[e]=k;if(d.pack[e].regex){var j=d.pack[e].regex,h,g;for(g=0;g]+>/g;if(m.test(d)){h.context.innerHTML=d}else{if(d){try{i.node.data=i.node.data.split(c.trim(i.node.data)).join(d)}catch(k){}}else{if(console&&console.log){console.warn('Organizr Function: Translation for "'+l+'" not found!')}}}}}else{try{i.node.data=i.langDefaultText}catch(k){}}}};b.prototype._translateAttribs=function(f,g){var d,e=f.data("lang-attr")||{},h;for(d in e){if(e.hasOwnProperty(d)){if(f.attr(d)){if(g!==this.defaultLang){h=this.translate(e[d],g);if(h){f.attr(d,h)}}else{f.attr(d,e[d])}}}}};b.prototype._translateContent=function(f,g){var d=g!==this.defaultLang,h,e;if(f.is("input")){switch(f.attr("type")){case"button":case"submit":case"hidden":case"reset":if(d){h=this.translate(f.data("lang-val"),g);if(h){f.val(h)}}else{f.val(f.data("lang-val"))}break}}else{if(f.is("img")){if(d){h=this.translate(f.data("lang-src"),g);if(h){f.attr("src",h)}}else{f.attr("src",f.data("lang-src"))}}else{e=f.data("lang-text");if(e){this._setTextNodes(f,e,g)}}}};b.prototype.change=function(d,f,k){var l=this;if(d===this.defaultLang||this.pack[d]||this._dynamic[d]){if(d!==this.defaultLang){if(!this.pack[d]&&this._dynamic[d]){this.loadPack(d,function(n,m,o){if(!n){l.change.call(l,d,f,k)}else{if(k){k("Language pack could not load from: "+o,d,f)}}});return}else{if(!this.pack[d]&&!this._dynamic[d]){if(k){k("Language pack not defined for: "+d,d,f)}throw ("Could not change language to "+d+" because no language pack for this language exists!")}}}var h=false,g=this.currentLang;if(this.currentLang!=d){this.beforeUpdate(g,d);h=true}this.currentLang=d;var i=f!==undefined?c(f).find("[lang]"):c(":not(html)[lang]"),j=i.length,e;while(j--){e=c(i[j]);if(e.attr("lang")!==d){this._translateElement(e,d)}}if(h){this.afterUpdate(g,d)}if(typeof a!=="undefined"){a.set(l.cookieName,d,{expires:l.cookieExpiry,path:l.cookiePath})}if(k){k(false,d,f)}}else{if(k){k("No language pack defined for: "+d,d,f)}throw ('Attempt to change language to "'+d+'" but no language pack for that language is loaded!')}};b.prototype._translateElement=function(d,e){this._translateAttribs(d,e);if(d.attr("data-lang-content")!="false"){this._translateContent(d,e)}d.attr("lang",e)};b.prototype.translate=function(e,d){d=d||this.currentLang;if(this.pack[d]){var f="";if(d!=this.defaultLang){f=this.pack[d].token[e];if(!f){f=this._regexMatch(e,d)}if(!f){if(console&&console.log){langStrings.token[e]=e}}return f||e}else{return e}}else{return e}};b.prototype._regexMatch=function(j,i){var e,k,h,g,f,d;e=this.pack[i].regex;if(e){k=e.length;for(h=0;h