// displays the list of accessors
function updateAccessorsList()
{
  // adding the resource to the document
  sendUrlResponseXmlToFunction
  ( 
    getAccessorsRequestUrl, 
    function( response )
    {
      if ( !response || typeof response != "object" )
      {
        updateAccessorsList();
        return;
      };

      var container = obtainElementById( "accessorsBox" );
      if ( !container )
        return;

      var accessorsCount = 0;
    
      // generating the content
      var content = "<h1>Эту страницу просматривают:</h1>\n";
      content += "<p>\n";
      
      // named accessors
      var accessors = response.getElementsByTagName("accessor");
      
      for ( var i = 0; i < accessors.length; i++ )
      {
        var userScreenName = accessors[i].getAttribute('screenName');
        var userId = accessors[i].getAttribute('userId');
        var status = accessors[i].getAttribute('status');
        
        if ( i > 0 )
          content += ", ";
        content += "<a href='" + userProfileUrlCommonPart + userId + "'>" + userScreenName;
        content += "</a>";
        if ( status == USER_STATUS_MODERATOR )
          content += "<small> (модератор)</small>";

        accessorsCount++;
      };
      
      // the unnamed users
      var unnamedUsersCount = 0;
      try
      {
        unnamedUsersCount = response.getElementsByTagName("unnamedUsers")[0].getAttribute('count');
      }
      catch (e) {};
      if ( unnamedUsersCount > 0 )
      {
        accessorsCount += unnamedUsersCount ;

        if ( accessors.length > 0 )
          content += " и ещё ";
        content += unnamedUsersCount;
        switch ( unnamedUsersCount % 10 )
        {
          case 2:
          case 3:
          case 4:
            if ( unnamedUsersCount < 12 || unnamedUsersCount > 14 )
              content += " человека";
            else
              content += " человек";
            break;
          default:
            content += " человек";
        };
      }
      content += "</p>\n";
      
      // skipping cases when there's only a single viewer
      if ( accessorsCount < 2 )
        return;
      
      // displaying the content
      container.innerHTML = content;
    }
  );
}