var currentCommentBlock="";function Comments(target,message,thanks,contentType,title,categoryid){this.name=target;this.target=document.getElementById(target);if(this.target==null){return false}this.ids=Array();this.accLinks=Array();this.currentIndex;this.comments=Array();this.sorry=document.getElementById("sorryMsg");this.contentType=contentType;if(this.sorry!=null){this.sorryClose=this.sorry.getElementsByTagName("a")[0];var o=this;this.sorryClose.onclick=function(){o.sorry.style.display="none";return false}}this.message=document.getElementById(message);if(message==undefined){return }this.thanks=document.getElementById(thanks);if(this.thanks!=null){this.initNotAcceptablePopup()}this.getComments(categoryid,title);return }Comments.prototype.initNotAcceptablePopup=function(){this.cancel=document.getElementsByClassName("first",this.message);if(this.cancel.length>0){Event.observe(this.cancel[0],"click",this.canceler.bind(this),false)}var send=document.getElementsByClassName("send",this.message);if(send.length>0){Event.observe(send[0],"click",this.sender.bind(this),false)}var close=document.getElementsByClassName("close",this.thanks);if(close.length>0){Event.observe(close[0],"click",this.closer.bind(this),false)}};Comments.prototype.closer=function(obj){if(this.name!=currentCommentBlock){return }this.thanks.style.display="none";return false};Comments.prototype.sender=function(obj){if(this.name!=currentCommentBlock){return }var str="target="+this.comments[this.currentIndex].id+"&source="+this.contentType;AJAXRequest("POST","/flagInappropriate.do",str,function(){});this.thanks.style.left=this.findPosX(this.message)+"px";this.thanks.style.top=this.findPosY(this.message)+"px";this.thanks.style.display="block";this.message.style.display="none";return false};Comments.prototype.canceler=function(obj){if(this.name!=currentCommentBlock){return }this.message.style.display="none";return false};Comments.prototype.deleter=function(id,obj){var str="contentRefId="+id;AJAXRequest("POST","/deletecomment.do",str,function(){window.location.reload()})};Comments.prototype.getComments=function(categoryid,title){var comments=document.getElementsByClassName("memberPost",this.target);var o=this;for(var i=0;i<comments.length;i++){var comment=new Object();comment.id=comments[i].id.split("_")[1];var message=document.getElementsByClassName("helpThanks",comments[i]);comment.message=message[0];var link=document.getElementsByClassName("helpLink",comments[i]);if(link.length>0){var cattitle="/"+categoryid+"/"+title;comment.link=link[0];comment.link.id=i;comment.link.onclick=function(){var str="ratingValue=1&contentRefId="+o.comments[this.id].id+"&contentType="+o.contentType;AJAXRequest("POST","/createRating.do",str,function(){});o.comments[this.id].message.style.display="inline";o.comments[this.id].link.style.display="none";_dolWAObjSubmitLink("helpfulThanks",cattitle);return false}}var accPopup=document.getElementsByClassName("accPopup",comments[i]);var accLink=document.getElementsByClassName("not-acceptable",comments[i]);if(accPopup.length>0&&accLink.length>0){comment.accPopup=accPopup[0];comment.accLink=accLink[0];comment.accLink.id=i;var o=this;comment.accLink.onclick=function(){currentCommentBlock=o.name;o.message.style.display="block";o.message.style.left=o.findPosX(this)+110+"px";o.message.style.top=o.findPosY(this)-o.message.offsetHeight+"px";o.currentIndex=this.id;return false}}var deleteLink=document.getElementsByClassName("deleteComment",comments[i]);if(deleteLink.length>0){Event.observe(deleteLink[0],"click",this.deleter.bind(this,comment.id),false)}this.comments.push(comment)}};Comments.prototype.findPosX=function(obj){var curleft=0;if(obj.offsetParent){while(obj.offsetParent){curleft+=obj.offsetLeft;obj=obj.offsetParent}}else{if(obj.x){curleft+=obj.x}}return curleft};Comments.prototype.findPosY=function(obj){var curtop=0;if(obj.offsetParent){while(obj.offsetParent){curtop+=obj.offsetTop;obj=obj.offsetParent}}else{if(obj.y){curtop+=obj.y}}return curtop}