anchor.diff:              carto_embed_map.setZoom(carto_embed_map.getZoom()-1);
             });
           });
  +
  +
  +
  +        /**
  +         * CartoDB Infowindow
  +         * Needed:
  +         *  user_name, table_name, map_canvas, map_key??(no)
  +         **/
  +
  +        function CartoDBInfowindow(params) {
  +          this.latlng_ = new google.maps.LatLng(0,0);
  +          this.feature_;
  +          this.map_ = params.cartodb_map;
  +          this.columns_;
  +          this.offsetHorizontal_ = -107;
  +          this.width_ = 214;
  +          this.setMap(params.cartodb_map);
  +          this.params_ = params;
  +          this.getActiveColumns(params);
  +        };
  +
  +
  +        CartoDBInfowindow.prototype = new google.maps.OverlayView();
  +
  +
  +        CartoDBInfowindow.prototype.getActiveColumns = function(params) {
  +          var that = this;
  +          $.ajax({
  +            url:'http://' + params.cartodb_user_name + '.' + TILESERVER + '/tiles/' + params.cartodb_table_name + '/infowindow?'+ 'map_key=' + (params.cartodb_map_key || '')+'&callback=?',
  +            dataType: 'jsonp',
  +            success:function(result){
  +              var columns = JSON.parse(result.infowindow);
  +              if (columns) {
  +                that.columns_ = parseColumns(columns);
  +              } else {
  +                $.ajax({
  +                  // If the table is private, you can't run any api methods without being
  +                  method:'get',
  +                  url: 'http://'+ that.params_.cartodb_user_name + '.' +  SQL_SERVER + '/api/v1/sql/?q='+escape('select * from '+ that.params_.cartodb_table_name + ' LIMIT 1'),
  +                  dataType: 'jsonp',
  +                  success: function(columns) {
  +                    that.columns_ = parseColumns(columns.rows[0]);
  +                  },
  +                  error: function(e) {}
  +                });
  +              }
  +
  +            },
  +            error: function(e){}
  +          });
  +          
  +          function parseColumns(columns) {
  +            var str = '';
  +            for (p in columns) {
  +              if (columns[p] && p!='the_geom_webmercator') {
  +                str+=p+',';
  +              }
  +            }
  +            return str.substr(0,str.length-1);
  +          }
  +        }
  +
  +
  +        CartoDBInfowindow.prototype.draw = function() {
  +          var me = this;
  +          
  +          var div = this.div_;
  +          if (!div) {
  +            div = this.div_ = document.createElement('div');
  +            div.setAttribute('class','cartodb_infowindow');
  +        
  +            div.innerHTML = '<a href="#close" class="close">x</a>'+
  +                            '<div class="outer_top">'+
  +                              '<div class="top">'+
  +                              '</div>'+
  +                            '</div>'+
  +                            '<div class="bottom">'+
  +                              '<label>id:1</label>'+
  +                            '</div>';
  +            
  +            $(div).find('a.close').click(function(ev){
  +              ev.preventDefault();
  +              ev.stopPropagation();
  +              me.hide();
  +            });
  +
  +            google.maps.event.addDomListener(div,'click',function(ev){ev.preventDefault()});
  +            google.maps.event.addDomListener(div,'dblclick',function(ev){ev.preventDefault()});
  +            google.maps.event.addDomListener(div,'mousedown',function(ev){ev.preventDefault()});
  +            google.maps.event.addDomListener(div,'mouseup',function(ev){ev.preventDefault()});
  +            google.maps.event.addDomListener(div,'mousewheel',function(ev){ev.stopPropagation()});
  +            google.maps.event.addDomListener(div,'DOMMouseScroll',function(ev){ev.stopPropagation()});
  +            
  +            var panes = this.getPanes();
  +            panes.floatPane.appendChild(div);
  +
  +            div.style.opacity = 0;
  +          }
  +        
  +          var pixPosition = this.getProjection().fromLatLngToDivPixel(this.latlng_);
  +          if (pixPosition) {
  +            div.style.width = this.width_ + 'px';
  +            div.style.left = (pixPosition.x - 49) + 'px';
  +            var actual_height = - $(div).height();
  +            div.style.top = (pixPosition.y + actual_height + 5) + 'px';
  +          }
  +        };
  +        
  +        
  +        CartoDBInfowindow.prototype.setPosition = function() {
  +          if (this.div_) { 
  +            var div = this.div_;
  +            var pixPosition = this.getProjection().fromLatLngToDivPixel(this.latlng_);
  +            if (pixPosition) {
  +              div.style.width = this.width_ + 'px';
  +              div.style.left = (pixPosition.x - 49) + 'px';
  +              var actual_height = - $(div).height();
  +              div.style.top = (pixPosition.y + actual_height + 5) + 'px';
  +            }
  +            this.show();
  +          }
  +        }
  +        
  +        
  +        CartoDBInfowindow.prototype.open = function(feature){
  +          var that = this;
  +          that.feature_ = feature;
  +          
  +          // If the table is private, you can't run any api methods without being
  +          $.ajax({
  +            method:'get',
  +            url: 'http://'+ this.params_.cartodb_user_name + '.' + SQL_SERVER + '/api/v1/sql/?q='+escape('select '+that.columns_+',ST_AsGeoJSON(ST_PointOnSurface(the_geom),6) as cdb_centre from '+ this.params_.cartodb_table_name + ' where cartodb_id=' + feature)+'&callback=?',
  +            dataType: 'jsonp',
  +            success: function(result) {
  +              positionateInfowindow(result.rows[0]);
  +            },
  +            error: function(e) {}
  +          });
  +         
  +          function positionateInfowindow(variables) {
  +            if (that.div_) {
  +              var div = that.div_;
  +              // Get latlng position
  +              that.latlng_ = that.transformGeoJSON(variables.cdb_centre);
  +                      
  +              // Remove the list items
  +              $('div.cartodb_infowindow div.outer_top div.top').html('');
  +
  +              for (p in variables) {
  +                if (p!='cartodb_id' && p!='cdb_centre') {
  +                  $('div.cartodb_infowindow div.outer_top div.top').append('<label>'+p+'</label><p class="'+((variables[p]!=null)?'':'empty')+'">'+(variables[p] || 'empty')+'</p>');
  +                }
  +              }
  +              
  +              $('div.cartodb_infowindow div.bottom label').html('id: <strong>'+feature+'</strong>');
  +              that.moveMaptoOpen();
  +              that.setPosition();     
  +            }
  +          }
  +        } 
  +        
  +
  +        CartoDBInfowindow.prototype.hide = function() {
  +          if (this.div_) {
  +            var div = this.div_;
  +            $(div).animate({
  +              top: '+=' + 10 + 'px',
  +              opacity: 0},
  +              100, 'swing',
  +              function () {
  +                div.style.visibility = "hidden";
  +              }
  +            );
  +          }
  +        }
  +
  +
  +        CartoDBInfowindow.prototype.show = function() {
  +          if (this.div_) {
  +            var div = this.div_;
  +            div.style.opacity = 0;
  +            div.style.visibility = "visible";
  +            $(div).animate({
  +              top: '-=' + 10 + 'px',
  +              opacity: 1},
  +              250
  +            );
  +          }
  +        }
  +
  +
  +        CartoDBInfowindow.prototype.isVisible = function(marker_id) {
  +          if (this.div_) {
  +            var div = this.div_;
  +            if (div.style.visibility == 'visible' && this.feature_!=null) {
  +              return true;
  +            } else {
  +              return false;
  +            }
  +          } else {
  +            return false;
  +          }
  +        }
  +        
  +        
  +        CartoDBInfowindow.prototype.transformGeoJSON = function(str) {
  +          var json = JSON.parse(str);
  +          return new google.maps.LatLng(json.coordinates[1],json.coordinates[0]);
  +        }
  +        
  +        
  +        CartoDBInfowindow.prototype.moveMaptoOpen = function() {
  +          var left = 0;
  +          var top = 0;
  +          var div = this.div_;
  +          var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.latlng_);
  +
  +          if ((pixPosition.x + this.offsetHorizontal_) < 0) {
  +            left = (pixPosition.x + this.offsetHorizontal_ - 20);
  +          }
  +          
  +          if ((pixPosition.x + 180) >= ($('#'+this.params_.cartodb_map_canvas).width())) {
  +            left = (pixPosition.x + 180 - $('#'+this.params_.cartodb_map_canvas).width());
  +          }
  +          
  +          if ((pixPosition.y - $(div).height()) < 0) {
  +            top = (pixPosition.y - $(div).height() - 30);
  +          }
  +              
  +          this.map_.panBy(left,top);
  +        }
   
         </script>
       <% end %>
  
positive.code:             <% end %>
  
          
          var sql,style,params = <%= request.query_string.split('&').to_json.html_safe %>;
          
          // Getting vars
          for (var i = 0, length = params.length; i<length; i++) {
            if (params[i].search('style=%23') != -1) {
              style = params[i].replace('style=','');
            }
            if (params[i].search('sql=') != -1) {
              sql = params[i].replace('sql=','');
            }
          }
        </script>
  
        <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
        <script type="text/javascript">
          $(function() {
            // If there is no sql
            if (sql == "") {
              sql = "SELECT * FROM " + table_name;
            }
  
            var cartodbMapOptions = {
              zoom: 2,
              center: new google.maps.LatLng(0,0),
              disableDefaultUI: true,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            }
  
            // Init the map
            var carto_embed_map = new google.maps.Map(document.getElementById("map_cartodb_container"),cartodbMapOptions);
  
negative.code: 
            // Setup your map styles
            $.ajax({
              url:TILEHTTP + '://' + cartodb_user_name + '.' + TILESERVER + '/tiles/' + cartodb_table_name + '/map_metadata',
              type: 'GET',
              dataType: 'jsonp',
              success:function(result){
  