if (typeof maps == 'undefined') {
    var maps = {};
}
maps.NumberCluster = function(input) {
    this.input = input;
    this.adapterObj = {};
    this.numbers = {};
    var self = this;
    if (input.showAdaptersSwitch === true) {
        var adaptersSwitch = '<ul id="' + input.switchId + '" style="z-index:2; position:absolute; left:40%; list-style:none; margin:0; padding:0;">';
        for (var i in input.adapters) {
            adaptersSwitch += '<li style="display:inline;"><a style="text-decoration: none; display:inline-block; background: #ccc; padding: 0.5em 1em;" data-adapter="' + i + '" href="#' + i + '">' + input.adapters[i] + '</a></li>';
        }
        adaptersSwitch += '</ul>';
        $('#' + input.containerId).append(adaptersSwitch);
        $('#' + input.switchId).find('a').click(function() {
            var adapter = $(this).data('adapter');
            self.changeAdapter(adapter);
            if (typeof self.numbers != {}) {
                self.addNumbers(self.numbers);
            }
        });
    }
    this.adapter = input.defaultAdapter;
    self.changeAdapter(input.defaultAdapter);
}

maps.NumberCluster.prototype.addNumbers = function(numbers) {
    var self = this;
    self.numbers = numbers;
    self.adapterObj.addNumbers(numbers);
}

maps.NumberCluster.prototype.changeAdapter = function(adapter) {
    var self = this;console.log(adapter);
    var mapId = self.input.containerId + '_' + adapter;
    if ($('#' + mapId).length == 0) {
        $('div.maps_container').each(function() {
            $(this).hide();
        });
        var tmp2 = '<div class="maps_container" id="' + mapId + '" style="' + $('#' + self.input.containerId).attr('style') + '"></div>';
        $('#' + self.input.containerId).append(tmp2);
        self.adapterObj = new maps.NumberCluster.adapters[adapter](self.input);
    } else {
        $('div.maps_container').each(function() {
            $(this).hide();
        });
        $('#' + mapId).show();
    }
}

@@ -156,24 +156,65 @@
 mbers = %7B%7D;%0A
+    this.adapter = input.defaultAdapter;%0A
     var self
@@ -240,13 +240,9 @@
 put.
-showA
+a
 dapt
@@ -250,16 +250,21 @@
 rsSwitch
+.show
  === tru
@@ -264,24 +264,128 @@
 === true) %7B%0A
+        this.backgrounds = %7B%0A            %22normal%22 : '#444',%0A            %22visiting%22: %22#3d9400%22%0A        %7D%0A
         var 
@@ -420,23 +420,32 @@
 + input.
-s
+adaptersS
 witch
-I
+.i
 d + '%22 s
@@ -641,16 +641,211 @@
  style=%22
+';%0A            var background = self.backgrounds.normal;%0A            if (i == this.adapter) %7B%0A                background = self.backgrounds.visiting;%0A            %7D%0A            adaptersSwitch += '
 text-dec
@@ -863,24 +863,25 @@
 ne; display:
+ 
 inline-block
@@ -886,45 +886,98 @@
 ck; 
-background: #ccc; padding: 0.5em 1em;
+color: #fff; background: ' + background + '; padding: 0.5em 1em; border: 1px solid #ebebeb
 %22 da
@@ -1157,16 +1157,77 @@
 Switch);
+console.log(1);%0A        console.log(input.adaptersSwitch.id);
 %0A       
@@ -1245,15 +1245,24 @@
 put.
-s
+adaptersS
 witch
-I
+.i
 d).f
@@ -1495,24 +1495,113 @@
         
+  
+  $('#' + input.adaptersSwitch.id).find('a').css(%7B%22background%22: self.backgrounds.normal
 %7D);%0A    
 %7D%0A    th
@@ -1596,50 +1596,246 @@
     
-%7D%0A
+    
     
+$(
 this
-.adapter = input.defaultAdapter;
+).css(%7B%22background%22: self.backgrounds.visiting%7D);%0A            if (input.adaptersSwitch.changeHash === false) %7B%0A                return false;%0A            %7D%0A            //window.location.hash = '#' + adapter;%0A        %7D);%0A    %7D
 %0A   

switch color