function CaLegendInterface(map) { this.map = map; // map interface object this.contentId; this.legendItems; this.currentPage; this.pageCount; this.blockTitle; this.isOn; this.pOnClose; this._create = function() { this.contentId = 'infoblock_legenda'; this.attachEvents(); } this.initialize = function() { this.isOn = false; this.currentPage = 0; this.pageCount = 0; this.blockTitle = ''; this.pOnClose = jQuery.proxy(this.onClose, this);; this.attachEvents(); } this.refresh = function() { if (this.legendItems[this.currentPage]) { var html = ""; for (var x = 0; x < this.legendItems[this.currentPage].length; x++) { html+= ""; html+= "" + this.legendItems[this.currentPage][x]["text"] + ""; html+= "
 
"; } html+= "
"; html+= this.blockTitle; for (var x = 0; x < this.pageCount; x++) { if (x == this.currentPage) { html+= "" + (x + 1) + " "; } else { html+= "" + (x + 1) + " "; } } html+= "
"; document.getElementById("infoblock_legenda_obsah").innerHTML = html; } } this.setPage = function(p) { this.currentPage = p; this.refresh(); return false; } this.setItems = function(items) { this.legendItems = items; } this.onClickFlip = function() { this.flip(); return false; } this.flip = function() { if (!this.isOn) { this.show(); } else { this.hide(); } } this.show = function() { this.map.cCaInfoBox.openInfoBox(this.contentId, this.pOnClose); if (this.map.isOnWinter) { this.currentPage = 13; } else { this.currentPage = 0; } this.refresh(); this.isOn = true; } this.hide = function() { this.map.cCaInfoBox.hideInfoBox(); } this.onClose = function() { this.isOn = false; } this.attachEvents = function() { } this._create(); this.initialize(); }