anchor.diff:      CopyToClipboard;
   end;
   
  -{----------------TMapItem.Create}
  +{ TMapArea }
  +
  +//-- BG ---------------------------------------------------------- 31.12.2011 --
  +function TMapArea.PtInArea(X, Y: Integer): Boolean;
  +begin
  +  Result := PtInRegion(FRegion, X, Y);
  +end;
  +
  +{ TMapAreaList }
  +
  +//-- BG ---------------------------------------------------------- 31.12.2011 --
  +function TMapAreaList.getArea(Index: Integer): TMapArea;
  +begin
  +  Result := get(Index);
  +end;
  +
  +{ TMapItem }
   
   constructor TMapItem.Create;
   begin
     inherited Create;
  -  Areas := ThtStringList.Create;
  -  AreaTargets := ThtStringList.Create;
  -  AreaTitles := ThtStringList.Create;
  +  FAreas := TMapAreaList.Create;
   end;
   
   destructor TMapItem.Destroy;
  +begin
  +  FAreas.Free;
  +  inherited Destroy;
  +end;
  +
  +function TMapItem.GetURL(X, Y: Integer; out URLTarg: TUrlTarget; out ATitle: ThtString): boolean;
   var
     I: Integer;
  -begin
  -  for I := 0 to Areas.Count - 1 do
  -    DeleteObject(THandle(Areas.Objects[I]));
  -  Areas.Free;
  -  AreaTargets.Free;
  -  AreaTitles.Free;
  -  inherited Destroy;
  -end;
  -
  -function TMapItem.GetURL(X, Y: Integer; out URLTarg: TUrlTarget; out ATitle: ThtString): boolean;
  -var
  -  I: Integer;
  +  Area: TMapArea;
   begin
     Result := False;
  -  with Areas do
  -    for I := 0 to Count - 1 do
  -      if PtInRegion(THandle(Objects[I]), X, Y) then
  +  for I := 0 to FAreas.Count - 1 do
  +  begin
  +    Area := FAreas[I];
  +    if Area.PtInArea(X, Y) then
  +    begin
  +      if Area.HRef <> '' then {could be NoHRef}
         begin
  -        if Strings[I] <> '' then {could be NoHRef}
  -        begin
  -          URLTarg := TUrlTarget.Create;
  -          URLTarg.URL := Strings[I];
  -          URLTarg.Target := AreaTargets[I];
  -          ATitle := AreaTitles[I];
  -          Result := True;
  -        end;
  -        Exit;
  +        URLTarg := TUrlTarget.Create;
  +        URLTarg.URL := Area.HRef;
  +        URLTarg.Target := Area.Target;
  +        ATitle := Area.Title;
  +        Result := True;
         end;
  +      Exit;
  +    end;
  +  end;
   end;
   
   procedure TMapItem.AddArea(Attrib: TAttributeList);
   const
     MAXCNT = 300;
  -var
  -  I, Cnt, Rad: Integer;
  -  HRef, S, Target, Title: ThtString;
  -  S1, Nm: ThtString;
  -  Coords: array[0..MAXCNT] of Integer;
  -  Rect: TRect absolute Coords;
  -  Handle: THandle;
  -  Shape: (Rec, Circle, Poly);
  -
  -  procedure GetSubStr;
  +
  +  function GetSubStr(var S: ThtString): ThtString;
     var
       J, K: Integer;
     begin
  
positive.code:     K := Pos(' ', S); {for non comma situations (bad syntax)}
      if (J > 0) and ((K = 0) or (K > J)) then
      begin
        S1 := copy(S, 1, J - 1);
        Delete(S, 1, J);
      end
      else if K > 0 then
      begin
        S1 := copy(S, 1, K - 1);
        Delete(S, 1, K);
      end
      else
      begin
        S1 := Trim(S);
        S := '';
      end;
      while (Length(S) > 0) and ((S[1] = ',') or (S[1] = ' ')) do
        Delete(S, 1, 1);
    end;
  
  begin
    if Areas.Count >= 1000 then
      Exit;
    HRef := '';
    Target := '';
    Title := '';
    Shape := Rec;
    Cnt := 0;
    Handle := 0;
    for I := 0 to Attrib.Count - 1 do
      with TAttribute(Attrib[I]) do
        case Which of
          HRefSy: HRef := Name;
          TargetSy: Target := Name;
          TitleSy: Title := Name;
          NoHrefSy: HRef := '';
          CoordsSy:
            begin
              S := Trim(Name);
              Cnt := 0;
              GetSubStr;
              while (S1 <> '') and (Cnt <= MAXCNT) do
              begin
                Coords[Cnt] := StrToIntDef(S1, 0);
                GetSubStr;
                Inc(Cnt);
              end;
            end;
          ShapeSy:
            begin
              Nm := copy(Lowercase(Name), 1, 4);
              if Nm = 'circ' then
                Shape := Circle
              else if (Nm = 'poly') then
                Shape := Poly;
            end;
        end;
    case Shape of
      Rec:
        begin
          if Cnt < 4 then
            Exit;
          Inc(Coords[2]);
          Inc(Coords[3]);
          Handle := CreateRectRgnIndirect(Rect);
        end;
      Circle:
        begin
          if Cnt < 3 then
            Exit;
          Rad := Coords[2];
          Dec(Coords[0], Rad);
          Dec(Coords[1], Rad);
          Coords[2] := Coords[0] + 2 * Rad + 1;
          Coords[3] := Coords[1] + 2 * Rad + 1;
          Handle := CreateEllipticRgnIndirect(Rect);
        end;
      Poly:
        begin
          if Cnt < 6 then
            Exit;
  {$ifdef LCL}        // ToDo: Find LCL replacement for CreatePolygonRgn(
  {$else}
          Handle := CreatePolygonRgn(Coords, Cnt div 2, Winding);
  {$endif}
        end;
    end;
    if Handle <> 0 then
    begin
      Areas.AddObject(HRef, TObject(Handle));
      AreaTargets.Add(Target);
      AreaTitles.Add(Title);
    end;
  end;
  
  
negative.code: {$else}
    Windows,
  {$endif}
    SysUtils, Contnrs, Classes, Graphics, ClipBrd, Controls, Messages, Variants, Types,
  {$IFNDEF NoGDIPlus}
    GDIPL2A,
  {$ENDIF}
  