code: function(resolution, closest) {
          var zoom, i, len;
          if(this.map.fractionalZoom) {
              var lowZoom = 0;
              var highZoom = this.resolutions.length - 1;
              var highRes = this.resolutions[lowZoom];
              var lowRes = this.resolutions[highZoom];
              var res;
              for(i=0, len=this.resolutions.length; i<len; ++i) {
                  res = this.resolutions[i];
                  if(res >= resolution) {
                      highRes = res;
                      lowZoom = i;
                  }
                  if(res <= resolution) {
                      lowRes = res;
                      highZoom = i;
                      break;
                  }
              }
              var dRes = highRes - lowRes;
              if(dRes > 0) {
                  zoom = lowZoom + ((highRes - resolution) / dRes);
              } else {
                  zoom = lowZoom;
              }
          } else {
              var diff;
              var minDiff = Number.POSITIVE_INFINITY;
              for(i=0, len=this.resolutions.length; i<len; i++) {            
                  if (closest) {
                      diff = Math.abs(this.resolutions[i] - resolution);
                      if (diff > minDiff) {
                          break;
                      }
                      minDiff = diff;
                  } else {
                      if (this.resolutions[i] < resolution) {
                          break;
                      }
                  }
              }
              zoom = Math.max(0, i-1);
          }
          return zoom;
      }
docs: APIMethod: getZoomForResolution
  
  Parameters:
  resolution - {Float}
  closest - {Boolean} Find the zoom level that corresponds to the absolute
  closest resolution, which may result in a zoom whose corresponding
  resolution is actually smaller than we would have desired (if this
  is being called from a getZoomForExtent() call, then this means that
  the returned zoom index might not actually contain the entire
  extent specified... but it'll be close).
  Default is false.
  
  Returns:
  {Integer} The index of the zoomLevel (entry in the resolutions array)
  that corresponds to the best fit resolution given the passed in
  value and the 'closest' specification.