function postComment(){

entry_id = document.comments_form.entry_id.value;
author = document.comments_form.author.value;
    if (commenter_name) {
         author = commenter_name;
    }
email = document.comments_form.email.value;
url = document.comments_form.url.value;
linked_name = '<a href="' + url + '">' + author + '</a>';
text = document.comments_form.text.value;
text = text.replace(/\n/g,"<br />");
var date = getCalendarDate() + ' ' + getClockTime();

if (url) {
  $('new_comment_author').innerHTML = linked_name;
} else {
  $('new_comment_author').innerHTML = author;
}

$('new_comment_date').innerHTML = date;
$('new_comment_body').innerHTML = text;
Element.show('new_comment_row','blue_line');

Element.hide('comments_form');
Element.setStyle('comment_status', {'background-color':'red'} );
$('comment_status').innerHTML = 'Spam Scanning in Progress...';

post_url = '/cgi-bin/mt/reply.fcgi';
params = Form.serialize("comments_form");
myAjax = new Ajax.Request(post_url, {method: 'post', parameters: params, onSuccess: showResponse, onFailure: showError });
return false;
}

function showResponse(originalRequest) {
status_code = originalRequest.status;
status_text = 'Your reply has been posted.';
// $('comment_status').innerHTML = status_text;
$('comment_status').innerHTML = originalRequest.text;
Element.setStyle('comment_status', {'background-color':'yellow','color':'black'} );
}

function showError(originalRequest) {
status_code = originalRequest.status;
$('comment_status').innerHTML = 'Error: Your reply was not posted. Error Code: ' + status_code;
Element.hide('new_comment_row','blue_line');
Element.show('comments_form');
}

function getCalendarDate()
{
   var months = new Array(13);
   months[0]  = "January";
   months[1]  = "February";
   months[2]  = "March";
   months[3]  = "April";
   months[4]  = "May";
   months[5]  = "June";
   months[6]  = "July";
   months[7]  = "August";
   months[8]  = "September";
   months[9]  = "October";
   months[10] = "November";
   months[11] = "December";
   var now         = new Date();
   var monthnumber = now.getMonth();
   var monthname   = months[monthnumber];
   var monthday    = now.getDate();
   var year        = now.getYear();
   if(year < 2000) { year = year + 1900; }
   var dateString = monthname +
                    ' ' +
                    monthday +
                    ', ' +
                    year;
   return dateString;
} // function getCalendarDate()

function getClockTime()
{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   var ap = "AM";
   if (hour   > 11) { ap = "PM";             }
   if (hour   > 12) { hour = hour - 12;      }
   if (hour   == 0) { hour = 12;             }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString = hour +
                    ':' +
                    minute +
                     " " +
                    ap;
   return timeString;
} // function getClockTime()
