var GraffitiHelpers=new Object();GraffitiHelpers.statusMessage=function(b,d,c){var a=$(b);if(a!=null){a.show();a.innerHTML=d}else{if(c){alert(d)}}};var Comments=new Object();Comments.statusMessage=function(c,b){var a=$("comment_status");if(a!=null){a.show();a.innerHTML=c}else{if(b){alert(c)}}if(typeof decrementComments=="function"){decrementComments()}};Comments.deleteCommentWithStatus=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=deleteCommentWithStatus",{method:"post",parameters:{commentid:d},onSuccess:function(f){c.each(Element.hide);if($("commentsPending")){$("commentsPending").innerHTML=parseInt($("commentsPending").innerHTML)-1}var e=f.responseText||"no response text";Comments.statusMessage(e,false)},onFailure:function(){alert("Something went wrong...")}})};Comments.approve=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=approve",{method:"post",parameters:{commentid:d},onSuccess:function(f){c.each(Element.hide);var e=f.responseText||"no response text";Comments.statusMessage(e,false)},onFailure:function(){alert("Something went wrong...")}})};Comments.unDelete=function(b,d){var a=false;if(arguments.length>2){for(var c=2;c<arguments.length;c++){a=arguments[c]}}new Ajax.Request(b+"?command=unDelete",{method:"post",parameters:{commentid:d},onSuccess:function(f){var e=f.responseText||"no response text";Comments.statusMessage(e,false);if(!a){window.location=window.location.pathname}},onFailure:function(){alert("Something went wrong...")}})};Comments.deleteComment=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=deleteComment",{method:"post",parameters:{commentid:d},onSuccess:function(e){c.each(Element.hide)},onFailure:function(){alert("Something went wrong...")}})};Comments.submitComment=function(a){Comments.statusMessage("Sending... please wait",true);new Ajax.Request(a+"?command=newComment",{method:"post",parameters:Form.serialize("comment_form"),onSuccess:function(c){var b=c.responseText||"no response text";Comments.statusMessage(b,true);$("comment").value=""},onFailure:function(){Comments.statusMessage("Something went wrong. The comment was likely not saved.",true)}})};var Posts=new Object();Posts.deletePost=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=deletePost",{method:"post",parameters:{postid:d},onSuccess:function(f){c.each(Element.hide);var e=f.responseText||"no response text";Comments.statusMessage(e,false)},onFailure:function(){alert("Something went wrong...")}})};Posts.permanentDeletePost=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=permanentDeletePost",{method:"post",parameters:{postid:d},onSuccess:function(f){c.each(Element.hide);var e=f.responseText||"no response text";window.location=e},onFailure:function(){alert("Something went wrong...")}})};Posts.unDeletePost=function(a,d){var c=new Array();if(arguments.length>2){for(var b=2;b<arguments.length;b++){c[b-2]=arguments[b]}}new Ajax.Request(a+"?command=unDeletePost",{method:"post",parameters:{postid:d},onSuccess:function(f){c.each(Element.hide);var e=f.responseText||"no response text";window.location=window.location.pathname},onFailure:function(){alert("Something went wrong...")}})};var Contact=new Object();Contact.submitMessage=function(a){GraffitiHelpers.statusMessage("contact_status","sending",true);new Ajax.Request(a+"?command=newContactMessage",{method:"post",parameters:Form.serialize("contact_form"),onSuccess:function(c){var b=c.responseText||"no response text";GraffitiHelpers.statusMessage("contact_status",b,true);$("message").value=""},onFailure:function(){GraffitiHelpers.statusMessage("contact_status","Something went wrong. The contact request was likely not sent.",true)}})};function togglePermissions(b,a,d,c){b=document.getElementById(b);a=document.getElementById(a);d=document.getElementById(d);if(c=="read"){if(b.checked==false){a.checked=false;d.checked=false}}if(c=="edit"){if(a.checked==true){b.checked=true}else{d.checked=false}}if(c=="publish"){if(d.checked==true){b.checked=true;a.checked=true}}if(a.checked){b.checked=true}};