function CaInfoBoxInterface(map) { this.map = map; // map interface object this.elFloatBox; this.actualBoxId; this.actualOnCloseCallback; this.contentById; this._create = function() { this.elFloatBox = document.getElementById('float_box'); this.attachEvents(); } this.initialize = function() { this.actualBoxId = null; this.contentById = {}; this.attachEvents(); } this.openInfoBox = function(id, onCloseCB) { this.hideInfoBox(); if (onCloseCB) this.actualOnCloseCallback = onCloseCB; this.actualBoxId = id; if (!this.contentById[this.actualBoxId]) { this.contentById[this.actualBoxId] = document.getElementById(this.actualBoxId).innerHTML; document.getElementById(this.actualBoxId).innerHTML = ''; } this.elFloatBox.innerHTML = this.contentById[this.actualBoxId]; this.elFloatBox.style.display = 'block'; } this.onClickhideInfoBox = function() { this.hideInfoBox(); return false; } this.hideInfoBox = function() { if (this.actualBoxId) { if (this.actualOnCloseCallback) this.actualOnCloseCallback(); this.elFloatBox.style.display = 'none'; this.elFloatBox.innerHTML = ''; this.actualBoxId = null; } } this.onClickFlipInfoBox = function(id) { this.flipInfoBox(id); return false; } this.flipInfoBox = function(id) { var el = document.getElementById(id); if (el.style.display != 'none') { el.style.display = 'none'; } else { el.style.display = 'block'; } } this.attachEvents = function() { } this._create(); this.initialize(); }