
  var commentWindow;
  var commentWindowNew = true;

  function openComment(commentArea) {
    if (commentArea != 'general') {
      document.location = "specific_comment.html?caseName=" + commentArea;
    } else {
      document.location = "general_comment.html";
    }
  }

  function openComment_old(commentArea){
    // Close the comment window if it's already opened
    if (commentWindow != null && !commentWindow.closed) { commentWindow.close(); }
    else if (commentWindowNew) { commentWindowNew = false; }
    
    var strTargetURL = "general_comment.html"

    if (commentArea != 'general') {
       strTargetURL = "specific_comment.html?caseName=" + commentArea;
    }

  	var targetWidth = 650;
    var targetHeight = 450;
    var topCorner = (screen.availHeight - targetHeight)/2;
    var leftCorner = (screen.availWidth - targetWidth)/2;
    if (topCorner < 0) { topCorner = 0; }
    if (leftCorner < 0) { leftCorner = 0; }
    var strFeatures = "width=" + targetWidth + ",height=" + targetHeight + ",top=" + topCorner;
    strFeatures += ",left=" + leftCorner + ",resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=no" ;
    commentWindow = window.open(strTargetURL, "Comment", strFeatures);
    if (window.focus) { commentWindow.focus(); }
  }


  var viewWindow;
  var viewWindowNew = true;

  function viewComment(commentArea) {
    if (commentArea != 'general') {
      document.location = "view_specific_comment.html?caseName=" + commentArea;
    } else {
      document.location = "view_general_comment.html";
    }
  }

  function viewComment_old(commentArea){
    // Close the view window if it's already opened
    if (viewWindow != null && !viewWindow.closed) { viewWindow.close(); }
    else if (viewWindowNew) { viewWindowNew = false; }
    
    var strTargetURL = "view_general_comment.html"

    if (commentArea != 'general') {
       strTargetURL = "view_specific_comment.html?caseName=" + commentArea;
    }

  	var targetWidth = 650;
    var targetHeight = 450;
    var topCorner = (screen.availHeight - targetHeight)/2;
    var leftCorner = (screen.availWidth - targetWidth)/2;
    if (topCorner < 0) { topCorner = 0; }
    if (leftCorner < 0) { leftCorner = 0; }
    var strFeatures = "width=" + targetWidth + ",height=" + targetHeight + ",top=" + topCorner;
    strFeatures += ",left=" + leftCorner + ",resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,status=no" ;
    viewWindow = window.open(strTargetURL, "Comment", strFeatures);
    if (window.focus) { viewWindow.focus(); }
  }

  var reviewWindow;
  var reviewWindowNew = true;

  function reviewComment(commentArea) {
    if (commentArea != 'general') {
      document.location = "manage_specific_comment.html";
    } else {
      document.location = "manage_general_comment.html";
    }
  }

  function reviewComment_old(commentArea){
    // Close the review window if it's already opened
    if (reviewWindow != null && !reviewWindow.closed) { reviewWindow.close(); }
    else if (reviewWindowNew) { reviewWindowNew = false; }
    
    var strTargetURL = "manage_general_comment.html"

    if (commentArea != 'general') {
       strTargetURL = "manage_specific_comment.html";
    }

  	var targetWidth = 900;
    var targetHeight = 450;
    var topCorner = (screen.availHeight - targetHeight)/2;
    var leftCorner = (screen.availWidth - targetWidth)/2;
    if (topCorner < 0) { topCorner = 0; }
    if (leftCorner < 0) { leftCorner = 0; }
    var strFeatures = "width=" + targetWidth + ",height=" + targetHeight + ",top=" + topCorner;
    strFeatures += ",left=" + leftCorner + ",resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,status=no" ;
    reviewWindow = window.open(strTargetURL, "Comment", strFeatures);
    if (window.focus) { reviewWindow.focus(); }
  }

function editComment(commentID) {
    var displayArea = document.getElementById("displayComment_" + commentID);
    var editArea = document.getElementById("editComment_" + commentID);
    var editLink = document.getElementById("editLink_" + commentID);

    if (displayArea && editArea) {        
        editArea.style.display = (editArea.style.display == "none")?"":"none";
        displayArea.style.display = (displayArea.style.display == "none")?"":"none";
        editLink.innerHTML = (displayArea.style.display == "none")?"Cancel":"Edit";
    }

}