/*
* Ajax comments for Wordpress.
*
* Hacked together for 2D World, should not be used
* for a standard blog as will only work with this setup.
*/
function ajaxComment(url){var author = jQuery("#author").val();
var comment = jQuery("#comment").val();
var par = jQuery("#comment_parent").val();
var id = jQuery("#comment_post_ID").val();
var form = jQuery("#c_form");
var msg = jQuery("#c_msg");
var button = jQuery("#submit");
if ( author == '' || comment == '' ){msg.html("You have not completed both fields.");
msg.fadeIn("slow");
} else {button.attr("disabled", "true");
msg.html("Posting comment, please wait...");
msg.fadeIn("slow");
jQuery.ajax ({ type: "POST", url: url+"/ajax_comment.php", data: "author="+author+"&comment="+comment+"&comment_post_ID="+id+"&comment_parent="+par, success: function(msg) {if (msg=="success") {jQuery("#c_form").fadeOut("slow");
jQuery("#c_msg").html("Your comment should appear soon.");
} else {jQuery("#c_form").fadeOut("slow");
jQuery("#c_msg").html("An unkown error has occured, please try again later.");
}}});
}}