function verify(url, text){ if (text=='') text='Are you sure you want to delete this comment?'; if (confirm(text)){ document.location = url; } return void(0); } // setup everything when document is ready jQuery(document).ready(function($) { $("#idiotspeak_post").css("display","none"); $("#idiotspeak_post_toggle").click(function(){ $("#idiotspeak_post").slideToggle("fast"); $("#idiotspeak_post #comment").focus(); $("#idiotspeak_post #author").focus(); }); $('#idiotspeakform').ajaxForm({ // target identifies the element(s) to update with the server response target: '#idiotspeakcomments', // handler function for success event success: function(responseText, statusText) { $('#idiotspeakresponse').html(''+'Well, thats what YOU say...'+''); $('#submit_idiotspeak_post').attr('value', 'Submit'); $("#idiotspeak_post").hide("fast"); $("#idiotspeak_post #author").attr('value', ''); $("#idiotspeak_post #comment").attr('value', ''); } , // handler function for errors error: function(request) { // parse the response for WordPress error if (request.responseText.search(/
(.*)<\/p>/); $('#idiotspeakresponse').html(''+ data[1] +''); } else { $('#idiotspeakresponse').html('An error occurred, please notify the administrator.'); } $('#submit_idiotspeak_post').attr('value', 'Submit'); $("#idiotspeak_post #author").attr('value', ''); $("#idiotspeak_post #comment").attr('value', ''); } , beforeSubmit: function(formData, jqForm, options) { // clear response div $('#idiotspeakresponse').empty(); for (var i=0; i < formData.length; i++) { if (!formData[i].value) { $('#idiotspeakresponse').html(''+'Please fill in the required fields.'+'