var ForumService=new Class({destroy_message:function(C){this.setOptions(C);var B=this;if(confirm("Are you sure you want to delete this forum message?")){var A=new Ajax("/forums/"+this.options.forum_id+"/messages/"+this.options.message_id+"/delete",{data:"no=matter",method:"get",onComplete:function(){B.destroy_message_complete(this.response)}}).request()}},destroy_messages:function(C){this.setOptions(C);var B=this;if(confirm("Are you sure you want to delete the selected forum messages?")){var A=new Ajax("/forums/"+this.options.forum_id+"/messages/delete_set",{data:"id="+this.options.ids,method:"get",onComplete:function(){B.destroy_message_complete(this.response)}}).request()}},destroy_message_complete:function(A){var C=Json.evaluate(A.text);var B=/^\{ok\}.*$/;if(C&&C.text.match(B)){this.destroy_message_view(this.options.source);return true}return false},destroy_message_view:function(A){switch(A){case"forum_index":$("notice").setHTML("The Forum message has been permanently deleted.");$("notice").style.display="block";$("message_"+this.options.message_id).remove();break;case"show_message":window.location="/forums/"+this.options.forum_id;break;case"message_set":window.location="/forums/"+this.options.forum_id+"/messages";break}},check_forum_availability:function(C){this.setOptions(C);var B=this;var A=new Ajax("/forums/new;validate_custom_forum/",{data:"name="+C.forum_name,method:"get",onComplete:function(){B.data_loaded(this.response)}}).request()},data_loaded:function(A){var D=Json.evaluate(A.text);var C=/^\{ok\}.*$/;var B=/^\{error\}.*$/;if(D){if(D.text.match(C)){this.is_available(D.text)}if(D.text.match(B)){this.availability_error(D.text)}}},is_available:function(){this.hide_availability_error();this.clear_selections();this.load_profile_form();$("page_title").setHTML("Sign up and start using your "+this.options.forum_name+" Neighborhood Forum");$("custom_forum").value=1},load_profile_form:function(){show_form()},clear_selections:function(){$$(".group").each(function(A){A.checked=false})},hide_availability_error:function(){$("availability_errors").style.display="none"},availability_error:function(A){var B=A.substring(7);this.show_availability_error(B);$("custom_forum").value=0},show_availability_error:function(B){var A=$("availability_errors");A.empty();A.adopt(new Element("span",{"class":"error"}).setHTML(B));A.style.display="block"}});ForumService.implement(new Options)