/*global Icinga:false define:false require:false base_url:false console:false */ (function() { "use strict"; var asyncMgrInstance = null; define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) { var pending = { }; var getDOMForDestination = function(destination) { var target = destination; if(typeof destination === "string") { target = containerMgr.getContainer(destination)[0]; } else if(typeof destination.context !== "undefined") { target = destination[0]; } return target; }; var handleResponse = function(html) { if(this.destination) { containerMgr.updateContainer(this.destination,html,this); } else { containerMgr.createPopupContainer(html,this); } }; var handleFailure = function(result,error) { if(error === "abort") { return; } log.error("Error loading resource",error,arguments); if(this.destination) { containerMgr.updateContainer(this.destination,result.responseText,this); } }; var isParent = function(dom,parentToCheck) { while(dom.parentNode) { dom = dom.parentNode; if(dom === parentToCheck) { return true; } } return false; }; var CallInterface = function() { this.clearPendingRequestsFor = function(destination) { if(!$.isArray(pending)) { pending = []; return; } var resultset = []; for(var x=0;x