ajaxAllForms=true;function commentsPage(e,page){var comDiv=$(e).closest('div.comments-show');var outerDiv=$(comDiv).parents('div');var commentsType=$(outerDiv).find('input[name="comments-type"]').val();var sectionID=$(outerDiv).find('input[name="section-id"]').val();comDiv.html(wait_img_small);var sendString='action=get-page&page='+page+'&comments-type='+escape(commentsType)+'&section-id='+escape(sectionID);submit_ajax(sendString,comDiv,'http://www.plane-mad.com/comments/get-page.html');}
function comments_response(submitted_form,responseData){var comment_section=submitted_form.attr('id').replace('post-comments-','');if(responseData.success=='true'){if($('div.comments-'+comment_section).find('div.comment').length==0){$('div.comments-'+comment_section).html(responseData.comment);}else{$('div.comments-'+comment_section).find('div.comment-msg').removeClass('comment_last');$('div.comments-'+comment_section).find('div.comment:last').after(responseData.comment);}
change_local_times();$('div.comments-'+comment_section).find('div.comment:last').slideDown('slow');reset_form(submitted_form);}else{$(submitted_form).prepend(responseData.error);}}
function showCommentsPage(obj,msg){$(obj).html(msg.code);}
function show_comment_delete(submitted_form,responseData){if(responseData.success=='true'){submitted_form.closest('div.comment').slideUp('slow');}else{alert('There was an error deleting the comment. ');}}
function validate_comment_form(submitted_form){var error_msg='';var name_el=$(submitted_form).find('[name="com-name"]');var comments_el=$(submitted_form).find('[name="com-comments"]');if(name_el.val()==''){error_msg+='Please enter a name.\n';name_el.addClass('submit-error');}else{name_el.removeClass('submit-error');}
if(comments_el.val()==''){error_msg+='Please enter some comments.\n';comments_el.addClass('submit-error');}else{comments_el.removeClass('submit-error');}
if(error_msg!=''){alert(error_msg);return false;}else{return true;}}
$(document).ready(function(){if($("textarea[name='com-comments']").length>0){$("textarea[name='com-comments']").maxChar(750,{singularMessage:' character remaining',pluralMessage:' characters remaining'});}
$('img.delete-comment').live('click',function(){if(confirm('Are you sure you want to delete this comment?')){$(this).closest('form').submit();}else{return false;}});});
