!function(e){var t="Loader",i=e.Core.newType("hafasModule"),a={},l={};var n=function(t){this.container=document.body,e("#DynamicTemplates")&&(this.container=e("#DynamicTemplates")),this.file=t.file,this.tplId=t.tplId||null,this.callback=t.callback,a[this.file]||this.tplId&&e("#"+this.tplId)?this.callback(this.tplId):this.get()};n.prototype.get=function(){if(l.hasOwnProperty(this.file))l[this.file].push(this);else{l[this.file]=[],l[this.file].push(this);e.Core.newType("hafasRequest",{requestType:"customUrl",responseString:!0,method:"get",url:e.Config.templatePath+this.file+"?v="+e.Core.getAntiCacheParam(),callback:function(e){this.create(e)}.bind(this),errorCallback:e.bind((function(e){throw error(e)}),this)})}},n.prototype.create=function(e){var t,i=document.createElement("div");i.hidden=!0,i.setAttribute("data-src",this.file),i.style.display="none",i.innerHTML=e,this.container.appendChild(i),a[this.file]=!0,t=this.file,l.hasOwnProperty(t)&&l[t].forEach((function(e){e.callback(e.tplId)}))},i.loadTemplateFiles=function(t,i){for(var a=t.length,l=0;l<t.length;l++)e.Core.newType("hafasLoader",{file:t[l],tplId:t[l],callback:function(e){0==--a&&i()}})},e.Core.registerType(t,"hafasLoader",n),e.Core.registerModule(t,i)}(window.Hafas=window.Hafas||{});