function showRequest(formData, jqForm, options) { 
    // formData is an array; here we use $.param to convert it to a string to display it 
    // but the form plugin does this for you automatically when it submits the data 
    var queryString = $.param(formData); 
 
    // jqForm is a jQuery object encapsulating the form element.  To access the 
    // DOM element for the form do this: 
    // var formElement = jqForm[0]; 
 
    alert('About to submit: \n\n' + queryString); 
 
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
    return true; 
} 

function validate(formData, jqForm, options) { 
    // formData is an array of objects representing the name and value of each field 
    // that will be sent to the server;  it takes the following form: 
    // 
    // [ 
    //     { name:  username, value: valueOfUsernameInput }, 
    //     { name:  password, value: valueOfPasswordInput } 
    // ] 
    // 
    // To validate, we can examine the contents of this array to see if the 
    // username and password fields have values.  If either value evaluates 
    // to false then we return false from this method. 
    var formElement = jqForm[0]
    
switch ($('#' + formElement.id + ' :hidden').fieldValue()[0]) {
case "radio":
  var selectors = $('#' + formElement.id + ' :radio').fieldSerialize();
break;
case "checkbox":
  var selectors = $('#' + formElement.id + ' :checkbox').fieldSerialize();
break;
case "textarea":
	var selectors = $('#' + formElement.id + ' :textarea').fieldValue()[0];
break;
}
if (selectors.length == 0) {
return false }
} 

 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 

if (responseText.indexOf("comment") > -1) {
document.comments_form.reset()
}
$('#pollingcomplete').fadeIn("slow").fadeTo(2000, 1).fadeOut("slow");
} 
