code: function(maxExtent, options) {    
          options = options || {};
          
          var leftTolerance = options.leftTolerance || 0;
          var rightTolerance = options.rightTolerance || 0;
  
          var newBounds = this.clone();
      
          if (maxExtent) {
              var width = maxExtent.getWidth();
  
              //shift right?
              while (newBounds.left < maxExtent.left && 
                     newBounds.right - rightTolerance <= maxExtent.left ) { 
                  newBounds = newBounds.add(width, 0);
              }
  
              //shift left?
              while (newBounds.left + leftTolerance >= maxExtent.right && 
                     newBounds.right > maxExtent.right ) { 
                  newBounds = newBounds.add(-width, 0);
              }
             
              // crosses right only? force left
              var newLeft = newBounds.left + leftTolerance;
              if (newLeft < maxExtent.right && newLeft > maxExtent.left && 
                     newBounds.right - rightTolerance > maxExtent.right) {
                  newBounds = newBounds.add(-width, 0);
              }
          }
                  
          return newBounds;
      }
docs: APIMethod: wrapDateLine
  Wraps the bounds object around the dateline.
  
  Parameters:
  maxExtent - {<OpenLayers.Bounds>}
  options - {Object} Some possible options are:
  
  Allowed Options:
  leftTolerance - {float} Allow for a margin of error
  with the 'left' value of this
  bound.
  Default is 0.
  rightTolerance - {float} Allow for a margin of error
  with the 'right' value of
  this bound.
  Default is 0.
  
  Returns:
  {<OpenLayers.Bounds>} A copy of this bounds, but wrapped around the
  "dateline" (as specified by the borders of
  maxExtent). Note that this function only returns
  a different bounds value if this bounds is
  *entirely* outside of the maxExtent. If this
  bounds straddles the dateline (is part in/part
  out of maxExtent), the returned bounds will always
  cross the left edge of the given maxExtent.
  .