var commentsGroup=null;var currentComment=null;function addComment(group,replyTo){var id=null;if(replyTo!=-1){id=group+'_'+replyTo;}else{id=group;}
commentsGroup=group;currentComment=replyTo;loadUrl('/nena/modules/profile/ajax/comments/addComment.php?language='+getLanguage()+'&group='+encodeURIComponent(group)+'&comment='+encodeURIComponent(document.getElementById('comment_'+id).value)+'&replyTo='+encodeURIComponent(replyTo),id+'-result','refreshCommentsAjax');document.getElementById('comment_'+id).value='';}
function deleteComment(group,comment){commentsGroup=group;currentComment=comment;loadUrl('/nena/modules/profile/ajax/comments/deleteComment.php?language='+getLanguage()+'&comment='+encodeURIComponent(comment),null,'refreshCommentsAjax');}
function reportCommentAsInappropriate(group,comment){commentsGroup=group;currentComment=comment;loadUrl('/nena/modules/profile/ajax/comments/reportAsInappropriate.php?language='+getLanguage()+'&comment='+encodeURIComponent(comment),null,'refreshCommentsAjax');}
function refreshCommentsAjax(){loadUrl('/nena/modules/profile/ajax/comments/refreshComments.php?language='+getLanguage()+'&group='+encodeURIComponent(commentsGroup),'comments_'+commentsGroup,null);if(currentComment!=null){if(document.getElementById('comment'+currentComment+'-news')!=null){loadUrl('/nena/modules/profile/ajax/comments/refreshComment.php?language='+getLanguage()+'&comment='+encodeURIComponent(currentComment),'comment'+currentComment+'-news',null);}}
Windows.closeAll();}
function refreshComments(group){loadUrl('/nena/modules/profile/ajax/comments/refreshComments.php?language='+getLanguage()+'&group='+encodeURIComponent(group),'comments_'+group,null);if(currentComment!=null){if(document.getElementById('comment'+currentComment+'-news')!=null){loadUrl('/nena/modules/profile/ajax/comments/refreshComment.php?language='+getLanguage()+'&comment='+encodeURIComponent(currentComment),'comment'+currentComment+'-news',null);}}
Windows.closeAll();}
function replyToCommentWindow(group,replyTo){newWindow(null,null,-1,650,300);loadUrl('/nena/modules/profile/ajax/comments/getEditComment.php?language='+getLanguage()+'&group='+encodeURIComponent(group)+'&replyTo='+encodeURIComponent(replyTo),'window-content',null);}
function newWindow(title,call,position_y,width,height){var window=new Window({className:'nena',width:width,height:height,title:title});window.setDestroyOnClose(true);if(position_y==-1){window.showCenter();}else{window.show();window.setLocation(position_y,(document.body.offsetWidth-width)/2);}
window.getContent().innerHTML='<div id="window-content"></div>';callFunction(call);}
function insertText(text,textarea){var textarea=document.getElementById(textarea);var first=textarea.value.slice(0,getCaret(textarea));var second=textarea.value.slice(getCaret(textarea));textarea.value=first+text+second;}
function getCaret(el){if(el.selectionStart){return el.selectionStart;}else if(document.selection){el.focus();var r=document.selection.createRange();if(r==null){return 0;}
var re=el.createTextRange(),rc=re.duplicate();re.moveToBookmark(r.getBookmark());rc.setEndPoint('EndToStart',re);return rc.text.length;}
return 0;}
function displaySmileys(id){if(document.getElementById(id)!=null)
if(document.getElementById(id).style.display=='block'){document.getElementById(id).style.display='none';}else{document.getElementById(id).style.display='block';}}
