
Infused.addHandlers({saveTopic:function(success,data){if(success){document.location.href=document.location.href;}},editPost:function(success,data){if(success){$('#post-container-'+data.id).html(data.html)}},deletedPost:function(success,data){if(success){$('#post-container-'+data.id).remove();}}});$(function(){addFCK('reply-content','forum');$('.quick-reply').click(function(ev){ev.preventDefault();ev.target.blur();$('.reply-form').toggle();});$('#add-post-submit').click(function(ev){ev.preventDefault();ev.target.blur();$('#add-post-form').submit();});$('#add-post-form').submit(function(ev){ev.preventDefault();$('#reply-content').val(FCKeditorAPI.GetInstance('reply-content').GetXHTML(true));Infused.makeRequest({module:'forums',controller:'add',action:'addReply',form:'add-post-form',handler:'saveTopic'});return false;});$('.forum-post-box').click(function(ev){ev.target=$(ev.target).findParent('a');if($(ev.target).hasClass('edit-my-post')){ev.target.blur();ev.preventDefault();a=$(ev.target).findParent('a');id=$(a).stripId();postContent=FCKeditorAPI.GetInstance('edit-post-'+id).GetXHTML(true)
Infused.makeRequest({module:'forums',controller:'add',action:'editpost',postData:{'id':id,'content':postContent},handler:'editPost'});}
else
if($(ev.target).hasClass('edit-post')){ev.target.blur();ev.preventDefault();id=$(ev.target).stripId();content=$('#post-content-'+id).html()
$('#post-container-'+id).html('<textarea name="new-content" id="edit-post-'+id+'">'+content+'</textarea>'+'<a href="#" class="dark-button form-button edit-my-post" id="edit-post-'+
id+'">'+'<span class="dark-button-start">Edit</span>'+'<span class="dark-button-end">&nbsp;</span>'+'</a><br style="clear:both"/>');addFCK('edit-post-'+id,'forum');}
else
if($(ev.target).hasClass('delete-post')){ev.target.blur();ev.preventDefault();Infused.Msg.confirm('Delete post','Are you sure you want to delete this post?',function(pressed){if(pressed=='yes'){id=$(ev.target).stripId();Infused.makeRequest({url:'/forums/add/deletePost/',handler:'deletedPost',postData:{'id':id,'threadId':DataBridge.threadId}});}});}
else
if($(ev.target).hasClass('quote-post')){ev.target.blur();id=$(ev.target).stripId();content=$('#post-content-'+id).html()
$('.reply-form').show();FCKeditorAPI.GetInstance('reply-content').SetHTML('<blockquote><i>"'+content+'"</i></blockquote>');FCKeditorAPI.GetInstance('reply-content').Focus();}});});