  // do Author insertion and async XML call
  // strUrl = the author glob servlet URL
  // field = the field name for searching
  // strTerm = the term to glob authors

  function callAuthorGlob(strUrl, queryid, field, strTerm) {
      var XmlHttpRequest = false;
      var self = this;
      
      // now loading message...
      loadingAuthor('Author Listing ...');

      // construct the appropriate XML object
      if (window.XMLHttpRequest) { // Mozilla/Safari/Firefox
          self.XmlHttpRequest = new XMLHttpRequest();
      } else if (window.ActiveXObject) { // MSIE
          self.XmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
      }
      self.XmlHttpRequest.open('POST', strUrl, true);
      self.XmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      self.XmlHttpRequest.onreadystatechange = function() {
          if (self.XmlHttpRequest.readyState==4) {
              loadAuthorDiv(self.XmlHttpRequest.responseText, field, strTerm);
          }
      }
      
      self.XmlHttpRequest.send('format=json&query_id='+ queryid);
  }
  // load a message into the DIV
  // msg = the message to display
  function loadingAuthor(msg) {
    document.getElementById("author").innerHTML="<span class=\"attention\">" + msg + "</span>";
  }

  // load the DIV contents from a suggestion
  // contents = the JSON response from the author glob
  // field = the field name for searching
  // term = the original search term
  function loadAuthorDiv(contents,  field, term) {
   // window.alert(contents);
    var authorResponse = eval("("+contents+")");
    var a = authorResponse.authors;
    var authorHTML = "<span class=dontprint><b>Authors of Relevant Research</b></span><span class=dontprint><ul>";
    var authorSuggestions = "";
    var numberOfAuthors = 0;
    var displayLimit = 10;
    
    if (a.length > 0){     
      for (i=0; i<a.length; i++){
        var aRowClass = "shade-white";
        if (i%2 == 0){
          aRowClass = "shade-light";
        } else {
          aRowClass = "shade-white";
        }      
        var author = a[i].author;
        var rcount = a[i].hits;
        if ( numberOfAuthors < displayLimit){
          if (numberOfAuthors > 0) authorSuggestions;
          authorSuggestions += "<li class='" + aRowClass + "'><a href='searchresults.jsp?formname=searchform&" + field + "=" + term + "&Author"  + "=&quot;" + author +"&quot;' title='Search for author=" + author + " "+ field + "=" + term + "'>" + author + "</a></li>";          
          numberOfAuthors++;
        }        
      }
    }

    authorHTML += authorSuggestions;
    authorHTML += "</ul></span>";
    document.getElementById("author").innerHTML = authorHTML;
  }
