var loadingImage='load.gif';var commentLoadingBar='<div style="padding:20px;text-align:center;"><img src="pic/'+loadingImage+'" /></div>';function EditComment(cid,tid)
{cid=parseInt(cid);tid=parseInt(tid);jQuery('#comment_text'+cid).empty();jQuery('#comment_edit_panel'+cid).hide();jQuery('#comment_text'+cid).html(commentLoadingBar);jQuery.post('commentActions.php',{'do':'edit',cid:cid,tid:tid},function(response){jQuery('#comment_text'+cid).empty();jQuery('#comment_text'+cid).html(response);},'html');}
function SaveComment(cid,tid)
{cid=parseInt(cid);tid=parseInt(tid);var text=jQuery('#edit_post').val();if(text.length>0&&text.replace(/ /g,'')!=''){jQuery('#comment_text'+cid).empty();jQuery('#comment_text'+cid).html(commentLoadingBar);jQuery.post('commentActions.php',{'do':'save',cid:cid,tid:tid,text:text},function(response){jQuery('#comment_text'+cid).empty();jQuery('#comment_text'+cid).html(response);jQuery('#comment_edit_panel'+cid).show();},'html');jQuery('#edit_post').focus();}
else
{alert('Комментарий не может быть пустым!');jQuery('#edit_post').focus();return false;}}
function CommentCancel(cid,tid)
{cid=parseInt(cid);tid=parseInt(tid);jQuery('#comment_text'+cid).empty();jQuery('#comment_text'+cid).html(commentLoadingBar);jQuery.post('commentActions.php',{'do':'save_cancel',cid:cid,tid:tid},function(response){jQuery('#comment_text'+cid).empty();jQuery('#comment_text'+cid).html(response);jQuery('#comment_edit_panel'+cid).show();},'html');}
function Quote(cid,tid)
{cid=parseInt(cid);tid=parseInt(tid);var text=jQuery('#text').val();jQuery.post('commentActions.php',{'do':'quote',cid:cid,tid:tid,text:text},function(response){jQuery('#text').empty();jQuery('#text').val(response);},'html');jQuery('#text').focus();}
function SendComment(tid)
{tid=parseInt(tid);var comments=jQuery('#comments_list');var text=jQuery('#text').val();var bValid=true;if(text.length>0&&text.replace(/ /g,'')!='')
{jQuery('#send_comment').get(0).disabled='disabled';jQuery.post('commentActions.php',{'do':'add',tid:tid,text:text},function(response){comments.html(response);jQuery('#send_comment').get(0).disabled='';jQuery('#text').val('');},'html');}
else
{alert('Комментарий не может быть пустым!');jQuery('#text').focus();return false;}}
function DeleteComment(cid,tid)
{cid=parseInt(cid);tid=parseInt(tid);var comments=jQuery('#comments_list');var cfrm=null;if(confirm('Вы уверены что хотите удалить комментарий?'))
{jQuery.post('commentActions.php',{'do':'delete',cid:cid,tid:tid},function(response){comments.html(response);},'html');}else return false;}
