    var page = 1;
    var seq = 1;
    var pageAnchor = document.getElementById('page-1');
    var oRPC = new jsRPC();
    
    function loadComments(_page)
    {
      page = _page;
      var first = (page - 1) * 10 + 1;
      var last = page * 10;
      oRPC.href = '/rpc/loadComments.cfm?uid=' + uid + '&page=' + page + '&seq=' + (++seq) + '&first=' + first + '&last=' + last;
      oRPC.execute();
    }
    
    function prevCommentsPage()
    {
      if (page > 1) page -= 1;
      loadComments(page);
    }
    
    function nextCommentsPage()
    {
      if (page < num_pages) page += 1;
      loadComments(page);
    }
    
    function showAddForm()
    {
      if (commentSlider.value == 100) return;
      commentSlider.startValue = 0;
      commentSlider.endValue = 100;
      commentSlider.startSlide();
    }
    
    function hideAddForm()
    {
      if (commentSlider.value == 0) return;
      commentSlider.startValue = 100;
      commentSlider.endValue = 0;
      commentSlider.startSlide();
    }
    
    function resetAddForm()
    {
      document.getElementById('contact_add_form').reset();
      document.getElementById('comment-submit-button').disabled = false;
    }
    
    function updatePageAnchors(num_pages)
    {
      // Step 1.  Delete all current anchors
      var div = document.getElementById('comment-pagination-anchors');
      
      while (div.firstChild)
        div.removeChild(div.firstChild);
      
      // Step 2.  Loop through and add new anchors
      for (var i = 0; i < num_pages; i++)
      {
        var anchor = document.createElement('a');
        anchor.href = '#';
        anchor.onclick = new Function('loadComments(' + (i + 1) + '); return false;');
        anchor.id = 'page-' + (i + 1);
        anchor.style.borderStyle = 'solid';
        anchor.style.borderWidth = '1px';
        anchor.style.borderColor = 'white';
        anchor.style.padding = '2px';
        anchor.appendChild(document.createTextNode(i + 1));
        div.appendChild(anchor);
      }
//      <a href="##" onclick="loadComments(#i#); return false;" id="page-#i#" style="border: solid 1px white; padding: 2px;">#i#</a>
    }
    
    function handleComments(comments, page, num_pages, num_comments, _seq)
    {
      if (_seq != seq) return;
      if (comments.length == 0) return;
      updatePageAnchors(num_pages);
      clearComments();
      for (var i = 0; i < comments.length; i++)
        addComment(comments[i]);
      
      var span = document.getElementById('paging-first');
      clearChildren(span);
      span.appendChild(document.createTextNode(comments[0].num));

      var span = document.getElementById('paging-last');
      clearChildren(span);
      span.appendChild(document.createTextNode(comments[comments.length - 1].num));
      
      var span = document.getElementById('paging-total');
      clearChildren(span);
      span.appendChild(document.createTextNode(num_comments));
      
      if (pageAnchor)
      {
        pageAnchor.style.borderStyle = 'solid';
        pageAnchor.style.borderWidth = '1px';
        pageAnchor.style.borderColor = 'white';
        pageAnchor.style.padding = '2px';
      }

      var anchor = document.getElementById('page-' + page);
      anchor.style.borderStyle = 'solid';
      anchor.style.borderWidth = '1px';
      anchor.style.borderColor = 'black';
      anchor.style.padding = '2px';
      
      pageAnchor = anchor;
    }
    
    function clearComments()
    {
      var div = document.getElementById('comments');
      clearChildren(div);
    }
    
    function clearChildren(element)
    {
      while (element.firstChild)
        element.removeChild(element.firstChild);
    }
    
    function addComment(comment)
    {
      var div = document.createElement('div');
      div.style.marginBottom = '8px';
      div.style.borderBottomWidth = '1px';
      div.style.borderBottomStyle = 'solid';
      div.style.borderBottomColor = 'pink';
      div.style.paddingBottom = '5px';
      
      var div_rating = document.createElement('div');
      div_rating.style.cssFloat = 'right';
      div_rating.style.styleFloat = 'right';
      div_rating.style.borderWidth = '1px';
      div_rating.style.borderStyle = 'solid';
      div_rating.style.borderColor = '#DDDDDD';
      div_rating.style.padding = '3px';
      div_rating.style.marginLeft = '5px';
      div_rating.style.textAlign = 'center';
      
      var img = document.createElement('img');
      img.src = '/images/' + comment.rating + '.gif';
      div_rating.appendChild(img);

      div.appendChild(div_rating);
      
      var div_image = document.createElement('div');
      div_image.style.cssFloat = 'left';
      div_image.style.styleFloat = 'left';
      div_image.style.width = '80px';
      div_image.style.marginRight = '5px';
      
      
      var img = document.createElement('img');
      img.src = comment.img;
      img.style.margin = 'auto';
      img.style.width = '80px';
      div_image.appendChild(img);

      div.appendChild(div_image);
      
      var t = document.createTextNode('From: ');
      div.appendChild(t);
      
      
      var anchor = document.createElement('a');
      anchor.href = '/u/' + comment.my_dance_place_id + '/';
      anchor.appendChild(document.createTextNode(comment.name));
      div.appendChild(anchor);
      
      document.getElementById('comments').appendChild(div);
      
      var div_comments = document.createElement('div');
      div_comments.style.fontStyle = 'italic';
      div_comments.style.marginTop = '3px';
      div_comments.appendChild(document.createTextNode(comment.date_created + ': ' + comment.comments));
      
      
      div.appendChild(div_comments);
      
      var div_clearer = document.createElement('div');
      div_clearer.style.clear = 'both';

      div.appendChild(div_clearer);
    }
    
    loadComments(1);
    var commentSlider
    try
    {
      commentSlider = new StyleSlider('comment-add-form', 'height');
      commentSlider.length = 500;
      commentSlider.slideMode = 'easeOut';
    }
    catch(e)
    {
    }


    function validateComment(form)
    {
      if (sending_comment) return false;
      if (form.review.value == '')
      {
        alert('You cannot enter a blank review.');
        form.review.focus();
        return false;
      }
      sending_comment = true;
      var oRPC = new jsRPC(form.action);        
      oRPC.sendForm(form);
      return false;
    }
    
    function handleCommentSave(success)
    {
      sending_comment = false;
      if (success)
      {
        resetAddForm();
        hideAddForm();
        loadComments(1);
      }
    }
    
    var sending_comment = false;