var VCMSComponent=(function(){function VCMSComponent(apiLink,apiModuleName,data,target){this.apiLink=apiLink;this.apiModuleName=apiModuleName;this.data=data;this.target=target;target['component']=this;}
VCMSComponent.prototype.setDebugOn=function(){VCMSComponent.debug=true;};VCMSComponent.prototype.getHTML=function(){throw new Error("Abstract method");};VCMSComponent.doEvent=function(name,data){var e=document.createEvent('CustomEvent');e.initCustomEvent(name,true,false,data);window.dispatchEvent(e);};VCMSComponent.prototype.onEvent=function(name,call){$(window).bind(name,function(e){call(e.originalEvent.detail);});};VCMSComponent.prototype.init=function(){};VCMSComponent.insertActionData=function(actiondata){if('uniqid'in actiondata)
VCMSComponent.eventCurrent[actiondata.uniqid]=actiondata;if(!VCMSComponent.eventQueue[actiondata.apiLink])
VCMSComponent.eventQueue[actiondata.apiLink]=[actiondata];else
VCMSComponent.eventQueue[actiondata.apiLink].push(actiondata);if(!VCMSComponent.eventQueueTimeout)
VCMSComponent.eventQueueTimeout=setTimeout(VCMSComponent.processQueue,15);};VCMSComponent.prototype.ajax=function(action,data,callback,replacequeuemode,stack){VCMSComponent.ajaxIndex++;var actiondata={apiLink:this.apiLink,action:action,module:this.apiModuleName,data:data,callback:callback,index:VCMSComponent.ajaxIndex};if(replacequeuemode){actiondata.uniqid=this.apiLink+action+this.apiModuleName;if(actiondata.uniqid in VCMSComponent.eventCurrent){if(!VCMSComponent.eventCurrent[actiondata.uniqid].fired){VCMSComponent.eventCurrent[actiondata.uniqid].data=actiondata.data;VCMSComponent.eventCurrent[actiondata.uniqid].callback=actiondata.callback;return;}
if(this.apiModuleName=='flightlist'){console.log('FL: set delayed',actiondata.index);}
VCMSComponent.eventDelayed[actiondata.uniqid]=actiondata;return;}}
if(this.apiModuleName=='flightlist'){console.log('FL: set REQUEST',actiondata.index);}
VCMSComponent.insertActionData(actiondata);};VCMSComponent.prototype.hashFromData=function(hashData){document.location.hash='#'+encodeURIComponent(JSON.stringify(hashData));};VCMSComponent.processQueue=function(){VCMSComponent.eventQueueTimeout=null;var eqcopy=VCMSComponent.eventQueue;VCMSComponent.eventQueue=Object();for(var x in eqcopy){var request=eqcopy[x];var data=new Object();for(var y in request){if(request.hasOwnProperty(y)){var item=request[y];item.fired=true;if(typeof item.data==='function'){data[y]={m:item.module,d:(item.data)(),a:item.action};}
else{data[y]={m:item.module,d:item.data,a:item.action};}}}
if(VCMSComponent.debug){var uniqueid=Math.random();VCMSComponent.doEvent("ajaxstart",{uniq:uniqueid,r:request});}
$.ajax(x+location.search,{accepts:"json",data:{d:data,c:VCMScontext},type:"POST"}).done(function(result){for(var y in request){if(request.hasOwnProperty(y)){if(request[y]['module']=='flightlist'){console.log('FL: AJAX DONE',request[y]['index']);}
if(result&&('d'in result)&&(y in result.d)){if(result.d[y].d)
request[y].callback(result.d[y].d,null);else if(result.d[y].e)
request[y].callback([],result.d[y].e);else{request[y].callback([],"no data");};}
else{request[y].callback([],"request error");}}}}).fail(function(){for(var y in request){if(request.hasOwnProperty(y)){request[y].callback([],'server error');}}}).always(function(){if(VCMSComponent.debug){VCMSComponent.doEvent("ajaxstop",{uniq:uniqueid});}
for(var y in request){if(request.hasOwnProperty(y)){if('uniqid'in request[y]){if(request[y]['module']=='flightlist'){console.log('DELETE FORM ACTIVE',request[y].index);}
delete VCMSComponent.eventCurrent[request[y].uniqid];}}}
for(var x in VCMSComponent.eventDelayed){if(VCMSComponent.eventDelayed.hasOwnProperty(x)){if(VCMSComponent.eventDelayed[x].uniqid in VCMSComponent.eventCurrent)
continue;VCMSComponent.insertActionData(VCMSComponent.eventDelayed[x]);delete VCMSComponent.eventDelayed[x];}}});}};VCMSComponent.eventQueue=Object();VCMSComponent.eventDelayed=Object();VCMSComponent.eventCurrent=Object();VCMSComponent.debug=false;VCMSComponent.ajaxIndex=0;return VCMSComponent;}());var VCMSTemplate=(function(){function VCMSTemplate(owner){this.owner=owner;this.tpl=new Object();this.tpldynamic=new Object();this.dynData=[0];this.functions=new Object();this.parent=owner.parentElement;this.tc='textContent'in owner;if('querySelectorAll'in owner){this.elemselectfunction=function(sender,selector){return Array.prototype.slice.call(sender.querySelectorAll(selector));};}
else{this.elemselectfunction=function(sender,selector){return $(selector,sender).toArray();};}
var dynamicsections=this.elemselectfunction(owner,'[data-dynamicsection]');for(var i=0;i