  function fetchComments(entryToFetch)
  {
     new Ajax.Updater('comments'+entryToFetch, '/diary/fetchcomments.php', 
         { 
            evalScripts: true,
            method: 'get',
            parameters: {entry: entryToFetch }
         });
  }

  function hideComments(entryToHide)
  {
    $('comments'+entryToHide).innerHTML = '' ;
  }

  function showCommentForm(blogEntry, followup, author)
  {
    var frm = $('commentForm'+blogEntry) ;
    frm['entry'].value = blogEntry ;
    frm['followup'].value = followup ;
    if (followup != -1)
   {
      $('commentFormHdr'+blogEntry).innerHTML = "Post a followup comment to " 
         + author;
   }
    else
    {
      $('commentFormHdr'+blogEntry).innerHTML = "Post a comment:" ;
    }
    frm.setStyle({display: 'block'}); 
    $('MathmaA'+blogEntry).setAttribute('autocomplete', 'off');
  }

  function hideCommentForm(blogEntry)
  {
    var frm = $('commentForm'+blogEntry) ;
    frm.reset() ;
    frm.setStyle({display: 'none'}); 
  }

  function processCommentForm(blogEntry)
  {
     var frm = $('commentForm'+blogEntry) ;
     var frmHash = frm.serialize({getHash: true}) ;

     new Ajax.Updater('comments'+blogEntry, '/diary/submitcomment.php', 
         { 
            evalScripts: true,
            method: 'post',
            parameters: frmHash
         });
      
  }

  function resetForm(blogEntry)
  {
     var frm = $('commentForm'+blogEntry) ;
     frm.reset() ;
  }

  function newMathma(blogEntry)
  {
        new Ajax.Updater('MathmaQ'+blogEntry, '/diary/mathma.php',
        {
            evalScripts: true,
            method: 'post',
            parameters: { entry : blogEntry }
        }) ;
        
        var input = $('MathmaA'+blogEntry)
        if (input)
        {
           input.value = '' ;
        }
  }
